Csound Csound-dev Csound-tekno Search About

Reverb/Nested All Pass Filters Orc/Sco

Date1997-11-29 05:55
FromHans Mikelson
SubjectReverb/Nested All Pass Filters Orc/Sco
Hello,

I hope this post is not too big for the list.  Let me know if it bothers
anyone.  I have created a set of nested all pass filter instruments.  I
think the implementation is correct but I may have made a mistake.

These instruments can be used for rapid prototyping of reverbs like those
presented in "The Virtual Acoustic Room" by Bill Gardner.  A post script
version can be found at:

http://sound.media.mit.edu/papers.html

Unfortunately typing in the same parameters presented in the paper resulted
in some nasty feedback overload.  I reduced some of the gains and was able
to get it to work.  I also prefitered the input, changed the low-pass to a
broad band pass filter and lowered the filter cut-offs to get rid of some
metallic ringing at the expense of perhaps sounding too boomy.

To play this score you will need to have a sound file of at least four
seconds of 44.1 K mono sound entitled soundin.11 to which the reverb will
be added.

Good luck,
Hans Mikelson

; ORCHESTRA
; Csound system for implementing reverbs based on nested all-pass filters
; similar to those used by William Gardner (MIT)
; Coded by Hans Mikelson 12/2/97
;
; 1. Noise Click
; 2. Disk Input
; 8. Simple Sum
; 9. Feedback Filter
;10. Delay
;11. Simple All-Pass Filter
;12. Nested All-Pass Filter
;13. Double Nested All-Pass Filter
;15. Output 

sr=44100
kr=22050
ksmps=2
nchnls=2
zakinit 30,30

;---------------------------------------------------------------------------
---
; Noise Click for testing the decay curve of the reverb.
       instr  1

idur   =      p3
iamp   =      p4
ioutch =      p5
ifco   =      p6

kamp   linseg 0, .002, iamp, .002, 0, idur-.004, 0
aout   rand   kamp

afilt  butterlp aout, ifco
       zaw    afilt, ioutch
       outs   aout, aout

       endin

;---------------------------------------------------------------------------
---
; Disk Input
       instr  2

iamp   =      p4
irate  =      p5
isndin =      p6
ioutch =      p7
ifco   =      p8

ain    diskin  isndin, irate
afilt  butterlp ain, ifco
       zaw    afilt*iamp, ioutch
       outs    ain*iamp, ain*iamp

       endin

;---------------------------------------------------------------------------
---
; Band-Limited Impulse
       instr  3

iamp   =      p4
ifqc   =      cpspch(p5)
ioutch =      p6

apulse buzz    1,ifqc, sr/2/ifqc, 1 ; Avoid aliasing

       zaw     apulse*iamp, ioutch
       outs    apulse*iamp, apulse*iamp

       endin

       
;---------------------------------------------------------------------------
---
; Simple Sum--Add 2 channels together and output to a third channel.
       instr  8

idur   =      p3
iinch1 =      p4
iinch2 =      p5
ioutch =      p6

ain1   zar    iinch1
ain2   zar    iinch2
       zaw    ain1+ain2, ioutch

       endin

;---------------------------------------------------------------------------
---
; Feedback Filter
       instr  9

idur   =      p3
ifco   =      p4
igain  =      p5
iinch1 =      p6
iinch2 =      p7
ioutch =      p8

ain1   zar    iinch1
ain2   zar    iinch2                   ; Read in two channels

afilt  butterbp ain2, ifco, ifco/2     ; Bandpass filter one channel
       zaw    ain1+igain*afilt, ioutch ; Adjust filter level add & output

       endin

;---------------------------------------------------------------------------
---
; Delay  -- Simple Delay
       instr  10

idur   =      p3
idtime =      p4/1000
igain  =      p5
iinch  =      p6
ioutch =      p7

ain    zar    iinch          ; Read the channel
aout   delay  ain, idtime    ; Delay for time
       zaw    aout, ioutch   ; Output the channel

       endin


;---------------------------------------------------------------------------
---
; Simple All-Pass Filter
       instr  11

idur   =      p3
itime  =      p4/1000
igain  =      p5
iinch  =      p6
ioutch =      p7
adel1  init   0

ain    zar    iinch

aout   =      adel1-igain*ain           ; Feed Forward
adel1  delay  ain+igain*aout, itime     ; Delay and Feedback

       zaw    aout, ioutch

       endin

;---------------------------------------------------------------------------
---
; Single Nested All-Pass Filter
       instr  12

idur   =      p3
itime1 =      p4/1000-p6/1000
igain1 =      p5
itime2 =      p6/1000
igain2 =      p7
iinch  =      p8
ioutch =      p9
adel1  init   0
adel2  init   0

ain    zar    iinch

asum   =      adel2 - igain2*adel1         ; Feed Forward (Inner all-pass)
aout   =      asum  - igain1*ain           ; Feed Forward (Outer all-pass)

adel1  delay  ain   + igain1*aout, itime1  ; Feedback (Outer all-pass)
adel2  delay  adel1 + igain2*asum, itime2  ; Feedback (Inner all-pass)

       zaw    aout, ioutch

       endin

;---------------------------------------------------------------------------
---
; Double Nested All-Pass Filter (1 outer with 2 inner in series)
       instr  13

idur   =      p3
itime1 =      p4/1000-p6/1000-p8/1000
igain1 =      p5
itime2 =      p6/1000
igain2 =      p7
itime3 =      p8/1000
igain3 =      p9
iinch  =      p10
ioutch =      p11
adel1  init   0
adel2  init   0
adel3  init   0

ain    zar    iinch

asum1  =      adel2 - igain2*adel1         ; First  Inner Feed Forward
asum2  =      adel3 - igain3*asum1         ; Second Inner Feed Forward
aout   =      asum2 - igain1*ain           ; Outer  Feed Forward

adel1  delay  ain   + igain1*aout, itime1  ; Outer Feedback
adel2  delay  adel1 + igain2*asum1, itime2 ; First Inner Feedback
adel3  delay  asum1 + igain3*asum2, itime3 ; Second Inner Feedback

       zaw    aout, ioutch

       endin


;---------------------------------------------------------------------------
---
; Output For reverb
       instr  15

idur   =      p3
igain  =      p4
iinch  =      p5

kdclik linseg 0, .002, igain, idur-.004, igain, .002, 0

ain    zar    iinch
       outs   ain*kdclik, -ain*kdclik  ; Inverting one side makes the sound
       endin                           ; seem to come from all around you.
                                       ; This may cause some problems with
                                       ; surround sound systems.

; SCORE
; 1. Noise Click
; 2. Disk Input
; 3. Band-Limited Impulse
; 8. Simple Sum
; 9. Feedback Filter
;10. Delay
;11. Simple All-Pass Filter
;12. Nested All-Pass Filter
;13. Double Nested All-Pass Filter
;15. Output 

f1 0 16384 10 1                               ; Sine

;---------------------------------------------------------------------------
----
; No Reverb
;---------------------------------------------------------------------------
----
;   Sta  Dur  Amp  Pitch  SoundIn  OutCh  Fco
i2  0.0  4.0  .8   1      11       1      10000

;---------------------------------------------------------------------------
----
; Small Room
;---------------------------------------------------------------------------
----
;   Sta  Dur  Amp    Pitch  OutCh
;i1  4.5  .01  30000     1

;   Sta  Dur  Amp  Pitch  SoundIn  OutCh  Fco
i2  4.5  4.0  0.5  1      11       1      6000

;   Sta  Dur  Fco   Gain  InCh1  InCh2  OutCh
i9  4.5  4.5  1600  .5    1      5      2

;   Sta  Dur  Time  Gain  InCh  OutCh
i10 4.5  4.5  24    1.0   2     3

;   Sta  Dur  Time1  Gain1  Time2  Gain2  Time3  Gain3  InCh  OutCh
i13 4.5  4.5  35     .15    22     .25    8.3    .30    3     4

;   Sta  Dur  Gain   InCh
i15 4.5  4.5  .6     4

;   Sta  Dur  Time1  Gain1  Time2  Gain2  InCh  OutCh
i12 4.5  4.5  66     .08    30     .3     4     5

;   Sta  Dur  Gain   InCh
i15 4.5  4.5  .6     5

;---------------------------------------------------------------------------
----
; Medium Room
;---------------------------------------------------------------------------
----
;   Sta  Dur  Amp  Pitch  SoundIn  OutCh  Fco
i2  9.0  4.0  0.5  1      11       1      6000

;   Sta  Dur  Fco  Gain  InCh1  InCh2  OutCh
i9  9.0  4.5  1000 .4    1      10     2

;   Sta  Dur  Time1  Gain1  Time2  Gain2  Time3  Gain3  InCh  OutCh
i13 9.0  4.5  35     .25    8.3    .35    22     .45    2     3

;   Sta  Dur  Gain   InCh
i15 9.0  4.5  .5     3

;   Sta  Dur  Time  Gain  InCh  OutCh
i10 9.0  4.5  5     1.0   3     4

;   Sta  Dur  Time1  Gain1  InCh  OutCh
i11 9.0  4.5  30     .45    4     5

;   Sta  Dur  Time  Gain  InCh  OutCh
i10 9.0  4.5  67    1.0   5     6

;   Sta  Dur  Gain   InCh
i15 9.0  4.5  .5     6

;   Sta  Dur  Time  Gain  InCh  OutCh
i10 9.0  4.5  15    .4    6     7

;   Sta  Dur  InCh1  InCh2  OutCh
i8  9.0  4.5  1.2    7      8

;   Sta  Dur  Time1  Gain1  Time2  Gain2  InCh  OutCh
i12 9.0  4.5  39     .25    9.8    .35    8     9

;   Sta  Dur  Gain   InCh
i15 9.0  4.5  .5     9

;   Sta  Dur  Time  Gain  InCh  OutCh
i10 9.0  4.5  108   1.0   9     10

;---------------------------------------------------------------------------
----
; Large Room
;---------------------------------------------------------------------------
----
;   Sta  Dur  Amp  Pitch  SoundIn  OutCh  Fco
i2  13.5 4.0  0.5  1      11       1      4000

;   Sta  Dur  Fco  Gain  InCh1  InCh2  OutCh
i9  13.5 5.0  1000 .5    1      10     2

;   Sta  Dur  Time1  Gain1  InCh  OutCh
i11 13.5 5.0  8      .3     2     3

;   Sta  Dur  Time1  Gain1  InCh  OutCh
i11 13.5 5.0  12     .3     3     4

;   Sta  Dur  Time  Gain  InCh  OutCh
i10 13.5 5.0  4     1.0   4     5

;   Sta  Dur  Gain   InCh
i15 13.5 5.0  1.5   5

;   Sta  Dur  Time  Gain  InCh  OutCh
i10 13.5 5.0  17    1.0   5     6

;   Sta  Dur  Time1  Gain1  Time2  Gain2  InCh  OutCh
i12 13.5 5.0  87     .5     62     .25    6     7

;   Sta  Dur  Time  Gain  InCh  OutCh
i10 13.5 5.0  31    1.0   7     8

;   Sta  Dur  Gain   InCh
i15 13.5 5.0  .8     8

;   Sta  Dur  Time  Gain  InCh  OutCh
i10 13.5 5.0  3     1.0   8     9

;   Sta  Dur  Time1  Gain1  Time2  Gain2  Time3  Gain3  InCh  OutCh
i13 13.5 5.0  120    .5     76     .25    30     .25    9     10

;   Sta  Dur  Gain   InCh
i15 13.5 5.0  .8     10





Received: from stork.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa08274;
          6 Dec 97 20:01 GMT
Received: from pat.bath.ac.uk by stork.maths.Bath.AC.UK id aa24798;
          6 Dec 97 20:01 GMT
Received: (qmail 16011 invoked from network); 6 Dec 1997 20:01:45 -0000
Received: from hermes.ex.ac.uk (HELO exeter.ac.uk) (144.173.6.14)
  by pat.bath.ac.uk with SMTP; 6 Dec 1997 20:01:45 -0000
Received: from noether [144.173.8.10] by hermes via SMTP (TAA21658); Sat, 6 Dec 1997 19:53:31 GMT
Received: from hermes.ex.ac.uk by maths.exeter.ac.uk; Sat, 6 Dec 97 19:53:14 GMT
Received: from mtigwc03.worldnet.att.net [204.127.131.34] by hermes via ESMTP (TAA02484); Sat, 6 Dec 1997 19:53:06 GMT
Received: from worldnet.att.net ([12.65.34.228])
          by mtigwc03.worldnet.att.net (post.office MTA v2.0 0613 )
          with ESMTP id AAA17479 for ;
          Sat, 6 Dec 1997 19:55:35 +0000
Message-Id: <343934AF.18EEF347@worldnet.att.net>
Date: Mon, 06 Oct 1997 11:57:52 -0700
From: Steven LeBeau 
X-Mailer: Mozilla 4.03 [en] (Win95; I)
Mime-Version: 1.0
To: "csound@maths.exeter.ac.uk" 
Subject: Another newbie question
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Though creating "orchestras" makes more sense to me, and I think I
understand "scores" pretty well, I have a couple of small questions.

    1. If I download an orchestra off the net that doesn't come with a
score, how do I know what the right opcode for the instrument is?
    2. What the heck does an opcode do? It mentioned the GEN routines
(which, someone who hasn't taken higher-level math makes very little
sense) and making wavetables, which I thought were something done by the
orchestra (i.e., you set up a virtual modual synth patch that generates
a sound each time the score sends it a note request). I've tried using
the DX emulated sounds, for example, and using the opcode in the manual
results in the thing referring to invalid wavetables!

I know that the manual talks about these things, but the manual caters
to someone who's had at least calculus and a familiarity with hardware
synths (and I have a little experience with the DX27, so I guess that
counts). This is all just a bit confusing!

    -Steven LeBeau





Received: from stork.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa09163;
          7 Dec 97 5:03 GMT
Received: from pat.bath.ac.uk by stork.maths.Bath.AC.UK id aa09183;
          7 Dec 97 5:03 GMT
Received: (qmail 28951 invoked from network); 7 Dec 1997 05:03:42 -0000
Received: from hermes.ex.ac.uk (HELO exeter.ac.uk) (144.173.6.14)
  by pat.bath.ac.uk with SMTP; 7 Dec 1997 05:03:42 -0000
Received: from noether [144.173.8.10] by hermes via SMTP (EAA17454); Sun, 7 Dec 1997 04:52:22 GMT
Received: from hermes.ex.ac.uk by maths.exeter.ac.uk; Sun, 7 Dec 97 04:52:05 GMT
Received: from howl.werewolf.net [206.103.224.20] by hermes via SMTP (EAA09648); Sun, 7 Dec 1997 04:51:57 GMT
Received: from lizard by howl.werewolf.net via SMTP (950413.SGI.8.6.12/940406.SGI)
	for  id WAA20980; Sat, 6 Dec 1997 22:54:46 -0600
Message-Id: <3.0.3.16.19971129183151.2cfff30e@werewolf.net>
X-Sender: hljmm@werewolf.net
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.3 (16)
Date: Sat, 29 Nov 1997 18:31:51
To: csound@maths.ex.ac.uk
From: Hans Mikelson 
Subject: Introduction to Csound
In-Reply-To: <343934AF.18EEF347@worldnet.att.net>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Hello,

I'll try to give a little introduction to Csound as I understand it.

The Orchestra:

The orchestra starts with a header which is followed by a list of
instruments.  The header tells what the sample rate of the sound file will
be, what the control rate is, how many channels the sound file will have
(mono, stereo, quad).  Following is a typical header:

sr=44100   ; Sample Rate
kr=22050   ; Control Rate
ksmps=2    ; sr/kr As far as I know this is always the case
nchnls=2   ; 1=mono, 2=stereo, 4=quad

Everything following a semicolon on the same line is a comment.  The header
is followed by one or more instruments.  A simple instrument follows:

       instr  1               ; Instrument 1 begins here
aout   oscil  10000, 440, 1   ; An oscillator
       outs   aout, aout      ; Output the results to a stereo sound file
       endin                  ; Instrument 1 ends here

Every instrument starts with instr # and ends with endin.  Each line has a
single command or opcode.  The main command in this instrument is the
"oscil" opcode.  Every opcode has zero or more variables on the left side
of the opcode and zero or more parameters on the right side depending on
the opcode.  The oscil opcode is a simple oscillator.  The first parameter
for oscil tells how loud the signal should be, in this case 10000. (Note
that 16 bit of digital audio translates to +/- 32000 so that's the maximum
loudness)  The second parameter for oscil tells what the frequency of the
oscillator is, in this case 440 cycles/sec.  The third parameter tells the
waveform or table of the oscillator.  The waveforms are stored in the
score. (more on them later)

Variables:

There are several types of variables used in Csound.  The above instrument
uses one variable "aout".  The first letter of the variable usually tells
what kind of variable it is.  The letter "a" means audio rate and "k" means
control rate.  Variables usually start with an "a" or a "k".  Be careful
not to give them the same name as an opcode.  There are also some special
"p" variables or parameters.  The "p" paramters values are supplied by the
score.  The first three p parameters have a special meaning.  Variables
starting with the letter "i" are initialized to a value when the instrument
is started and do not usually change.

p1 is the instrument number.
p2 is the time the instrument starts.
p3 is the duration of the instrument.
p4, p5, p6 etc. can be used for different things.  The send values from the
score to the orchestra.

The Score:

There are two different things typically found in a score.  They are the
wave tables and the instrument calls.  Following is a typical score which
could be used with the above orchestra:

;Table#  Start  TableSize  TableGenerator   Parameter
f1       0      16384      10               1          ; Sine

;Instrument#  Start  Duration
i1            0      1

First I'll discuss the call to the instrument.  The i indicates that it is
an instrument call.  The 1 (p1) means to call instrument number 1.  The
next number (p2) is 0.  This tells when the instrument should start
playing.  The third number (p3) is the duration in this case 1 second.
These values can be accessed in the instrument as p1-p3 respectively.

Next consider the waveform function table (f).  There are five numbers on
this line.  The first number is the number the table will be referenced by
in the orchestra.  The second number is the time at which this table
becomes available to the orchestra.  The third number tells how many
samples are in the table.  The fourth number tells which GEN routine to use
to generate the table.  In this case GEN routine 10 is selected.  Any
following numbers on this line are used by the GEN routine to control what
is generated.  GEN 10 with a 1 as its only parameter generates a sine wave.
 Other GEN routines can be used to generate square, triangle or many other
shapes, including reading in user supplied samples.

Many opcodes make use of tables.  The table number is given to the opcode
as one of its parameters.  In the simple orchestra above the third
parameter tells oscil which table to use for its waveform.  The third
parameter is a 1 so table 1 (sine wave) is used.

One drawback of this orchestra/score is that it only plays one pitch at one
volume.  Following is a more versatile orchestra/score.

; ORCHESTRA
sr=44100   ; Sample Rate
kr=22050   ; Control Rate
ksmps=2    ; sr/kr As far as I know this is always the case
nchnls=2   ; 1=mono, 2=stereo, 4=quad

       instr  1               ; Instrument 1 begins here
iamp   =      p4
ifqc   =      p5
itabl1 =      p6
aout   oscil  iamp, ifqc, itabl1  ; An oscillator
       outs   aout, aout          ; Output the results to a stereo sound file
       endin                      ; Instrument 1 ends here

; SCORE
;Table#  Start  TableSize  TableGenerator   Parameter
f1       0      16384      10               1          ; Sine

;Instrument#(p1) Start(p2) Duration(p3) Amplitude(p4) Frequency(p5) Table(p6)
i1               0         1            10000         440           1

This does the same thing but more control has been moved to the score.
That way you can play a variety of notes by just making more "i" entries in
the score.  For example:

i1               0         1            2000         330           1
i1               1         1            4000         440           1
i1               2         1            6000         600           1
i1               3         1            8000         660           1

In this case a variety of volumes and pitches are generated.  There is one
more problem.  There is a loud click at the end.  That is because there is
no amplitude envelope.  The sound just ends abruptly rather than ramping
down smoothly.  To add an envelope use the following instrument:

       instr  1               ; Instrument 1 begins here
idur   =      p3
iamp   =      p4
ifqc   =      p5
itabl1 =      p6

;             Attack Decay  Sustain       Release
kamp   linseg 0, .1, 1, .2, .8, p3-.5, .8, .2, 0
aout   oscil  iamp, ifqc, itabl1   ; An oscillator
       outs   aout*kamp, aout*kamp ; Output the results to a stereo sound file
       endin                       ; Instrument 1 ends here

This uses the linseg opcode to add an envelpe to the sound.  linseg
generates a series of line segments defined by a list of levels and times.
In this example it starts at a zero level then ramps to a level of 1 in the
first .1 second.  During the next .2 seconds the level decays to .8.  The
level stays at .8 until .2 seconds before the end of the note and then
drops to zero.

This should be enough to get some of the beginners started.

Bye,
Hans Mikelson



Received: from stork.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa09389;
          7 Dec 97 7:23 GMT
Received: from pat.bath.ac.uk by stork.maths.Bath.AC.UK id aa11791;
          7 Dec 97 7:23 GMT
Received: (qmail 1103 invoked from network); 7 Dec 1997 07:23:49 -0000
Received: from hermes.ex.ac.uk (HELO exeter.ac.uk) (144.173.6.14)
  by pat.bath.ac.uk with SMTP; 7 Dec 1997 07:23:49 -0000
Received: from noether [144.173.8.10] by hermes via SMTP (HAA11694); Sun, 7 Dec 1997 07:13:48 GMT
Received: from hermes.ex.ac.uk by maths.exeter.ac.uk; Sun, 7 Dec 97 07:13:32 GMT
Received: from SYSTEM@alpha.cc.oberlin.edu [132.162.1.245] by hermes via ESMTP (HAA09849); Sun, 7 Dec 1997 07:13:25 GMT
Received: from RN2713.resnet.oberlin.edu
 ("port 1193"@RN2713.resnet.oberlin.edu) by OBERLIN.EDU (PMDF V5.1-8 #24033)
 with SMTP id <01IQVJMFJGGG002NAU@OBERLIN.EDU> for csound@maths.exeter.ac.uk;
 Sun, 7 Dec 1997 02:16:24 EDT
Received: by RN2713.resnet.oberlin.edu with Microsoft Mail id
 <01BD02B6.3EDB3A20@RN2713.resnet.oberlin.edu>; Sun, 07 Dec 1997 02:17:19 -0500
Date: Sun, 07 Dec 1997 02:17:18 -0500
From: Christopher Neese 
Subject: Opcodes
To: "Csound (E-mail)" 
Message-Id: <01BD02B6.3EDB3A20@RN2713.resnet.oberlin.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

I hope this message gets through OK; the last time I posted my messages =
were delayed about five days.

ABOUT OPCODES:

This message is aimed at beginners.  Hans Mikelson's Introduction to =
Csound should be a great help to beginners, but there is one point that =
needs elucidation.  Both the score and the orchestra make use of =
opcodes, and this can lead to confusion when the manual talks about =
opcodes.

The score opcodes are the first letter on each line of the score.  The =
legal score opcodes are f, i, a, t, s, and e.
Score opcodes are always single alphabetic characters.

On the other hand, a orchestra opcode is an alphanumeric string, such as =
oscil.  It is confusing that both score opcodes and orchestra opcodes =
are simply referred to as opcodes in the manual.

For those of you that need a justification for this [like me 8-)], =
suffice it to say that the word opcode has a specific meaning in =
computer science.  Both score opcodes and orchestra opcodes are opcodes =
in this sense.  However, score and orchestra opcodes are not =
interchangeable, just as English words are usually not interchangeable =
with Latin words.

I hope this clears some of the terminology in the manual up.

MORE ON THE FORMAT OF AN ORCHESTRA:

The following may be more confusing than helpful to some beginners, but =
it should help some.

Every line in a Csound score, ignoring blank lines, and lines with just =
labels and/or comments is a statement.  Most Csound statements have the =
following form:

Variables Opcode Expressions

Variables is a list of zero or more variables delimited by commas.

Opcode is an orchestra opcode (see above)

Expressions is a list of zero or more expressions delimited by commas.

In addition, every line can be prefaced with a label (followed by a =
colon) and ended with a comment (started with a semi-colon).  Program =
control statements are the sole exception to this form.

What variables and opcodes are should be fairly clear.  However, the =
concept of an expression in terms of a Csound orchestra may be a source =
of confusion.  An expression is a combination of functions, arithmetic =
operators, conditional operators, and variables.  The important thing =
here is that opcodes do not evaluate as expressions.  Opcodes and =
functions are not the same thing.  (again, this is consistent with =
computer science vocabulary).  In the Csound manual functions are also =
known as value converters and pitch converters.

I hope this message is helpful.  Good luck!

Christopher Neese




Received: from stork.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa09536;
          7 Dec 97 10:33 GMT
Received: from pat.bath.ac.uk by stork.maths.Bath.AC.UK id aa15084;
          7 Dec 97 10:33 GMT
Received: (qmail 3483 invoked from network); 7 Dec 1997 10:33:50 -0000
Received: from hermes.ex.ac.uk (HELO exeter.ac.uk) (144.173.6.14)
  by pat.bath.ac.uk with SMTP; 7 Dec 1997 10:33:50 -0000
Received: from noether [144.173.8.10] by hermes via SMTP (KAA18946); Sun, 7 Dec 1997 10:24:19 GMT
Received: from hermes.ex.ac.uk by maths.exeter.ac.uk; Sun, 7 Dec 97 10:24:02 GMT
Received: from messiah.cableinet.net [194.117.157.68] by hermes via SMTP (KAA02347); Sun, 7 Dec 1997 10:23:51 GMT
Received: (qmail 9825 invoked from network); 7 Dec 1997 10:26:34 -0000
Received: from lions.cableinet.net (193.38.113.5)
  by messiah with SMTP; 7 Dec 1997 10:26:34 -0000
Received: from igor (usr5-haw.cableinet.co.uk [194.117.146.15]) by lions.cableinet.net (950413.SGI.8.6.12/951211.SGI) via SMTP id KAA20070 for ; Sun, 7 Dec 1997 10:26:30 GMT
Message-Id: <348A78BF.5D0@cableinet.co.uk>
Date: Sun, 07 Dec 1997 10:21:51 +0000
From: Richard Dobson 
Reply-To: RWD@cableinet.co.uk
Organization: Composers Desktop Project
X-Mailer: Mozilla 3.0 (Win95; I)
Mime-Version: 1.0
To: csound@maths.ex.ac.uk
Subject: Re: Opcodes
References: <01BD02B6.3EDB3A20@RN2713.resnet.oberlin.edu>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Christopher Neese wrote:
> 
> I hope this message gets through OK; the last time I posted my messages were delayed about five days.
> 
> ABOUT OPCODES:
> 
> This message is aimed at beginners.  Hans Mikelson's Introduction to Csound should be a great help to beginners, but there is one point that needs elucidation.  Both the score and the orchestra make use of opcodes, and this can lead to confusion when the manual talks about opcodes.
> 
> The score opcodes are the first letter on each line of the score.  The legal score opcodes are f, i, a, t, s, and e.
> Score opcodes are always single alphabetic characters.
> 
> On the other hand, a orchestra opcode is an alphanumeric string, such as oscil.  It is confusing that both score opcodes and orchestra opcodes are simply referred to as opcodes in the manual.
> 
> For those of you that need a justification for this [like me 8-)], suffice it to say that the word opcode has a specific meaning in computer science.  Both score opcodes and orchestra opcodes are opcodes in this sense.  However, score and orchestra opcodes are not interchangeable, just as English words are usually not interchangeable with Latin words.
> 

Sorry, but I want to quibble about this:

My feeling is that we should restrict the term 'opcode' to the orchestra
file, and use the term 'event' with respect to the score.

With a few exceptions, the basic Csound opcodes are not defined with
respect to absolute time - an instrument can be activated at any time.
Indeed, the code for an instrument could in principle be loaded into
permanent memory - for example, as the basis of a hardware synthesizer. 

A score event is however entirely defined in absolute time - even the
function tables (I'm talking about 'standard Csound here, not the the
new Extensions), and one would not normally want to frezze an event
stream in hardware, unless one was making a musical doorbell or
something! It is quite natural to refer to MIDI events; a score is
essentially Csound-speak for an event stream.


Richard Dobson