CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Audio decompression?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

Audio decompression?
PostPosted: Thu Oct 02, 2008 10:36 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Thu Oct 02, 2008 11:32 am     Reply with quote

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&param=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! Razz )

Rohit
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Oct 02, 2008 1:31 pm     Reply with quote

Perhaps something like this would work as a base.
mp3
http://www.ladyada.net/make/minty/hardware.html
crystal_lattice



Joined: 13 Jun 2006
Posts: 164

View user's profile Send private message

PostPosted: Fri Oct 03, 2008 12:40 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Fri Oct 03, 2008 9:45 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group