Author Topic: General questions about MIDI  (Read 272 times)


  • Posts: 33
General questions about MIDI
« on: 19 Nov '18 - 14:14 »

1)Can i load midi file(not real instruments) and play it?
2)How to route signals to sounds? Or it's routed in fbz library already?
3)Can i use FX like tempo?
4)Where i can find complete examples for NET implementation? I can't find it on radio42 site, only method descriptions.
Thanks a lot, sorry for noob questions ::)

Ian @ un4seen

  • Administrator
  • Posts: 21529
Re: General questions about MIDI
« Reply #1 on: 19 Nov '18 - 16:57 »
You can play MIDI files with the BASSMIDI add-on, combined with SF2/SFZ soundfonts to provide the instrument sounds (a couple of example soundfonts can be found on the BASS webpage). The basic code could look like this:

Code: [Select]
BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, soundfontfilename); // set default soundfont to use
midi = BASS_MIDI_StreamCreateFile(FALSE, midifilename, 0, 0, BASS_MIDI_DECAYEND, 1); // create stream for MIDI file
BASS_ChannelPlay(midi, 0); // play it

You can use the MIDI_EVENT_SPEED option with BASS_MIDI_StreamEvent to adjust the tempo. An example of doing that can be found in the MIDITEST.C example included in the BASSMIDI package. BASS/BASSMIDI function calls will be basically the same in any language, so you could have a look at that for ideas even if you don't use C/C++.