Up to higher level

The Amplitude Envelope

The filter had made the sound a bit better. Let's go on and introduce some enveloping. We start with amplitude envelope. Actually we are going to build what is called the time-variant amplifier (TVA) and control it with an envelope.

There a going to be too many modules in our structure. It's better to have our TVA to be one module, not many modules, otherwise we are going to have a mess soon in our structure window.

Right-click the background and select Basic->Macro. This creates a macro module. A macro module is used to create your own modules, containing their own structure. This time we are creating the TVA. Right-click the macro module and select Caption. Modify the caption name to 'Amplifier'. Press OK.

We need one input for our amplifier (to route the signal in) and one output (to route the variant-amplified signal out). Right-click the macro again and select Inputs. Click Add. The default input name 'In' is suggested. Press OK. Press OK again to close the inputs dialog. Use the same way to create the module's output (this way selecting Outputs from the module's menu).

Insert the amplifier module between the filter and VC. It is highly recommended to insert the amplifier after the filter because the filters output is 'spread over' in time. That is e.g. when the signal at the filter's input terminates the filter's output does not terminate immediately but rather decays for a period of time. This is common with most filters (actually we don't know of a filter for which this is not true). But we want to control the amplitude of the output signal and the output is taken from the filter.

Right-click the amplifier macro and select Show Structure. You are now taken to the macro's internal structure window.

You should see the inputs module on the left and outputs module on the right. Those are the macro's structure connection with the outer world. Inside we are creating the TVA.

In math terms the amplification of the signal is simply multiplying the signal by either constant or variable value. E.g. multiplying the signal by 2 amplifies the signal by +6dB. Dividing the signal value by 2 is -6dB. But we don't care for the relationship between our multiplication coefficient and dB scale. What we know is that multiplying the signal by 1 leaves it intact, multiplying by a less value weakens the signal.

Create a multiplier module (Basic->Mult). Route the macro's input to one of the Mult inputs, route the Mult's output to the macro's output. Fine, all we have to do now is to define our multiplication coefficient.

We suggest that you first add a knob to the other Mult's input and find out yourself how changing the multiplication coefficient affects the signal volume. Create knob the same way you did with the filter and connect it to the other Mult's input. Leave the knob's Min and Max parameters at their default values (0 and 1) and the scale set to linear. We suggest that you set its caption to 'Volume', since this is what the knob does.

Switch to the panel window and drag the knob to the desired location (remember to turn on the Move Controls mode). Play some keys while turning the Volume knob. Hear the sound change. If the maximum volume is too small, you can modify it by adjusting the knob's Max parameter (be careful, too large volumes cause output signal clipping).

Now we add the envelope to modify our coefficient. Rather than connecting the envelope instead of the Volume knob we want to have them both. Right-click the Mult module and modify the Input Count parameter, by setting it to 3. Watch another input appearing on the Mult module.

Right-click the background and select Standard->Envelopes->ADSR, creating a classic ADSR envelope module. A, D, R inputs define the corresponding envelope times (attack, decay, release) in seconds. S defines the sustain level and G triggers the envelope (you can read it all by right-clicking the module and selecting Module Description).

Create 4 knobs and set their captions to A, D, S, R. Set the time knobs (A, D, R) to logarithmic scale and value range [0.001..10]. Set the sustain knob to linear [0..1] (the default knob settings). A convenient way to do this is to first create the A knob and set its parameters. Then duplicate it twice (by pressing Ctrl->D, or right-clicking the module and selecting Duplicate, or selecting Edit->Duplicate from the menu bar). The parameter values will be copied to the new modules, so that you don't have to set them again. Change the caption for the two new modules. Now create the S knob and set its parameters.

Connect the knobs to the corresponding envelope inputs. Switch to the panel and rearrange the knobs (remember to flip the Move Controls mode).

Switch back to the amplifier structure window. We need a signal to be routed to the G input. This signal is going to trigger the envelope. Its positive front will start the envelope when crossing the zero level, its negative front will release the envelope when crossing the zero level. The only problem is where to take this signal from.

This signal is most often taken from the Gate module. When in inactive state this module yields the signal which is slightly less that zero. Most of the time this module even does not yield any value, since it is polyphonic and the voice for the key which is not pressed is usually not active. As you press a MIDI key the voice becomes active, the gate signal is raised to 1. As you release the key, the signal drops back below zero.

Create the Gate module (Basic->MIDI Note->Gate) and route it to the G input of the envelope. Watch the envelope becoming polyphonic (the shadow appearing). Route the L output of the envelope into the unused Mult's input.

Switch to the panel and set A, D, S and R knobs to about halfway. Play some keys. Now increase the attack time. Hear the attack change. Play with the decay and sustain settings. Finally try the release setting. It does not work!

Actually the release setting works, but the voice is deallocated at the time you release the key. You need to make voices deallocate at the time of the envelope completion. This is done by routing the envelope activity signal (taken from the A output of the envelope) to the VR module. When the VR module is connected to nothing it releases the voices immediatly upon the key release. When it is connected to some source it releases the voice at the time the input signal for that voice drops below zero. (Thus disconnected VR module equals to the Gate module connected to the VR module). The envelope activity signal is set to 1 while the envelope is active and drops to a slighly below zero value upon the completion of the release stage. This way the voice is going to be released after the release stage is complete.

The only problem is that the envelope is inside the amplifier macro. OK, you create another output in the amplifier macro (either the way you did by right-clicking the macro, or from within the macro's structure, by right-clicking the Outs module). Let's call it A (activity). Route the envelope's A output to the macro's A output in the Outs module.

Switch to the ensemble window and connect the amplifier's A output to the VR module. Now play the keys and hear the release portion of your notes. You should also notice the click audible before at the key release disappering. This click was caused by the immediate voice termination without the smooth fade out.

Another small improvement will be to have our amplifier controls enclosed in a frame. Switch to the ensemble window, right-click the amplifier macro and select Panel. Set this parameter's value to Frame. Now switch to the panel. You probably would want to rearrange the panel a bit. Remember you can now move the entire contents of the amplifier subpanel by dragging the amplifier frame in the Move Controls mode.

Notice. Actually there is a ready-to use macro for such amplifier in the Library->Dr Sync->Amplifiers section, but we are here to learn, aren't we?

next page>>