gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS Misc > Who wants to work on a MIDI player?

#72001 - tssf - Wed Feb 15, 2006 10:17 pm

Does anyone want to get together and perhaps make a General MIDI player for the Nintendo DS? The player could output in the DS's 16 hardware channels, or even use a sound engine to push it, like MikMod or something. The player would mearly need to wrap the midi functions to output like a MOD.. (in this case, it would be a "Midi" to "Unimod" converter, heh)

I can't program, don't know how, don't really have much interest in taking on this big a project as my first anyway, but I do have much experience in creating instrumentation banks, so I could create a GM bank that could be used with it... I have experience making banks such as FF4.sf2, FF5.sf2, FF8sf2, etc. (SF2 files are soundfont files for SBLive/Audigy cards)

Was wondering if anyone had any interest at all? :)
_________________
Mathew Valente [TSSF]
------
Chrono Resurrection Musician

#72022 - Darkflame - Thu Feb 16, 2006 12:54 am

Interesting in useing it : Yes
Skills to make it : None

Helpfullyness of this post : 0/10

#72044 - tepples - Thu Feb 16, 2006 3:34 am

One big difference between tracked formats and MIDI is that MIDI uses dynamic voice allocation, which is similar to .it NNAs.

If you've written a modplayer, then you can probably refactor it into a part that plays notes and a part that interprets mod/s3m/xm. Replace the second part with a part that interprets standard MIDI files and allocates voices, and you're set.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#72086 - melw - Thu Feb 16, 2006 9:39 am

Not really interested in working on one as I realize it's going to be lot of work... What Tepples said makes sense though, general midi songs aren't that different technically from, let's say .it format, only lacking all the cool features and is being stuck with the same sampleset. :)

I wonder what formats the official Nintendo games on DS are using and if there's an equivalent midi player on that side... For example Mario & Luigi: Partners in Time (played that one through last week - neat game) has very midi-like sounds but it's still anyhow well executed on the sound side.

#72098 - tssf - Thu Feb 16, 2006 11:24 am

The way I would personally envision a MIDI library for the DS would work, is that it would support anything the hardware channels support.

Frequency, Pan, Main Volume, etc. (in the form of continuous controllers)

Of course the sample libraries would load samples into memory dynamically towards what the MIDI file calls (keeping a certain RAM sample limit, perhaps 1 meg at most).. That could probably work a little better.. And a dynamic voice manager would be essential if "sustain" or "Release" ADSR effects were to be supported.

I would love to see this put together for the main purpose of having a MID player for MoonShell, for example.
_________________
Mathew Valente [TSSF]
------
Chrono Resurrection Musician

#72176 - Pinesal - Thu Feb 16, 2006 10:20 pm

I've been wanting a portable midi player for about 8 years. I found one for GBA a couple months ago but it pretty much sucks. I would gladly donate to help fund a project like this.

#72181 - TheChuckster - Thu Feb 16, 2006 10:39 pm

I'm working on a drum machine right now, but I'd have to do a bit more research to extend it to support MIDI.

#72340 - tssf - Fri Feb 17, 2006 8:08 pm

I just don't think we'll easily find someone willing to take up a project like this, unless they have a lot of MIDI experience and what not.

Perhaps there's an open sourced software synthesizer library out there that someone wouldn't mind porting instead? Would that be a better idea?
_________________
Mathew Valente [TSSF]
------
Chrono Resurrection Musician

#72367 - TheChuckster - Sat Feb 18, 2006 12:39 am

There's timidity. Looking the code over, it looks moderately easy to port, though sorting through the whole thing looks like a challenge.

http://nchc.dl.sourceforge.net/sourceforge/timidity/TiMidity++-2.13.0.tar.bz2


Last edited by TheChuckster on Sat Feb 18, 2006 12:51 am; edited 1 time in total

#72370 - tepples - Sat Feb 18, 2006 12:46 am

tssf wrote:
Perhaps there's an open sourced software synthesizer library out there that someone wouldn't mind porting instead? Would that be a better idea?

A synth suitable for a 1000 MHz PC with 256 MB of RAM is not suitable for a 67 MHz DS with 4 MB of RAM.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#72371 - tssf - Sat Feb 18, 2006 12:50 am

Yes! I think that's definately the best route to take. :) Of course a lot of stuff won't be needed, it doesn't need to be a Sequencer on the DS (although that would be pretty freaken sweet) ..one step at a time :D
_________________
Mathew Valente [TSSF]
------
Chrono Resurrection Musician

#72377 - DekuTree64 - Sat Feb 18, 2006 1:36 am

Nah, MIDI kinda sucks compared to tracker formats, IMO.
The only advantage it has for me is that my beloved giant, touch-sensitive keyboard can record in MIDI format. Which sort of bypasses the whole sequencer part anyway.

It would be cool to play all my recordings on the DS, but I don't really have time to do a full player, seeing as I'm still working on my .it tracker (and a snail could outrun my progress at that). I could probably help out with the timing and CPU communication if someone else wants to do the main player logic though.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#72414 - tssf - Sat Feb 18, 2006 12:13 pm

tepples wrote:
A synth suitable for a 1000 MHz PC with 256 MB of RAM is not suitable for a 67 MHz DS with 4 MB of RAM.


If special limitations were set, and settings were configured, it would work just fine.

You forget, libmad, libmikmod, libogg, and the mpeg libraries were all never meant to run on the DS, and they all seem to run fine! (with the possible exception of libogg running slowly on a few circumstances)

There would have to be some form of dynamic sample management, and voice management systems in place if this were to run smoothly enough on the DS. The sound would have to output through the DS's 16 channels, of course, for lowest processor usage. With a bit of work, Timidity shouldn't have a problem.

The point is not to get this system running in games though, the point is mainly to have a mid player for the likes of MoonShell..without having to encode it to Mp3, or the inferior GSM format.
_________________
Mathew Valente [TSSF]
------
Chrono Resurrection Musician

#72489 - TheChuckster - Sat Feb 18, 2006 11:17 pm

Not only that, I'd imagine MIDI of all things would be easiest for the CPU to handle because of it's simplicity compared to say DPGs.

My plan would be figure out how to deal with the note on events, get a sample set, and play the corresponding patch samples at various frequencies (a la MOD files). That is if this is to be written from scratch.

Then work on the more complex events and the like...

#72490 - tssf - Sat Feb 18, 2006 11:25 pm

Only thing I'm worried about Chuckster is that if this were to turn into a Mid to Mod converter of some sort, but in real time, I'm worried what would happen if you tried to use more than one voice per channel, or even what would happen if you tried using pitch bends and the like. The problem with that being that the Mod format is not nearly as fast as General MIDI would require to be as precise. It wouldn't sound very accurate.

If this were to be done, I think using it as a "wrapper" for Mid to Mod, it just wouldn't work well in the end.

Anyway, the DS can probably handle MIDI way better than the GBA could, though. Maybe even handle more than 16 voices.. If MikMod can handle 16 without even using half the ARM9 CPU software processing on the DS, I wonder what, say, a custom system that software processed 2 voices per channel would be able to handle. (Anyone think that's even possible?)
_________________
Mathew Valente [TSSF]
------
Chrono Resurrection Musician

#72493 - DekuTree64 - Sat Feb 18, 2006 11:46 pm

If nothing else is meant to run at the same time, you could software mix a ridiculous number of channels on the ARM9. ARM7 has plenty of horsepower itself, so it could mix plenty during an actual game.

The timing would be pretty tricky if playing on hardware channels, since there's no set timestep to run off of like with mod formats. You'd have to figure up the time until the next event and set up a timer interrupt. Or 'resample' the event times to a set step amount (probably your best bet).

With software mixing, you can just mix however many samples until the next MIDI event, process the event, mix more samples, repeat until the buffer is full. You could also make special mixing loops to do pitch bends or volume slides updated per-sample, although it'd be kind of a waste of time since it's hard to tell the difference from a coarser timestep.

Most MIDI songs would probably sound ok with 16 channels though, so I'd probably go with hardware unless you really want lots of channels.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#73010 - tssf - Wed Feb 22, 2006 9:54 pm

Well, it seems Moonlight has shocked and surprised us all again. Apparently the MID plugin for MoonShell is based off of Timidity. I guess he does read these forums. :D

Thank you MoonLight, you are the best.
_________________
Mathew Valente [TSSF]
------
Chrono Resurrection Musician