fluid-dev
[Top][All Lists]
Advanced

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

Re: [fluid-dev] Breath control patch.


From: S. Christian Collins
Subject: Re: [fluid-dev] Breath control patch.
Date: Tue, 17 Feb 2009 12:03:50 -0600
User-agent: Thunderbird 2.0.0.18 (X11/20081105)

Peter,

In this case, FluidSynth behaves exactly as it should.  If you want the breath controller (CC2) to adjust volume, then you will need to specify that as a modulator in the SoundFont you wish to control.  When such a modulator is created, FluidSynth will control the volume using the breath controller.  It is done this way so that other parameters may be controlled by the breath controller, not just volume.

-~Chris

Peter Gebauer wrote:
(if this post appears twice it's because I had the wrong return path-before,
wanted to make sure it got posted properly)

Hi guys!

I was experimenting with a friend's EWI (Electronic Wind Instrument) and
the breath controller didn't update the output volume after note on.

Anyway, I browsed the source code and decided to write a hack that changes
attenuation based on note on velocity and the controller value.
Here's what I have so far, it "works", but as you can see a lot of things
are missing, like changing voices for the current channel only, etc.

int
fluid_channel_breath_attenuation(fluid_channel_t* chan, int val)
{
    fluid_synth_t* synth;
    int i;
    int vel;
    float value;
    fluid_voice_t* voice;
    synth = chan->synth;
    for (i = 0; i < synth->polyphony; i++) {
        voice = synth->voice[i];
        vel = fluid_voice_gen_get(voice, GEN_VELOCITY);
        value = 1920.0 * (1.0 - (val - vel) / 127.0) - 960.0;
        fluid_voice_gen_set(voice, GEN_ATTENUATION, value);
        fluid_voice_update_param(voice, GEN_ATTENUATION);
    }
    return FLUID_OK;
}

Any hints on how to improve this snippet would be useful.
I'm not good with C and I just started looking at fluidsynth yesterday,
so I'm expecting a lot of useful feedback. :)

Thanks!



_______________________________________________
fluid-dev mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/fluid-dev

  

reply via email to

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