Rockbox

Tasklist

FS#3005 - Midi player update

Attached to Project: Rockbox
Opened by Karl Kurbjun (kkurbjun) - Friday, 10 February 2006, 00:21 GMT
Last edited by Karl Kurbjun (kkurbjun) - Friday, 10 February 2006, 06:16 GMT
Task Type Patches
Category
Status Closed
Assigned To No-one
Operating System
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Here's an updated version of the midi player. I've
been testing it with files from here:
http://www.theparticle.com/midi/doommidi.html
on my H300.

Most of them work fine. I'm still getting buffer
misses occasionally though so more work needs to be
done on it.

Don't forget the patch set:
http://wam.umd.edu/~stevenm/patchset.tbz2

It will still crash if you don't have a patch set
installed.
This task depends upon

Closed by  Karl Kurbjun (kkurbjun)
Monday, 19 June 2006, 17:14 GMT
Reason for closing:  Accepted
Additional comments about closing:  Patches Committed
Comment by Karl Kurbjun (kkurbjun) - Friday, 10 February 2006, 06:16 GMT

This update to the midi player needs the same patch that
doom does. The only difference between the two is the
plugin buffer size (the midi player doesn't need a modified
buffer size to run) and the makefile doesn't need to be
modifed in plugins. This cvs diff includes the hold status
information for H300's and access to vsnprintf. If you
don't want to apply the cvs patch you can comment out the
insides of printf.
Comment by Karl Kurbjun (kkurbjun) - Tuesday, 11 April 2006, 18:17 GMT
Here's the latest version of the patch against cvs. This version seems much faster, I have fewer buffer misses in this version of the code. midiplay.c needs to be in apps/plugins, it still needs work though as it's still not full speed on some files and can't play at 44.1k yet.
Comment by Karl Kurbjun (kkurbjun) - Tuesday, 11 April 2006, 18:31 GMT
note:
midiplay.rock should replace midi2wav in viewers.config
i.e.
ch8,viewers/chip8,70 70 7f 7f 70 70
txt,viewers/viewer,55 55 55 55 55 55
nfo,viewers/viewer,55 55 55 55 55 55
txt,rocks/text_editor, 55 55 55 55 55 55
jpg,viewers/jpeg,18 24 3C 3C 24 18
mp3,viewers/vbrfix,10 08 58 38 04 02
m3u,viewers/search,00 00 00 00 00 00
txt,viewers/sort, 00 00 00 00 00 00
gb,viewers/rockboy, 0C 2A 59 7A 2E 0C
gbc,viewers/rockboy, 0C 2A 59 7A 2E 0C
m3u,viewers/iriverify,00 00 00 00 00 00
mid,viewers/midiplay, 20 70 70 3F 00 00
ss,rocks/sudoku, 55 55 55 55 55 55
wav,viewers/wav2wv, 00 00 00 00 00 00
wav,viewers/mp3_encoder, 00 00 00 00 00 00
Comment by Karl Kurbjun (kkurbjun) - Monday, 24 April 2006, 22:09 GMT
Here's the latest patch. It plays full speed on the files I've been testing at 11k. Some files are able to be played at 22k, 44k will cause buffer misses.
Comment by Steve (stevenm86) - Monday, 01 May 2006, 23:43 GMT
Hello.
I just applied patch to code, changed a few other things and put in CVS. Thank you very much!

I changed the sampling rate back to 22K to make it sound better, but I cut back on the number of active voices instead. I know it is below the MIDI spec but we can raise that once the synth code runs faster. For now, it just replaces old voice objects with new ones. Notes get cut, but it is not as bad as having more buffer misses. Hopefully at some point, with ASM and stuff it would be possible to run it with all voices enabled. I have a few files here of moderate complexity that actually play as intended.

Thanks again for the patch.
Stepan
Comment by Douglas Valentine (Dwyloc) - Friday, 05 May 2006, 10:05 GMT
Your midi player for Rockbox works quite well but it would be nice if it allowed you to change the volume inside the plugin rather than exiting as soon as you press a button.
Comment by gh (gh) - Saturday, 06 May 2006, 12:38 GMT
I have put the daily build of 20060506 on my H120, and when I try to read a midi file, the midi player displays some lines until "loading instruments", at that moment it freezes and the only way to quit is to use the reset button of the H120.
Comment by Steve (stevenm86) - Saturday, 06 May 2006, 18:05 GMT
That is strange. I only tested with 340 but it shoulod not matter? Do you have the soundset installed?

If not,
http://wamm.umd.edu/~stevenm/patchset.tbz2
Untar that into the .rockbox directory
Comment by Steve (stevenm86) - Saturday, 06 May 2006, 18:08 GMT
Woops, that's
http://wam.umd.edu/~stevenm/patchset.tbz2
I need to wake up
Comment by Karl Kurbjun (kkurbjun) - Saturday, 06 May 2006, 20:34 GMT
what gh stated is a bug, the player should not freeze when there isn't a patchset installed. I never got a chance to look into the reason this happens and I won't for at least another week, but I've experienced it as well. It is a bug that should be fixed before May 15th, the next proposed release date. Also, as a note, ipods will not play correct as they do not support frequencies other than 44k unless that's changed recently but ipods are not on the 3.0 release anyway.
Comment by Steve (stevenm86) - Sunday, 07 May 2006, 07:38 GMT
The freeze fix due to lack of patchset, as well as adjusting volume during playback are now in CVS. Works for me on iriver. It should also skip foreward a (3 sec or so) if you hit Right. It gets some buffer misses initially due to the voice array filling up really fast, but those go away a few sec into playback. Rewinding the file by some amount of time will be a lot harder. I don't even know how to realistically go about this, other than starting from the very beginning and just running ticks until the desired position is reached.

I've also been working on a way of making the ramping code more efficient, as samples do not need to be recalculated for every voice being ramped. Maybe make 2 global ramping variables, one for left and for right channels, and just add stuff onto them (pre-scaled for both note and channel volume) and then let each approach 0 with each sample. Ramping gives way too much trouble for me, so this will take some time.

Please check out the latest version- let me know what needs to be immediately fixed etc.
Comment by gh (gh) - Sunday, 07 May 2006, 20:29 GMT
OK thanks, it works now :)
Comment by Karl Kurbjun (kkurbjun) - Tuesday, 09 May 2006, 22:18 GMT
It looks really good, much more polished then the work I had. Buffer misses are not as noticable either.
Comment by Karl Kurbjun (kkurbjun) - Tuesday, 09 May 2006, 22:26 GMT
On another note, I'm looking at this player for incorporating into doom at somepoint to play the music in the game as well if fullspeed (or little notice to the listener) can be aquired at synchronous mixing in the plugin (at 11k as that's what doom runs at)(reason for the SYNC define). What I was wondering though is if there's a way to tell if a midi file loops as the doom tracks I've been testing would not cleanly loop from end to the begining. I don't really know how the files play in game as I havn't tested them on the computer with timidity or anything like that so this really may be a non-issue and I'm not familiar enough with the midi format to really know.
Comment by Steve (stevenm86) - Wednesday, 10 May 2006, 00:39 GMT
Hello.
Excellent- glad you like it

Looping? I did not know MIDI files could loop. To my knowledge this is not possible, and I have not seen anything anywhere in the file format specifications about an event that would cause looping or any sort of jumping within the file. How does doom's music system work? Is it real midi, or is it just FM / Audlib?

Comment by Karl Kurbjun (kkurbjun) - Wednesday, 10 May 2006, 05:31 GMT
Doom's music is a modified midi format titled mus. There's a builtin converter in prboom, the port I've based rockdoom (mostly) off of titled mus2mid, but it's not included in rockdoom's cvs yet. I havn't looked into it too much yet as I still think that's a long term goal. I was more just curious if there was such an event and if you knew about it.
Comment by Steve (stevenm86) - Wednesday, 10 May 2006, 06:00 GMT
Nope.. no looping event. I think MIDIs are meant to be more of a recording of a stream of MIDI messages coming from a keyboard to a synthesizer, etc. That's what MIDI is most widely used for- controlling equipment like synthesizers with keyboards etc. They had a Muse concert here where they wired the guy's keyboard to the lighting board and every note he played would get a bar of lights to turn on. Pretty nifty.

Loading...