Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category
  • Assigned To No-one
  • Operating System
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by kkurbjun - 2006-02-10
Last edited by kkurbjun - 2006-02-10

FS#3005 - Midi player update

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.

Closed by  kkurbjun
2006-06-19 17:14
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Patches Committed

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.

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.

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

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.

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

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.

gh commented on 2006-05-06 12:38

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.

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

Woops, that’s
http://wam.umd.edu/~stevenm/patchset.tbz2 I need to wake up

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.

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.

gh commented on 2006-05-07 20:29

OK thanks, it works now :)

It looks really good, much more polished then the work I had. Buffer misses are not as noticable either.

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.

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?

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.

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...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing