Author Topic: SMP - Simple Music Player  (Read 9999 times)

0 Members and 1 Guest are viewing this topic.

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1751
  • Just a coding machine.
SMP - Simple Music Player
« on: August 24, 2010, 04:25:08 AM »
Okay, for those of you who noticed, I made an entry into the summer compo - a music player for the N64. It has some bugs and limitations because I was so rushed to get it done before the deadline. This will be the official thread for the program, where people can discuss it and make requests and find updates.

Note to people reviewing for the summer compo - DON'T USE THIS! The only version that can be considered for the competition is the one posted before the deadline, bugs and all. The updates here are for people using this for playing music on their N64, or for a source of code for their own N64 homebrew.

So with all that said, here's the first update to SMP. Bugs fixed this time include a change to the SD card data transfer routine that caused libmad to go spastic. It wasn't a bug so much as an unstated limitation on the buffers you could pass to the SD card read routine. It's been "fixed" so that any buffer is fine. This version also features FLAC and M4A (AAC) playback. Note that AAC is TREMENDOUSLY taxing on the CPU. Even with all the bells and whistles turned off and the engine set to fixed point decoding, the N64 is BARELY capable of playing AAC streams with faad2 (AAC decoding library). There's no MIPS specific optimizations, so I can probably get a little more speed out of it, but I never use AAC, so it's a low priority. So if you play a high-bitrate, complex music .m4a file, it may stutter just a little at times as the CPU falls behind.

Ogg and FLAC are the best formats for music... and with this player as well. FLAC is lossless, so the files will be BIG... expect 300 to 400 MB per album with FLAC, so it's meant for audiophiles with SDHC cards. Ogg is best for regular music fans on regular SD cards.

Mp3 now plays fine, but I don't parse the ID3/Xing/LAME tags for info, so it takes a second or two for the player to get the mp3 info needed to start playing, so expect a second or two between songs. I'll probably work on getting the info from the tags next since probably many/most people use mp3.

If you want to add music to your N64 homebrew, you probably want to use the mp3 or ogg driver. They are the most time efficient players. Avoid the aac driver - as mentioned, it takes every last bit of CPU power.

Known bugs: MIDI still hangs between songs much of the time. I haven't looked at it yet. AAC may stutter at times - it's not a bug, it's low CPU power (relatively speaking). I may or may not look into MIPS-specific optimizations to FAAD2. VBR mp3s might not have the correct play time. It's one of the reasons I want to work on reading the mp3 tags. Which leads to the last bug: when the play time for a song goes longer than expected, the progress bar will draw outside the container. You may see this with VBR mp3s, and you see it with AAC files that stutter - the stutter is lost time that the progress bar doesn't notice. How far the bar goes outside the container is an indicator of how much stuttering occurred.  ~sm-82.gif~.gif

2010-08-23: v1.1
ROM without any music in the rom - 5 MB download/ 8MB N64 rom: http://www.mediafire.com/download.php?j50fmixl1owxji2
ROM with a few mp3s and oggs - 13 MB download/ 16 MB N64 rom: http://www.mediafire.com/download.php?b9thy0qntkdsbnf
The big rom and all sources, resources, and libs - 27 MB download: http://www.mediafire.com/download.php?sxlg5rsykq1k55a

The small(er) rom has nothing but the MIDI instruments and images in the rom, making it smaller than the regular rom. Because there is no music in the rom, it starts in the SD card browser automatically. It is recommended for people who wish to play music on their N64 from the SD card.

USAGE
Press START to switch between the ROM and SD browsers. Both browsers show the root directory initially. Subdirectories will be shown in brackets. Use the dpad to navigate the list - up and down move one entry, while left and right move on page of entries.

Press A or B to enter a subdirectory. While in a subdirectory, the topmost entry will be [..] - press A or B while it's selected to go back one directory level.

While a song is selected, pressing A starts playing that song; once it is done, the player continues with the next song in the directory automatically until all songs after the first selected song have been played. If you press B, the player will play all songs in the directory in random order. While songs are playing, press A to pause/resume the song, and press B to stop playing.

Press the right or left shoulder buttons to change the background image.
« Last Edit: August 24, 2010, 05:15:53 AM by ChillyWilly »

Offline Conle

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2203
Re: SMP - Simple Music Player
« Reply #1 on: August 24, 2010, 04:54:02 AM »
Woah  >:D , thats a great update.   :D I'll be testing it tomorrow & i will report if i noticed anything but those listed bugs :)

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1751
  • Just a coding machine.
Re: SMP - Simple Music Player
« Reply #2 on: September 17, 2010, 05:06:15 AM »
Okay, here's the next update. This version fixes the issues playing MIDI files - there were two problems: I was freeing memory twice in one place, and the libdragon system memory allocator didn't properly check for running out of memory. Note that when libWildMidi runs out of memory while parsing a MIDI track, it won't play the track, but if it runs out of memory while loading the instruments, it will... but with the instruments already loaded. So if you play a song and one or more instruments are wildly incorrect (say a piano instead of a tomtom), the N64 ran out of memory. I'm looking into some smaller instruments, but right now, you really need the memory expansion pak for most MIDI tracks. I also lowered the MIDI output sample rate to 22kHz for lower CPU usage.

This version enables a few more profiles in the AAC decoder. Also, the AAC player stops playing a track when it runs into an error in the bitstream like other players do rather than attempting to skip over the error. It was causing too much trouble, and every player I use just stops playing a track on finding an error, so it's not like I'm the only one not trying to deal with errors.  >:(

http://www.fileden.com/files/2009/2/3/2304902/SMPlayer-20100916.7z
http://www.fileden.com/files/2009/2/3/2304902/SMPlayer-20100916-src.7z

Offline Conle

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2203
Re: SMP - Simple Music Player
« Reply #3 on: September 17, 2010, 11:04:22 AM »
Are you sure that its just a "Simple" player? Seems almost complete to me (Just lacks a full GUI) :)

edit - Its on the news page now  ~sm-87.gif~.gif
« Last Edit: September 17, 2010, 11:07:30 AM by Conle »

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1751
  • Just a coding machine.
Re: SMP - Simple Music Player
« Reply #4 on: September 17, 2010, 12:12:07 PM »
Are you sure that its just a "Simple" player? Seems almost complete to me (Just lacks a full GUI) :)

edit - Its on the news page now  ~sm-87.gif~.gif

 ~sm-82.gif~.gif

Yes, it's definitely simple - no tag info, no covers, no control other than pause or stop... seems pretty simple to me. I'd need to add at least some basic tag info and a programmable play list to beat the "simple" label.
 ;)

Offline Conle

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2203
Re: SMP - Simple Music Player
« Reply #5 on: September 18, 2010, 01:07:38 AM »
~sm-82.gif~.gif

Yes, it's definitely simple - no tag info, no covers, no control other than pause or stop... seems pretty simple to me. I'd need to add at least some basic tag info and a programmable play list to beat the "simple" label.
 ;)

Well lets see how that 'S' will turn into a 'C' (complete) :)
But i still think that the heart of the program is almost complete(And that's the audio playback  ~sm-76.gif~.gif ).  ~sm-57.gif~.gif

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1751
  • Just a coding machine.
Re: SMP - Simple Music Player
« Reply #6 on: September 18, 2010, 01:53:13 AM »
Well lets see how that 'S' will turn into a 'C' (complete) :)

And eventually the M will change from Music to Media.  :D

Quote
But i still think that the heart of the program is almost complete(And that's the audio playback  ~sm-76.gif~.gif ).  ~sm-57.gif~.gif

Yes, if all you were after was A) code needed to add music to your own project, or B) the ability to play a folder full of songs in order or randomly, it's pretty complete.
 ~sm-36.gif~

Offline Conle

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2203
Re: SMP - Simple Music Player
« Reply #7 on: September 18, 2010, 03:11:05 AM »
Yes, if all you were after was A) code needed to add music to your own project, or B) the ability to play a folder full of songs in order or randomly, it's pretty complete.
 ~sm-36.gif~

Of course , we're talking about the N64 here  8) . I highly doubt that there's anything like this out there for the N64(That supports so many formats and does mp3 streaming off SD) that's why im saying this.  8)

And eventually the M will change from Music to Media.

You almost got an 68K CPU instruction there  CMP.x n,nn  ~sm-80.gif~.gif (Not really funny , but i liked it   ~sm-82.gif~.gif  >:D )

Offline sanni

  • Moderator
  • Hero Member
  • *****
  • Posts: 502
Re: SMP - Simple Music Player
« Reply #8 on: September 18, 2010, 04:47:17 AM »
Maybe you could make it so that the simple music player not only plays music but also N64 roms   ~sm-82.gif~.gif