Skip to content

File Renderer

Functions for managing file renderers and triggering the rendering.

The file renderer is only used to render a MIDI file to audio as fast as possible. Please see Fast file renderer for non-realtime MIDI file rendering for a full example.

If you are looking for a way to write audio generated from realtime events (for example from an external sequencer or a MIDI controller) to a file, please have a look at the file Audio Driver instead.

Lifecycle Functions for File Renderer

new_fluid_file_renderer()

fluid_file_renderer_t * new_fluid_file_renderer(fluid_synth_t *synth)

Create a new file renderer and open the file.

Parameters:

Name Description
synth The synth that creates audio data.

Returns: the new object, or NULL on failure

Note

Available file types and formats depends on if libfluidsynth was built with libsndfile support or not. If not then only RAW 16 bit output is supported.

Uses the following settings from the synth object: - audio.file.name : Output filename - audio.file.type : File type, "auto" tries to determine type from filename extension with fallback to "wav". - audio.file.format : Audio format - audio.file.endian : Endian byte order, "auto" for file type's default byte order - audio.period-size : Size of audio blocks to process - synth.sample-rate : Sample rate to use

Since

1.1.0

delete_fluid_file_renderer()

void delete_fluid_file_renderer(fluid_file_renderer_t *dev)

Close file and destroy a file renderer object.

Parameters:

Name Description
dev File renderer object.

Since

1.1.0

Functions

fluid_file_renderer_process_block()

int fluid_file_renderer_process_block(fluid_file_renderer_t *dev)

Write period_size samples to file.

Parameters:

Name Description
dev File renderer instance

Returns: FLUID_OK or FLUID_FAILED if an error occurred

Since

1.1.0

fluid_file_set_encoding_quality()

int fluid_file_set_encoding_quality(fluid_file_renderer_t *dev, double q)

Set vbr encoding quality (only available with libsndfile support).

Parameters:

Name Description
dev File renderer object.
q The encoding quality, see libsndfile documentation of SFC_SET_VBR_ENCODING_QUALITY

Returns: FLUID_OK if the quality has been successfully set, FLUID_FAILED otherwise

Since

1.1.7