gbuzz
Prev | Orchestra Opcodes and Operators | Next

## gbuzz

gbuzz — Output is a set of harmonically related cosine partials.

## Description

Output is a set of harmonically related cosine partials.

## Syntax

    ares gbuzz xamp, xcps, knh, klh, kmul, ifn [, iphs]

## Initialization

ifn -- table number of a stored function containing a cosine wave. A large table of at least 8192 points is recommended.

iphs (optional, default=0) -- initial phase of the fundamental frequency, expressed as a fraction of a cycle (0 to 1). A negative value will cause phase initialization to be skipped. The default value is zero

## Performance

The buzz units generate an additive set of harmonically related cosine partials of fundamental frequency xcps, and whose amplitudes are scaled so their summation peak equals xamp. The selection and strength of partials is determined by the following control parameters:

knh -- total number of harmonics requested. If knh is negative, the absolute value is used. If knh is zero, a value of 1 is used.

klh -- lowest harmonic present. Can be positive, zero or negative. In gbuzz the set of partials can begin at any partial number and proceeds upwards; if klh is negative, all partials below zero will reflect as positive partials without phase change (since cosine is an even function), and will add constructively to any positive partials in the set.

kmul -- specifies the multiplier in the series of amplitude coefficients. This is a power series: if the klhth partial has a strength coefficient of A, the (klh + n)th partial will have a coefficient of A * (kmul ** n), i.e. strength values trace an exponential curve. kmul may be positive, zero or negative, and is not restricted to integers.

buzz and gbuzz are useful as complex sound sources in subtractive synthesis. buzz is a special case of the more general gbuzz in which klh = kmul = 1; it thus produces a set of knh equal-strength harmonic partials, beginning with the fundamental. (This is a band-limited pulse train; if the partials extend to the Nyquist, i.e. knh = int (sr / 2 / fundamental freq.), the result is a real pulse train of amplitude xamp.)

Although both knh and klh may be varied during performance, their internal values are necessarily integer and may cause “pops” due to discontinuities in the output. kmul, however, can be varied during performance to good effect. gbuzz can be amplitude- and/or frequency-modulated by either control or audio signals.

N.B. This unit has its analog in GEN11, in which the same set of cosines can be stored in a function table for sampling by an oscillator. Although computationally more efficient, the stored pulse train has a fixed spectral content, not a time-varying one as above.

## Examples

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

Example 320. Example of the gbuzz opcode.

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

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    -odac     ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o gbuzz.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 32
    nchnls = 2
    0dbfs   =1

    instr 1

    kcps = 220
    knh  = p4		;total no. of harmonics
    klh  = p5		;lowest harmonic
    kmul line 0, p3, 1	;increase amplitude of
    			;higer partials
    asig gbuzz .6, kcps, knh, klh, kmul, 1
         outs asig, asig

    endin
    </CsInstruments>
    <CsScore>
    ; a cosine wave
    f 1 0 16384 11 1

    i 1 0 3 3  1 ;3 harmonics, lowest harmonic=1
    i 1 + 3 30 1 ;30 harmonics, lowest harmonic=1
    i 1 + 3 3  2 ;3 harmonics, lowest harmonic=3
    i 1 + 3 30 2 ;30 harmonics, lowest harmonic=3
    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

buzz

## Credits

September 2003. Thanks to Kanata Motohashi for correcting the mentions of the kmul parameter.

Prev | Up | Next
gausstrig | Home | gendy