This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
getting_started_vividshaper [2024/06/08 21:42] – lars | getting_started_vividshaper [2025/01/09 21:41] (current) – [Using more oscillators] lars | ||
---|---|---|---|
Line 140: | Line 140: | ||
In this example, we continue to let the generator be active as long as the volume for the oscillator is above 0.000001. Once the volume goes below, then **active == false** and the generator will turn itself off (until you press a note again). | In this example, we continue to let the generator be active as long as the volume for the oscillator is above 0.000001. Once the volume goes below, then **active == false** and the generator will turn itself off (until you press a note again). | ||
+ | |||
+ | From version 1.3, you can instead call **VSDeactivate()**. It will run exactly the same code: | ||
+ | |||
+ | <code Lua> | ||
+ | VSDeactivate() | ||
+ | -- This runs exactly the same thing as: | ||
+ | -- | ||
+ | </ | ||
When you play this simple patch, you will see the wave on the right side view: | When you play this simple patch, you will see the wave on the right side view: | ||
Line 165: | Line 173: | ||
active = VSMax(vol) > 0.00001 | active = VSMax(vol) > 0.00001 | ||
+ | |||
+ | pitchbend = pitchbend * 2 | ||
</ | </ | ||
Line 171: | Line 181: | ||
note[x] is an array corresponding to the notes being played for the eight oscillators (x is between 1-8). If we don't set note[x] explicitly, each oscillator will keep the default notein value. Hence, you don't have to set the note[] array if you don't want to change the note. | note[x] is an array corresponding to the notes being played for the eight oscillators (x is between 1-8). If we don't set note[x] explicitly, each oscillator will keep the default notein value. Hence, you don't have to set the note[] array if you don't want to change the note. | ||
- | Given that notein=48, note[1] will be 47.99 and note[2] will be 48.01. Setting these two oscillators slightly detuned will create a beat effect, which you can read more about here: | + | The pitchbend variable is representing the current pitch bend data from your keyboard, and ranges by default between -2 to +2 (two semi-tones in each direction). This value is added to each note[x] value in the sound engine (after the Lua code has finished running). Say that note[1] == 48 and pitchbend == 0.3. The note that will be played by the oscillator will then be 48.3. In the code above, we manipulate the pitchbend variable so that it ranges from -4 to +4 instead. If you wish to turn it off (or use the pitchbend data to modulate something else), you can do so by setting pitchbend = 0 somewhere in the code. |
+ | |||
+ | In the above code, we are adding and subtracting 0.01 for note[1] and note[2]. | ||
https:// | https:// | ||
Line 442: | Line 454: | ||
</ | </ | ||
+ | ===== Delay effect ===== | ||
+ | |||
+ | Version 1.3 of VividShaper comes with a delay effect. There are two delays (delay1 and delay2), which can either be used separately or as a ping-pong delay. There are a number of ways to route the audio through these delays. | ||
+ | |||
+ | There is not a separate delay for each generator. Instead, the generators share the same delays. This means the parameters for the actual delays (feedback, time, amplify) are set globally for all generators. However, | ||
+ | you can control how much audio from each oscillator in each generator that should be routed to each delay. For instance, it is possible to let only one oscillator be sent to the delay. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | The above picture shows how the different parameters affect the delays. The arrays d1vol[x] and d2vol[x] tell for each oscillator how much of the output that should be sent to each delay. For instance, if you wish to send the output of oscillator 1 to delay1 and the output from oscillator 2 to delay 2, you would set it as: | ||
+ | |||
+ | < | ||
+ | d1vol[1] = 1 | ||
+ | d2vol[2] = 1 | ||
+ | </ | ||
+ | |||
+ | The output to the delay lines are also affected by vol[x], so if you have set vol[1] = 0, then you won't send any sound to the delay lines. It is thus the output after applying any volume envelopes that are sent to the delays. | ||
+ | |||
+ | Separately, you can now also turn off the main output of an oscillator and just let it go through the delays. This is done by setting ovol[x] = 0, for oscillator x. | ||
+ | |||
+ | d1vol, d2vol, and ovol are local variables for each generator. You can for instance let oscillator 1 be routed through the delay lines in generator 1, but not generator 2, depending e.g. on the note value (allowing you to only let higher notes be sent to the delays). | ||
+ | |||
+ | There is a new global variable called mvol, which default value is always 1. It tells how much of the main output that should be sent to the output lines (before being amplify modulated by gvol). This allows you to decrease or increase the main volume without changing the delay effect volume. | ||
+ | |||
+ | Delay1 and delay2 are controlled using two global arrays delay1[x] and delay2[x], with the following parameters: | ||
+ | |||
+ | < | ||
+ | delay1[1] -- Feedback from itself | ||
+ | delay1[2] -- Feedback from delay2 | ||
+ | delay1[3] -- How much of the input that should be sent through the delay (0 = dry, 1 = wet) | ||
+ | delay1[4] -- How much the volume should be amplified (1 = normal) | ||
+ | delay1[5] -- Panning (0 = left, 1 = right) | ||
+ | delay1[6] -- Time in seconds, e.g. 0.5 | ||
+ | |||
+ | delay2[1] -- Feedback from itself | ||
+ | delay2[2] -- Feedback from delay1 | ||
+ | delay2[3] -- How much of the input that should be sent through the delay (0 = dry, 1 = wet) | ||
+ | delay2[4] -- How much the volume should be amplified (1 = normal) | ||
+ | delay2[5] -- Panning (0 = left, 1 = right) | ||
+ | delay2[6] -- Time in seconds, e.g. 0.5 | ||
+ | </ | ||
+ | |||
+ | There are three functions that you can use to set these parameters more easily: | ||
+ | |||
+ | < | ||
+ | VSPingPong(feedback, | ||
+ | VSStereoDelay(feedback, | ||
+ | VSMonoDelay(feedback, | ||
+ | </ | ||
+ | |||
+ | Simply adding VSPingPoing(0.9, | ||
===== MIDI output (experimental) ===== | ===== MIDI output (experimental) ===== |