Loop Player Root Note
-
Hmm perhaps using setContentCallback - anyone have any insights?
-
@paper_lung said in Loop Player Root Note:
Hmm perhaps using setContentCallback - anyone have any insights?
I played around with the loop player for a project a while ago and ran into annoying issues like this (and your one about not being able to set the loop range colours). I switched to using a sampler instead.
You might want to checkout this example project - https://github.com/christophhart/hise_tutorial/tree/master/CustomSampleImport
-
@d-healey Thanks, yeah I've had a look at that project but the sample start mod doesn't work in the same way as it does for the looper, and it's quite crucial for this project. I'm also only shipping a few samples, so I can easily bundle the audio into the installer as well, whereas with the sampler they'd be a separate download.
If I can find a way to fix the root note change, the looper will be just fine for my project, although I'm not sure if it's doable. Do you know if setContentCallback works with the Looper/Audio Sample Processor?
-
@paper_lung I'm not sure what the solution is (if there is one). Try the callback and let us know.
-
Don't think setContentCallback works, as far as I can tell anyway.
-
@paper_lung why not have a dig in the source code? There's probably a couple of lines that could be commented out to prevent the root note auto-detect
-
@DanH yeah I did wonder that, but didn’t want to break anything plus I don’t know any c++ haha. Maybe @Christoph-Hart can offer some insight?
-
@paper_lung said in Loop Player Root Note:
plus I don’t know any c++
Don't let that put you off. Looking around in the source code you can figure out what a lot of stuff is doing without fully understanding it. I do this all the time, sometimes I break stuff, so then I undo that and try something else.
-
@d-healey ok will do. Do I need to recompile Hise if I try commenting out some of the code / Anything I should be aware of?
-
@paper_lung yes you do. I tend to compress the hise folder before tinkering so I have a backup.
-
@paper_lung Yes compile debug versions because it's much quicker. Learn to use git as well, it will make life easier for you when switching between versions or reverting changes that you've made.
-
I managed to remove the root note pitch detection, thanks for the tips everyone. For anyone interested, I commented out the following code in the AudioLooper.cpp file within the source files:
/*if (copy.getNumSamples() > 0) { auto freq = PitchDetection::detectPitch(copy, 0, copy.getNumSamples(), sr); if (freq == 0.0) return; Array<Range<double>> freqRanges; freqRanges.add(Range<double>(0, MidiMessage::getMidiNoteInHertz(1) / 2)); for (int i = 1; i < 126; i++) { const double thisPitch = MidiMessage::getMidiNoteInHertz(i); const double nextPitch = MidiMessage::getMidiNoteInHertz(i + 1); const double prevPitch = MidiMessage::getMidiNoteInHertz(i - 1); const double lowerLimit = thisPitch - (thisPitch - prevPitch) * 0.5; const double upperLimit = thisPitch + (nextPitch - thisPitch) * 0.5; freqRanges.add(Range<double>(lowerLimit, upperLimit)); } for (int j = 0; j < freqRanges.size(); j++) { if (freqRanges[j].contains(freq)) { setAttribute(AudioLooper::SpecialParameters::RootNote, (float)(j), sendNotification); return; } } } */
I've not fully tested it yet, but hopefully proves useful to someone.
-
@paper_lung hi, If I remove the pitch detection in the source code, which note will be loaded as root note when I insert a sound?