Rockbox Technical Forums

Support and General Use => Plugins/Viewers => Topic started by: jbullfrog on April 22, 2008, 04:41:10 PM

Title: Midi Player
Post by: jbullfrog on April 22, 2008, 04:41:10 PM
How do I get midis to work on my sansa e250?  I tried looking at this page, http://rasher.dk/rockbox/WikiRescue/SoundCodecs-r1.100%20-%2008-27.html  but whatever I tried did not seem to work. 

Here is what I did.

I downloaded the patchset.tbz2 file, and extracted patchset.rar.  I then extracted patchset.rar, and got the folder patchset.  I opened patchset, and placed all the .pat files into my rockbox folder on my sansa.


I then put some midis into a folder called "Midis" in my "MUSIC" folder on my sansa.  I navigated to the Midis folder using rockbox and selected one of the midi files.

I got an error saying "No Midi patchset found.  Please install the instrument"
Can anyone please help?   

----------------------------------------------------------

Another thing:
I know how to convert my midis to wav files, but is it possible to reduce the size of the wav file that is outputed?  Each midi file I convert goes from a couple of KB to MB!
Title: Re: Midi Player
Post by: MarcGuay on April 22, 2008, 04:46:56 PM
That link is from August 2005!

Here's the proper link to that page:

http://www.rockbox.org/twiki/bin/view/Main/SoundCodecs.

Not sure how much has changed in the MIDI section, though...
Title: Re: Midi Player
Post by: karashata on April 22, 2008, 05:26:55 PM
First of all, you need to put the patchset files into a folder called "patchset" in the .rockbox folder.  The midi player plugin searches for that folder for the patchset so it can play the midis.

Second, .wav files typically will be quite large because they're uncompressed PCM data.  You will probably want to convert them to .mp3 or .ogg format with audio editing software, I would think something like a 128 KB/s .mp3 file would preserve the audio quality decently enough and shrink the size of the file by quite a significant amount.
Title: Re: Midi Player
Post by: jbullfrog on April 23, 2008, 09:11:46 AM
Now when I try it out, I get the following message

"Loading instrucments
Loading drums
Okay, starting sequencing"

However, I don't hear anything.

I think I might give up on this...

I am currently using Winamp to convert my midis to wav files, but this takes forever!

I have searched for a good midi to mp3 converter but have found nothing!  (Freeware)

Can anybody help?  Thanks again
Title: Re: Midi Player
Post by: LambdaCalculus on April 23, 2008, 09:21:36 AM
Have you tried Audacity (http://audacity.sourceforge.net/)?

EDIT: iTunes has the ability to import MIDI files and convert them to MP3s, but these will only sound as good as the MIDI system on your computer. Plus, you also have to know where the resulting files are going to end up on your system, so that you can retrieve them.
Title: Re: Midi Player
Post by: jbullfrog on April 23, 2008, 12:10:45 PM
Well, I found out that I could use Winamp to create mp3s directly from midi files.

This is will work out, even though it is really slow.   :'(

Do any of you know what is the equivalent  mp3 kb/sec for a midi file?

For example is a midi file equivalent to a 32kbps ABR, stereo mp3 file?

Thanks
Title: Re: Midi Player
Post by: Chronon on April 23, 2008, 12:35:48 PM
I think the quality that MIDI produces depends upon the quality of your patchset.  MIDI is not an encoded waveform like mp3 or ogg.  It's a sequence of instructions for synthesizing a piece of music.  The actual music (waveform) that gets produced depends upon the particular patches that you use to play the music.

So, I don't think you can make a direct comparison like that.  You will probably have to play around with it and see what sounds good to you.

I will try out MIDI playback on my e280 shortly.  I have not had any issues on my Gigabeat, but have yet to try it with my Sansa.
========
No problems on my e280.
Title: Re: Midi Player
Post by: jbullfrog on April 23, 2008, 03:18:13 PM
Thanks Chronon,

As of now, I am converting all my midi files using winamp into mp3 files with a bit rate of 112kbps.  A one minute midi file turns out to be roughly 1MB.

Good luck trying to get midi files to work.

 ;D
Title: Re: Midi Player
Post by: Chronon on April 23, 2008, 03:23:07 PM
Another Sansa user is having problems (though different from yours, it seems) with MIDI here: http://forums.rockbox.org/index.php?topic=16451.0
Title: Re: Midi Player
Post by: bascule on April 23, 2008, 04:17:09 PM
Now when I try it out, I get the following message
"Loading instrucments
Loading drums
Okay, starting sequencing"

That is correct, it should start playing. Are you sure it's not just the volume turned down or something silly?
Title: Re: Midi Player
Post by: karashata on April 23, 2008, 06:43:32 PM
I'll note that most midi files are much quieter than MP3s or other music files, you usually the volume needs to be turned up quite a bit.  Just remember to turn it down again before you start playing MP3s again you you'll get a bit of a shock to your ears...
Title: Re: Midi Player
Post by: jbullfrog on April 23, 2008, 07:56:41 PM
I turned up the volume full blast..and heard nothing.
Title: Re: Midi Player
Post by: karashata on April 23, 2008, 09:57:51 PM
It's possible the Midi you're trying to play uses only instruments that aren't included in the patchset.  As far as I can tell, the patchset only includes instruments from the General Midi set, not the XG or other instrument sets.
Title: Re: Midi Player
Post by: kfb on April 24, 2008, 02:40:59 AM
Are there any places where one can download patches with the other instrument sets?  (hopefully free of charge?)
Title: Re: Midi Player
Post by: karashata on April 24, 2008, 06:08:30 AM
I wouldn't know, personally.  I would have to say to try searching with Google and see what you can turn up.  Even if you can find more complete patchsets, though, who's to say whether or not the Midi plugin in Rockbox will recognize the extra instruments..?

I recall finding a patchset somewhere that was identical to the one provided by Rockbox, and one that was similar with extra instruments and a slightly different configuration file.  The identical one worked, the other one didn't (the plugin returned an error saying no patchset found or whatever it is exactly that it says when there isn't a patchset).
Title: Re: Midi Player
Post by: Chronon on April 24, 2008, 12:30:35 PM
jbulllfrog, could you post a sample MIDI file somewhere that doesn't work properly for you?  This will allow us to test for whether or not they are supported by the current MIDI player plugin. 

kfb, I have my doubts that a new patchset will help for your problem since your test file on the other topic seemed to play okay for others. 
Title: Re: Midi Player
Post by: jbullfrog on April 24, 2008, 04:27:26 PM
Here is a file from Phoenix Wright the nintendo ds video game

http://www.sendspace.com/file/v0vmra
Title: Re: Midi Player
Post by: Chronon on April 24, 2008, 04:36:10 PM
It plays for me, though with a few glitches.  I'm not sure what it should sound like but the plugin definitely produces recognizable sound.  This is with a Sansa e280 (r17232) and using the patchset from the wiki.
Title: Re: Midi Player
Post by: karashata on April 24, 2008, 05:30:41 PM
It plays for me, though with a few glitches.  I'm not sure what it should sound like but the plugin definitely produces recognizable sound.  This is with a Sansa e280 (r17232) and using the patchset from the wiki.

The file is probably stuttering.  The PortalPlayer targets currently can't process the midi information fast enough to keep up with playback, so playback tends to stutter a lot, unless the midi uses only a few instruments and plays at a slow tempo.  (This deduced from personal experience.)
Title: Re: Midi Player
Post by: Chronon on April 24, 2008, 05:45:03 PM
Yeah, I do have other .mid's that play fine that have a greater apparent complexity.  But I can't say much more than that at the moment.
Title: Re: Midi Player
Post by: karashata on April 24, 2008, 06:11:30 PM
Until someone manages to better optimize (if even possible) the MidiPlayPlugin (or whatever it's really called...) for the PP targets, I think playing midis will be trial-and-error to find which play fine and which stutter.

I wish I could, but I wouldn't know what files to poke around in, and my programming experience is only high-school level, though I do credit myself to being a fast learner and there are many websites that could help...
Title: Re: Midi Player
Post by: Chronon on April 24, 2008, 06:28:25 PM
It would be nice to get some more input on this from other users.  So far we have two individual players not behaving like the rest.
Title: Re: Midi Player
Post by: karashata on April 24, 2008, 06:42:35 PM
How many people actually use midi files seriously and consistently on their DAP's anyway..?  Currently the plugin only plays one at a time, then stops and you have to select the next midi to continue listening...  It's not yet something I would expect most people to use regularly...  I myself only used it to test it to see how well it was(n't) working.  Perhaps once it's fully optimised and made into a codec rather than a separate plugin, I'll find more practical use for it...
Title: Re: Midi Player
Post by: MarcGuay on April 24, 2008, 06:49:09 PM
It plays for me, though with a few glitches.  I'm not sure what it should sound like but the plugin definitely produces recognizable sound.  This is with a Sansa e280 (r17232) and using the patchset from the wiki.

Same for me.  I get a "Buffer miss!" error in the plugin screen when it glitches.

Title: Re: Midi Player
Post by: Chronon on April 24, 2008, 06:54:14 PM
Okay, so that means that the plugin works for us, but is not quite fast enough.  (I verified that I get the same message.)
Title: Re: Midi Player
Post by: saanaito on April 24, 2008, 08:17:51 PM
I recall finding a patchset somewhere that was identical to the one provided by Rockbox, and one that was similar with extra instruments and a slightly different configuration file.  The identical one worked, the other one didn't (the plugin returned an error saying no patchset found or whatever it is exactly that it says when there isn't a patchset).

Perhaps Timidity is what you're thinking of....? Here's a nice patchset (http://www.metaviewsoft.de/eawpats12_full_palm.zip); I'm pretty sure the format is compatable. Here's a smaller patchset (http://www.metaviewsoft.de/instruments.zip).

The file is probably stuttering.  The PortalPlayer targets currently can't process the midi information fast enough to keep up with playback, so playback tends to stutter a lot, unless the midi uses only a few instruments and plays at a slow tempo.  (This deduced from personal experience.)

Same here. I use a Sansa c250.

It would be nice to get some more input on this from other users.  So far we have two individual players not behaving like the rest.

And so I'm posting now.

How many people actually use midi files seriously and consistently on their DAP's anyway..?  Currently the plugin only plays one at a time, then stops and you have to select the next midi to continue listening...  It's not yet something I would expect most people to use regularly...  I myself only used it to test it to see how well it was(n't) working.  Perhaps once it's fully optimised and made into a codec rather than a separate plugin, I'll find more practical use for it...

I use it quite a bit.

I [also] get a "Buffer miss!" error in the plugin screen when it glitches.

Argh. Same here. I just do trial and error and delete whatever does it chronically.


Someone wondered about converting MIDIs. The free converter on http://www.hamienet.com/ is pretty decent.
Title: Re: Midi Player
Post by: Chronon on April 24, 2008, 08:28:13 PM
Thanks for posting, Strife89.

For the present I am considering all "Buffer Miss!" errors to be standard operation for the PP targets.  I am interested to see if other players are exhibiting either the problem reported in this topic by jbullfrog (no sound output at all) or the problem reported by kfb in the other topic (a null waveform error).

jbullfrog: have you tried resetting your settings?  Does this help?
Title: Re: Midi Player
Post by: karashata on April 24, 2008, 08:35:16 PM
For the present I am considering all "Buffer Miss!" errors to be standard operation for the PP targets.

That's standard for any buffer misses.  The PP targets are just more prone to them since they can't keep up with the midi instructions during playback.
Title: Re: Midi Player
Post by: Chronon on April 24, 2008, 09:24:06 PM
My point was to try to clarify that I am interested in seeing if anyone else sees the same behavior that jbullfrog or kfb have seen.  I am much less interested in whether or not anyone sees "Buffer Miss!".
Title: Summary of the other (locked) MIDI topic
Post by: bascule on April 25, 2008, 04:13:06 AM
I tried playing a MIDI file and no sound comes out, just the message "crap...null waveform..." printed out on the display repeatedly.  I followed the instructions at http://www.rockbox.org/twiki/bin/view/Main/PluginMidiPlay to download and copy over the patchset to .rockbox/patchset and verified that the patch files were in the right location.  I did this twice to make sure.  I also tried several different MIDI files.  However, I still get the same error message each time.  Any ideas?

I'm running r17068-080410.  I've attached an example midi file to this post.


It seems your file structure is correct, you should have folder:
/.rockbox/patchset

containing files:
*.pat (lots of)
*.cfg (two of)

Yup, I have those files and folders in the location described.
Argh :-\ is there any way to get in touch with the author of the midi plugin and find out more about what the error message "null waveform" is supposed to mean?

Well, I've found the error message in the code (http://svn.rockbox.org/viewvc.cgi/trunk/apps/plugins/midi/synth.c?view=markup), but there's no comments that help me understand what's going on here (seeing as I know nothing about MIDI and very, very little about C).

It would seem that you may just be out of luck, as the error only seems to exhibit itself on your device. You may want to hop onto IRC (linked from sidebar) and ask about it there, as that's where most of the actual coders hang out...
Title: Re: Midi Player
Post by: jbullfrog on April 25, 2008, 08:34:13 AM
Chronon, you are exactly right when you said that the midi plugin only works for specific midi files.

The file I posted was actually NOT the file I was having problems with.  I just posted a random midi out of my collection.  When I tested the file I posted, it actually worked.

Here are the actual files I am having problems with, either with no sound at all, or buffer problems.

http://www.sendspace.com/file/ivfynq

One more thing.  Is it possible to get the plugin to play the midis consecutively, not stopping after every midi is played?


Thanks everyone for their contribution!

Is it really that difficult for rockbox to recognize midi files just as it recognizes mp3 files?  Or is it because most people don't listen to midis that the developers didn't even bother to support midi files?  Even my nintendo ds can play midis!
Title: Re: Midi Player
Post by: Llorean on April 25, 2008, 08:42:39 AM
Playing *just* midi files is a LOT simpler than mixing them in with other formats of audio. Please, don't assume things are simple without doing some real research into the subject, even if "even" your DS can play them. The midi plugin doesn't get a lot of work because right now nobody can come up with a good way to incorporate it into the main playback code, and that's more or less a major step that needs to be accomplished.

It's not an issue of simply "recognizing" it. Files need to be put into memory in advance, so the disk only needs to spin every now and then rather than constantly spinning to be read. With MIDI files you have a lot of files (one song, and many patches). These patches can require a considerable amount of memory. As well, each song may need a different selection of patches, and some patches may be needed again for later songs. Managing these patches in memory (so that you don't load the same one more than once, and don't accidentally let any go early, etc) is complicated if you also want to be able to buffer other formats or even just more than one midi (efficiently at least).

And yes, part of the problem is that "most people don't listen to midis." Remember, everything is done by volunteers. If most people don't listen to midis that also means that most volunteers don't listen to midis, and most volunteers know nothing about how to improve support for them. In all honesty, if you're passionate about midi support the best thing to do is to *become* a developer. Put some time into learning about the relevant matters. Otherwise you are exactly the kind of person who "didn't even bother" that you mentioned in your own post.
Title: Re: Midi Player
Post by: bascule on April 25, 2008, 08:57:25 AM
I'm tempted to say that it was very unhelpful to post a working file in a problem file thread, but never mind...

Of all the 'broken' ones you posted, only 'Hotel Dusk 05' works for me (but with continuous buffer misses).

However, of interest is that the others, if left to play (silently) for long enough, do eventually splash 'FINISHED PLAYING' and drop back to the file browser.

So I suspect that they are playing, but are not being generated quickly enough to even start buffering, so the 'Buffer Miss' message is never being displayed. I'm guessing it must be some sort of a complexity issue (too many instruments or whatever).

So that just leaves kfb's mysterious "crap...null waveform..." error message to resolve, although I expect that, as stated earlier, it's the PortalPlayer targets' lack of horsepower that is behind both of these problems.

If I were you, I'd just convert them all to MP3/Vorbis/etc. and play them as normal. MIDI's were developed when storage was at a premium and lossy encoding had not been developed [citation needed] and, although it's kind of a cool concept to just provide instructions on 'how' to play a song, the availability of synths, sequencers and other digital music generation tools have really eliminated the need for this archaic format.
Title: Re: Midi Player
Post by: PaulPosition on April 25, 2008, 12:23:40 PM
Agree with you on all counts except that last one (that 'need' thing)...

You're obviously not a musician. Being able to share musical works in a format which allows reading the score (through an interface, obviously), isolating particular instruments, slowing and speeding without artefact, etc. is a boon.

Of course, for only listening, a purely audio format like you suggest is obviously preferable.  :)
Title: Re: Midi Player
Post by: Chronon on April 25, 2008, 12:54:03 PM
Apparently someone mentioned this on IRC in September 2007.

http://www.rockbox.org/irc/rockbox-20070927.txt

You can search for "crap".   ;)

It looks like that user was able to get rid of the "Crap. . . null waveform. . ." message by reinstalling Rockbox and the patchset -- though this left the default stuttering if too many instruments play at once.
Title: Re: Midi Player
Post by: jbullfrog on April 26, 2008, 11:00:53 AM
Thanks for the help.  I have learned that incorporating midi support is a much more daunting task than I guessed.  For now, I'll stick with converting them to wav files using Winamp, and then converting the wav files to mp3 format.

Maybe one day Rockbox will have full midi support.  Who knows?
Title: Re: Midi Player
Post by: karashata on April 26, 2008, 11:07:42 AM
Depending on what you mean by "full"...  As far as I can tell, it already has full support for general midi, though for PP targets it still needs some optimization to get it to decode the instructions fast enough to keep up with playback for higher tempo and more complex midis.

I don't know if anyone will add support for extended general or whatever other midi instrument sets are out there, or if adding that support would be as easy as finding a patchset with the extended general (or whatever) instrument set and a configuration file that Rockbox's midi plugin can read and use.
Title: Re: Midi Player
Post by: bascule on April 27, 2008, 02:52:29 PM
You're obviously not a musician...

Correct. And I apologise if I upset anyone who does still need to use it. I made an assumption that people still using it did so because they want to in some sort of a retro or deliberately 'old-skool' way. It just seems incredibly old-fashined to me (in digital terms, obviously).
Title: Re: Midi Player
Post by: saanaito on April 28, 2008, 07:40:00 PM
Thanks for the help.  I have learned that incorporating midi support is a much more daunting task than I guessed.  For now, I'll stick with converting them to wav files using Winamp, and then converting the wav files to mp3 format.

You can also use www.haminet.com 's MIDI to MP3 converter. It's free. ;)
Title: Re: Midi Player
Post by: robin0800 on April 29, 2008, 05:25:30 PM
Quote
For now, I'll stick with converting them to wav files using Winamp, and then converting the wav files to mp3 format
Rockbox can play wave files and also wavepack so no need? for mp3.
Title: Re: Midi Player
Post by: lgfb on July 12, 2008, 02:49:39 AM
I had the same problem with the "Crap... Null waveform..." on the sansa280. After several attempts, I tried it using different untar-tools. Using WinZIP or WinRAR brought somehow corrupted files out of the archive. You can try unpacking them at the command line using:

bunzip2 patchset.tbz2
tar xvf patchset.tar

These were the programs bringing success...:

D:\>bunzip2 -V
bzip2, a block-sorting file compressor.  Version 1.0.1, 23-June-2000.

   Copyright (C) 1996-2000 by Julian Seward.

   This program is free software; you can redistribute it and/or modify
   it under the terms set out in the LICENSE file, which is included
   in the bzip2-1.0 source distribution.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   LICENSE file for more details.

bunzip2: I won't read compressed data from a terminal.
bunzip2: For help, type: `bunzip2 --help'.

D:\>tar --version
tar (GNU tar) 1.12

Copyright (C) 1988, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Written by John Gilmore and Jay Fenlason.

Kind regards
Title: Re: Midi Player
Post by: kfb on July 13, 2008, 07:58:04 PM
lgfb, thanks a ton!!!  That did the trick.  I used 7-zip (http://www.7-zip.org/) instead of bzip, but it still worked.  Thanks again!
Title: Re: Midi Player
Post by: ariebe9115 on June 24, 2021, 12:29:53 PM
Yo, i rockboxed my Sansa e260v1 and everytime i open a midi, it says no instrument found, i have no patchset but i found out there is one saved in /.rockbox/timidity/instruments/
But well, cant use it anyways, i am not feeling in the mood to do anymore, tried copy pasting this set, renaming the folder but it just got annoying, do i need to remap every patch in the .cfg? Would be lots of work =/
Title: Re: Midi Player
Post by: __builtin on June 25, 2021, 11:33:30 AM
That patchset is shipped with Duke Nukem 3D and is not meant to be used for midiplayer. You could always experiment, though...
Title: Re: Midi Player
Post by: bluebrother on June 25, 2021, 12:11:04 PM
Yo, i rockboxed my Sansa e260v1 and everytime i open a midi, it says no instrument found, i have no patchset but i found out there is one saved in /.rockbox/timidity/instruments/

The wiki page has a patchset linked: https://www.rockbox.org/wiki/PluginMidiPlay
Development versions of Rockbox Utility can also install the patchset, but you'd need a development version (there are binaries of that around, see https://forums.rockbox.org/index.php/topic,53588.0.html)
Title: Re: Midi Player
Post by: ariebe9115 on June 27, 2021, 07:56:38 AM
Yo, i rockboxed my Sansa e260v1 and everytime i open a midi, it says no instrument found, i have no patchset but i found out there is one saved in /.rockbox/timidity/instruments/

The wiki page has a patchset linked: https://www.rockbox.org/wiki/PluginMidiPlay
Development versions of Rockbox Utility can also install the patchset, but you'd need a development version (there are binaries of that around, see https://forums.rockbox.org/index.php/topic,53588.0.html)

Uhh, 404 not found, thats why i ask here =/
Title: Re: Midi Player
Post by: ariebe9115 on June 27, 2021, 08:12:22 AM
That patchset is shipped with Duke Nukem 3D and is not meant to be used for midiplayer. You could always experiment, though...

Well, i tried, i moved the patches to /.rockbox/patchset and replaced "/.rockbox/timidity/instruments/" with "/.rockbox/patchset/" for every instrument, it didnt work for me, the cfg i tried named as "timidity.cfg" inside the patchset folder, didnt work
Renamed to "patchset.cfg" then it said failed to open "I've.pat"

EDIT: Ok after some modification of the file i found out its complicated to use that one, will wait for a reply, i just want something to listen to my at least 1000 midis
Title: Re: Midi Player
Post by: bluebrother on June 27, 2021, 09:12:53 AM
Uhh, 404 not found, thats why i ask here =/

The wiki page seems to be outdated. The file is actually available on the Rockbox download server, see https://download.rockbox.org/useful/midi-patchset.tbz2 or https://download.rockbox.org/useful/patchset.zip (those files have the same content). Don't copy around files from doom, this won't work.

I've updated the wiki page.

Btw, if a download link in the wiki is broken it can be helpful to simply search download.rockbox.org :)
Title: Re: Midi Player
Post by: ariebe9115 on June 30, 2021, 06:53:52 AM
Uhh, 404 not found, thats why i ask here =/

The wiki page seems to be outdated. The file is actually available on the Rockbox download server, see https://download.rockbox.org/useful/midi-patchset.tbz2 or https://download.rockbox.org/useful/patchset.zip (those files have the same content). Don't copy around files from doom, this won't work.

I've updated the wiki page.

Btw, if a download link in the wiki is broken it can be helpful to simply search download.rockbox.org :)
thanks very much, its working now, but some midis play faster then they do usually =/
But its workin, thats the main thing i want!
By the way it stucked at loading instruments with the duke3d patchset xD