-
Notifications
You must be signed in to change notification settings - Fork 13
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
Source example code for Player strategy needs to be updated #74
Comments
I tried the example and couldnt get it to work... am I missing something? It just says the BPM is undefined. Heres my code typescript file (Angular)
`
Then if I load this URL in my angular web app it starts downloading the file, so it's definitely there. If I change it to an invalid path I get an error about file not found. |
Hey @MileanCo The audioContext must be create after a human gesture so basically you should create within an event handler based on a button click. Typically: Get BPM or something. If the error persists can you share your repo or an example for me to try it out ? Thanks |
Hey @dlepaux , thanks for the response. I do have the audioContext being created after a button click. Im using Angular and Typescript, perhaps this is the reason? Here are some more code snippets (not complete project, it would be a lot of code here). Perhaps this is somehow missing $event in the button click function?
home.component.html
You get the the home page (index page) via a router
If I use an invalid path to an .mp3 file that doesnt exist, I get this error
If I use a valid path, I get BPM undefined. I print the event.data and it looks like this
You can easily generate your own Angular project by using 'ng generate': |
@MileanCo it seems that you successfully plugged the library. The reasons why you don’t have any results can be because your track doesn’t have enough energy in it (bass frequencies). you can try to remove the lowpass filter to check if you get any results. Can you share the audio file you’re trying to analyse please ? I would take a look tomorrow. |
OK, even after playing the audio by just doing Anyways I tried the Local/Offline strategy and it worked! Here's the code I used (had to change from what you had on the README page again, it complained in typescript about Here's the code I got working
And the result
Can we always assume the first top candidate (index 0) is correct? The track is indeed 124. |
@MileanCo Glad you succeed to use it ! |
Just a nit pick, but the src code on the readme page for "Player strategy" is missing some imports and definitions. For example, I had to update the import like this
import { createRealTimeBpmProcessor, getBiquadFilter } from 'realtime-bpm-analyzer';
And define an audio context like so
const audioContext = new AudioContext();
Also the
track
appears to be missing, how do you get this from the DOM / html page defined? These things might be really obvious to some people but not to others :)The text was updated successfully, but these errors were encountered: