View previous topic :: View next topic |
Author |
Message |
John P
Joined: 17 Sep 2003 Posts: 331
|
Audio decompression? |
Posted: Thu Oct 02, 2008 10:36 am |
|
|
I'm thinking of a project where I'd use a PIC to play back any of several sound effects in response to digital inputs. I'd store the sound data in a serial EEPROM or flash, but when I think about the data rate, it just seems like I'd need a gigantic memory to store any significant length of sound. Like, 8 bits at 8KHz is as low as uncompessed WAV files go, and that's still only 16 seconds per megabit for fairly low-quality sound. So, can anyone suggest a compression scheme that's suitable for the PIC, preferably a 16F877A? I don't care how much processing it takes to create the data--I can do that on the computer--but most likely the choice of algorithm will be limited by the ability of the PIC to reconstruct the waveform in real time. Ideas? |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Thu Oct 02, 2008 11:32 am |
|
|
Hi John:
Audio does required a massive amount of storage space, and, sadly, there is no way to get around that (I think this is what you would like to do, right? - http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2660¶m=en535129 ). You will necessarily require a large memory chip, and I would recommend SD/MMC cards for their ease of use. Though these cards have proprietary data transfer protocols, all of them support the slightly slower SPI protocol as well.
There are a few ways you can reduce the size of an audio clip:
-use mp3 / ogg to compress files (but this would entail using a decoder chip as well, like the STA015 for mp3, which would increase overall cost)
-sample lower frequency audio; male voices have lower frequencies than female voices, and therefore are easier to work with at low sampling rates
-if you simply want to implement an interactive voice system, use 'phonemes' to construct the voice (agreed, it'll end up sounding like Microsoft Sam, but it takes ups much less storage space! )
Rohit |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
|
crystal_lattice
Joined: 13 Jun 2006 Posts: 164
|
|
Posted: Fri Oct 03, 2008 12:40 pm |
|
|
Have you tried the 1-Bit sound compression by Roman Black, http://www.romanblack.com/btc_alg.htm. Think there is even source code in the code library of the forum. |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Fri Oct 03, 2008 9:45 pm |
|
|
I completely forgot about the BTc algorithm by Roman Black! Its pretty good for low fidelity sound. Nothing beats the simplicity of the output hardware, and low memory consumption. As before, its better to work with lower frequencies during encoding.
There is a correction in the link; it is actually http://www.romanblack.com/picsound.htm .
Rohit |
|
|
|