I am using the Tsunami QUICC, controlling it through the QUICC port, and using the Sparkfun library for the board. I am trying to implement controlled attack time and decay time for sound samples. Decay seems pretty straightforward, but I am having some issues with attack.
For turning a sound file on, I am using:
tsunami.trackPlayPoly(track, 0, false);
tsunami.trackGain(track, -70);
tsunami.trackFade(track, vol, attack, false);
And to turn it off:
tsunami.trackFade((int(bank) << 7) + pitch, -70, decay, true);
Does this make sense? I started out sending the trackGain() before the trackPlayPoly() but that did not seem to work. I am concerned that starting the track then setting its volume to -70 might create a startup glitch, but I haven’t detected anything yet.
BTW, I am not using the MIDI input because the MIDI output from my control board is dedicated to something else.
Attack is an int; should that be uint_16t perhaps?
What is the acceptable range for the third parameter of the trackFade() function? There seem to be issues when the value is below three (milliseconds?). Does this come from the length of an audio buffer?
Actually I am puzzled by the results of further testing.
Some values of attack produce no sound at all, and some produce sound at a reduced volume.
attack result
3 low volume
5 no sound
7 full volume
9 no sound
11 low-ish volume
13 full volume
15 no sound
17 low sound
And so forth