• Nenhum resultado encontrado

37 S IGNAL G ENERATORS : A DDITIVE S YNTHESIS /R ESYNTHESIS

No documento The Public Csound Reference Manual (páginas 149-155)

The Public Csound Reference Manual Version 4.10 Signal Generators: Additive Synthesis/Resynthesis Page 37-1

37 S IGNAL G ENERATORS : A DDITIVE

The Public Csound Reference Manual Version 4.10 Signal Generators: Additive Synthesis/Resynthesis Page 37-2 kfmod is a control-rate transposition factor: a value of 1 incurs no transposition, 1.5 transposes up a perfect fifth, and .5 down an octave.

The Public Csound Reference Manual Version 4.10 Signal Generators: Additive Synthesis/Resynthesis Page 37-3

37.2 a d s y n t

ar adsyntadsyntadsyntadsynt kamp, kcps, iwfn, ifreqfn, iampfn, icnt[, iphs]

D

ESCRIPTION

Performs additive synthesis with an arbitrary number of partials, not necessarily harmonic.

I

NITIALIZATION

iwfn – table containing a waveform, usually a sine. Table values are not interpolated for performance reasons, so larger tables provide better quality.

ifreqfn – table containing frequency values for each partial. ifreqfn may contain beginning frequency values for each partial, but is usually used for generating parameters at runtime with tablew. Frequencies must be relative to kcps. Size must be at least icnt.

iampfn – table containing amplitude values for each partial. iampfn may contain beginning amplitude values for each partial, but is usually used for generating parameters at runtime with tablew. Amplitudes must be relative to kamp. Size must be at least icnt.

icnt – number of partials to be generated

iphs – initial phase of each oscillator, if iphs = -1, initialization is skipped. If iphs > 1, all phases will be initialized with a random value.

P

ERFORMANCE

kamp – amplitude of note

kcps – base frequency of note. Partial frequencies will be relative to kcps.

Frequency and amplitude of each partial is given in the two tables provided. The purpose of this opcode is to have an instrument generate synthesis parameters at k-rate and write them to global parameter tables with the tablew opcode.

E

XAMPLES

These two instruments perform additive synthesis. The output of each sounds like a Tibetan bowl. The first one is static, as parameters are only generated at init-time. In the second one, parameters are continuously changed.

gifrqs ftgenftgenftgenftgen 2, 0, 32, 7, 0, 32, 0 ; generate two emty tables

; for adsynt

giamps ftgenftgenftgenftgen 3, 0, 32, 7, 0, 32, 0 ; for freqency and amp

; parameters instr

instr instr

instr 1 ; generates parameters at init time

icnt = 10 ; generate 10 voices

index = 0 ; init loop index

The Public Csound Reference Manual Version 4.10 Signal Generators: Additive Synthesis/Resynthesis Page 37-4

loop: ; loop only executed at

; init time

ifreq powpowpowpow index + 1, 1.5 ; define non-harmonic partials iamp = 1 / (index+1) ; define amplitudes

tabtab

tabtableiwleiwleiwleiw ifreq, index, gifrqs ; write to tables tableiw

tableiw tableiw

tableiw iamp, index, giamps ; used by adsynt

index = index + 1

if if if

if (index < icnt) igotoigotoigotoigoto loop ; do loop

asig adsyntadsyntadsyntadsynt 5000, 150, giwave, gifrqs, giamps, icnt outout

outout asig endin

endin endin endin

instr instr instr

instr 2 ; generates paramaters

;

;

;

; every k-cycle

icnt = 10 ; generate 10 voices

kindex = 0 ; reset loop index

loop: ; loop executed every

; k-cycle

kspeed powpowpowpow kindex + 1, 1.6 ; generate lfo for

; frequencies

kphas phasorbnk kspeed * 0.7, kindex, icnt ; individual phase for each voice

klfo tabletabletabletable kphas, giwave, 1

kdepth powpowpowpow 1.4, kindex ; arbitrary parameter twiddling...

kfreq powpowpowpow kindex + 1, 1.5

kfreq = kfreq + klfo*0.006*kdepth tablew

tablew tablew

tablew kfreq, kindex, gifrqs ; write freqs to table for

;

;

;

; adsynt

kspeed powpowpowpow kindex + 1, 0.8 ; generate lfo for amplitudes kphas phasorbnk kspeed*0.13, kindex, icnt, 2 ; individual phase for

; each voice klfo tabletabletabletable kphas, giwave, 1

kamp powpowpowpow 1 / (kindex + 1), 0.4 ; arbitrary parameter

; twiddling...

kamp = kamp * (0.3+0.35*(klfo+1))

tablew tablew tablew

tablew kamp, kindex, giamps ; write amps to table for

;

;

;

; adsyntadsyntadsyntadsynt

kindex = kindex + 1

ifif

ifif (kindex < icnt) kgotokgotokgotokgoto loop ; do loop

giwave ftgenftgenftgenftgen 1, 0, 1024, 10, 1 ; generate a sinewave

; table

asig adsyntadsyntadsyntadsynt 5000, 150, giwave, gifrqs, giamps, icnt outout

outout asig endin

endin endin endin

A

UTHOR

Peter Neubäcker Munich, Germany August, 1999

New in Csound version 3.58

The Public Csound Reference Manual Version 4.10 Signal Generators: Additive Synthesis/Resynthesis Page 37-5

37.3 h s b os ci l

ar hsboscilhsboscilhsboscilhsboscil kamp, ktone, kbrite, ibasfreq, iwfn, ioctfn \\

[, ioctcnt[, iphs]]

D

ESCRIPTION

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

I

NITIALIZATION

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 – number of octaves used for brightness blending. Must be in the range 2 to 10.

Default is 3.

iphs – initial phase of the oscillator. If iphs = -1, initialization is skipped.

P

ERFORMANCE

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.

The Public Csound Reference Manual Version 4.10 Signal Generators: Additive Synthesis/Resynthesis Page 37-6

E

XAMPLES

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

instr instr instr

instr 1 ; endless glissando ktona linelinelineline 0,10,1

asig hsboscilhsboscilhsboscilhsboscil 10000, ktona, 0, 200, giwave, giblend, 5 outout

outout asig endin

endin endin endin

instr instr instr

instr 2 ; MIDI instrument: all octaves sound alike, itona octmidioctmidioctmidioctmidi ; velocity is mapped to brightness

ibrite ampmidiampmidiampmidiampmidi 3

ibase = cpsoct(6) kenv exponexponexponexpon 20000, 1, 100

asig hsboscilhsboscilhsboscilhsboscil kenv, itona, ibrite, ibase, giwave, giblend, 5 outoutoutout asig

endin endin endin endin

A

UTHOR

Peter Neubäcker Munich, Germany August, 1999

New in Csound version 3.58

The Public Csound Reference Manual Version 4.10 Signal Generators: FM Synthesis Page 38-1

No documento The Public Csound Reference Manual (páginas 149-155)