vibrato — Generates a natural-sounding user-controllable vibrato.


Generates a natural-sounding user-controllable vibrato.


kout vibrato kAverageAmp, kAverageFreq, kRandAmountAmp, \
      kRandAmountFreq, kAmpMinRate, kAmpMaxRate, kcpsMinRate, \
      kcpsMaxRate, ifn [, iphs]


ifn -- Number of vibrato table. It normally contains a sine or a triangle wave.

iphs -- (optional) Initial phase of table, expressed as a fraction of a cycle (0 to 1). A negative value will cause phase initialization to be skipped. The default value is 0.


kAverageAmp -- Average amplitude value of vibrato

kAverageFreq -- Average frequency value of vibrato (in cps)

kRandAmountAmp -- Amount of random amplitude deviation

kRandAmountFreq -- Amount of random frequency deviation

kAmpMinRate -- Minimum frequency of random amplitude deviation segments (in cps)

kAmpMaxRate -- Maximum frequency of random amplitude deviation segments (in cps)

kcpsMinRate -- Minimum frequency of random frequency deviation segments (in cps)

kcpsMaxRate -- Maximum frequency of random frequency deviation segments (in cps)

vibrato outputs a natural-sounding user-controllable vibrato. The concept is to randomly vary both frequency and amplitude of the oscillator generating the vibrato, in order to simulate the irregularities of a real vibrato.

In order to have a total control of these random variations, several input arguments are present. Random variations are obtained by two separated segmented lines, the first controlling amplitude deviations, the second the frequency deviations. Average duration of each segment of each line can be shortened or enlarged by the arguments kAmpMinRate, kAmpMaxRate, kcpsMinRate, kcpsMaxRate, and the deviation from the average amplitude and frequency values can be independently adjusted by means of kRandAmountAmp and kRandAmountFreq.


Here is an example of the vibrato opcode. It uses the file vibrato.csd.

Example 494. Example of the vibrato opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac           -iadc     -d     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o vibrato.wav -W ;;; for file output any platform

; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  ; Create a vibrato waveform.
  kaverageamp init 2500
  kaveragefreq init 6
  krandamountamp init 0.3
  krandamountfreq init 0.5
  kampminrate init 3
  kampmaxrate init 5
  kcpsminrate init 3
  kcpsmaxrate init 5
  ifn = 1
  kvamp vibrato kaverageamp, kaveragefreq, krandamountamp, \
                krandamountfreq, kampminrate, kampmaxrate, \
                kcpsminrate, kcpsmaxrate, ifn

  ; Generate a tone including the vibrato.
  a1 oscili 10000+kvamp, 440, 2

  out a1


; Table #1, a sine wave for the vibrato.
f 1 0 256 10 1
; Table #1, a sine wave for the oscillator.
f 2 0 16384 10 1

; Play Instrument #1 for 2 seconds.
i 1 0 2


See Also

jitter, jitter2, vibr


Author: Gabriel Maldonado

Example written by Kevin Conder.

New in Version 4.15