Skip to content

Synthesizing a raw s16le waveform #952

Answered by derselbst
harieamjari asked this question in Q&A
Discussion options

You must be logged in to vote

How could I set the preset to be use to play?

e.g. fluid_synth_program_select(); but usually, it's up to the .mid file to make this selection.

How could I set the duration of the note to be played (maybe in number of samples?)

fluid_synth_noteon() and fluid_synth_noteoff() take effect immediately after rendering audio. Thus it's up to you to render "as-many-samples-as-you-want" before calling fluid_synth_noteoff().

I suppose fluid_synth_process(synth, 44100, 2, fx, 2, dry); did nothing here as the output are all zeros.

fluid_synth_process() outputs float samples. Float samples are in the range [-1;1]. Int16 samples are in the range [-32768;32767]. Your code just casts all the float …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@harieamjari
Comment options

@derselbst
Comment options

@harieamjari
Comment options

Answer selected by harieamjari
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants