Page 1 of 2

Midi music as a backround music

Posted: Sun Jan 21, 2007 1:19 pm
by ekix
Hello guys

Is there any easy way to use a midi file as a background music in PureBasic, and use it as a resource, so not as a separed file.
I think it should be something like Include (music.mid) or so on...
Also it should loop the music continuously.

Is there any easy way? I just started to practice PureBasic, that's for a lot of dummy questions, but anyway I could not find an easy solution for this.

Ekix

Posted: Sun Jan 21, 2007 4:25 pm
by Kaeru Gaman
the easy way to use some .mid file is the movie-lib:
MIDI-music can be played using PlayMovie()

but there is no CatchMovie(), so you couldn't directly use the date
if you attach it to the .exe via IncludeBinary.

Posted: Sun Jan 21, 2007 9:26 pm
by josku_x
Kaeru Gaman wrote:the easy way to use some .mid file is the movie-lib:
MIDI-music can be played using PlayMovie()

but there is no CatchMovie(), so you couldn't directly use the date
if you attach it to the .exe via IncludeBinary.
If I'm not wrong, the Movie PureLibrary uses avisynth.dll which is used in Windows to play MIDI files.. so this is only limited to Windows.

I guess you guys are using Windows, which means that you would need something commercial to convert the MIDIs to MP3's.. Anyway, I use Linux and I can convert your MIDI files to high quality (320Kbps) MP3's. Just drop me a PM and I'll do the work for you. (I guess you can use CatchSound() with MP3's, right?)

Posted: Mon Jan 22, 2007 11:43 am
by Kaeru Gaman
josku_x wrote:If I'm not wrong, the Movie PureLibrary uses avisynth.dll which is used in Windows to play MIDI files.. so this is only limited to Windows.
PB-Win MovieLib uses DirectShow, PB-OSX MovieLib uses QuickTime, both can play mp3.
according to the PB-Help, PB-Linux even has no Movie-Lib...

Posted: Mon Jan 22, 2007 1:11 pm
by Trond
QuickTime can also play midi files.

Posted: Mon Jan 22, 2007 2:37 pm
by Kaeru Gaman
sorry, I meant MIDI, this is the topic...
was a bit screwed up with the other mp3-topic...

dunno why josku came up with mp3 here, that just missed the topic.
I see no use in using an mp3 if I made some MIDI-music.

Posted: Mon Jan 22, 2007 2:40 pm
by josku_x
Kaeru Gaman wrote:sorry, I meant MIDI, this is the topic...
was a bit screwed up with the other mp3-topic...

dunno why josku came up with mp3 here, that just missed the topic.
I see no use in using an mp3 if I made some MIDI-music.
Easier portability? MIDI just contains information about what instruments to play, when to play, etc.. an MP3 contains the audio data which people actually hear. So you would have to need to write your own MIDI parser if you don't want to use a Movie-lib..

Posted: Mon Jan 22, 2007 2:45 pm
by Kaeru Gaman
josku_x wrote:So you would have to need to write your own MIDI parser if you don't want to use a Movie-lib..
LOL :lol:
...and how should I play the mp3 without Movie-Lib? ;)

the sound-argument is ok, but then I would convert my MIDI on my own in order to hear the sounds the mp3 will have.
additionally I would use some totally differend music-program and would not walk the way across MIDI....
MIDI would be the solution for oldskool-athmosphere, and then it can stay MIDI...

Midi (not mp3....)

Posted: Tue Jan 23, 2007 3:27 pm
by ekix
And I would just include midi-file inside the exe-file, and play it looped. Midi files are small, that's whyI'd like to use them. Of coarse I know that it's up to soundboard how it sounds, but anyway can it be done?

Re: Midi (not mp3....)

Posted: Tue Jan 23, 2007 10:10 pm
by josku_x
ekix wrote:And I would just include midi-file inside the exe-file, and play it looped. Midi files are small, that's whyI'd like to use them. Of coarse I know that it's up to soundboard how it sounds, but anyway can it be done?
I have not found any code to do this, but it is possible to include MOD or any other module formats into the EXE. MIDI just containts information, not samples, whilst MOD, XM, IT, S3M and other modules formats include samples and they are small..

http://en.wikipedia.org/wiki/Module_file

Posted: Tue Jan 23, 2007 10:21 pm
by Kaeru Gaman
@ekix

afaik you can play midi-files using PlayMovie.

you can include the midi-file using IncludeBinary,
but you'll have to write it to harddisk at run-time to load it with LoadMovie,
because there is no CatchMovie command...

Converting midi to mod

Posted: Wed Jan 24, 2007 9:43 am
by ekix
I've seen that there's around some software which converts midi files to mod's. So, it replaces the soundboard synth sounds with samples.
Doe's anyone know what would be good freeware software for this?

Posted: Wed Jan 24, 2007 3:10 pm
by Kaeru Gaman
for some MOD you'll need an extra DLL to play the MOD
and you'll need more memory because the samples have to be stored, too.

but of course, it's your decision....

Posted: Wed Jan 24, 2007 4:36 pm
by Num3
Why not use windows MCI functions !?

They are free, standard, and easy to use :)

Posted: Wed Jan 24, 2007 4:40 pm
by traumatic
Num3 wrote:They are free, standard, and easy to use :)
...and deprecated *SCNR*