fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] New Lua module; therefore various questions


From: David Henningsson
Subject: Re: [fluid-dev] New Lua module; therefore various questions
Date: Wed, 20 Aug 2014 18:35:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0



On 2014-08-20 01:13, Peter Billam wrote:
Greetings,

I've just got version 1.0 of a fluidsynth.lua module up on
   https://rocks.moonscript.org/
   https://rocks.moonscript.org/modules/peterbillam
What there is (more or less) works (it was a wrestling match)
but it's basically a place-holder (e.g. no Sequencer, yet;
no test script; bad doc).  1.1 will be more serious...

Interesting stuff! I hope you manage to keep it updated over time - not that we're putting many releases out there right now :-)

So, I've got some Fluidsynth API questions...

After
   new_fluid_synth(settings)
has been called, the doc says:
   "The settings parameter is used directly,
    and should not be modified or freed independently."
but is it still permissible to change those parameters not
related to creating the synth, such as audio.file.name ?

You can change any parameter safely, but don't expect all of them to take effect.

The sentence means that doing this is wrong:

settings = new_fluid_settings();
synth = new_fluid_synth(settings);
delete_fluid_settings(settings);
fluid_synth_xxx(synth); /* Accessing any fluid_synth_* function might use the freed settings object */

When
   new_fluid_audio_driver(settings, synth)
is called, does the settings have to be the same settings
that was used to create the synth ? or can it be a new
settings created in order to configure the audio_driver ?

Hmm, good question. I guess it would be okay to have a different object, otherwise there wouldn't be another settings pointer in the first place. But we should probably look up this better.

If I want to output to the soundcard, and output to a wav file
at the same time, do I just create two simultaneous audio_drivers
connected to the same synth ?
Or would I have to roll my own, using fluid_synth_write_s16(),
(and then convert raw->wav) ?

In general, using two audio drivers in parallel is not supported, because they will request audio in different chunks, i e, even if they're both set to the same sample rate, the clocks will likely drift after some time.

So yes, you would have to roll your own.

When I'm using it to convert from .mid to .wav it runs in real
time (which I can understand if the "just create two simultaneous
audio_drivers" trick might get used). But timidity, for example,
if converting .mid to .wav runs the CPU flat out and doesn't
bother to wait for anything, and finishes a lot faster.
Is there a way of asking fluidsynth to do the same ?

You can look in src/fluidsynth.c to see how it's done. There is a fluid_file_renderer_t object you can use for this purpose.

// David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]