PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Playing MIDI and WAV files?

how can I play MIDI and WAV files on the PocketPC?
I dont want to use a readly library (like FMOD)
where I can find resources how to do it:?:
TIA.
There's no way to play MIDI, although a few standalone players exist.
WAV files.

If you are just going to do a loop of menu music. And bleep a bit in the game. And nothing more.

Use PlaySound, check help in EVC++
As far as MIDI files go... There is no built-in player. As Sponge said, there are a couple of stand-alone players, but that's it. There are some libraries that will do it (I *think* FMod does)... Writing your own is what is required, or porting an open-source one (I haven't looked for one). Even so, one of the problems with doing so is that you need all the samples in memory to do so, and with a limited memory device, this can become an issue quickly. Then again, I can't imagine the case is any worse for MOD files, and there are a number of libraries to do that, Hekkus at the top of the list, so maybe I'm overstating that problem anyway...
I'd imagine MIDI would be more useful if you have a lot of music, where you can just reuse the same MIDI samples, perhaps even across games.
I was thinking that too... In fact, after seeing this thread, I've been off looking for an open-source MIDI player I might be able to port. No luck so far, so if anyone knows of one, send it my way :)

I HAVE found some code to play back a MIDI file via MIDI hardware, but of course that doesn't help. I need a sample-based MIDI playback engine. I really don't have the time (or the desire) to write one from scratch, but if an open-source library exists, porting it for all PPC developers to use might be an exercise I'd be willing to undertake.
Timidity. Has been ported to PPC before too. Can go from the very small to huge 50MB+ samples.
Well geez, there we go :) I was not aware of this, but I just downloaded it, source and all. Now I know where the music for my next project is coming from. Finally, I can compose in Cakewall and not even try and mess with MOD trackers. Woo-hoo! :)
Hey Frank let me know if that works. I just found an old copy of CakeWalk that I never even installed. Might be an excuse to finally try it out.
Will do Marc. I had some trouble with eVC++ last night when I got this, and I'm just getting ready for the day now, so possibly in a few hours...
That first link Sponge provided is the one of particular interest to us developers (that's where I got the source I'm now working with).

I got it to compile, not a big deal, and it worked in the emulator. At the moment I have to re-install eMbedded Tools because it's just not working right... Argh...

When that's done I'm going to try and throw together a quick sample app, see if I understand how the code is structured and all that jazz. I'll post that when I have it working.

It'll be interesting to see how this does performance-wise, and the other question I have is how to deal with it and Hekkus in the same project... It won't be too much use if it can't be used, say, to play background music while still having SFX over that... I'm thinking maybe modify this code to send it's WAVs through Hekkus, but then latency might be a concern.

Ah well, baby steps... Get eVC++ working again, then my own sample app...
Well, I don't think Timidity is going to do it for me, not without more work than I'm willing to put into it...

It compiles and runs just fine, but it's doing all it's own WAV out (which you'd expect), and I don't think this is going to work with something like Hekkus. I don't really have the time to try and extricate all that code and hook it into Hekkus.

So, unless someone else wants to do it, don't look at me :)
Frank, you got about as far as I did when I was looking at the midi music for Warlords. I just didn't (and still don't) have the time to devote to creating a general midi player for the PPC. At the time I was looking at interfacing it with fMod... interfacing with Hekkus should be a much more viable solution since previous releases of the source are still floating around. Maybe Thomas would be interested in including Midi playback in a future Hekkus release.
Yeah, I'm kind of depressed that I don't have the time to really get into it... It didn't seem like it would really be that difficult, probably would take longer to understand the code enough to hack it than to actually do the work.
Hand of Fate · 05 Oct 2004, 04:35 UTC
How about Ogg Vorbis? Isn't that a good music compression format and free w/out royalties to use?
Hand of Fate wrote:How about Ogg Vorbis? Isn't that a good music compression format and free w/out royalties to use?


Sure, if you don't need CPU time left for something else ;)
Hand of Fate · 05 Oct 2004, 07:15 UTC
xPeterx":12olp0g6]

Ohhhh I see. Right. For most PPCs nowadays, it isn't a problem...but for the older ones he would like to support, I guess it might be an issue? or maybe not. I'm thinking maybe not.
I've added ogg vobis support to our dev lib, but nobody use it in our team, the decoding consumes about 20-30% CPU, and it's too much...
Hand of Fate · 05 Oct 2004, 19:07 UTC
Seriously? Dang, I had no idea. What about MP3s? Are they more effiecient? I think they got some sort of royaltie patent issue dont they?
If you're doing something like an adventure or RPG game, you can probably go for MP3 or OGG, but don't expect any fast-paced games.

Has anyone determined the CPU usage with a 624MHz device?
Did anyone try converting a midi to a mod and then playing with Hekkus?

If there is a mid to mod converter, I'd assume the instrument samples are relatively small and though you'd lose some of the midi controller detail, I'd think it would work ok??

Byron
I've plugged my PC's sound O/P into the sound I/P and re-recorded a MIDI file via windows sound recorder (ADPCM format).
There actually are applications that will play a MIDI file and output it as a WAV file, without the need of doing a "loopback" with the cables. I've used Mid2Wav Recorder (http://mp3.downloadatoz.com/midi2wav-recorder/)
Nice and cheap looking solution Frank. Didn't come across this when I needed it though, besides my needs were for a one off so the "Loopback" fitted nicely. :)
If someone's willing to give me little support, i'll try to write a simple patch based midiplayer.
It shouldn't be that hard but i need very simple midi tracks to get started on the format.