Shop OBEX P1 Docs P2 Docs Learn Events
Audio Sampling — Parallax Forums

Audio Sampling

abcdefgabcdefg Posts: 10
edited 2007-01-31 18:12 in General Discussion
How much storage space do I need for, say 15 to 30 seconds of audio with the bare minimum sampling rate? I'm using a digital-> analog converter, running the output over to a BASIC stamp, and using an aproximation of the I2COUT / I2CIN functions. I basically want to record audio of a D/A converter, store it, and play it back through a A/D converter.

I'm thingking of using one of microchip.com's I2C compatible EEPROMs around the 256-1024 KB range, but I have no idea what kind of A/D converter to use.

Comments

  • Tricky NekroTricky Nekro Posts: 218
    edited 2007-01-30 15:11
    Firstly you need the ADC to record and the DAC to playback...
    Well... saying that the minimum Kbps of play able sound is 8... Meaning that you have to record about a KByte per second... (Not very sure about that but still....) You have to use a large memory and a very quick ADC and DAC to play it back... Perhaps too quick for a Stamp... I have never worked with the SX (here in Greece·they are too expensive and as long as they come only in rails it isn't worth a try unless I can free sample one or two which I don't consider able, anyway....) to tell you they're able to "behave", but they are·VERY fast·..... Winbond offers some solutions, but you don't interface the BS2 much....

    Hope I helped...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rule your Destiny-
    --Be Good. Be Bad. Be Provas--

    The hellinic (Greek) robots portal: Greekbotics
    Many Projects and Schematics by the users·and also robotic news
    (Translate using babelfish)
  • BeanBean Posts: 8,129
    edited 2007-01-30 15:59
    I would look at using the propeller chip for that.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
  • abcdefgabcdefg Posts: 10
    edited 2007-01-31 14:20
    I know this isn't really the right place to ask, but I have on hand a BASIC board and a few C-programable microcontrollers. How hard would it be to learn enough C code for this?

    The A/D converter I'm using has a resolution of 8 bits, meaning that every time it samples a signal it outputs 8 bits or 256 possible voltage states. So sampling at 25 times a second I would be writing 200 bits a second. This probably wouldn't be doable, right?

    Post Edited (abcdefg) : 1/31/2007 2:31:41 PM GMT
  • BeanBean Posts: 8,129
    edited 2007-01-31 14:41
    To sample audio you need to sample the A/D at least 8000 times a second. That is 64000 bits per second.
    Alot depends on how fast the controller and the A/D is.
    For 8KHz audio you need to sample and store 1 sample every 125uSec.

    Another problem is that EEPROMs need to about 5mSec (5000uSec) to write data. FRAM would be a better choice.

    What you are trying to do is not easy. Alot of things must happen quickly to pull it off.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
  • abcdefgabcdefg Posts: 10
    edited 2007-01-31 16:32
    Bean (Hitt Consulting) said...
    To sample audio you need to sample the A/D at least 8000 times a second. That is 64000 bits per second.
    Alot depends on how fast the controller and the A/D is.
    For 8KHz audio you need to sample and store 1 sample every 125uSec.

    Another problem is that EEPROMs need to about 5mSec (5000uSec) to write data. FRAM would be a better choice.

    What you are trying to do is not easy. Alot of things must happen quickly to pull it off.

    Bean.

    Is the rate of 8000 samplings a second the minimum or is it what is used normally? I might just abandon this project but thanks for all the info.
  • BeanBean Posts: 8,129
    edited 2007-01-31 17:22
    8000 samples per second is telephone quality.
    You can use less, but the audio gets crappy if you go much below 8K.

    I have used the SX with SX/B to do playback from an EEPROM.
    That is much easier to do.

    I used a regular EEPROM and a parallal 8 bit DAC.

    As I remember I setup an interrupt to read the next byte from the EEPROM and put the value on the DAC.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
  • David BDavid B Posts: 591
    edited 2007-01-31 17:35
    If you're willing to lose some clarity, you could try lowering the digitization rate below 8 kHz. The quality will start to suffer, but if you really need to reduce the storage requirements, maybe you could get away with a lower rate if your particular application doesn't need high fidelity.

    Is it speech that you're digitizing? Here's a paper that goes into what gets lost when you reduce the bandwidth of digitized speech -

    http://www.polycom.com/common/pw_cmp_updateDocKeywords/0,1687,6388,00.pdf

    A good way to try this out if you have a PC with a sound card is to plug a microphone in and use the Windows Sound Recorder to make some recordings at 8 kHz, 8 bits, mono, PCM format. Record some speech, save it to a file, then play it back. That will give you a sense of the quality of that digitization rate and the size of the resulting data file for some number of seconds of audio.

    David
  • BeanBean Posts: 8,129
    edited 2007-01-31 18:12
    Here are the programs I used to get the sound file into the EEPROM (using my SD Data Logger Module), and the program to play it back using a 8-bit R2R Dac on port RB.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
Sign In or Register to comment.