hsboscil

hsboscil — An oscillator which takes tonality and brightness as arguments.

Description

An oscillator which takes tonality and brightness as arguments, relative to a base frequency.

Syntax

ares hsboscil kamp, ktone, kbrite, ibasfreq, iwfn, ioctfn \
               [, ioctcnt] [, iphs]

Initialization

ibasfreq -- base frequency to which tonality and brighness are relative

iwfn -- function table of the waveform, usually a sine

ioctfn -- function table used for weighting the octaves, usually something like:

f1 0  1024  -19  1  0.5  270  0.5

ioctcnt (optional) -- number of octaves used for brightness blending. Must be in the range 2 to 10. Default is 3.

iphs (optional, default=0) -- initial phase of the oscillator. If iphs = -1, initialization is skipped.

Performance

kamp -- amplitude of note

ktone -- cyclic tonality parameter relative to ibasfreq in logarithmic octave, range 0 to 1, values > 1 can be used, and are internally reduced to frac(ktone).

kbrite -- brightness parameter relative to ibasfreq, achieved by weighting ioctcnt octaves. It is scaled in such a way, that a value of 0 corresponds to the orignal value of ibasfreq, 1 corresponds to one octave above ibasfreq, -2 corresponds to two octaves below ibasfreq, etc. kbrite may be fractional.

hsboscil takes tonality and brightness as arguments, relative to a base frequency (ibasfreq). Tonality is a cyclic parameter in the logarithmic octave, brightness is realized by mixing multiple weighted octaves. It is useful when tone space is understood in a concept of polar coordinates.

Making ktone a line, and kbrite a constant, produces Risset's glissando.

Oscillator table iwfn is always read interpolated. Performance time requires about ioctcnt * oscili.

Examples

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

Example 196. Example of the hsboscil 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 hsboscil.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

; synth waveform
giwave ftgen 1, 0, 1024, 10, 1, 1, 1, 1
; blending window
giblend ftgen 2, 0, 1024, -19, 1, 0.5, 270, 0.5

; Instrument #1 - produces Risset's glissando.
instr 1
  kamp = 10000
  kbrite = 0.5
  ibasfreq = 200
  ioctcnt = 5

  ; Change ktone linearly from 0 to 1, 
  ; over the period defined by p3.
  ktone line 0, p3, 1

  a1 hsboscil kamp, ktone, kbrite, ibasfreq, giwave, giblend, ioctcnt
  out a1
endin


</CsInstruments>
<CsScore>

; Play Instrument #1 for ten seconds.
i 1 0 10
e


</CsScore>
</CsoundSynthesizer>


Here is an example of the hsboscil opcode in a MIDI instrument. It uses the file hsboscil_midi.csd.

Example 197. Example of the hsboscil opcode in a MIDI instrument.

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  MIDI in
-odac           -iadc     -d          -M0    ;;;RT audio I/O with MIDI in
; For Non-realtime ouput leave only the line below:
; -o hsboscil_midi.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

; synth waveform
giwave ftgen 1, 0, 1024, 10, 1, 1, 1, 1
; blending window
giblend ftgen 2, 0, 1024, -19, 1, 0.5, 270, 0.5

; Instrument #1 - use hsboscil in a MIDI instrument.
instr 1
  ibase = cpsoct(6)
  ioctcnt = 5

  ; all octaves sound alike.
  itona octmidi
  ; velocity is mapped to brightness
  ibrite ampmidi 3

  ; Map an exponential envelope for the amplitude.
  kenv expon 20000, 1, 100

  asig hsboscil kenv, itona, ibrite, ibase, giwave, giblend, ioctcnt
  out asig
endin


</CsInstruments>
<CsScore>

; Play Instrument #1 for ten minutes
i 1 0 600
e


</CsScore>
</CsoundSynthesizer>


Credits

Author: Peter Neubäcker
Munich, Germany
August, 1999

New in Csound version 3.58