This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
getting_started_vividshaper [2025/01/06 19:47] – 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 492: | Line 504: | ||
</ | </ | ||
+ | Simply adding VSPingPoing(0.9, | ||
===== MIDI output (experimental) ===== | ===== MIDI output (experimental) ===== |