MIDISOUNDBANK: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 65: Line 65:


{{PageSeeAlso}}
{{PageSeeAlso}}
* [https://qb64phoenix.com/forum/showthread.php?tid=2979 Featured in our "Keyword of the Day" series]
* [[_SNDOPEN]]
* [[_SNDOPEN]]




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 17:42, 25 August 2024

The _MIDISOUNDBANK command enables _SNDOPEN to use an external FM Bank or SoundFont when playing MIDI files.


Syntax

_MIDISOUNDBANK: fileName$[, capabilities$]


Parameters

  • fileName is literal or variable STRING file name value.
  • The literal or variable STRING capabilities$ is optional, but it can be set to MEMORY and one of the following formats:
    • MEMORY: This will treat fileName as a memory buffer containing the sound file instead of a file name.
    • AD: Global Timbre Library format for Audio Interface Library.
    • OP2: DMX OPL-2 format.
    • OPL: Global Timbre Library format for Audio Interface Library.
    • SF2: Creative's SoundFont 2.0 format.
    • SF3: MuseScore's Ogg compressed Creative SoundFont 2.0 format.
    • SFO: Bernhard Schelling's Ogg compressed Creative SoundFont 2.0 format.
    • TMB: Apogee Sound System timbre format.
    • WOPL: Vitaly Novichkov's OPL3BankEditor format.


Description

  • The selected sound bank is what is used to play all MIDI files.
  • If fileName is missing, corrupted, or inaccessible, the command will not produce any errors. However, subsequent attempts to open a MIDI file with _SNDOPEN will fail.
  • The command supports AD, OP2, OPL, SF2, SF3, SFO, TMB, WOPL formats on all supported platforms.
  • It also supports VSTi (Virtual Studio Technology Instruments) 2.x (DLL) on Windows. However, a VST host, such as the one utilized by foo_midi, is required.
  • _EMBEDDED$ sound banks can be used directly with _MIDISOUNDBANK.


Availability


Examples

Example 1
Loading a MIDI sound bank and play a song.
_MIDISOUNDBANK "awesome.sf3"

handle = _SNDOPEN("onestop.mid")
_SNDPLAY handle

Example 2
Instead of loading a MIDI sound bank, it can also be embedded and used with the MEMORY capabilitiy.
$EMBED:'./tiny.sf2','mysf2'

_MIDISOUNDBANK _EMBEDDED$("mysf2"), "memory, sf2"

handle = _SNDOPEN("canyon.xmi")
_SNDPLAY handle


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link