Csound Csound-dev Csound-tekno Search About

igoto

Date1998-06-14 23:18
FromKevin Gallagher
Subjectigoto
I have been working on creating a script that would enable a variety of
possible "patches" for a MIDI device.  The igoto command and
conditional branching seem like they would be a large part of that.  Here
is a script I put together as a test of the logic of igoto and conditional
branching (some of the comments wrapped in this email, but you can still
tell what's supposed to be a single line.)  Trouble is it won't work:

The orchestra, "split.orc":

sr = 22050
kr = 441
ksmps = 50
nchnls = 1

instr 1
ipch=p5							;if I integrated
MIDI into this, this would read "ipch=pchmidi".
if ipch<=8 igoto below					;jumps to the
"below" section if the key is below middle C
if ipch>=8.01 igoto above				;jumps to the
"above" section if the key is above middle C
below: a1 oscil 10000, cpspch(ipch), 1			;produces a sine
wave for pitches below middle C
igoto sendit						;jumps past the
"above" section to the output statement
above: a1 pluck 10000, cpspch(ipch), cpspch(ipch), 0, 1	;produces a pluck
for pitches above middle C
sendit: out a1						;output, reached
by the igoto in the "below" section or reached naturally by the "above"
section
endin

And the score, "split.sco":

f1 0 1024 10 1	;typical GEN10 sine function table
i1 0 1 0 7.06	;chromatic scale from F# below middle C to F# above middle
C
i1 + 1 0 7.07	;7.06 through 8 should output as sine waves
i1 + 1 0 7.08
i1 + 1 0 7.09
i1 + 1 0 7.10
i1 + 1 0 7.11
i1 + 1 0 8
i1 + 1 0 8.01	;8.01 through 8.06 should output as plucks
i1 + 1 0 8.02
i1 + 1 0 8.03
i1 + 1 0 8.04
i1 + 1 0 8.05
i1 + 1 0 8.06
e

When I run this using Gabriel Maldonado's RTSound 1.8, a variation of
Csound 3.46, in conjunction with Riccardo Bianchini's WCShell95, I get
"This program has performed an illegal operation and will be shut down."
When I run it using Winsound, I get "INIT ERROR: pluck: not initialized."
I've tried all sorts of combinations, and it seems that when it skips over
a signal generator (which I guess it never TRULY does) it gets screwy.
Does anyone have experience using igoto?  Any suggestions?

			Kevin Gallagher, kgallagh@astro.temple.edu 
			Web Address - http://astro.temple.edu/~kgallagh