noise

noise — A white noise generator with an IIR lowpass filter.

Description

A white noise generator with an IIR lowpass filter.

Syntax

ares noise xamp, kbeta

Performance

xamp -- amplitude of final output

kbeta -- beta of the lowpass filter. Should be in the range of -1 to 1.

The filter equation is:

[Filter equation for filter in noise opcode.]

where xn is the original white noise and yn is lowpass filtered noise. The higher β is, the lower the filter's cut-off frequency. The cutoff frequency is roughly sr * ((1-kbeta)/2).

Examples

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

Example 273. Example of the noise 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
; Audio out   Audio in    No messages
-odac           -iadc     -d     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o noise.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

; Instrument #1.
instr 1
  kamp = 30000

  ; Change the beta value linearly from 0 to 1.
  kbeta line 0, p3, 1

  a1 noise kamp, kbeta
  out a1
endin


</CsInstruments>
<CsScore>

; Play Instrument #1 for one second.
i 1 0 1
e


</CsScore>
</CsoundSynthesizer>


Here is an example of the noise opcode controlling the kbeta parameter with a GUI interface. It uses the file noise-2.csd.

Example 274. Example of the noise opcode controlled with a GUI.

<CsoundSynthesizer>
<CsOptions>
; 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 noise.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

FLpanel "noise", 200, 50, -1 , -1
    gkbeta, gislider1 FLslider "kbeta", -1, 1, 0, 5, -1, 180, 20, 10, 10
FLpanelEnd
FLrun

instr 1
  iamp = 0dbfs / 4  ; Peaks 12 dB below 0dbfs
  print iamp

  a1 noise iamp, gkbeta
  printk2 gkbeta
  outs a1,a1
endin


</CsInstruments>
<CsScore>

; Play Instrument #1 for one minute.
i 1 0 60
e


</CsScore>
</CsoundSynthesizer>


Credits

Author: John ffitch
University of Bath, Codemist. Ltd.
Bath, UK
December 2000

Example written by Kevin Conder.

New in Csound version 4.10