MP3 PLAYER using basic stamp 2
cydelcamat
Posts: 53
in BASIC Stamp
I need to create a mp3 player using basic stamp 2. Does anyone here has an experience to create a mp3 player using basic stamp 2? Any suggestions would be so much appreciated. Thanks!
Comments
You could hack the MP3 player buttons and have the BS2 control it using some I/O pins.
Yes.
It could probably be made to do all of the decoding (supposing all of the code would fit in its relatively small EEPROM and supposing that its tiny RAM is big enough, which I highly doubt), but it would be useless, since it would be at a rate of a few samples per second, when audio needs thousands of samples per second to work at all and tens of thousands of samples per second to sound any good.
http://www.digikey.com/product-search/en?keywords=vmusic2
Here is a project I did with a Vmusic2 and a propeller...
http://forums.parallax.com/discussion/135033/ir-remote-controlled-vmusic2-mp3-player
You would have to license the MP3 CODEC :
http://mp3licensing.com/help/developers.html
Basically can't be done on a BS2.
You can use a some readily available items like:
http://www.digikey.com/product-detail/en/ftdi-future-technology-devices-international-ltd/VMUSIC3/768-1179-ND/4009908?WT.srch=1&gclid=Cj0KEQjwv467BRCbkMvs5O3kioUBEiQAGDZHLyVgtivhL1kEgecrP1YdK4pDiysz8FfsP-RtD7Kc6RgaAuFx8P8HAQ
Requires standard serial commands from a BS2 to play music from a USB drive.
I have used a VMusic2 with a BS2 in museums with very good results.
EDIT: Some links:
http://www.scary-terry.com/vm2/vm2_bs2.htm
http://www.efx-tek.com/topics/ap-8.html
Talks with BS chips via serial.
(Parallax sells them, but they are out of stock)
The other way to play audio files with a Propeller is simply to play them in the old CD format, that is as uncompressed wave files as this is quite easy to do although it takes up more memory, but then memory is very cheap. I've done this on the Prop many times in conjunction with an SD card but for "sounds" you could probably get away with a small SPI Flash memory.
BTW, the Basic Stamp may be easy to use but it is too slow for any of this high speed real-time processing. Even PC processors despite their speed have special chips just to offload real-time processing to.
Please see attachment. Thank you!
As far as using the CY T16 V1.1 and controlling it with the BS2, that may be practical as long as the program and data needed to control the CY chip will fit in the BS2 memory. That of course depends on what you want the system to do.
It sounds like you are planning this as a replacement for the annunciator. Is that the case?
It's ironic that you want to use a BS2 to replace a PIC running assembly when the BS2 uses a PIC running Assembly.
I think the Propeller would be better suited for your application and it's Spin language is very similar to PBASIC.
The Propeller is not only a lot faster than the BS2, but it also has a lot more memory and it's also multi-cored.
Take a look at the Propeller Education Kit text which offers one of the best introductions to the Propeller and Spin that I know of.
The Propeller can also be programmed in C if you prefer.
I don't see any commands for the CY T16 V1.1 that allow you to write to the SD card so I can't tell how you plan to load up the SD card with the MP3 files. It does look like the Basic Stamp should be able to control the MP3 player. It's a simple use of the SEROUT statement to transmit to the CY T16 V1.1. This should work fine at 9600 Baud. There's very little in terms of data sent to the Basic Stamp and you'd use a SERIN statement for that. Be careful to keep the SERIN statements simple since the Basic Stamp is slow and the SERIN statement is marginal at 9600 Baud (it can miss characters). As kwinn mentioned, the rest depends on the size of your program and its data.
http://obex.parallax.com/object/164
My personal choice would be a Prop Mini using Tachyon Forth for programming, but cydelcamat has already looked at PBasic enough to decide that it's a reasonable starting point. PropBASIC is similar, but has its own quirks. It is a viable upgrade path for Stamp users, but, as Chris Savage pointed out to me quite a while ago, the Basic Stamps are still more than adequate for many tasks and easy to learn and use.
The Basic Stamp is "old tech", still very useful, but "old". I have no idea what sort of shape PBasic binary format documentation is in, but Ken could probably fashion a simple and straightforward non-disclosure agreement that would adequately protect Parallax's remaining interest in the IP, particularly given the basic honesty present in the experienced long-term community members here and start a project to allow the Prop-1 (and Prop-2) to run PBasic binary code. I think this would be a much smaller effort than that required to compile PBasic to C or Spin or even PASM.
In my mind it has to do with the complexity of the project. I see a PBasic interpreter, particularly for BS2 PBasic as being simpler than a compiler for a source code compatible version of PBasic. I could very well be wrong given the compiler construction tools available, but PICs have very limited code and data space and that's the target of the interpreter.
Partly we were discussing our preference for the Propeller and whether or not PropBasic is a useful tool for migrating applications from the BS2 to the Propeller and, if not, what might be an alternative. The BS2 as mentioned is still very useful and will be available for years yet ... That's the way Parallax operates. It has a tremendous amount of educational material available and all the sample code that goes with that. On the other hand, the Propeller is faster, has more memory and 8 processors. The Propeller is a 3.3V device and has to be interfaced to 5V devices although that's usually trivial to do.
Since you didn't originally say that you had an MP3 module, we thought you wanted to actually have the BS2 do the MP3 decoding itself, which would certainly be impossible, instead of the much simpler task of having it control a separate module over serial that will do the actual MP3 decoding for you, which should be quite possible.
The process and how it works depends on what the completed system needs to do. I have not worked with the CY T16 V1.1, but I have worked on automation systems, which have similar requirements. That is the controllers send serial data commands to control the system.
You posted a reference to a schedule of events previously so you will need some kind of clock/timer code/hardware for that, possibly even for day/date as well.
You will also need tables to store the schedule events and the CY T16 V1.1 commands.
Best way to start imo is to make a list of events the current system performs along with any additional tasks you want to add. Once you have that you can list the commands you need to send to the CY T16 V1.1 for each of those tasks. A spreadsheet works well for this.