|
ok... how do i load a .sf2 file in allegro 4? |
jktech
Member #23,248
May 2022
|
i am using allegro 4.2.1 and i cant find anything that can load a patch for the midi i will play.. how do i set it up? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
It looks like you need to load a midi file using load_midi and then play midi commands using midi_out. I'm not familiar with midi or patches at all so.... My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
jktech
Member #23,248
May 2022
|
well... what i am have trouble with isnt playing the midi itself... but choosing a patch/instrument for the midi. |
Todd Cope
Member #998
November 2000
|
The information you seek is here. You'll also need to use the MIDI_DIGMID driver (install_sound(DIGI_AUTODETECT, MIDI_DIGMID, NULL)). |
jktech
Member #23,248
May 2022
|
ok but like.. what are the functions to load the sf2 and to choose the patches for the midi? i have come to these links before... and i have installed midi and digi.. other works and does sound.. but i dont know how to choose instruments and load them with the midi or something |
Todd Cope
Member #998
November 2000
|
You don't load the SF2, you have to convert it to a format Allegro understands. Quoted from the linked page: Quote: To convert a SoundFont into the patches.dat format, run “pat2dat -o patches.dat filename.sf2 -8”, and then copy the resulting patches.dat into either the same directory as your program, the location pointed to by the ALLEGRO environment variable, or the location specified by the “patches=” line in your allegro.cfg. As for choosing instruments, that depends on what you're trying to do. If you are playing back MIDI files with play_midi(), that information needs to be changed in the MIDI file itself. If you are generating MIDI information yourself and sending it to the MIDI device, you'll need to send the appropriate MIDI event for selecting the instrument (MIDI Program Change) before sending notes with midi_out(). If you are doing the latter, you'll need to call load_midi_patches() before sending note playback commands to ensure the patches are loaded before attempting to be played. |
Chris Katko
Member #1,881
January 2002
|
I was going to say, isn't a soundfont file basically a set of software sound patches (the way a MIDI hardware ships with its own internal sound patches). So you can't play it. It's just (essentially) a zip file full of waves with some metadata. Basically, you can take any MIDI "song" and play it with any number of different "soundfont"s and it'll sound different because one sound font's "piano" may sound different than another soundfont's "piano." I honestly didn't know Allegro 4 had a soundfont tool, as soundfonts have been dead since forever ago except in niche music applications. I used those things on my Creative Labs Audigy 2 in Windows 2000/XP (terrible soundcard, terrible marketting hype only company, btw). -----sig: |
|