Shop OBEX P1 Docs P2 Docs Learn Events
MP3 PLAYER using basic stamp 2 — Parallax Forums

MP3 PLAYER using basic stamp 2

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!
«134

Comments

  • ercoerco Posts: 20,257
    Not even close. A Propeller could almost do it, but not a Stamp. Note that a BS-2 is $50 and a cheap MP3 player is 77 cents: http://www.ebay.com/itm/311589001077

    You could hack the MP3 player buttons and have the BS2 control it using some I/O pins.
  • so it is impossible to create a mp3 player using basic stamp 2?
  • kwinnkwinn Posts: 8,697
    cydelcamat wrote: »
    so it is impossible to create a mp3 player using basic stamp 2?

    Yes.
  • May I know why?
  • ElectrodudeElectrodude Posts: 1,660
    edited 2016-06-17 18:56
    The Basic Stamp 2 isn't nearly fast enough to do all the computations necessary for MP3 decoding fast enough to output audio data.

    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.
  • ercoerco Posts: 20,257
    A BS-2 has a tiny fraction of the power of the Propeller, which still isn't quite up to the task: http://forums.parallax.com/discussion/134015/reading-from-an-sd-card-and-decoding-mp3-files
  • You could drive a Vmusic2 module with a BS2 but a propeller would be better

    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
  • PublisonPublison Posts: 12,366
    edited 2016-06-17 23:16
    cydelcamat wrote: »
    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!

    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





  • PublisonPublison Posts: 12,366
    edited 2016-06-17 23:24
    An even better MP3 Player with amplification would be :

    http://www.efx-tek.com/topics/ap-8.html

    Talks with BS chips via serial.

    (Parallax sells them, but they are out of stock)



  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2016-06-17 23:42
    There are so many "standards" that are so common and so cheap that you might think they were simple. But MP3 and USB for instance are never simple and besides any licensing requirements these "standards" suit big business and it is only through ginormous volumes that they appear cheap. Even tiny little MP3 "decode" chips are a complete digital signal processor + analog but if you try and buy them individually they cost an arm and a leg due to licensing costs or whatever. The easiest way to play MP3 is to pick up a module off ebay as they are quite cheap and would we care how they have dealt with MP3 licensing?

    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.
  • Hi guys thanks for all the reply. I am now using our own mp3 module. We use PIC to control the mp3 and my goal is to change the PIC to basic stamp.
  • im using this mp3 module that is called "CY T16 V1.1"

    Please see attachment. Thank you!
  • kwinnkwinn Posts: 8,697
    First, you should try to keep all the information in one thread so it does not get scattered. Might as well keep it in this one.

    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?
  • Yes. Im planning to change our PIC to basic stamp 2. The process is exporting the mp3 files via usb cable and syncing and programming the schedule of the alarms via serial port 9-pins. The problem is our PIC is written in assembly language and it will take a lot of time for me to study that language so I decided to bought a basic stamp 2 and I believe that this language is much easier to learn than assembly language. by the way, we use vb6 program to do the process like exporting and syncing. My goal now is to change the microcontroller by using the basic stamp 2. any idea about this process?
  • Cydelcamat,

    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 think it's illustrative that here's someone with an application already using a PIC that they want to upgrade that's planning on switching to use a Basic Stamp which has a PIC processor at its heart. It shows the power of a well thought out interpretive language for prototyping and low volume products where the additional device costs are overwhelmed by the ease of use.

    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.
  • Mike Green wrote: »
    I think it's illustrative that here's someone with an application already using a PIC that they want to upgrade that's planning on switching to use a Basic Stamp which has a PIC processor at its heart. It shows the power of a well thought out interpretive language for prototyping and low volume products where the additional device costs are overwhelmed by the ease of use.
    How close do you think a Prop Mini running PropBASIC will duplicate the experience of using the BS2? Is that a viable upgrade path for Stamp users? I keep thinking that stuff like SERIN and SEROUT would greatly benefit from a serial driver running in a separate COG.

  • Martin Hebel wrote a nice program for duplicating some BS2 commands. It's not asm, but it gets the job done many times.
    http://obex.parallax.com/object/164
  • Mike GreenMike Green Posts: 23,101
    edited 2016-06-18 19:47
    @David,
    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.
  • Mike Green wrote: »
    @David,
    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.
    Yes, the BS2 is still a nice platform but it would be nice to have a migration path for people who need more capacity. I wonder how much effort it would take to provide a smooth migration path from BS2/PBASIC -> PropMini/PropBASIC. Can't be that hard to make PropBASIC backward compatible with PBASIC.

  • Since early in the history of Prop-1 use, I have felt that Basic Stamp to Prop-1 evolution would have been better served with a PBasic interpreter ... running PBasic binary code. The PBasic interpretive code format has never been publically documented and I've never had the time to try to reverse engineer it. I did start to try to parse PBasic source code using a Propeller, but again didn't have the time to get far. It's really a task for a desktop application. PropBASIC is different enough from PBasic that you can't reuse most code ... a show-stopper as far as I'm concerned.

    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.
  • Mike Green wrote: »
    Since early in the history of Prop-1 use, I have felt that Basic Stamp to Prop-1 evolution would have been better served with a PBasic interpreter ... running PBasic binary code. The PBasic interpretive code format has never been publically documented and I've never had the time to try to reverse engineer it. I did start to try to parse PBasic source code using a Propeller, but again didn't have the time to get far. It's really a task for a desktop application. PropBASIC is different enough from PBasic that you can't reuse most code ... a show-stopper as far as I'm concerned.

    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.
    As I understand it, PBASIC is actually just tokenized and interpreted directly on the PIC. It isn't compiled to VM code like Spin is. Wouldn't it be sufficient to have an implementation of PBASIC for the Propeller that was source code compatible with the PBASIC for the BASIC Stamp? Why is binary compatiblity needed?

  • @David
    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.
  • Mike Green wrote: »
    @David
    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.
    The last time I looked, it seemed like the PBASIC language itself was pretty simple. I think the complexity comes in the statements like SERIN, SEROUT, etc. I guess you could consider those part of the language as well but they seem more like a runtime library to me. Anyway, there are lots of them with quite a bit of functionality to duplicate so I guess I can understand your comment about the complexity of the project.

  • Hi guy thanks for all the reply really appreciate it. So it is impossible that BS2 can control the mp3 module ("CY T16 V1.1") ? I thought that BS2 can do the same process because our pic using right now is very old and it will obsolete anytime soon. So I am thinking to replace our microcontroller to basic stamp 2.
  • Mike GreenMike Green Posts: 23,101
    edited 2016-06-20 04:29
    That's not what we said at all. It's possible that the BS2 can control the MP3 module. It can send and receive serial data at 9600 Baud although receiving at 9600 Baud requires a bit of extra care since it's right on the edge of what the BS2 can handle. The BS2 has limited data storage and 2K of program storage. If your application is not too complex, it should fit easily since the binary interpretive code is very compact.

    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.
  • ElectrodudeElectrodude Posts: 1,660
    edited 2016-06-20 04:23
    A BS2 should be able to control a serial MP3 module that an old PIC can control.

    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.
  • ok guys thanks again for the reply and now I know that it is possible for bs2 to control the mp3 module. My question now is does anyone here has an experience on controlling the mp3 module using basic stamp 2? May I know the initial process? just to have idea on how the process is working.
  • Do you have the code that's running on the PIC you have controlling the mp3 module now? If so, don't you just need to port it to the Basic Stamp?
  • kwinnkwinn Posts: 8,697
    cydelcamat wrote: »
    ok guys thanks again for the reply and now I know that it is possible for bs2 to control the mp3 module. My question now is does anyone here has an experience on controlling the mp3 module using basic stamp 2? May I know the initial process? just to have idea on how the process is working.

    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.
Sign In or Register to comment.