Audio Loop Player Auto Detect Note
-
I have a 1 second timer running which returns the root note (as automatically detected in the loop player). This updates a combo box with which you can select a new root note or whatever. Basically you drag in a file and within a second it updates the root note combo box.
Now, when I begin changing the start point of the sample the root note changes! Is it updating itself based on what the start is? The sample is a vocal so changes pitch throughout. It's not very helpful tbh! Once the root note is set I imagine you want it kept that way.
I don't think there is a callback for loading in a new audio file - please correct me if I'm wrong...
-
I've just encountered the same issue. I'm wondering if we can use the new broadcaster system for this and react when the pitch is updated. @Christoph-Hart ??
By the way, the detected pitch seems to be 10 semitones out for me. If I load a C3 (MIDI 60) file the detected pitch is 50. If the file is 73 the detected pitch is 63. Are you experiencing that? Maybe it's just my audio files.
-
Actually I found the proper solution and it's quite simple.
const audioFile = AudioLoopPlayer1.getAudioFile(0); audioFile.setContentCallback(function(event) { if (isDefined(event)) { var rootNote = AudioLoopPlayer1.getAttribute(AudioLoopPlayer1.RootNote); knbRoot.setValue(rootNote); } });
-
@Christoph-Hart Coming back to this one after a while.
TheCorrection, it does fire, butsetContentCallback
doesn't always fire when an audio file is set using thesetFile
function.event
isn't always defined.And the detected root note is almost always wrong.
-
@d-healey Sir David, DO you have a Working Idea to Read the Pitch Tracking information and Show it up on UI?
This doesn't work anymore :/ -
@d-healey @Natan The problem continues even today. If we declare the event as undefined it works perfectly. Would there be a problem with this trick?
audioFile.setContentCallback(function(event) { if (!isDefined(event)) { var rootNote = AudioLoopPlayer1.getAttribute(AudioLoopPlayer1.RootNote); knbRoot.setValue(rootNote); } });
Or to be even safer, remove the condition (works as well):
audioFile.setContentCallback(function(event) { var rootNote = AudioLoopPlayer1.getAttribute(AudioLoopPlayer1.RootNote); knbRoot.setValue(rootNote); });
Oh and the pitch detector seems to be working now (at least with my samples)