Midi music as a backround music

Just starting out? Need help? Post your questions and find answers here.
ekix
User
User
Posts: 34
Joined: Thu Apr 21, 2005 7:43 pm
Location: Finland
Contact:

Midi music as a backround music

Post 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
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post 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?)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
oh... and have a nice day.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

QuickTime can also play midi files.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post 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..
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
oh... and have a nice day.
ekix
User
User
Posts: 34
Joined: Thu Apr 21, 2005 7:43 pm
Location: Finland
Contact:

Midi (not mp3....)

Post 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?
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Re: Midi (not mp3....)

Post 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
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
oh... and have a nice day.
ekix
User
User
Posts: 34
Joined: Thu Apr 21, 2005 7:43 pm
Location: Finland
Contact:

Converting midi to mod

Post 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?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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....
oh... and have a nice day.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2810
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Why not use windows MCI functions !?

They are free, standard, and easy to use :)
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Num3 wrote:They are free, standard, and easy to use :)
...and deprecated *SCNR*
Good programmers don't comment their code. It was hard to write, should be hard to read.
Post Reply