Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp MP3 player... — Parallax Forums

Basic Stamp MP3 player...

delboydelboy Posts: 6
edited 2005-04-01 15:25 in BASIC Stamp
Hi guys,

I've been playing around with my BOE & Basic Stamp 2IC for a while now and although I'd still class myself as a novice, I feel reasonably comfortable attempting a more ambitious project and want to bounce it off the experts here to see if I'm being optimistically naive (which I suspect I may be!).

Long story short, I want to attempt a project similar to the Quadravox Pet Trainer project (www.parallax.com/dl/docs/cols/nv/vol2/col/nv65.pdf) but want to use an MP3 decoder and MP3 files instead of the Quadravox ChipCorder and low-quality WAVs.

Breaking the project down into manageable chunks, here's my current 3-phase approach:

Phase 1 - Based on what I've learnt in the following two Nuts & Volts columns, develop PBASIC / Visual Basic apps to save a small (say 50k) MP3 file into a 24LC256 256k EEPROM:
www.parallax.com/dl/docs/cols/nv/vol3/col/nv88.pdf
www.parallax.com/dl/docs/cols/nv/vol3/col/nv89.pdf

Phase 2 - Acquire an STA013 MP3 decoder and a CS4334 Digital to Analog Converter and following the high-level instructions here: www.pjrc.com/tech/mp3/sta013.html attempt to pull the MP3 data from the 256k EEPROM and run it through the STA013 MP3 decoder via my Basic Stamp.

Phase 3 - Assuming the above two phases actually work, acquire either an ALFAT-SD board (www.ghielectronics.com/ALFAT-SD.htm) or the Spark Fun SD breakout board (www.sparkfun.com/shop/index.php?shop=1&cart=213632&cat=1&itemid=331&) and read the MP3 data directly from an SD/MMC card into the STA013.

I realise this is all pretty ambitious, but is it even realistic? I know the Basic Stamp is considered "slow" relative to chips like the SX - is it capable of streaming the data from an EEPROM to the MP3 decoder fast enough? Should I perhaps consider the SX instead?

Any advice / pointers would be most appreciated guys!

Del.

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2005-03-31 17:01
    At Nasa, we have the Data path (high speed) and the Control path (low speed). The BS2 doesn't run fast enough to run the sound data trhough it, but certainly runs fast enough to sit 'off to the side' and control the actions of other chips.

    So as long as you can establish a separate control methodology that allows the actual data to bypass the BS2, this can work.
  • ForrestForrest Posts: 1,341
    edited 2005-03-31 18:11
    Here's a few things to analyze before building this project (please keep in mind I'm new to this also)

    1. The 24LC256 holds 32 kilobytes - so the maximum file you can load is 32 KB
    2. The 24LC256 is a faily slow device - 400 KHz serial data
    3. The STA013 is a fast device - and can accept data up to 20 Mbps
    4. The BS2 has 26 bytes of RAM and runs can process 4000 instructions per second

    You should 'do the math' before building this project - because right now it doesn't add up! You'll probably need to switch to a faster memory chip and switch to a faster CPU.
  • delboydelboy Posts: 6
    edited 2005-03-31 19:14
    Great - thanks for that guys - exactly the kind of feedback that I was looking for!

    Forrest - thanks for the detailed breakdown - I should've really researched that prior to asking the question here. The following is my understanding of the maths behind this:

    Forgetting the EEPROM speed for a moment...

    If I use the BS2p24-IC, I can theoretically run at 12,000 instructions a second. If I take 2 instructions to Read from EEPROM and write to STA013A, theoretically could I pump ~6000 bytes a second to the STA013A? If I use a 32kbps MP3 file assuming a fixed bit rate, I would need to pump at least 4000 bytes a second into the ST013A to get smooth playback - so based on my novice understanding does this mean I could theoretically achieve low-quality MP3 output using the fastest Basic Stamp?

    Del.
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-03-31 20:11
    Yes, except you can't read from EEPROM in two instructions. And none of the BS2's have anything that will write at 20 MB/Sec -- the fastest they will write is a SEROUT at 56 KBits/sec (or mayby a SHIFTOUT is somewhat faster).
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-31 20:33
    one avenue to consider is video RAM (VRAM), they have a parallel interface as well as a high speed serial address to feed the video out, coupling this with a 1 bit DAC may solve your uncompressed bandwidth problem. (The STA mp3 decoder would feed the parallel port of the VRAM or perhaps·the RAM would feed the STA, depending on your organization, but in this case you can use a standard SRAM).

    To nutshell, the stamp doesn't have enough power to directly drive your system, you'll need significant glue logic to get CD quality sound (generating addresses etc), but this system's overall control can still be directed through a stamp (Play, Stop, Fast Forward, Reverse, etc).
  • Scott MScott M Posts: 43
    edited 2005-03-31 21:53
    I looked at something like this. Just creating a scheme where you load an address into a counter, and have it go counting up through addresses until you get to some end point, and use those addresses to fetch bytes from memory and pump them into an 8 bit DAC... it turns into a fair number of chips quickly. I've vaguely surprised no one's developed a chip that takes two addresses, Start and End, and just plays out the interviening audio samples from onboard memory at some standard rate, like 8Hz. Stuff your samples into the memory, attach a speaker, stuff in two addresses, and get sound.
  • CPUMANCPUMAN Posts: 55
    edited 2005-03-31 21:55
    If you really want the MCU directly involved, instead of just sitting·there as the controller,·the SX would probably serve this task best.· With SX/B it wouldn't be all that hard to switch to the SX.

    12,000 instructions per·second·for the BS2P vs 50,000,000 instructions per·secondfor an SX·at 50MHz.· Only thing is the extrenal memory the SX would be using would need to be fairly·fast.

    Anyway thats just my 2 cents.

    Chris
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-31 22:10
    CPUMAN said...
    Only thing is the extrenal memory the SX would be using would need to be fairly·fast.

    Simple enough, Ive interfaced with Cypress 12ns and 15ns async SRAM, and Alliance Semiconductor also puts out similarly high speed SRAM, the current memory product Im salivating over (haven't gotten one yet) is Freescale's MR2A16A, a 256Kx16 magnetoresistive RAM (a new technology that uses magnetic orientation as the storage mechanism, and is non-volatile), has a 25nS access time and is addressable via byte or word orientation.
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-04-01 15:25
    Very cool. I thought the magneto-resistive RAM did have some write-cycle limitations, however. It's in the Billions of writes. You might look for that.
Sign In or Register to comment.