-
joem5636
I searched a lot for an example of how to do pitch shifting with FFT in PD with minimal luck. I did finally run across a patch that said it could do what I needed but it was broken. I have fixed the patch (and its sub-patch) so that they now work correctly and have attached them.
While these do work, they don't do everything I want -- I would like to be able to shift frequencies by bands: 3000 to 12000 by a factor of 2 (600 cents?) and then repeat, for instance. If my patches are of use, perhaps someone else can contribute the banding??
-
joem5636
I am trying to do the shifting to overlay the high frequency spectrum over the low frequencies. I tried lrshift~ but it seems to not be happy with using a variable for the shift amount. Spec2_shift does take a variable, but seems to not like negative shifts? In any case it fails for me even using the help.pd for it if I take the shift negative. I am not very good at C programming (Java is my language) and I could not figure out what the error is in looking at the code.
I can post my patch for testing, but the one that comes with spec2_shift~ is good enough.
-
joem5636
A "band" is a frequency range -- in this case, I want to take the "band" between, say, 3kHz and 6k and divide by 2, similarly, the band from 6k to 12k would be divided by 4 (hence the two left shifts). I figure that if I shift the entire spectrum from 3K up left by a factor of 2 and then do the same thing I will have approximately what I want (and could repeat until there are no more frequencies that are non-zero).
I will do the shifting and adding to both real and imaginary -- I suspect the "cost" of computing the magnitude is at least as high as operating on both arrays.
Thanks for the pointer to pvoc~ -- I may have missed it in searching for examples of what I want to do.
I hope to have this running on a Raspberry Pi for a portable solution "real soon now."
-
joem5636
Another option is tof/sample-shifft~.pd (sic!). It has both frequency and time expanding. I think I see how to add banding to either, but have not actually sat down to do it.... Lrshift won't do it alone but might work with [+!]. For instance, I think I could shift and add twice to get both the 2 and 4X divisions using two shifts (for instance, shift 1024 out of 2048, add, shift another 512, and add again.....] It would require making a copy of the array but only one. That would not be a general banding solution, but would satisfy my need!
For audio, I think I could ignore the imaginary if cpu load becomes an issue.
-
joem5636
I just posted a patch that I got working on this. Topic is FFT Pitch Shift here