1
$\begingroup$

I'm using Math.net and Bass.Net to write FX effects for guitars. I'm currently stuck on the the pitch shifter. I have to implement a custom DSP callback function which provides the guitar PCM data and the length in bytes (the sample rate is 44100 Hz). I currently use the FFT implementation of Math.Net, but I don't know what to do with the complex output. My code is the following:

        //buffer (IntPtr) contains the PCM data in 32-bit floating point samples
        //length (int) is the number of bytes to process

        Complex[] cOutput = new Complex[length/4]; //allocate the buffer to store the complex numbers 
        float* data = (float*)buffer;
        for (int i = 0; i < (length / 4); i++)
        {
            cOutput[i] = new Complex((double)data[i], 0.0); //fill the Complex array
        }

        Fourier.Forward(cOutput); //apply the FFT to the filled Complex array and overwrite its data

So I'm now have an array of Complex, but I don't know what part of this array I have to modify to change the pitch. So what comes next in the pitch shifting algorithm?

Thanks for your help

$\endgroup$
  • $\begingroup$ Have you looked up the different methods of time-pitch modification and chosen one? $\endgroup$ – hotpaw2 Aug 20 '17 at 12:15
  • $\begingroup$ No, I haven't found any. Where can I find those? $\endgroup$ – Tom Stuart Aug 20 '17 at 12:33
  • $\begingroup$ Maybe start with dsp.stackexchange.com/questions/tagged/pitch $\endgroup$ – MBaz Aug 20 '17 at 15:26
  • $\begingroup$ I looked there, but I couldn't find anything that could help me with my problem. $\endgroup$ – Tom Stuart Aug 20 '17 at 15:38
  • 1
    $\begingroup$ You will have to do a lot more than "look". Try studying: time pitch modification, PSOLA, phase vocoder, etc. Follow the references. $\endgroup$ – hotpaw2 Aug 20 '17 at 16:50

Browse other questions tagged or ask your own question.