For technical reasons I can no longer use tone.js and I need to generate the needed tones in another way and save them in an audio format in order to use them in my audiovisual installation. Somebody online suggested I could create those with the free cakewalk/bandlab version and some free synth VST plugins. Sadly I was not able to do so, as all plugins did not have the option for entering a specific Hz frequency. Further online research led me to Audacity and Nyquist, which is really great by the way!
As I am not very proficient in Nyquist, I would appreciate any help with what I am trying to accomplish (I came quite close so far).
I would like to achieve the following, creating tones with the following specs/params (which are the ones I used with tone.js to create my tones):
Why can’t I define the “sustain” parameter? I see there is an “overall duration” parameter, which I though if I set it to the sum of A+D+R+S it could work as well without a separate S parameter, but adjusting the above Nyquist script by adding a last parameter inside the (env …) line did output always the same tone, no matter what the other params were, so I removed the “overall duration” again…
Is there any way to define the attack and release curves?
I suppose the ADS levels I can keep to 1.0? This option was not set with tone.js.
This makes it a little bit tricky because Nyquist has different commands for linear control signals and exponential control signals.
The basic linear version is PWL.
The basic exponential version is PWE.
You can create a linear envelope that goes from an amplitude of 1, down to 0.1 in 0.5 seconds and then stays at 0.1 for a “sustain” period of 0.5 seconds like this:
(pwl 0 1 0.5 0.1 1 0.1 1)
One thing to be cautious about with exponential envelopes is that they use a logarithmic scale, which means that an amplitude of zero is impossible (a true exponential decay will decay to zero in infinite time).
There are two ways around this problem. The easiest is to simply decay to a very small value (say 0.005) and then stop.
This will produce an exponential decay from a level of 0.1 to 0.005 in 2.4 seconds:
(pwe 0 0.1 2.4 0.005)
Now, to join these two envelopes together, you can make them into a sequence with the SEQ command:
That’s the starting phase of the waveform.
Try generating some simple sine tones with different phase settings, and observe the start of the waveform (zoom in close)
I divided the value of “spread” by 200 so that you don’t need to enter tiny values. One “step” is equivalent to a semitone.
Think about how a map is scaled - each measurement on the ground is multiplied by a scaling factor (such as 1/25000) to give the length on the map.
In this case, we want to scale the waveform by making it proportional to the “envelope”. In other words, we multiply the waveform by the envelope.