Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio offset in offline analysis #67

Open
KCFindstr opened this issue Feb 3, 2024 · 7 comments
Open

Audio offset in offline analysis #67

KCFindstr opened this issue Feb 3, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@KCFindstr
Copy link

Thanks for the great library. I am wondering if it is possible to add time offsets to each BPM candidate? A use case would be in rhythm games, the chart designer often wants to align notes with beats, so having both start offset of the first bar and BPM will make the alignment much easier and more accurate.

@dlepaux
Copy link
Owner

dlepaux commented Feb 3, 2024

Hi @KCFindstr,

I’m not sure to understand what do you need.

Could you please provide details for the use case ?

Typically, what you would expect. Please also provide a sample to implement tests.

Thanks

@dlepaux dlepaux added the enhancement New feature or request label Feb 3, 2024
@KCFindstr
Copy link
Author

Example: this is the auto BPM detection from a rhythm game Malody.

After setting the correct offset & BPM, it's expected that a lot of the strong beats lie on the start of each bar.

The start of each bar in seconds is calculated as
$$bar_i = \frac{60}{BPM}i - offset$$

(+offset or -offset does not matter here as long as it's exposed in the API)

@dlepaux
Copy link
Owner

dlepaux commented Feb 3, 2024

@KCFindstr Ok thank you for your clarification.

It is possible to add this information in each BPM candidates.

In order to be sure while implementing the feature could you provide a sample with the expected result please ?

@KCFindstr
Copy link
Author

Great, thanks for the prompt reply!
I have attached an example song. song-bg.zip
Expected BPM is 130 and offset is 429ms. (any offset like 429±(60000/130)*i will be correct too, and if the offset is off by ~10ms it would also be acceptable)

@dlepaux
Copy link
Owner

dlepaux commented Feb 4, 2024

@KCFindstr Thanks for those informations. I'll keep you informed when the feature will be released.
I have a last question, in which context is this feature useful to you ? Are you a contributor of Malody App ?

@KCFindstr
Copy link
Author

@dlepaux Nope - Malody is a commercial app and it already has a BPM detector with very good accuracy, but the algorithm is closed source. I am developing an open source lyrics editor in which displaying beat information will also be helpful, and I am looking for an open source alternative.

@dlepaux dlepaux self-assigned this Feb 6, 2024
@dlepaux
Copy link
Owner

dlepaux commented Feb 9, 2024

@KCFindstr I've done an experimental implementation of the feature but it implies more complex issues related to the algorithm.

You might not know this, but the algorithm to compute BPM is based on amplitude thresholding. We basically look for the highest peaks and then we can compute the BPM with the intervals, etc.

To get the information we're looking for, we would need to identify each peaks, and then we would be able to compute the duration in second to reach it from the beginning of the audio. So, we would need to wait a deep refacorization of the library to get this information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants