I am trying to build a pitch shifting plugin that uses midi in.
I have a pyo version that works great..
Trying to get it to run on a bela mini
https://github.com/belangeo/pyo-bela
Following these instructions I come across this error .
Running /root/Bela/projects/fx-harmonizer/fx-harmonizer
Error: no audio callback defined. Make sure you set settings->render to point to your audio callback
Error: unable to initialise audio
Fatal Python error: PyEval_AcquireThread: NULL new thread state
Aborted
Makefile:515: recipe for target 'runonly' failed
make: *** [runonly] Error 134
Connection to 192.168.7.2 closed.
I can see this error is generated in the RTAudio.cpp I think when bela tries to set up the audio.
The PYO repo is pretty old and hopefully Olivier will have time to update it at some point.
I read this blog ..
https://blog.bela.io/2017/01/04/using-an-external-library-with-bela/
I hope to run a little bit of PYO on the bela to do pitch shifting via midi ..
The pyo code looks a bit like this ..
https://github.com/seanwayland/waylosynth/blob/master/Waylosynth.py
s = Server(sr=samplerate, buffersize=buffsize).boot()
s.start()
a = Input(chnl=inputchan)
n = Notein(poly=polyphony,scale=2, first=lowestkey, last=highestkey) # transpo
bend = Bendin(brange=bendrange, scale=1)
env = MidiAdsr(n['velocity'], attack=attacksetting, decay=decaysetting, sustain=sustainsetting, release=releasesetting)
pit = n["pitch"]
pva = PVAnal(a, size=2048)
pvt = PVTranspose(pva, transpo= pit*bend)
pvs = PVSynth(pvt)
fx2 = STRev(pvs, inpos=0.25, revtime=2, cutoff=5000, mul=env, bal=0.01, roomSize=1).out()
As I understand it's a phase vocoder transposing the pitch via midi in.
It has a basic ADSR and also splits the FFT's into voices so you can play chords.
I had a look at the bela phase vocoder class but can't quite figure out yet how to hack it to do what I want . I found a supercollider file that looks like it might work. I was going to try this next ..
https://github.com/dyfer/PitchShiftPA/blob/master/Classes/PitchShiftPA.sc
How would I hack this code in the BELA FFT source to change the pitch in a "smooth" way ?
switch (gEffect){
case kRobot :
// Robotise the output
for(int n = 0; n < gFFTSize; n++) {
float amplitude = sqrtf(frequencyDomain[n].r * frequencyDomain[n].r + frequencyDomain[n].i * frequencyDomain[n].i);
frequencyDomain[n].r = amplitude;
frequencyDomain[n].i = 0;
}
Sorry for the long rambling post! Any advice would be appreciated! Eventually Olivier will update the repo ..
Perhaps using Bela's code directly will run faster so that would be a good option to get working.
Thanks for your help and the fun of the Bela!
Sean