View Full Version : FFT and Propeller
02-19-2007, 06:45 AM
I'm designing a device to convert an electric guitar's output into serial scan codes for a synthesizer unit I have. In order to do this I need to do a fast fourier transform in real time to calculate the peak frequency and pass that to a function that determines which code to send based on that frequency. I'm wondering if the Propeller is able to FFTs in real time, if not I am planning on using the Texas Instruments TMS320C6410 (http://focus.ti.com/docs/prod/folders/print/tms320c6410.html) DSP to do the FFT and passing that information to a Propeller to do the other function. I'm new to embedded design and programming though, so I'm not sure if the Propeller is capable of doing what I would like. Any advice would be appreciated.
Thanks in advance
I was also thinking about how the way the Propeller is designed each of the 8 cogs has its own independent processor and video unit. If I could use the Propeller to do everything, I'm wondering if the FFT algorithm could be parallelized enough to run across all 8 processor cores for a speed increase. If I use the DSP instead (which I'm thinking I'll probably have to) I was wondering if I could individually control each cog, as I'd like to have a few used for doing video output and one for serial/usb output for debugging purposes.
Post Edited (Tristor) : 2/19/2007 12:06:55 AM GMT
02-19-2007, 10:05 AM
IMHO, if you use all 8 cogs of a propeller for parallel FFT calculations, you've basically wasted a propeller; there are chips available that will do it better, cheaper, faster, and with significantly fewer headaches. The primary benefit of the propeller is being able to run 8 unrelated processes on one chip without the hassles of traditional multitasking.
And that's assuming it would work; I don't think a propeller has very high ADC precision at 40kHz, and I think you'd run out of memory mighty fast unless your sample length was so short as to be useless. I'd like someone with more FFT experience to back me up on that, though.
If I use the DSP instead (which I'm thinking I'll probably have to) I was wondering if I could individually control each cog, as I'd like to have a few used for doing video output and one for serial/usb output for debugging purposes.
02-19-2007, 10:12 AM
shows a spin implimentation of a FFT. It's rather slow though. Changing to integer math and assembly should allow it to run far faster.
http://en.wikipedia.org/wiki/Fast_Fourier_transform <= this should give a lot of places to look for further info.
http://www.google.com/search?hl=en&q=FFT&btnG=Google+Search <= searching on Google for "FFT" also turns up lots of info, some of the sites even look like they have C-source avalable to pour through.
02-19-2007, 10:32 AM
This subject has come up before and you might want to take a look at these threads and comments:
http://forums.parallax.com/showthread.php?p=572721 <- discussion
http://forums.parallax.com/showthread.php?p=615024 <- working spin code, 160 milliseconds for 64 points
http://forums.parallax.com/showthread.php?p=609439 <-CORDIC idea
http://forums.parallax.com/showthread.php?p=592470 <- time estimate 30ms for 1024 point fft
The Propeller does not have a hardware multiplier, and the access to memory as an array may be limiting. Howerver, Propeller ASM is well suited for integer algorithms such as CORDIC. I don't think it could get up to audio frequencies in real time unless you use some tricks. For example, If you can keep the number of samples down, for example, by looking at the times between zero crossings instead of the entire array of analog samples. That might work for a signal with a strong fundamental. I don't have any specific code to offer you, but I'm interested in the subject too.
Post Edited (Tracy Allen) : 2/19/2007 5:31:22 PM GMT
02-19-2007, 10:07 PM
I once worked for a company that sells commercial guitar2midi converters.
This gadgets use a 300MHz Mips processor with FPU and 512k fast RAM.
Not to mention the 24bit audio ADC's.
I don't think that a propeller is really a good choice for this.
The propeller is shurely a nice part that can toggle it's pins very fast,
but it is not really suitable for complex signal processing.
02-19-2007, 11:34 PM
Thank you for your help everyone. I'm probably just going to use the Propeller for the mapping function and driving an LCD then, and use the DSP for doing the FFTs and audio processing.
02-20-2007, 12:47 AM
Please keep us informed about experiences with the TMS320C6410 DSP. For someone who has never worked with one of those, it looks pretty daunting, all the way from the 288 pin BGA package and its 140 page hardware data sheet to the long list of separate application resource guides. Not a quick guide.
It is one thing to analyze the complexity of a sound with all its harmonic richness, and another to extract the fundamental frequency of a single instrument. Cheap guitar tuners manage to do that without having a DSP. I do wonder if the full-fledged DSP might not be overkill for your application?
02-20-2007, 12:53 AM
I don't know if it's fast enough for your purposes, but this thing (http://www.micromegacorp.com/umfpu-v3.html) is available in an 18-pin DIP package, and does FFTs in floating point.