Both sides previous revisionPrevious revisionNext revision | Previous revision |
vividshaper_reference_manual [2023/11/12 20:02] – [A simple example] lars | vividshaper_reference_manual [2025/06/03 09:25] (current) – external edit 127.0.0.1 |
---|
====== VividShaper Reference Manual ====== | ====== VividShaper Reference Manual ====== |
| |
VividShaper is a wavetable AUv3 plugin synthesizer, where each wavetable consists of 128 samples. Instead of having a fixed number of wavetables to choose from, VividShaper allows you to program your own waves using the built in Lua programming language and change them over time. | VividShaper is a wavetable AUv3 plugin synthesizer, where each wave consists of 128 samples. Instead of having a fixed number of waves to choose from, VividShaper allows you to program your own waves using the built in Lua programming language and change them over time. |
| |
The Lua-code is called many times per second. Default is 93.75 times/second, meaning it is updating after 512 frames at 48000 Hz sample rate. This can be changed as well (128 = 375 times/sec, 256, 512, 1024, 2048, and 4096 ≈ 12 times/sec). This allows the wavetable to be programmatically changed in realtime. | The Lua-code is called many times per second. This allows the waves to be programmatically changed in realtime. Default is 93.75 times/second, meaning it is updating after 512 frames at 48000 Hz sample rate. This can be changed as well (128 = 375 times/sec, 256, 512, 1024, 2048, and 4096 ≈ 12 times/sec). |
| |
There are up to eight generators for polyphony (the number of generators can be set from 1 to 8). Each generator has in turn up to eight oscillators. Each oscillator has the following states that can be manipulated in Lua-code: | There are up to eight generators for polyphony (the number of generators can be set from 1 to 8). Each generator has in turn up to eight oscillators. Each oscillator has the following states that can be manipulated in Lua-code: |
* left-right panning | * left-right panning |
* note (including cent note) | * note (including cent note) |
| * pitch bend information |
* A wave table array containing 128 samples | * A wave table array containing 128 samples |
| |
| |
<code Lua> | <code Lua> |
-- Patch: A simple example | -- Patch: A simple example #simple |
wave[1] = VSTriangle(1,0) | wave[1] = VSTriangle(1,0) |
vol[1] = VSADSRE(1,1,0.8,3,0,gatetimeon,gatetimeoff) | vol[1] = VSADSRE(1,1,0.8,3,0,gatetimeon,gatetimeoff) |
| active = vol[1] > 0.00001 |
| pitchbend = pitchbend*2 |
</code> | </code> |
| |
This example encapsulates the fundamental process of generating a wave and setting its volume envelope in VividShaper. The line **wave[1] = VSTriangle(1,0)** creates a triangle wave at the base frequency of 1 Hz and phase of 0 degrees (between 0-360 degrees). You need to provide both arguments even if you are not phase shifting the wave. The frequency here refers to the number of complete cycles of the Triangle wave form that fits within the sample (consisting of 128 sample points). A frequency of 1 Hz means one complete cycle of the triangle fits within the 128 samples. | This example shows the process of generating a wave and setting its volume envelope in VividShaper. The line **wave[1] = VSTriangle(1,0)** creates a triangle wave at the base frequency of 1 Hz and phase of 0 degrees (between 0-360 degrees). You need to provide both arguments even if you are not phase shifting the wave. The frequency here refers to the number of complete cycles of the Triangle wave form that fits within the sample (consisting of 128 sample points). A frequency of 1 Hz means one complete cycle of the triangle fits within the 128 samples. |
| |
This is not the playback frequency of the note (i.e. which note that is being played). The speed of the 128 samples is determined by note[1] for oscillator 1. We don't have to set note[1] explicitly, it is already set by the note you are playing on the keyboard. However, if we do wish to change it, for instance transposing one octave, we can do so by setting: **note[1] = notein+12**. Alternatively, if we wish to set it to a constant value, making it play back the same note even if play another note, we could do that as well: **note[1] = 40**. | This is not the playback frequency of the note (i.e. which note that is being played). The speed of the 128 samples is determined by note[1] for oscillator 1. We don't have to set note[1] explicitly, it is already set by the note you are playing on the keyboard. However, if we do wish to change it, for instance transposing one octave, we can do so by setting: **note[1] = notein+12**. Alternatively, if we wish to set it to a constant value, making it play back the same note even if play another note, we could do that as well: **note[1] = 40**. |
| |
| The pitch bend value comes from your keyboard and will be added to the note value for each oscillator after the Lua code has finished. This value is stored in the variable pitchbend, which goes from -2 to +2 (i.e. 2 semi-notes). If note[1] == 40 for oscillator 1 and pitchbend == 0.53, the final note value used to play the note will be 43.53. If you want to turn off pitch bend, you can set pitchbend = 0 anywhere in your code. if you want to pitch bend from -4 to +4, you can just multiply it by 2 (pitchbend = pitchbend *2). This is done in the example above. You can also use the pitch bend value to modulate e.g. something else first, then set it to zero if you don't want it to also bend the notes. |
| |
The volume will then be set to an exponential volume ADSR envelope, with attack=1 sec, decay=1 sec, sustain=0.8, release=3 sec, startlevel=0. The name of the wave table will be "A simple example". | The volume will then be set to an exponential volume ADSR envelope, with attack=1 sec, decay=1 sec, sustain=0.8, release=3 sec, startlevel=0. The name of the wave table will be "A simple example". |
| |
| The last row checks if the volume is above a certain threshold. If not, the boolean variable **active** will be false and the generator will turn off. It is not needed but you save some CPU power by turning off non-sounding generators. |
| |
| The patch name **A simple example #simple** has a hashtag **#simple**. Adding hashtags to your patch names will allow you to organise your patches into categories (e.g. #bass, #pad, #lead, or whatever you want). |
| |
This is all it takes to generate a simple wave. This will then be played back at different speeds, depending on the note being played. | This is all it takes to generate a simple wave. This will then be played back at different speeds, depending on the note being played. |
-- Input information | -- Input information |
notein -- The current input note for the active generator. | notein -- The current input note for the active generator. |
| pitchbend -- The pitch bend data, from -2 to 2. |
tempo -- Current tempo (beats per second, e.g. 120). | tempo -- Current tempo (beats per second, e.g. 120). |
timesignnum -- Time signature numerator, e.g. 3 for three beats per bar (3/4). (Next version) | timesignnum -- Time signature numerator, e.g. 3 for three beats per bar (3/4). (Next version) |
gatetimeon -- Time in seconds for how long the key was pressed. | gatetimeon -- Time in seconds for how long the key was pressed. |
gatetimeoff -- Time in seconds since the key was released. | gatetimeoff -- Time in seconds since the key was released. |
| timeon -- The number of seconds since the generator was turned on. Resets after parse. |
| gtimeon -- Global time. The number of seconds since the first generator was turned on. Resets after parse. |
tick -- The number of times the Lua code has been called since initiation (when tick=0). | tick -- The number of times the Lua code has been called since initiation (when tick=0). |
cc[x] -- Value of CC message x (between 0 to 127). | cc[x] -- Value of CC message x (between 0 to 127). |
| |
-- Output information | -- Output information |
wave[x] -- Wave array x (one array for each oscillator x). | pitchbend -- The pitchbend is sent back as output information. Set it to zero if you don't want it to pitch bend the notes. |
| wave[x] -- Wave array x (one array for each oscillator x, 128 elements). |
panning[x] -- Panning for oscillator x (between 0 - 1; 0 = left, 0.5 = middle, 1= right). | panning[x] -- Panning for oscillator x (between 0 - 1; 0 = left, 0.5 = middle, 1= right). |
note[x] -- Note output for oscillator x (default value is the same as note). | note[x] -- Note output for oscillator x (default value is the same as note). |
vol[x] -- Volume for oscillator x. Default is 0. | vol[x] -- Volume for oscillator x. Default is 0. |
| ring[x]=y -- Oscillator x should be ring moduled by oscillator y, where x>y. |
| sync[x]=y -- Oscillator x should be synced by oscillator y, where x>y. |
gvol -- Global volume, default = 1. Multiplied on the output to amplify or limit the audio. | gvol -- Global volume, default = 1. Multiplied on the output to amplify or limit the audio. |
updatefreq -- Update frequency: 128, 256, 512, 1024, 2048, or 4096. Tells how many frames to wait before running Lua. | updatefreq -- Update frequency: 128, 256, 512, 1024, 2048, or 4096. Tells how many frames to wait before running Lua. |
generators -- Number of generators (between 1 to 8). | generators -- Number of generators (between 1 to 8). |
active -- A value true/false. A false value turns off the generator until it is turned on again. (Next version) | active -- A value true/false. A false value turns off the generator until it is turned on again. |
midigenerator -- A value true/false. A true value means only one generator will be running and it cannot turn off. (Next version) | midigenerator -- A value true/false. A true value means only one generator will be running and it cannot turn off. |
| |
| -- Coming soon in a future version (v1.4 probably) |
| sample[x] -- Set oscillator x to a specific sample, e.g. sample[1] = "alien" |
| loopstart[x] -- Set loop start point as value between 0 - 1 |
| loopend[x] -- Set loop end point as value between 0 - 1 |
| sxfade[x] -- Sample cross fade |
| svol[x] -- Volume output for sample playback |
| |
| -- Delay output information |
| delay1[x] -- Delay1 parameters: |
| -- delay1[1] = own feedback (value from 0 - 1) |
| -- delay1[2] = feedback from delay2 |
| -- delay1[3] = wet (0 - 1, 0 = dry sound, no delay, 1 = only delay) |
| -- delay1[4] = Amplify value before sending to main output (default value 1) |
| -- delay1[5] = panning (0 = left, 1 = right) |
| -- delay1[6] = time in seconds, e.g 0.5 for half a second delay |
| delay2[x] -- Delay2 parameters |
| d1vol[x] -- How much of the output from oscillator x that should be routed to delay1 bus |
| d2vol[x] -- How much of the output from oscillator x that should be routed to delay2 bus |
| ovol[x] -- How much of oscillator x that should be sent to main output (1 = default) |
| mvol -- Amplify main output only (1 = default) |
| |
-- Views settings | -- Views settings |
text -- A text string that is printed in the waves view. | text -- A text string that is printed in the waves view. |
scaleview -- The waves view is normally between [-1, 1]. Setting scaleview=0.5 changes to [-0.5, 0.5]. | scaleview -- The waves view is normally between [-1, 1]. Setting scaleview=0.5 changes to [-0.5, 0.5]. |
wavesview -- Which wave to show, between [1, 8]. | wavesview -- Which wave to show, between [1, 8]. Set it to 0 for oscilloscope view (default). |
| oscnote -- For the oscilloscope view, set the frequency to follow (note number). Default is notein. |
</code> | </code> |
| |
wave[x] = VSWaveFold(wave[x],amplify) -- Wave will be folded outside the range [-1, 1]. | wave[x] = VSWaveFold(wave[x],amplify) -- Wave will be folded outside the range [-1, 1]. |
wave[x] = VSNorm(wave[x],threshold,normvalue) -- Normalise the waveform to normval if max amplitude is above threshold | wave[x] = VSNorm(wave[x],threshold,normvalue) -- Normalise the waveform to normval if max amplitude is above threshold |
| wave[x] = VSAbs(wave[x]) -- Return absolute values of the input wave. |
| |
-- Wave math operators - arguments can be either arrays or scalar factors | -- Wave math operators - arguments can be either arrays or scalar factors |
wave[x] = VSAdd(wave1,wave2) -- Add element wise wave1 with wave2 | wave[x] = VSAdd(wave1,wave2) -- Add element wise wave1 with wave2 |
wave[x] = VSSub(wave1,wave2) -- Subtract element wise wave1 with wave2 | wave[x] = VSSub(wave1,wave2) -- Subtract element wise wave1 with wave2 |
| |
| -- LFOs (Low Frequency Operators): |
| -- These LFO functions take time as input. They are similar to the wave generators in how they |
| -- operate, but they only return a scalar value between [-1, 1]. (v1.2): |
| lfo = VSLFOSin(frequency,phase,time) -- phase is in degrees |
| lfo = VSLFOTriangle(frequency,phase,time) |
| lfo = VSLFOSaw(frequency,phase,time) |
| lfo = VSLFOSquare(frequency,phase,width,time) -- width is between 0 to 1 |
| |
| -- Helper functions to remove negative values (Rect = rectify) |
| output = VSRect(input) -- Input is a scalar value |
| wave[x] = VSRect(wave[x]) -- Input is a wave array |
| |
| -- Helper functions for delays |
| VSPingPong(feedback,time) -- This function sets the delay variables needed for ping pong delay. |
| VSStereoDelay(feedback,time) -- This function sets the delay variables needed for a stereo delay. |
| VSMonoDelay(feedback,time) -- This function sets the delay variables needed for a mono delay. |
| |
| |
| |
-- Envelopes | -- Envelopes |
vol[x] = VSADSR(attack,decay,sustain,release,initlevel,timeOn,timeOff) -- initlevel is initial volume | vol[x] = VSADSR(attack,decay,sustain,release,initlevel,timeOn,timeOff) -- initlevel is initial volume |
vol[x] = VSADSRE(attack,decay,sustain,release,initlevel,timeOn,timeOff) -- Exponential release | vol[x] = VSADSRE(attack,decay,sustain,release,initlevel,timeOn,timeOff) -- Exponential release |
| |
| |
-- Filters (x = oscillator) | -- Filters (x = oscillator) |
biquadcoeff = VSBandpass(cutoffFreq,resonance,notein) -- Helper function to set the quadfilter values | biquadcoeff = VSBandpass(cutoffFreq,resonance,notein) -- Helper function to set the quadfilter values |
biquadcoeff = VSHighpass(cutoffFreq,resonance,notein) -- Helper function to set the quadfilter values | biquadcoeff = VSHighpass(cutoffFreq,resonance,notein) -- Helper function to set the quadfilter values |
wave[x] = VSBiquad(wave[x],biquadcoeff) -- Apply filter on wave using quadfilter settings | wave[x] = VSBiquad(wave[x],biquadcoeff) -- Apply filter on wave using quadfilter settings |
| |
-- MIDI output | -- MIDI output |
-- beatpos crosses over to a new bar. | -- beatpos crosses over to a new bar. |
| |
VSMIDI(command,data1,data2) -- Send MIDI data. (Next version) | VSMIDI(command,data1,data2) -- Send MIDI data. (v1.2) |
VSMIDIPlay(channel,note,velocity,length) -- Play a given note on the given channel. length=1/4 means a quarter note, (Next version) | VSMIDINote(channel,note,velocity,length) -- Play a given note on the given channel. length=1/4 means a quarter note, (v1.2). channel = 0 to 15, velocity = 0 to 127. |
VSTick(prevbeatpos,beatpos,length) -- Returns true for every new time interval with the given length. (Next version) | VSTick(prevbeatpos,beatpos,length) -- Returns true for every new time interval with the given length. (v1.2) |
</code> | </code> |
| |