Csound Csound-dev Csound-tekno Search About

[Csnd] number issues in use of event

Date2011-08-28 00:25
FromDennis Raddle
Subject[Csnd] number issues in use of event
Below is the code I'm using to create an instrument (instr 1) that
invokes another instrument (instr 100) via the "event" opcode. I'm
running instr 1 as a midi instrument and invoking instr 100. I read
the midi key number via the --midi-key=5 flag. There seems to be some
problem doing arithmetic on the midi key and passing it to instr 100.
See below


; instr 1 is
; a midi instrument that takes the midi key via p5 and
; triggers one or more events via the 'event' opcode
instr 1
iampl = p4
ikey = p5
idur = i(gk__41)
iovl = i(gk__42)

; itb: time between instrument invocations
itb = idur-iovl

ktrigger init 1
if (ktrigger == 0) goto contin

;;; it is supposed to do this: several events representing a rising scale

   event "i", 100, 0*itb, idur, iampl, ikey
   event "i", 100, 1*itb, idur, iampl, ikey + 2
   event "i", 100, 2*itb, idur, iampl, ikey + 4

;; but there is something wrong with adding a number to ikey. even
;; just the following causes the problem. see below for description of
;; problem

  event "i", 100, 1*itb, idur, iampl, ikey + 2

   ktrigger = 0
contin:

endin


;; instr 100 is this
instr 100

idur=p3
iampl = p4
ikey = p5

;; the following debugging line prints the same key
;; every time instr 100 is invoked. I think the specific
;; key it prints is the value it has on the first invocation
print key

;;  lots of stuff here

endin


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-08-28 01:29
Frommatt ingalls
SubjectRe: [Csnd] number issues in use of event
im not sure if i understand what you are trying to do, but
i think you want to use "event_i" instead
(and can get rid of all the if/then stuff -- although probably replacing goto with a kgoto would 
make it work too..)


On Aug 27, 2011, at 4:25 PM, Dennis Raddle wrote:

> Below is the code I'm using to create an instrument (instr 1) that
> invokes another instrument (instr 100) via the "event" opcode. I'm
> running instr 1 as a midi instrument and invoking instr 100. I read
> the midi key number via the --midi-key=5 flag. There seems to be some
> problem doing arithmetic on the midi key and passing it to instr 100.
> See below
> 
> 
> ; instr 1 is
> ; a midi instrument that takes the midi key via p5 and
> ; triggers one or more events via the 'event' opcode
> instr 1
> iampl = p4
> ikey = p5
> idur = i(gk__41)
> iovl = i(gk__42)
> 
> ; itb: time between instrument invocations
> itb = idur-iovl
> 
> ktrigger init 1
> if (ktrigger == 0) goto contin
> 
> ;;; it is supposed to do this: several events representing a rising scale
> 
>   event "i", 100, 0*itb, idur, iampl, ikey
>   event "i", 100, 1*itb, idur, iampl, ikey + 2
>   event "i", 100, 2*itb, idur, iampl, ikey + 4
> 
> ;; but there is something wrong with adding a number to ikey. even
> ;; just the following causes the problem. see below for description of
> ;; problem
> 
>  event "i", 100, 1*itb, idur, iampl, ikey + 2
> 
>   ktrigger = 0
> contin:
> 
> endin
> 
> 
> ;; instr 100 is this
> instr 100
> 
> idur=p3
> iampl = p4
> ikey = p5
> 
> ;; the following debugging line prints the same key
> ;; every time instr 100 is invoked. I think the specific
> ;; key it prints is the value it has on the first invocation
> print key
> 
> ;;  lots of stuff here
> 
> endin
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 



Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-08-28 02:27
FromDennis Raddle
SubjectRe: [Csnd] number issues in use of event
On Sat, Aug 27, 2011 at 5:29 PM, matt ingalls  wrote:
> im not sure if i understand what you are trying to do, but
> i think you want to use "event_i" instead
> (and can get rid of all the if/then stuff -- although probably replacing goto with a kgoto would
> make it work too..)
>
>

Oh, I was wondering what the difference was between event and event_i.
Let me try this event_i.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"