Differenze tra le versioni di "Ottenere un file WAV da un file Midi con le funzioni esterne del API di FluidSynth"
Da Gambas-it.org - Wikipedia.
(Creata pagina con "Con le risorse della libreria '''Libfluidsynth''' è possibile ottenere un file WAV da un file Midi. E' necessario avere istallata e richiamare in Gambas la libreria dinamica...") |
|||
Riga 5: | Riga 5: | ||
Mostriamo di seguito un esempio ''a riga di comando'': | Mostriamo di seguito un esempio ''a riga di comando'': | ||
+ | Library "libfluidsynth:1.5.2" | ||
+ | |||
+ | <FONT Color=gray>' ''fluid_settings_t* new_fluid_settings(void)'' | ||
+ | ' ''Create a new settings object.''</font> | ||
+ | Private Extern new_fluid_settings() As Pointer | ||
+ | |||
+ | <FONT Color=gray>' ''fluid_synth_t * new_fluid_synth(fluid_settings_t * settings)'' | ||
+ | ' ''Create new FluidSynth instance.''</font> | ||
+ | Private Extern new_fluid_synth(settings As Pointer) As Pointer | ||
+ | |||
+ | <FONT Color=gray>' ''int fluid_is_soundfont(const char * filename)'' | ||
+ | ' ''Check if a file is a SoundFont file.''</font> | ||
+ | Private Extern fluid_is_soundfont(filename As String) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''int fluid_synth_sfload(fluid_synth_t * synth, const char * filename, nt reset_presets)'' | ||
+ | ' ''Load a SoundFont file.''</font> | ||
+ | Private Extern fluid_synth_sfload(synth As Pointer, filename As String, reset_presets As Integer) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''int fluid_settings_getnum(fluid_settings_t* settings, const char *name, double* val)'' | ||
+ | ' ''Get the numeric value of a named setting.''</font> | ||
+ | Private Extern fluid_settings_getnum(settings As Pointer, name As String, dval As Pointer) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''fluid_player_t* new_fluid_player(fluid_synth_t * synth)'' | ||
+ | ' ''Create a new MIDI player.''</font> | ||
+ | Private Extern new_fluid_player(synth As Pointer) As Pointer | ||
+ | |||
+ | <FONT Color=gray>' ''int fluid_is_midifile(const char *filename)'' | ||
+ | ' ''Check if a file is a MIDI file.''</font> | ||
+ | Private Extern fluid_is_midifile(filename As String) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''int fluid_player_add(fluid_player_t * player, Const char * midifile)'' | ||
+ | ' ''Add a MIDI file to a player queue.''</font> | ||
+ | Private Extern fluid_player_add(player As Pointer, midifile As String) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''int fluid_player_play(fluid_player_t * player)'' | ||
+ | ' ''Activates play mode for a MIDI player if not already playing.''</font> | ||
+ | Private Extern fluid_player_play(player As Pointer) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''int fluid_synth_write_s16(fluid_synth_t* synth, int len, void* lout, int loff, int lincr, void* rout, int roff, int rincr)'' | ||
+ | ' ''Synthesize a block of 16 bit audio samples to audio buffers.''</font> | ||
+ | Private Extern fluid_synth_write_s16(synth As Pointer, ilen As Integer, luot As Short[], loff As Integer, lincr As Integer, rout As Short[], forr As Integer, rincr As Integer) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''int fluid_player_get_status(fluid_player_t * player)'' | ||
+ | ' ''Get MIDI player status.''</font> | ||
+ | Private Extern fluid_player_get_status(player As Pointer) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''int delete_fluid_player(fluid_player_t * player)'' | ||
+ | ' ''Delete a MIDI player instance.''</font> | ||
+ | Private Extern delete_fluid_player(player As Pointer) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''int delete_fluid_synth(fluid_synth_t * synth)'' | ||
+ | ' ''Delete a FluidSynth instance.''</font> | ||
+ | Private Extern delete_fluid_synth(synth As Pointer) As Integer | ||
+ | |||
+ | <FONT Color=gray>' ''void delete_fluid_settings(fluid_settings_t * settings)'' | ||
+ | ' ''Delete the provided settings object.''</font> | ||
+ | Private Extern delete_fluid_settings(settings As Pointer) | ||
+ | |||
+ | |||
+ | '''Public''' Sub Main() | ||
+ | |||
+ | |||
+ | |||
+ | '''End''' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | =Riferimenti= | ||
+ | * http://fluidsynth.sourceforge.net/api/ | ||
<FONT Color=Red size=4><B>Pagina in costruzione !</b></font> | <FONT Color=Red size=4><B>Pagina in costruzione !</b></font> |
Versione delle 16:25, 4 mag 2016
Con le risorse della libreria Libfluidsynth è possibile ottenere un file WAV da un file Midi.
E' necessario avere istallata e richiamare in Gambas la libreria dinamica condivisa: "libfluidsynth:1.5.2"
Mostriamo di seguito un esempio a riga di comando:
Library "libfluidsynth:1.5.2" ' fluid_settings_t* new_fluid_settings(void) ' Create a new settings object. Private Extern new_fluid_settings() As Pointer ' fluid_synth_t * new_fluid_synth(fluid_settings_t * settings) ' Create new FluidSynth instance. Private Extern new_fluid_synth(settings As Pointer) As Pointer ' int fluid_is_soundfont(const char * filename) ' Check if a file is a SoundFont file. Private Extern fluid_is_soundfont(filename As String) As Integer ' int fluid_synth_sfload(fluid_synth_t * synth, const char * filename, nt reset_presets) ' Load a SoundFont file. Private Extern fluid_synth_sfload(synth As Pointer, filename As String, reset_presets As Integer) As Integer ' int fluid_settings_getnum(fluid_settings_t* settings, const char *name, double* val) ' Get the numeric value of a named setting. Private Extern fluid_settings_getnum(settings As Pointer, name As String, dval As Pointer) As Integer ' fluid_player_t* new_fluid_player(fluid_synth_t * synth) ' Create a new MIDI player. Private Extern new_fluid_player(synth As Pointer) As Pointer ' int fluid_is_midifile(const char *filename) ' Check if a file is a MIDI file. Private Extern fluid_is_midifile(filename As String) As Integer ' int fluid_player_add(fluid_player_t * player, Const char * midifile) ' Add a MIDI file to a player queue. Private Extern fluid_player_add(player As Pointer, midifile As String) As Integer ' int fluid_player_play(fluid_player_t * player) ' Activates play mode for a MIDI player if not already playing. Private Extern fluid_player_play(player As Pointer) As Integer ' int fluid_synth_write_s16(fluid_synth_t* synth, int len, void* lout, int loff, int lincr, void* rout, int roff, int rincr) ' Synthesize a block of 16 bit audio samples to audio buffers. Private Extern fluid_synth_write_s16(synth As Pointer, ilen As Integer, luot As Short[], loff As Integer, lincr As Integer, rout As Short[], forr As Integer, rincr As Integer) As Integer ' int fluid_player_get_status(fluid_player_t * player) ' Get MIDI player status. Private Extern fluid_player_get_status(player As Pointer) As Integer ' int delete_fluid_player(fluid_player_t * player) ' Delete a MIDI player instance. Private Extern delete_fluid_player(player As Pointer) As Integer ' int delete_fluid_synth(fluid_synth_t * synth) ' Delete a FluidSynth instance. Private Extern delete_fluid_synth(synth As Pointer) As Integer ' void delete_fluid_settings(fluid_settings_t * settings) ' Delete the provided settings object. Private Extern delete_fluid_settings(settings As Pointer) Public Sub Main() End
Riferimenti
Pagina in costruzione !