Shop OBEX P1 Docs P2 Docs Learn Events
is it possible — Parallax Forums

is it possible

science_geekscience_geek Posts: 247
edited 2008-03-24 01:06 in Propeller 1
·ok, so i went to work this week, was listening to my MP3 player, and it decided to jump out of my pocket, so instead of buying a new one i decided i would make one, what i would like to know is, is it possible to use the prop to play music from an sd card or is there a chip i can get that i can control which song is played using the prop, i want to use the prop because i am doing other things with it for my garage, and it would make a good system to have an embedded music player in my garage system

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-23 16:32
    A couple of people have thought about this and posted some of their thoughts. The general feeling is that MP3 is too compute-intensive for the Propeller. It might be possible as a demonstration of concept, but not practical, particularly with cheap MP3 decoder chips available that can be interfaced to a Propeller. There is a WAV player that has been posted. SparkFun has a complete MP3 decoder for about $40 that can be controlled by a Propeller (www.sparkfun.com/commerce/product_info.php?products_id=7832). You can also buy a small board with just the MP3 chip and some support circuitry.
  • OwenSOwenS Posts: 173
    edited 2008-03-23 16:46
    They also sell the raw (Surface mount) chips that can be used for MP3 decoding. The simplest to solder would be this one:
    http://www.sparkfun.com/commerce/product_info.php?products_id=8125

    Note that the datasheet for the VS chips is quite complex; though the project is by no means impossible (It's possible to stream the music to the DSP with a PIC16, which operates at 1/4th of the clock of a single Propeller cog). Also be careful with your analogue power supply; you will want lots of capacitors
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-03-23 16:50
    Mike, you mentioned a chip that can decode the MP3. First, what chip is this, and can it be used directly to interpret the the data on the SD card and ouput wav files? What kind of structure does the system have - ie would the prop send data from the SD card to the chip, and the chip directly ouputs an analog signal which is amplified into sound?

    Secondly, I'm interested in how MP3's can compress a vast amount of sound data into such clear audio. I now know why USB is so complicated(from a previous post), and would like to know why MP3 is, too. I gather it has something to do with calculuting a complex series based off of the data given in the MP3 files...
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-23 16:57
    Look at SparkFun's webpage and their webpage on just the chip and its supporting circuitry (clock, regulator, passive components). With most of these decoders, the processor initializes the chip, then sends data from the file on the SD card as fast as the chip will take it. The decoders have a little buffering on-chip to help. The decoder produces a stereo analog output which has to be amplified for headphones or speakers.

    As with a lot of other things, the Wikipedia has a lot of information on MP3. Do a websearch for "wiki MP3".
  • OwenSOwenS Posts: 173
    edited 2008-03-23 17:05
    Phildapill,

    The chip is the one I mentioned above. It outputs analogue audio that can be passed to headphones, or amplified and passed to speakers. Alternatively, some of the other chips in the family provide digital (uncompressed) audio output IIRC.

    The reason MP3 is complex is three fold:
    Firstly, it involves lots of multiplication and division, which the Prop 1 can't do fast enough
    Secondly, it requires keeping quite a bit of data in memory
    Thirdly, it's relatively high bandwidth (128kb/s to 192kb/s) and as such needs a relatively powerful processor

    I believe the Prop II should do it, provided the decoder and it's state will fit into cog ram.

    MP3 (and co) compress the data by doing something called quanitization: This is the throwing away of the high frequency data in a sample, while preserving the low frequency data. This often results in long runs of zeros or ones, which are then compressed using a more general purpose compression algorithm. Our brains care less about high frequency data, and as such it's removal goes un-noticed. There are other optimizations: audio compression isn't my forte, but I can give you an example in the video domain: Almost all modern video codecs operate in a Luminance/Chrominance colour model, and throw away 3/4ths of the chrominance data, because the eye has more rod cells than cone cells and as such is more sensetive to brightness than hue.

    Theres a lot of (math heavy) specifics in every compression format, and this is only scratching the surface.
  • science_geekscience_geek Posts: 247
    edited 2008-03-23 17:31
    alright, maybe i should rephrase mp3 to song, i was thinking i could load a bunch of songs onto an sd card,· and play it back, i would only really use the prop as a user interface, or is there another chip i could use that is more powerful that could handle an index array, and also output a song, what my main project is that i want automate my garage, with climate control, electric keypad locks, motion sensors to activate certain things like lights, the whole nine yards, thats why i was thinking the prop with the 8 cogs, is there another chip that could handle this or is the prop my best bet, oh, and thanx for the extremely fast replies
  • ForrestForrest Posts: 1,341
    edited 2008-03-23 17:50
    Sounds like you want the FTDI VMusic2 www.vinculum.com/prd_vmusic1.html which has been discussed on this forum a few times. It's available from mouser.com for $37.25
  • OwenSOwenS Posts: 173
    edited 2008-03-23 18:00
    Interestingly, that uses the bigger cousin of the chip I posted
  • science_geekscience_geek Posts: 247
    edited 2008-03-23 19:44
    ok, one last question i have since i dont have the prop yet, since the program is stored on an eeprom chip, is it possible to have 2 props, 1 as master the other a slave, and could you use the master to access the eeprom chip and reprogram the slave prop?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-23 19:51
    Yes. Chip Gracey some time ago posted a downloader written in Spin so that a master chip could reprogram a slave chip.
    Look in Graham Stabler's Good Thread Index here http://forums.parallax.com/showthread.php?p=663638.
    Look for "Propeller Loader"

    In the "Completed Projects" forum, there's a posting for an audio sequencer using two VMusic2 controlled by a Propeller.
    There's a playlist stored as a text file on the memory stick. The Propeller reads the playlist into its memory and uses that
    to control the order of tracks to be played. It also displays information about the track on an OLED display as well as the
    time in seconds played from the track. Here http://forums.parallax.com/showthread.php?p=677691.

    Post Edited (Mike Green) : 3/23/2008 7:59:16 PM GMT
  • hippyhippy Posts: 1,981
    edited 2008-03-23 21:08
    Not sure from which website I lifted this VMUSIC2 image from, but it looks like the SPI interface from the VNC1L to VS1003 could be quite easily hacked into. Maybe just holding the VNC1L in reset may float the pins ?

    That could save a lot of work for someone who wants a handy hardware platform off the shelf.
    1167 x 869 - 744K
  • science_geekscience_geek Posts: 247
    edited 2008-03-23 21:29
    what about a WAV file instead of an MP3, could the prop read and play that or not
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-23 21:32
    Here's one thread on the subject: http://forums.parallax.com/showthread.php?p=683127.
  • OwenSOwenS Posts: 173
    edited 2008-03-23 21:35
    hippy said...
    Not sure from which website I lifted this VMUSIC2 image from, but it looks like the SPI interface from the VNC1L to VS1003 could be quite easily hacked into. Maybe just holding the VNC1L in reset may float the pins ?

    That could save a lot of work for someone who wants a handy hardware platform off the shelf.

    Though it may be easier to solder the VS1011e to a board than solder wires to those tiny LQFP pins
    science_geek said...
    what about a WAV file instead of an MP3, could the prop read and play that or not
    Yes, though the problem there is getting a fast enough data rate between the SD card and whatever DAC you use.

    (The prop wouldn't be able to play overtly complex waves however, for example ADPCM, or, MPEGLAYER3)
  • science_geekscience_geek Posts: 247
    edited 2008-03-23 21:56
    would basic speech be to complex
  • OwenSOwenS Posts: 173
    edited 2008-03-23 22:04
    Speech can be recognized even when recorded at extremely low bandwidths (I know that Iridum satelite phones compress everything into 9600kbit/s, though they do use a complex compression algorithm). Even 8000Hz 8-Bit WAV files would be clearly understandable - and low bandwidth. Speech can even be recognized at 8000Hz 1-Bit (Frequency matters more than bitrate).

    Speech poses no problem for playback
  • science_geekscience_geek Posts: 247
    edited 2008-03-23 23:35
    one last group of questions:

    can the lcd appmod for the bs2 be used with the prop?

    can the 4x4 keypad be used with the prop?

    and should i get the prop or fuel cells first?
  • hippyhippy Posts: 1,981
    edited 2008-03-24 00:08
    OwenS said...
    hippy said...
    it looks like the SPI interface from the VNC1L to VS1003 could be quite easily hacked into.

    Though it may be easier to solder the VS1011e to a board than solder wires to those tiny LQFP pins

    True, but I was thinking of the four tracks which run straight across the board, under the "U". Guess I should have mentioned what I was actually thinking wink.gif

    With a bit of judicious scrapping, it should be possible to stagger the exposure of copper and give a reasonable piece of tracking to solder on to.
  • RaymanRayman Posts: 14,162
    edited 2008-03-24 01:06
    Just noticed this thread...

    I have some WAV player code here:

    http://www.rayslogic.com/propeller/Programming/dac/dac.htm

    Also, I tried (and failed) to implement MP3 on the Prop.· I have notes about it here:

    http://www.rayslogic.com/propeller/Programming/RaysStuff/MP3/MP3.htm
Sign In or Register to comment.