midi vs. mp3

Blitz3D Forums/Blitz3D Beginners Area/midi vs. mp3

collimic(Posted 2013) [#1]
Hello,
I am from the old school gaming world. I started playing games on the old Tandy TRS-80. I love the sound of midi files while playing games.

Problem is if I use a .midi file with the playmusic command the game takes 30 - 0 secs before it will open up and let me plat. But if I use the same commands and replace the .midi file with a .mp3 the game starts in under 2 seconds and music and game play are very responsive.

What is the problem with loading midi files. They are so much smaller you would think they would load much faster.

Thank you


TomToad(Posted 2013) [#2]
I can verify this behavior. Midi files start after about 10 seconds on my computer, but mp3s start right away.

Windows 7 Home Premium SP1 64 bit
AMD Phenom 9550 Quad Core 2.2mhz
Realtek sound (integrated on the system board)


Kryzon(Posted 2013) [#3]
You need to render your MIDIs to any PCM format (WAV, MP3, OGG).
This way you keep the same nostalgic sounds but have the benefit of using LoadSound() and all the channel controls.

To convert your MIDIs to WAV, MP3 or OGG you can use something like this.

Alternatively, you can use Audacity.
- Open Audacity;
- Set the recording source to be STEREO MIX;
- Hit the record button to start recording;
- Play the MIDI with Media Player or something else.
- After the song finishes, stop the media player and Audacity's recording mode and delete the blank start of the audio capture (you started recording before you started playing so you wouldn't lose any bits).

Audacity will "capture" the midi audio being played by your computer as PCM data. You can then save this data as WAV, MP3 or OGG.


RGR(Posted 2013) [#4]
Hi

Best way to solve your problem:
Download, extract and start Modplug Tracker
http://download.chip.eu/de/ModPlug-Tracker_548406.html

Load a Midi file
Save it as .it Module
Song=PlayMusic("YourSong.it")

That's all
.



Imperium(Posted 2013) [#5]
Correct me if I'm wrong but isn't midi emulated by all sound cards today? It's a shame hardware accelerated sound cards didn't catch on.


Kryzon(Posted 2013) [#6]
That's absolutely correct; But then every card will sound a bit different from the others. It could sound better, but could also sound worse - it depends on the wavetable the card uses.
The only way to ensure that what-you-hear-is-what-you-get is to record your card's output in some manner.


Midimaster(Posted 2013) [#7]
there is the possibility to use the hardware of the soundcard, which is fast (latency below 50msec), but the samples quality is bad (less RAM for each sound).

On the other hand there is a emulator enclosed in every OS. In window is it the "Microsoft GS Wavetable". The quality is higher, but you have a bad latency of 300msec. If you can use "Roland Virtual Sound Canvas" you wll have 500msec but a studio quality.

Normaly window is set to use the emulator and Blitz uses this device.

There is a small tool of me, that converts a complete instrument of a MIDI-Device into a bundle of chromatic scaled sounds. F.e. if you start it on "Piano Program Change 0" afterwards you will have 60 Piano_xx.OGG sounds from C to c'''.

You ca do this with all 128 GS Sounds. At the end you will have a complete copy of the Midi-Instrument. And it is legal!, because recorded sounds are not longer under the copyright of the Instruments manufactor.

Sourcecode: http://www.blitzforum.de/forum/viewtopic.php?t=37210

Exe: http://www.blitzforum.de/upload/file.php?id=10656


Imperium(Posted 2013) [#8]
That's really freaken neat!


fox95871(Posted 2016) [#9]
Midimaster, can what you posted about be used to create midi like music with Blitz3d? Please continue this topic at http://www.blitzbasic.com/Community/posts.php?topic=106444