Shop OBEX P1 Docs P2 Docs Learn Events
Work in Progress...Basic Stamp2 MP3 Player and ID3 Tag Reader — Parallax Forums

Work in Progress...Basic Stamp2 MP3 Player and ID3 Tag Reader

MikerocontrollerMikerocontroller Posts: 310
edited 2009-05-28 05:57 in General Discussion
· I'm working on a project using the VMusic2 MP3 player.· The user interface is an IR remote using the Sony TV protocol.· I've been trying to extract data from the ID3 tags which are embedded in most MP3 files.· I had trouble consistently reading the song title data using the SERIN function.· I decided to·prepend··each song title with the "@" symbol (ASCII code 64).· I did this by editing the song title using my PC.· Now I can locate the song titles by using the WAIT(64) formatter in my SERIN statements.· The MP3 file names also had to be changed to conform to the 8+3 rule;this means a maximum of eight characters followed by the .MP3 extension.· I store song groups in seperate folders so I can navigate by album as well as by track.· The LCD will display up to fourteen characters followed by two periods.· This indicates that a song title has been truncated because it exceeds fourteen characters.· If the title is displayed complete no periods are displayed
after the title.· My goal is to display more ID3 tag information including elapsed time and album or
artist information.· Any tips or feedback will be appreciated.· Thank you.

Post Edited (Mikerocontroller) : 1/20/2009 4:59:47 AM GMT

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-20 18:05
    Wow, it’s been a little while since someone has tackled the VMusic module for an MP3 Player Project. I guess it’s a good thing the new hardware/firmware support MP3 tags. I don’t believe the older hardware (VMUSIC1)/firmware did. Displaying more data might necessitate a larger display. Perhaps a 4x20 would be able to fit that task. =)

    In any event I haven’t worked with the new module so I am not familiar with how it sends the tag data. The firmware specification indicates the 5 lines are sent immediately following the ‘playing’ message, however it is unclear if they’re sent back-to-back or not. This would determine whether the BASIC Stamp has enough time to get them all. By the way, if you used the 4x20 LCD you could fetch more characters from the module because you still have 6 bytes of variable RAM left. This would give you 20 characters instead of 14.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-01-21 01:00
    Thank you for the reply, Chris. Right now I'm working on displaying elapsed play time from the ID3 data stream. The time is displayed in seven bytes (0-6) with this format: $01 $00 ...... $02 $00 ....etc. The first hexadecimal value is seconds (bytes 1 and 2) and the second value (bytes 5 and 6) is minutes. Any suggestions on how this conversion is done?· I would like to display
    (minutes) : (seconds) in decimal.· Thank you.
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-01-22 04:37
    I tried to set up an elapsed- time display for my MP3 project using this code. It functions just fine until I reach
    04:15 at which point it resets itself back to 00:00. I like to blame myself before I blame the equipment. Do you
    see something that I'm overlooking? If there is a more efficient way to go from point A to point B please let me know....


    ·· time VAR Word

    SERIN VMusic2,Baud,[noparse][[/noparse]WAIT("T $"),HEX4 time]···· ' extract 4-byte hexadecimal string from VMusic2

    time=(time/60)*100+(time//60)······················· ' convert to "clock format" (minutes:seconds)

    SEROUT LCD,Baud,[noparse][[/noparse]148,DEC1 time DIG 3,DEC1 time DIG 2,58,DEC1 time DIG 1,DEC1 time DIG 0]
    ···································································'display to LCD like this:· 02:59

    Post Edited (Mikerocontroller) : 1/22/2009 4:45:15 AM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-22 18:35
    Well, to be honest up to now I have not done anything with this module. I did however check as I promised and I do have two VMUSIC2 Modules at my home office. I will be hooking them up (after firmware updates) this weekend (probably Friday) to see what I can come up with. So, just for clarification…does the module keep sending time data every second? The documentation isn’t real clear on that, hence my need to experiment and see what I get.

    The datasheet shows:
    54 20 01 00 0D
    54 20 02 00 0D
    54 20 03 00 0D
    54 20 04 00 0D

    Is this data sent every second? Is it always in this format? If so you can simplify your LCD SEROUT routines a bit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-01-22 21:02
    Chris, there appear to be two different monitor output modes: IPH and IPA. My VMusic2 defaults to IPA mode which is ASCII format. Apparently IPH is binary (or non-indicated hex ?) output and looks easier to work with (your example shows IPH mode). There is a command to enable IPH mode and it is explained in the Vinculum
    firmware PDF file but I haven't had time to read it yet. I'm at work so I have to go now! Thanks, Chris.
    P.S. yes the data is updated every second. This is the IPA time format: T $01 00 CR (10 bytes)
    The time is a 16-bit value (expressed in seconds) according to the firmware documentation.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-22 21:32
    What are the 10 bytes following the T $01 00 CR? I still think the routine can be simplified, but until I hook it up I won’t be able to test much. I wonder if the short command mode affects the feedback. I will definitely have to test some of this out soon.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-01-22 22:31
    ··· Chris, the time string in IHA mode is ten bytes long (+ carriage return)= 11 total·

    ···· "T"· "space"· "$"·· "0"·· "0"·· "space"·· "$"· "0"·· "0"··· "space"··· "CR"

    · This entire string is updated every second.·· As you can see the data is sent in "literal" ASC format.· Back to work I must go!
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-01-23 23:22
    ·· Chris Savage:· I hope you have a chance to try out the VMusic2 with the updated firmware soon.· I solved my resetting to 00:00 after 04:15 indicated time.· Four fifteen equals 255 seconds. I must have been using only the least significant byte of the word value output by the VMusic2.· I used the wrong WAIT formatter in my SERIN statement.··My next experiment will be to reduce the baud rate of the VMusic monitor.· No sucess yet.· I look forward to hearing·(and learning) from your experiences with this gadget.· Thank you.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-23 23:45
    I intend to get to this project this weekend…that in and of itself is ambitious since I have so many to work on in one weekend, but I think this is one of the ones I put off for too long. I’m glad you figured out the issue…if I had paid a little attention to your code I would have caught that since the formatter will terminate at the first non-digit character, in this case the space between values.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-02-27 03:22
    · I'm enclosing photos of my MP3 project.· The unit consists of a Vmusic2 MP3 decoder/disk reader.· It uses an infrared control interface based on the Sony TV remote protocol.· There is also a white LED to indicate when a valid code is received by the 40 kHz. IR detector.· A Basic Stamp Homework board is mounted inside and supplied via an 8-volt wall wart.· The logo is stainless steel and was laser cut by a friend.· The PBasic code is· roughly the same as the code I posted earlier in this thread.· The only significant addition was a track elapsed time function which is still buggy and in need of more work.·· The serial port is accessable from the top of the project enclosure.
    576 x 432 - 58K
    576 x 432 - 37K
    576 x 432 - 67K
  • uxoriousuxorious Posts: 126
    edited 2009-02-27 06:05
    Nice work, much cleaner than my Vmusic2 code. Mine was so flaky that I put it aside almost a year ago. After seeing this, I am going to update the firmware on mine and try to get back up to speed.

    My project was supposed to be a 3rd birthday present for my daughter, who turned 3 last month cry.gif
    A handheld MP3 player with some special buttons. Apart from regular control buttons, I was going to put a few buttons for specific songs so she could play 'spoonful of sugar' without having to look for it by hitting the next button a hundred times.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ~~ dRu ~~
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-02-27 17:25
    Very nice…I have my VMUSIC2 module in my laptop bag right now and had intended to get the firmware updated before trying anything with it. I think that might be a tonight project. BTW, this could be posted in the Completed Projects now if you have schematics to go with the code and pictures. =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-03-01 07:06
    · Thanks dRu and Chris. Here's another pic of the MP3 player (yes, of course, its playing Led Zeppelin!)· I bought the subwoofer amp and speakers at Office Depot for around $15.· It doesen't sound too bad at·moderate listening levels .··I·ordered a Propeller Demo·Board·this weekend and am looking forward to a new learning experience.· Maybe a Propeller MP3 player? I would like to·optimize some functions before I post this as a complete project.· I look forward to seeing how you guys progress on your projects.··

    ········

    ····
    529 x 386 - 37K
  • RobomasterRobomaster Posts: 8
    edited 2009-04-01 17:57
    Your project looks great and has inspired my to get my VMusic2 up and running.
    I would like to see the code that has the track run time, maybe I can get it working better for you.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tim J Lewis
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-04-01 18:45
    Sadly I still haven't even gotten the firmware updated on my VMUSIC2...so many projects...so little time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-04-02 05:00
    · Robomaster: Thank-you for the compliment.· The enclosed updated program has an elapsed play time subroutine but it is buggy (it doesen't update consistently because the wait state for the timer must be juggled with the wait state for the ID3 tag data).· There is definitely room for improvements.··Keep us posted on your project.
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-05-28 05:57
    · Before I dismantle my project (I need the Homework Board) I need to ask:·can the Vmusic2 be interfaced with a USB printer?
Sign In or Register to comment.