Shop OBEX P1 Docs P2 Docs Learn Events
VS1003B based MP3 player — Parallax Forums

VS1003B based MP3 player

RaymanRayman Posts: 14,651
edited 2014-01-17 11:37 in Propeller 1
Just finished initial testing a prototype MP3 player based on the VS1003.
The driver was a lot more difficult that I thought, but not too bad.
I was turned off in the past by the high cost of these chips.
But, recently noticed this one for $4.95 at Sparkfun.
Only problem I'm having is that it plays MP3 just fine, but won't play wav or midi, like it claims it can...
Anyway, if I can make this all work, I'll be getting closer to a MPEG video player...

One downside is that it uses a lot more pins than regular wav file playback (that uses just 2 pins).
But, for low sample rate stuff, I think I can use a I2C to SPI adapter to use only 2 pins...

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-03-08 16:33
    Very nice Ray!

    How about some pics of the prototype?

    OBC
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-03-08 17:02
    Hard to say why it's not running MIDI, as that could be electrical connection (GPI pins, reset) and/or the right MIDI bytes, which admittedly are pretty simple, so there's not much to get wrong. I've only used these from the board level (mostly the SparkFun ones, which use a slightly different variation, but also from VLSI), and not chip-level. I've never tried to get these chips to do WMA (don't know if this version will do WAV; other versions of the chip can). As most uses of WMA have been for protected content there's not much point.

    I have been suggesting a MIDI board to Ken and MattG for a while, and it would be nice to see some more options on the market, assuming you plan to commercialize this.

    MIDI only needs Rx and reset. It's just the MP3 that takes more pins, but the Prop can't decode MP3 anyway, so it's not a fair comparison. These chips decode standard 160 kbps MP3, so the sound quality should be quite good.

    -- Gordon
  • cavelambcavelamb Posts: 720
    edited 2012-03-08 17:39
    Curious.

    I thought I saw several MP3 players in the object exchange.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-03-08 18:52
    More than likely they're objects for driving boards that use licensed MP3 codecs on them. Decoding MP3 is pretty processor intensive, and is usually done in silicon when outside of a full-blown OS. MP3 decoding requires decompressing a nominal 160 kbps data stream into 1.44 mbps stereo audio. The VLSI chips that Ray is referring to are probably the most common silicon codecs. The VS1003 is a little older, but it gets the job done. Most also have a full bank of synthesized MIDI instruments (possibly some of the chips in their line have sampled instruments).

    -- Gordon
  • cavelambcavelamb Posts: 720
    edited 2012-03-08 19:37
    Looks like you were right, Gordon.
    The one I saw was using a VNC1L chip.

    And here I was expecting someone to say they had done that in one cog...
    :)
  • RaymanRayman Posts: 14,651
    edited 2012-03-09 05:37
    Here's a pic for you OBC: (even plug Prop Platform USB for you :)

    MP3_Proto1.jpg


    This is only 3/4 of the actual board though...
    The real one actually has another pushbutton on the other side of the audio jack.
    Also, this one is missing the microphone circuit...

    There are some other things I still need to test:
    pushbuttons, LEDs, microphone, line in.

    Also, it seems I need to figure out how to disable the WMA feature (or else pay Microsoft a million dollars...).

    One other thing I'd like to do is reduce the number of cogs require to play from SD...
    Right now, it takes 4 if you want to play and do other things at the same time
    (1 main Spin cog, 1 for SD, 1 for MP3, and 1 to coordinate SD and MP3)

    Also, I'd like to see what kind of metadata I can extract from the stream... I think the VS1003 chip does some of this for me...
    1024 x 768 - 95K
  • RaymanRayman Posts: 14,651
    edited 2012-03-09 06:19
    BTW: I just noticed that this is VS1003B and not VS1003. No idea what the difference is, but I assume this one is better...

    I just took a look at the competition (other VS1003B boards)....
    (Maybe one should do this before designing a product?)
    I think I can be price competitive with the imported version...
    One think I see that I wish I'd done is include mounting holes...
    But, if absolutely required, I suppose one could remove the switches and drill mounting holes there...
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-03-09 09:48
    Rayman wrote: »
    Also, I'd like to see what kind of metadata I can extract from the stream... I think the VS1003 chip does some of this for me...

    I'm not sure about the VS1003, but the other chips don't provide a register or other function for this, so I doubt this one does, either. You need to sift through the stream. Some Arduino code here for comparison:

    https://github.com/madsci1016/Sparkfun-MP3-Player-Shield-Arduino-Library

    It makes use of some methods in the SdFat library for the Arduino, and the methods are likely similar to ones you have available for the Prop, or can readily create.

    On licensing: The later chips have some of the features that require licensing disabled by default, but it doesn't look like WMA is one of them. They suggest instead looking at a status register to see what format is playing, and disable it if it's WMA. As you're not creating an end-user device, I wonder if this is even meaningful or required. Your product is basically a breakout board for the chip, for the purposes of evaluation and education.

    How did you handle the output? I assume you used the protective circuit described in the docs, but how about the bypass for GBUF, when using an external amplifier? SparkFun's boards have the basic protective circuit, but in the past, treated GBUF as a kind of ground (which it's not), and only recently started advising people to read up on the output circuitry recommended in a separate VLSI document. As it's only a couple resistors and a capacitor per channel, it would be so much easier if it were already on your board. People could use the direct headphone circuit, or if they connected to on board amplifier, attach through the bypassed circuit.

    -- Gordon
  • RaymanRayman Posts: 14,651
    edited 2012-03-09 13:08
    I pretty much did the reference design in the datasheet... Except for pushbuttons and LEDs on the GPIOs...

    It is true that the "ground" on the earphone connector hovers at Vdd/2, so connecting that to earth gound could be bad.

    That problem could arise if you connect the earphone output to a Line-In of an amplifier...
    I think a lot of Line-In connections are AC coupled, so you'd be OK if that was true.
    I think computer speakers are AC coupled too, but don't know for sure...
    If you're using batteries, you'd be also OK.
  • T ChapT Chap Posts: 4,223
    edited 2012-03-09 14:35
    You should not ground the ground output, nor connect the ground outputs together for the speaker outputs. I do tie the outputs together for the line outputs and also tie the line outputs to system ground. I use basically the same circuit as the Vmusic2, which is a vinculum + VS1033 + USB drive. Works great. With this circuit it is just a UART device needing tx/rx.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-03-09 15:06
    "You should not ground the ground output" -- you REALLY need to know this chip to understand this statement! :lol:

    Have you ever tried the VS1000 module VLSI sells? It only plays OGG Vorbis, but this makes it license free. The module is about $5 in quantity of 100, and directly connects to TTL serial or USB. It has a small 16 MB built-in Flash, and can read from a micro-SD card. Playback can also be controlled via I/O, and the standard firmware is supposidly updatable. Being able to play MP3s is handy, but for a sound effects project OGG is as good, and the module appears very easy to use. It's about $15 in single quantity, but so far I haven't found a US-based reseller.

    URL is here: http://www.vlsi.fi/en/products/vs1000module.html

    -- Gordon
  • RaymanRayman Posts: 14,651
    edited 2012-03-10 05:57
    License free is good. But, everybody knows MP3 and probably has some. Or, it's easy to find ways to convert to MP3.
    Also, the chip is licensed for MP3. They've paid Fraun... (something) the $$ already, so you don't have to worry about that.

    On a seperate note, I was finally able to play a midi file. Turns out the chip is extremely picky about the file format.
    Had to use a tool called GN1:0 to get it in the format it likes.

    Still need to figure out how to play WAV files. My guess it that it's really picky about that format too...

    I'm still kicking myself for not including mounting holes...
    When I get the boards, I'll try taking them to a big hole punching press and see if I can easily put mounting holes under the switches...
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-03-10 07:48
    True enough that MP3 is the better format for compatibility for those adding their own audio clips. But bear in mind that the MP3 license is one of the things that makes these expensive. SparkFun's $5 price is obviously something special, as it's well under the going rate that VLSI sells these for single quantity. You'd need to buy about 250 at a time to get that price, with increasing discounts for much higher quantities. SparkFun seems to have a lot of these at the moment, but you may want to do a lifetime buy (assuming <250) in order to keep your price. The other VS10xx units SparkFun sells is more in line with the expected per-unit pricing structure.

    I've seen another regular poster here, MacTuxLin as I recall, post in the VLSI forums about the VS1000, so if you see this thread, let us know about your experiences with the chip, reflashing the firmware, etc.

    Anyway, this is looking t-riffic, even without the mounting holes!

    -- Gordon
  • RaymanRayman Posts: 14,651
    edited 2012-03-10 08:10
    The price is great. That's the only reason I considered doing this...


    maybe I should buy a bunch before they figure out they made a mistake...


    But, if someone wants to pay more... It looks like one can possibly use the other VS10XX chips with this board.
    I took a look at the VS1053B and the only possible problem is that there are 5 pins that I have not connected that are connected for the VS1053b.
    Four of them or I2S output, so I don't think that's a problem. But, one is an additional digitial I/O ground. But, I'd guess that pin isn't needed either if not using the I2S bus...
  • MacTuxLinMacTuxLin Posts: 821
    edited 2012-03-10 09:50
    I've seen another regular poster here, MacTuxLin as I recall, post in the VLSI forums about the VS1000, so if you see this thread, let us know about your experiences with the chip, reflashing the firmware, etc.

    -- Gordon

    Yeap. I was working on VS1000d last year (will be continuing very soon once I've finished current project) . In the end, to me, I felt its better to get down coding in VSIDE. (the latest version works without having to compile & sending to VS1000 in dos command line window, finally!). Its just a little tricky as you'll need to compile & 3 firmware each time but the documentation seems sufficient. I got it to comm with Prop1 using UART with specific controls. The VS1000 module is very neat (small & compact). I already have a proto-type casing using this module with a simple prop setup for mobile media. Unfortunately, that's all I've reach at the moment.

    Gordon, we bought a bunch of these modules & I'll be bringing some (maybe 5 pcs) along with me to Parallax Expo & can sell to you if you're interested. I'll bring more if anyone is interested, Rayman?
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-03-12 12:04
    MacTuxLin wrote: »
    Gordon, we bought a bunch of these modules & I'll be bringing some (maybe 5 pcs) along with me to Parallax Expo & can sell to you if you're interested. I'll bring more if anyone is interested, Rayman?

    I'm planning on being there, so I'll likely take you up on the offer for at least one.

    -- Gordon
  • RaymanRayman Posts: 14,651
    edited 2012-06-28 19:24
    Finally got around to testing out the production MP3 player modules...
    They work! At least, they play MP3 files...
    Still need to see of the LEDs, buttons, and microphone work...

    Had hoped that could use Prop pins to power the device, but it turns out that it draws too much current for that.
    Here's a board photo and test setup:
    Mp3Product.jpg
    Mp3Testing.jpg
    1024 x 768 - 128K
    1024 x 768 - 113K
  • RaymanRayman Posts: 14,651
    edited 2012-07-01 13:42
    Got LEDs lit and recording to WAV on SD working! Just need to check buttons and it's a done deal...

    Interesting sidenote: The VS1003 records and plays a wav format that is compressed, called: IMA ADPCM

    From the little bit I've read about it, this simple compression seems like something that the Prop could do in real time too.
    Sounds like a 4:1 compression factor. Not huge, but still could be useful in some instances maybe...
  • RaymanRayman Posts: 14,651
    edited 2012-10-20 07:11
    Well, I was pretty bummed that everything seems to work perfectly, except the buttons, probably the simplest thing on the board...
    But, I think I just found some buttons that I can make work. It's not perfect, but I think it will work:

    100_7065.jpg
    1024 x 768 - 71K
  • RaymanRayman Posts: 14,651
    edited 2012-12-21 16:07
    I wasn't very happy with that previous layout due to a mistake with the switches and no mounting holes...

    So, I've just had this new version made (at least the prototype):
    RevB.png


    I hope it will fix the earlier problems...

    One thing I was wondering is if the kinda funny floating ground output of this chip would be able to work with powered PC speakers or home theater systems. So, in a very small experiment, I just tried the original version on one set of powered PC speakers and one home theater system audio input. I'm happy to report that it works very well in both cases without any popping or hissing. So, I'm thinking that most new systems have capacitively coupled inputs and with work with simple output circuit that I'm using here.

    Only change I'm thinking about making is moving the GND next to VDD so it can plug directly onto the Proto board USB...

    Now, I have to figure out what to do with about 5 of this old version I made... They work, but I'm not happy with them enough to sell them...
    463 x 292 - 16K
  • WBA ConsultingWBA Consulting Posts: 2,934
    edited 2014-01-16 12:46
    Ray, I never found any code for your project for the basic operation of playing back MP3 files. I was looking into an MP3 player board for an upcoming project and would like to make it as Propeller heavy as possible and just use a VLSI breakout board, but looks like I would have to do a lot of work that is over my head to make it work. Right now, I am looking at just pairing a Propeller with one of these MP3 boards from MDFLY.
  • T ChapT Chap Posts: 4,223
    edited 2014-01-16 16:54
    I recreated the Vmusic2 on a board with a Vinculum and VS1003, it plays audio off a USB drive. Pretty simple stuff, the Prop just sends the commands via serial strings. These modules are a little more pricey than the boards you linked, but there is very little start up time to get it going.
  • RaymanRayman Posts: 14,651
    edited 2014-01-17 11:37
    Andrew, I can probably post my VS1003 code... I was going to wait until I had a product for sale, but I may punt on that...
  • Hey there Rayman. Sorry to dig up an ancient discussion, but did you finish this project? Do you still have your VS1003 code? I'm just getting started with learning to program the Propeller and would love to see your objects for reference.
  • RaymanRayman Posts: 14,651
    edited 2015-11-14 12:54
    Thanks for asking. I did finish and even made a few boards. But, I never found time to get a web page going for them or anything...

    Anyway, here's what I think is the latest the code: (it's not letting me upload...)
  • RaymanRayman Posts: 14,651
    Strange... Wouldn't let me upload zip file, so had to do individual files...
Sign In or Register to comment.