|
From: | David Henningsson |
Subject: | Re: [fluid-dev] Fluid_synth_write and sequencer queries |
Date: | Wed, 30 Apr 2014 17:38:52 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
On 2014-04-27 06:14, sqweek wrote:
Hi folks, Thanks for fluid-synth! I've been using it for the midi side of a transcription program I'm developing. To ensure the midi notes are synchronized with the audio stream, I'm using fluid_synth_write_s16 and mixing the streams together myself. I have it working, but I haven't quite grasped _which_ samples the fluid_synth_write call returns. Do they return the present state of the synthesizer (ie. the returned samples should be played immediately), or does it return the most recently rendered samples that have yet to be retrieved by a _write call? (or is there some other semantics?)
Well, if you first call fluid_synth_note_on, and after that call fluid_synth_write_s16, then the note you added will sound from the beginning. Does that answer your question?
Secondly, my crude implementation results in some midi events being triggered up to 4095 frames too early or too late; the plan is to use fluid-synth's sequencer API to fix this.
Right, you can do this because the sequencer supports "sample timers" which is an internal concept that makes it possible for the sequencer to insert note events "in the middle" of calls to fluid_synth_write_*.
However, it's probably easier for you to just call fluid_synth_write_* with just 64 samples at a time, and start your notes between the right two calls to fluid_synth_write_*. That would give you the same granularity as is being used internally in fluidsynth.
Is it reasonable to use the frame number directly as the sequencer's 'tick' (ie. fluid_sequencer_set_time_scale(seq, 1.0/44100.0) ) or is that too fine? Cheers, -sqweek _______________________________________________ fluid-dev mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/fluid-dev
[Prev in Thread] | Current Thread | [Next in Thread] |