Dunno if anyone’s interested but I fleshed out the entire driver for the audio chip on the ChipworkX to make a full featured MP3 player for Gadgetos. If you want it let me know and I’ll put it on code.tinyclr.com.
Get Position of File (in seconds)
Get Duration of File (in seconds)
Get Encoding (Layer 1, 2, or 3)
Get Bit Rate (integer Kbps / 1000)
I’ll also be adding a ID2 & ID3 class for getting other info.
It’s now online here: [url]http://code.tinyclr.com/project/375/vs10xx-driver/[/url]
Works with any VS10XX chip (including ChipworkX’s VS1053D)
Play/Pause files (IO & Resource)
Get the duration of a file
Get the position of a file
Get the bitrate & MPEG layer of a file
Receive events (HeaderReady, PositionChanged, PlayCompleted)
Get the chip version
Add seek capabilities
Add direct MIDI control
Add Bass/Treble control
NOTE: If you downloaded before 5:44PM CST; I had uploaded the wrong ZIP (the old version) and made a typo; it’s now corrected.
I looked through your code. Good stuff, nice additions to the original driver.
Glad ya like it man; I’m sure I’ll have more features as we get towards FLEX/Gadgetos release.
Yesterday I’ve tried to port these driver(s) to a Fez-Panda-II with a Fez-Music-shield:
After deploy I got the error message: unhandled exception …
I think this depends on my low expert count.
Is it possible to port this program ?
I’ve never used it and don’t have one in house to test but looking at the driver code posted I don’t see anything stopping you from making a port.
I am trying to play an mp3 file about 2 Mb in size but my ChipworkX is throwing an exception. I then went ahead and checked the bit rate of the mp3 I had downloaded from the internet. Apparently it was 128 kbps while your mp3 files have a bit rate of 16kbps. How do I change the bit rate to 128 kbps in your code? Truly appreciating your help in advance.
What’s the mpeg layer? Right now I only support Layer 3 bc there’s some licensing issues with 1 & 2. The bitrate calculations are done according to the docs.
I’ll check in the morning if your rate is supported by the chip (probably is). If it’s layer 3 and a supported rate maybe you could send a copy to me to test w; I haven’t encountered any failed MP3s to date.
I am missing a bunch of metadata at the start of the .mp3 file I am trying to play using your code. Your files on the other hand seem to have the metadata present at the start of the file. That is the only noticeable difference I have come across. Do you think that can be a factor? Is there any way I can upload the mp3 file so that you can take a look as you mentioned before.
Please pardon my excessive pestering but playing mp3 files is a crucial part of my project, and luckily for me you seemed to have open a huge path for me.
You can upload files on my site www.skewworks.com/forum.
Metadata is quite likely the issue, and here’s why:
In order to calculate the duration of a file I need to know the bitrate and length.
In order to get the bitrate I need the encoding layer.
Without that I can’t get the duration.
It shouldn’t, however, stop the file from playing altogether.
This is the location on your forum where I have uploaded the file. Again I would like to express my gratitude for making it easy for me to go ahead on my project.
The chip is a big fat liar. That’s right, I said it.
Even when doing a check for if the chip is still decoding it tells me it’s done decoding the header before it is!
So; anytime it returns a layer other than 3 I instantly return from the method with a -1 so that it will be called again. When it is eventually done decoding (for real) it will grab the correct information and stop calling the method.
Update is on [url]http://code.tinyclr.com/project/375/vs10xx-driver/[/url]
I have ported this project to a Fez-Panda-II and Fez-Music-Shield.
When I use mp3 files longer 14 kilobytes I get an error message from the debugger:
Failed allocation 12600 bytes.
I think I need a background filestreaming from uSD-Card.
This program has no mp3 filestreaming from uSD-Card for unlimited
(greater 100 MByte) mp3 file length ?
Both my and GHI’s driver has a buffer; what it looks like to me from your error message is you’re running out of RAM. Try decreasing the size of the buffer.
Also don’t run it with the debugger attached. We’ve since this before, proven with Spiral, debugger eats memory.
i have problems when getting duration of variable bitrate mp3 and mp3 files having id3TagV2…
duration of file is ~3minute, but your driver says it is 70minute
the id3TagV2 has image inside the mp3… so this makes problem i think…
is there any solution to get the correct duration from chip itself… (we can get the position from chip, but inside the datasheet of vs1053 , i could not find it… )
Yeah it’s not easy getting the information out of this guy. I’m extremely busy with other project at the moment but I will take a look at this when time permits.