[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [fluid-dev] File output with FluidSynth API
From: |
Felix Krause |
Subject: |
Re: [fluid-dev] File output with FluidSynth API |
Date: |
Fri, 12 Feb 2010 01:03:03 +0100 |
On 11.02.2010, at 18:56, David Henningsson wrote:
> Felix Krause wrote:
>> Hi all,
>>
>> I'm trying to save FluidSynth's audio output into a file using the API. My
>> code basically does this:
>>
>> - get settings object with new_fluid_settings
>> - set audio.driver to "file"
>> - set audio.file.* settings (tried different output types - raw, aiff, wav)
>> - create synth with new_fluid_synth
>> - create audio driver with new_fluid_audio_driver
>> - load a SoundFont
>>
>> And for testing:
>> - do some sound output with fluid_synth_noteon / noteoff
>> - create a midi player with new_fluid_player, load and play a midi file with
>> it
>>
>> The file specified by audio.file.name is created, but FluidSynth does not
>> write anything to it. Did I miss to do something in order to start writing
>> the output to the file?
>
> First, if you want output as fast as possible, and then I suggest you
> use the new filerenderer API (see fluidsynth.c's fast_render_loop
> function for inspiration).
>
> Otherwise I think your version should work, assuming you wait a while
> between doing new_fluid_audio_driver and delete_fluid_audio_driver. At
> least you should have a file larger than 0 bytes.
>
> // David
>
I can't use fast file rendering as the output depends on user interaction. The
file FluidSynth creates is always 4KB on disk (256 bytes) which I believe is
just the header. I also checked fluid_synth_error for errors, there is none.
I tested using FluidSynth 1.0.9 with raw output and that works with my code -
however, 1.1.1 does not. I also tested the FS command line utility:
fluidsynth -F output.wav -i -n -T wav soundfont.sf2 midifile.mid
This works as it should and renders the midi file to output.wav.
fluidsynth -a file -i -n -T wav -o audio.file.name=output.wav soundfont.sf2
midifile.mid
This just creates a 4KB file. Is it possible that this is a FS bug?