[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[fluid-dev] Breath control patch.
From: |
Peter Gebauer |
Subject: |
[fluid-dev] Breath control patch. |
Date: |
Sat, 14 Feb 2009 23:03:21 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
(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] Breath control patch.,
Peter Gebauer <=