FLOSS Manuals

 English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

CSOUND

OPCODE GUIDE: BASIC SIGNAL PROCESSING

 

  • OSCILLATORS AND PHASORS

    • Standard Oscillators

      oscils is a very simple sine oscillator which is ideally suited for quick tests. It needs no function table, but offers just i-rate input arguments.

      ftgen generates a function table, which is needed by any oscillator except oscils. The GEN Routines fill the function table with any desired waveform, either a sine wave or any other curve. Refer to the function table chapter of this manual for more information.

      poscil can be recommended as standard oscillator because it is very precise, in particular for long tables and low frequencies. It provides linear interpolation, any rate its amplitude and frequency input arguments, and works also for non-power-of-two tables. poscil3 provides cubic interpolation, but has just k-rate input. Other common oscillators are oscili and oscil3. They are less precise than poscil/poscili, but you can skip the initialization which can be useful in certain situations. The oscil opcode does not provide any interpolation, so it should usually be avoided. More Csound oscillators can be found here.

    • Dynamic Spectrum Oscillators

      buzz and gbuzz generate a set of harmonically related cosine partials.

      mpulse generates a set of impulses of user-definable amplitude and interval gap between impulses.

      vco and vco2 implement band-limited, analogue modelled oscillators that can use variety of standard waveforms.

    • Phasors

      phasor produces the typical moving phase values between 0 and 1. The more complex syncphasor lets you synchronize more than one phasor precisely.

  • RANDOM AND NOISE GENERATORS

    seed sets the seed value for the majority of the Csound (pseudo) random number generators. A seed value of zero will seed random number generators from the system clock thereby guaranteeing a different result each time Csound is run, while any other seed value generates the same random values each time.

    rand is the usual opcode for uniformly distributed bipolar random values. If you give 1 as input argument (called "amp"), you will get values between -1 and +1. randi interpolates between values which are generated with a variable frequency. randh holds the value until the next one is generated (sample and hold). You can control the seed value by an input argument (a value greater than 1 seeds from current time), you can decide whether to generate 16bit or 31bit random numbers and you can add an offset.

    rnd31 can output all rates of variables (i-rate variables are not supported by rand). It also gives the user control over the random distribution, but has no offset parameter.

    random provides extra conveniece in that the user can define both the minimum and a maximum of the distribution as input argument; rand and rnd31 only output bipolar ranges and we define amplitude. It can also be used for all rates, but you have no direct seed input, and the randomi/randomh variants always start from the lower border, instead anywhere between the borders.

    pinkish produces pink noise at audio-rate (white noise can be produced using rand or noise).

    There are many more random opcodes worth investigating. Here is an overview. A number of GEN routines are also used for generating random distributions. They can be found in the GEN Routines overview.

  • ENVELOPES

    • Simple Standard Envelopes

      linen applies a linear rise (fade in) and decay (fade out) to a signal. It is very easy to use, as you put the raw audio signal in and get the enveloped signal out.

      linenr does the same for any note whose duration is not known when they begin. This could mean MIDI notes or events triggered in real time. linenr begins the final stage of the envelope only when that event is turned off (released). The penultimate value is held until this release is received.

      adsr calculates the classic attack-decay-sustain-release envelope. The result is to be multiplied with the audio signal to get the enveloped signal.

      madsr does the same for notes triggered in real time (functioning in a similar way to linenr explained above).

      Other standard envelope generators can be found in the Envelope Generators overview of the Canonical Csound Manual.

    • Envelopes By Linear And Exponential Generators 

      linseg creates one or more segments of lines between specified points.

      expseg does the same but with exponential segments. Note that zero values or crossing the zero axis are illegal.

      transeg is particularly flexible as you can specify the shape of each segment individually (continuously from convex to linear to concave).

      All of these opcodes have 'r' variants (linsegr, expsegr, transegr) for MIDI or other real time triggered events. ('r' stands for 'release'.)

      More opcodes for generating envelopes can be found in this overview.

    • Envelopes By Function Tables

      Any function table (or part of it) can be used as envelope. Once a function table has been created using ftgen or a GEN Routine it can then be read using an oscillator, and multiply the result with the audio signal you want to envelope. 

  • DELAYS

    • Audio Delays

      The vdelay family of opcodes are easy to use and implement all the necessary features expected when working with delays:

      vdelay implements a variable delay at audio rate with linear interpolation.

      vdelay3 offers cubic interpolation.

      vdelayx has an even higher quality interpolation (and is for this reason slower). vdelayxs lets you input and output two channels, and vdelayxq four.

      vdelayw changes the position of the write tap in the delay line instead of the read tap. vdelayws is for stereo, and vdelaywq for quadro.

      The delayr/delayw opcodes establishes a delay line in a more complicated way. The advantage is that you can have as many taps in one delay line as you need.

      delayr establishes a delay line and reads from the end of it.

      delayw writes an audio signal to the delay line.

      deltap, deltapi, deltap3, deltapx and deltapxw function in a similar manner to the relevant opcodes of the vdelay family (see above) bearing the same suffixes.

      deltapn offers a tap delay measured in samples, not seconds. This might be more useful in the design of filters
    • Control Delays

      delk and vdel_k let you delay any k-signal by some time interval (useful, for instance, as a kind of 'wait' function).

  • FILTERS

    Csound boasts an extensive range of filters and they can all be perused on the Csound Manual pages for Standard Filters and Specialized Filters. Here, some of the most frequently used filters are mentioned, and some tips are given. Note that filters usually change the signal level, so you may also find the balance opcode useful.

    • Low Pass Filters

      tone is a first order recursive low pass filter. tonex implements a series of tone filters.

      butlp is a second order low pass Butterworth filter.

      clfilt lets you choose between different filter types and different numbers of poles in the design.

    • High Pass Filters

      atone is a first order recursive high pass filter. atonex implements a series of atone filters.

      buthp is a second order high pass Butterworth filter.

      clfilt lets you choose between different filter types and different numbers of poles in the design.

    • Band Pass And Resonant Filters

      reson is a second order resonant filter. resonx implements a series of reson filters, while resony emulates a bank of second order bandpass filters in parallel. resonr and resonz are variants of reson with variable frequency response.

      butbp is a second order band-pass Butterworth filter.

    • Band Reject Filters

      areson is the complement of the reson filter.  

      butbr is a band-reject butterworth filter.

    • Filters For Smoothing Control Signals

      port and portk are very frequently used to smooth control signals which are received by MIDI or widgets.

  • REVERB

    Note that you can easily work in Csound with convolution reverbs based on impulse response files, for instance with pconvolve

    freeverb is the implementation of Jezar's well-known free (stereo) reverb.

    reverbsc is a stereo FDN reverb, based on work of Sean Costello.

    reverb and nreverb are the traditional Csound reverb units.

    babo is a physical model reverberator ("ball within the box").
  • SIGNAL MEASUREMENT, DYNAMIC PROCESSING, SAMPLE LEVEL OPERATIONS

    • Amplitude Measurement And Amplitude Envelope Following

      rms determines the root-mean-square amplitude of an audio signal.

      balance adjusts the amplitudes of an audio signal according to the rms amplitudes of another audio signal.

      follow / follow2 are envelope followers which report the average amplitude in a certain time span (follow) or according to an attack/decay rate (follow2).

      peak reports the highest absolute amplitude value received.

      max_k outputs the local maximum or minimum value of an incoming audio signal, checked in a certain time interval.

    • Pitch Estimation

      ptrack, pitch and pitchamdf track the pitch of an incoming audio signal, using different methods.

      pvscent calculates the spectral centroid for FFT streaming signals (see below under "FFT And Spectral Processing")

    • Tempo Estimation

      tempest estimates the tempo of beat patterns in a control signal.  

    • Dynamic Processing

      compress compresses, limits, expands, ducks or gates an audio signal.

      dam is a dynamic compressor/expander.

      clip clips an a-rate signal to a predefined limit, in a “soft” manner.

    • Sample Level Operations

      limit sets the lower and upper limits of an incoming value (all rates).

      samphold performs a sample-and-hold operation on its a- or k-input.

      vaget / vaset allow getting and setting certain samples of an audio vector at k-rate.
  •  SPATIALIZATION

    • Panning

      pan2 distributes a mono audio signal across two channels according to a variety of panning laws.

      pan distributes a mono audio signal amongst four channels.

    • VBAP

      vbaplsinit configures VBAP output according to loudspeaker parameters for a 2- or 3-dimensional space.

      vbap4 / vbap8 / vbap16 distributes an audio signal among up to 16 channels, with k-rate control over azimut, elevation and spread.

    • Ambisonics

      bformenc1 encodes an audio signal to the Ambisonics B format.

      bformdec1 decodes Ambisonics B format signals to loudspeaker signals in different possible configurations.
    • Binaural / HRTF

      hrtfstat, hrtfmove and hrtfmove2 are opcodes for creating 3d binaural audio for headphones. hrtfer is an older implementation. All of these opcodes require data files containing information about the sound shadowing qualities of the human head and ears.

There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.