Csound Csound-dev Csound-tekno Search About

Re: igoto

Date1998-06-15 01:04
FromRichard Dobson
SubjectRe: igoto
In fact, using igoto in this way, to skip the initialzation stage of an opcode,
will hardly ever produce satisfactory results (I can't see why one would ever
want to do it), and in this case, means that memory required for the delayline
is not allocated. On a performance pass, igoto is a no-op, and the opcode is
reached, whereupon it tries to access the unallocated memory. Without the error
traps, (many of which I added to Winsound myself, having found just this
problem!), the operating system will protest as you describe.

Are you using the latest version of RTSound? I would have thought these bug
fixes will have have been added by now.

Richard Dobson
  

Kevin Gallagher wrote:
> 
> 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

Date1998-06-15 05:05
FromKevin Gallagher
SubjectRe: igoto
I have experimented with using conditionals to check some variable and
change the output accordingly.  I did this in another script where I
calculated a dozen possible outputs, and the "out" statement was changed
according to the value in my "patch" variable.  I wanted to jump around
the initialization stage of the opcode because I figured by doing so, I
could calculate only one output signal and send it out, rather than
calculate a bunch and then choose one.  I thought igoto would be an
efficient way of doing this.  Would I be correct in assuming that this is
not the case?  It seems from what you said, Csound doesn't work quite like
a typical programming "language" where you can jump around pretty much at
will without worrying much about memory allocation.  Is it (paradoxically)
easier to create several signals and then output only one?  I've done THAT
successfully, but it seems to my mind to be rather inefficient, especially
when dealing with more than 4 or 5 signals.  Thanks for your help!

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

On Mon, 15 Jun 1998, Richard Dobson wrote:

> In fact, using igoto in this way, to skip the initialzation stage of an opcode,
> will hardly ever produce satisfactory results (I can't see why one would ever
> want to do it)
I want to be able to control which opcodes it reads and which it skips
through MIDI or some other real-time outside control, as in the split
keyboard example.  Only one possible output at a time would be active, so
the other possible output(s) would be skipped.  I didn't include any MIDI
commands in my example for the sake of simplicity.

> and in this case, means that memory required for the delayline
> is not allocated. On a performance pass, igoto is a no-op, and the opcode is
> reached, whereupon it tries to access the unallocated memory. Without the error
> traps, (many of which I added to Winsound myself, having found just this
> problem!), the operating system will protest as you describe.
> 
> Are you using the latest version of RTSound? I would have thought these bug
> fixes will have have been added by now.
I got it in April, so yeah, I think it's the latest.
> 
> Richard Dobson
>   
> 
> Kevin Gallagher wrote:
> > 
> > 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
>