setEnvelope() - what does it do?
-
@Maxwello yes, I was using it on both. Ok, for fading a clip it would work. But I am still wondering whats the difference to
setVolume( channel, volume )
. I will try it on an FM Synth sound. -
I may have found out how that function works:
- On a synth sound it changes the length of the tone, means it re-sets the playNote()-speed parameter.
- It has no effect on playNote() if you set it before calling playNote() (unlike the setModulator() or setFilter(). In the help example its also called after the playAudio().
- Interesting application: play a note, and before it ends, call
setEnvelope(channel, 0)
, it will hold the tone forever. (I use it until the key on the keyboard is released)
I still have to check if I can speed up an Audio-Clip with this, during it plays?! that would be cool. I imagine, the game gets more difficult, and the sound speeds up.
-
I checked again the effect on an audio clip. It seems like it is affecting the volume parameter and not the speed parameter. Is that on purpose?
playAudio( channel, handle, volume, pan, speed, loops )
playNote( channel, wave, frequency, volume, speed, pan ) -
Ok, maybe its like this
- modifying the sustain part of the envelope for the amplitude when playing an audio clip.
- modifying the whole length (time axis) of the envelope for playing a note (or only the length of the sustain part? not 100% sure).
-
Just going to do a copy paste of a poste I've made on the other post to make sure it's all seen.
Technically, the function setADSR does exist in Fuze right now, but is in need of a couple of fixes to be fully functional. Because of that, the help page for it hasn't been constructed since it does not work as intended. In fact, it has very limiting factors currently which make it almost redundant.
It will be functional in the next patch, and help pages will be in Fuze to explain it!
Apologies for the delay everybody.
-
Right, I've taken a good look at this and it seems that the help example is indeed lacking. I have raised an issue for this and the example will be improved to demonstrate properly the effect of envelope speed.
the
speed
parameter insetEnvelope()
and inplayNote()
is intended to be a simplified ADSR envelope. It takes a supplied number, and creates an envelope applied to the piece of audio which peaks at, or 'attacks' at 1/speed
seconds. Similarly, it will 'release' at 1/speed seconds. Essentially, higher number = faster, shorter sound. Lower number = slower, longer sound.The help example has badly clamped values on the envelopeSpeed variable, making this effect almost non existent. If you set the envelopeSpeed variable at the beginning of the example to 30, then run the program you will very much hear the effect on the envelope.
Even more perceivable is when this is used with
playNote()
, instead.There will be an upgraded help page with both of these examples present, using
playNote()
andplayAudio()
and much more sensible vaues to really make the effect apparent.With the addition of working
setADSR()
support, the user will have the option of going for the full control approach, or using a simplified speed setting for either a 'fast' or 'slow' sound. -
This inquiry has also highlighted a bug in that it appears
playAudio()
does not reset the envelope generator. This has also been raised as an issue. -
Thank you for your help to understand this better. It explains to me why a low number could make the audio clip quieter, because the attack was to short to reach the max. amplitude. But a small observation: with the audio clip if I use speed 1/2 (for two seconds) the attack phase is 2 sec but the release phase (It seems as you said, for setEnvelope() theres no sustain or decay phase) seems to be > 14s. But maybe this could be the "reset envelope generator" bug. No worries, I will try it out, when its adapted.
-
@Dave can it be that playNote() does not reset the setReverb() effect. At least for the delay 150 and the atennuation 1, calling playNote() several times, sounds different everytime.
-
@spikey I haven't noticed such a thing but I will certainly test that today
-
Sorry, @Dave, I have to take this up again, I understand that there are new things coming in the next patch according to sound, but maybe the following information can help to get the help-docs right or my understanding ;-)
The work on my "Musical USB Keyboard" project, raised my interest in synthesizing sounds and getting these parameters right. I was not able to verify the exact attack and release duration. But the length of the sound, played with
playNote
seems to be like this: 10/speed = duration in seconds.
Together with your information that the attack is taking 1/speed seconds, it seems that the release phase takes 9/speed seconds.
Maybe this would be a helpful additional detail for the help docs.I measured two square wave sounds, one with speed 10 and one with 15.
square, speed: 10, duration measured: 1.008 sec (assumption silence at -77dB)
square, speed: 15, duration measured: 0.658 sec -
@Dave I did some further investigations and a DEMO programm. But I put the details in another thread, because it concerns
setReverb()
and notsetEnvelope()
, hope thats fine.