How would I slow down audio?
tim1986
Posts: 41
I don't know if I need to use a propeller for this, but I want to take an stereo (analog) audio signal and slow it down depending on a voltage input or the number of times a switch is closed per minute. So the higher the voltage or more times the switch is closed the faster and closer to normal speed the audio is played. I want it to sound like a cassette/tape player/walkmen's battery dieing.
How can I do this?? Any ideas are appreciated.
Thanks in advance.
-Tim
How can I do this?? Any ideas are appreciated.
Thanks in advance.
-Tim
Comments
-Phil
http://www.leonheller.com/Audio%20Processor/AP.pdf
A different codec would be needed for music (stereo or mono).
What kind of memory were you planning to use to buffer the incoming stream? Simply stretching the audio or chopping it up and replicating the pieces is probably within the Propeller's capability. The big problem is that data is coming in faster than it goes out.
Here's a classic example of the need for buffering when the input is faster than the output:
-Phil
http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010345
There are others with a lot more.
It would take megabytes to do what the OP wants, unless his audio snippets are very short or he has a way to interrupt the input.
-Phil
I think it's used in low end effect processors from Alesis, like the Microverb, which is probably based the same AL3201BG IC.
Regards
Alessandro
Nice Have you built something using that?
I thought about getting a DRE chip mostly because it has a ready made leslie effect. And the SOIC package should be not too hard to solder by hand.
-Tim
http://elm-chan.org/works/vp/report.html
I designed a little four-layer PCB to try one out, with the companion ADC and DAC chips, but couldn't get it to work. Here is the schematic:
http://www.leonheller.com/Audio%20Processor/Alesis%20DSP.pdf
I used a small AVR as the controller.
I've attached an image of the PCB layout. It's rather dense.
It all gets much easier if the audio data is stored on an SD card.
Tim, I doubt you'd want to use flash for this application. Flash can be written to a limited number of times.
I think this is probably an application where you'd want to use SRAM. There are several multi-bit bus SRAM projects on the Propeller forum. I even did a cheap version by stacking eight DIP chips to make up a 256KByte "module."
You'll need to decide on the sound quality you want and how long you want a buffer to last. Then you can figure out how much memory you need. Or, as often is the case, you could work backward and figure out what quality and time you could get from a set about of memory.
Have you tried the "microphone_to_headphones" demo? It's in the "_Demos" folder of the Propeller Tool. The program uses the microphone and headphone jack on the Demo board. The program can help you quantify the quality you're after.
As others have mentioned, if you don't need to preserve the pitch of the original sound the problem is a lot easier.
Duane
Let's do the math. If your audio source is speech, for example, you will need to acquire at least 8000 samples per second, 16,000 for stereo. For speech 8 bits per sample is probably adequate, especially with companding. Say you want to slow it down to as little as 50%. That means you've got as many as 8000 samples per second coming in that you can't send out right away. If you want to handle an incoming stream that lasts 15 minutes, that's 8000 x 15 x 60 = 7.2MB of memory required. If your source is something besides speech or if you need more than 15 minutes of input, the memory requirements go up from there.
-Phil
If Tim only wants to slow down a sentence at a time then he only needs to store a few seconds. 8000 x 6 = 48000 = 48KB.
Or lets assume he's using 256KB SRAM. 256000 / 8000 = 32 seconds of speech could be stored. Could be fun.
Duane
You're right. A lot depends on his requirements, which he's not yet stated. The memory reqirement is also relaxed if the minimum speed ratio is more than 50%.
-Phil
It would be easier to record a sentence and then play it back (at variable speed) after the entire sentence has been recorded.
If all you will be putting through the device will be speech, you could get fancier and do a best guess of the speaker's pitch and then look for zero crossings that roughly meet the timing. Take that waveform, stretch it to a standard length and put it into a temporary buffer. There would be a main buffer that held the actual waveform that was output. When the out pointer reached the end of the main buffer, you could swap buffers. That would take care of glitching. This should be in the realm of possible on a propeller.
Tim, it would be nice if you could clarify exactly what specs (bandwidth, duration, whether the output has to be simultaneous with input, whether you want the pitch to shift with rate, etc.) you're after. Otherwise, we're just spinning our wheels here.
Thanks,
-Phil
You can find examples of that in OBEX.
They could be easily modified to play back at different speed.
But, if you mean you want to record in real time and playback slower, then you need a lot of memory as has been discussed.
Maybe you could do it with SD card, I think it has enough bandwidth, but I haven't seen it done yet.
Jonathan
-Tim
Ok. But that's not slowing it down. Simulating a tape player slowing down involves delaying the signal by an increasing amount and dropping its pitch. That's why you need a decent sized chunk of memory. For the effect you want I'd suggest that just pitch shifting will be enough. You should be able to do that just using Hub Ram.
But he does want the audio to slow down.
And that the side effect of pitch going down is OK.
I would use some spi sram, make a circular buffer,
if it's OK that the audio skips if the buffer overflows?
Or use the pause function on the ipod.
Then, you could do some simple changes to the wav player code to vary the speed as desired.