Csound Csound-dev Csound-tekno Search About

[Csnd] event + subinstr

Date2011-11-19 18:58
FromAnton Kholomiov
Subject[Csnd] event + subinstr
I want to combine the behaviour of event and subinstr
opcodes. event can play several notes, but gives no output
and subinstr can play only one note. 

I'd like to play several notes and get output of the instruments.
Is it possible with sime combination of opcodes? I can not use 
global variables or zak because I'd like to be able to invoke
several instances of the same instruments.


Anton

Date2011-11-19 19:26
FromVictor Lazzarini
SubjectRe: [Csnd] event + subinstr
if you want to get the output of instruments, you can still use event and one of these

1) global audio signals
2) audio bus channels (chn* opcodes)
3) zak opcodes

For example (no.1 above)

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
0dbfs=1
gabus init 0

instr 1
kcnt init 0
start:
if kcnt > 10 kgoto end
event "i", 2, 0, 5, (kcnt+1)*0.005, (kcnt+1)*50 + 270
kcnt = kcnt + 1
kgoto start

end:
event "i",3,0,5
turnoff
endin

instr 2

k1 linen p4, 0.1,p3,0.1
k2 expon 1, p3, 0.5
a1 oscili k1, p5*k2, 1
out a1
gabus = gabus + a1

endin

instr 3

k1 expsegr 1,1,1,1,0.001
a1,a2 freeverb gabus, gabus, 0.9, 0.35
out k1*(a1+a2)

gabus = 0

endin

</CsInstruments>
<CsScore>
f1 0 16384 10 1

i1 0 0.1

</CsScore>
</CsoundSynthesizer>


Regards

Victor


On 19 Nov 2011, at 18:58, Anton Kholomiov wrote:

I want to combine the behaviour of event and subinstr
opcodes. event can play several notes, but gives no output
and subinstr can play only one note. 

I'd like to play several notes and get output of the instruments.
Is it possible with sime combination of opcodes? I can not use 
global variables or zak because I'd like to be able to invoke
several instances of the same instruments.


Anton

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-11-19 20:46
FromAnton Kholomiov
SubjectRe: [Csnd] event + subinstr
I can not use it that way. If I'm invoking 'instr 2' 
at the same time from two instruments in gabus
I'm getting consequences of both events while
I want to use them separately. 

Anton

2011/11/19 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
if you want to get the output of instruments, you can still use event and one of these

1) global audio signals
2) audio bus channels (chn* opcodes)
3) zak opcodes

For example (no.1 above)

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
0dbfs=1
gabus init 0

instr 1
kcnt init 0
start:
if kcnt > 10 kgoto end
event "i", 2, 0, 5, (kcnt+1)*0.005, (kcnt+1)*50 + 270
kcnt = kcnt + 1
kgoto start

end:
event "i",3,0,5
turnoff
endin

instr 2

k1 linen p4, 0.1,p3,0.1
k2 expon 1, p3, 0.5
a1 oscili k1, p5*k2, 1
out a1
gabus = gabus + a1

endin

instr 3

k1 expsegr 1,1,1,1,0.001
a1,a2 freeverb gabus, gabus, 0.9, 0.35
out k1*(a1+a2)

gabus = 0

endin

</CsInstruments>
<CsScore>
f1 0 16384 10 1

i1 0 0.1

</CsScore>
</CsoundSynthesizer>


Regards

Victor


On 19 Nov 2011, at 18:58, Anton Kholomiov wrote:

I want to combine the behaviour of event and subinstr
opcodes. event can play several notes, but gives no output
and subinstr can play only one note. 

I'd like to play several notes and get output of the instruments.
Is it possible with sime combination of opcodes? I can not use 
global variables or zak because I'd like to be able to invoke
several instances of the same instruments.


Anton

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Date2011-11-19 20:53
FromAnton Kholomiov
SubjectRe: [Csnd] event + subinstr
I'd like to write somehow

  instr 1
  ...
  ...
  out sig
  endin

  instr 2 
a1   subinstr {{
              i 1, 0, 1, ...
              i 1, 1, 1, ... }}  
  ...
  endin


  instr 3 
a1   subinstr {{
              i 1, 0, 1, ...
              i 1, 1, 1, ... }}  
  ...
  endin

2011/11/19 Anton Kholomiov <anton.kholomiov@gmail.com>
I can not use it that way. If I'm invoking 'instr 2' 
at the same time from two instruments in gabus
I'm getting consequences of both events while
I want to use them separately. 

Anton

2011/11/19 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
if you want to get the output of instruments, you can still use event and one of these

1) global audio signals
2) audio bus channels (chn* opcodes)
3) zak opcodes

For example (no.1 above)

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
0dbfs=1
gabus init 0

instr 1
kcnt init 0
start:
if kcnt > 10 kgoto end
event "i", 2, 0, 5, (kcnt+1)*0.005, (kcnt+1)*50 + 270
kcnt = kcnt + 1
kgoto start

end:
event "i",3,0,5
turnoff
endin

instr 2

k1 linen p4, 0.1,p3,0.1
k2 expon 1, p3, 0.5
a1 oscili k1, p5*k2, 1
out a1
gabus = gabus + a1

endin

instr 3

k1 expsegr 1,1,1,1,0.001
a1,a2 freeverb gabus, gabus, 0.9, 0.35
out k1*(a1+a2)

gabus = 0

endin

</CsInstruments>
<CsScore>
f1 0 16384 10 1

i1 0 0.1

</CsScore>
</CsoundSynthesizer>


Regards

Victor


On 19 Nov 2011, at 18:58, Anton Kholomiov wrote:

I want to combine the behaviour of event and subinstr
opcodes. event can play several notes, but gives no output
and subinstr can play only one note. 

I'd like to play several notes and get output of the instruments.
Is it possible with sime combination of opcodes? I can not use 
global variables or zak because I'd like to be able to invoke
several instances of the same instruments.


Anton

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie






Date2011-11-19 21:37
FromVictor Lazzarini
SubjectRe: [Csnd] event + subinstr
And what is the difference between instr 2 & 3? I don't follow. 

If you want the output of some instances of a instr to go elsewhere, just use more than one bus and patch accordingly.
Here's another example. Half of instr 2 instances go to reverb and half go to flanger. This uses bus channels, but you could have used
globals or zak too.

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
0dbfs=1

instr 1
kcnt init 0
start:
if kcnt > 10 kgoto end
event "i", 2, 0, 5, (kcnt+1)*0.005, (kcnt+1)*50 + 270, kcnt%2
kcnt = kcnt + 1
kgoto start

end:
event "i",3,0,5
event "i",4,0,5
turnoff
endin

instr 2
arev init 0
aflan init 0
k1 linen p4, 0.1,p3,0.1
k2 expon 1, p3, 0.5
a1 oscili k1, p5*k2, 1
out a1
if p6 == 1 goto flang
arev = a1
goto chans
flang:
aflan = a1
chans:
chnmix arev, "reverb"
chnmix aflan, "flanger"

endin

instr 3

asig chnget "reverb"
k1 expsegr 1,1,1,1,0.001
a1,a2 freeverb asig, asig, 0.9, 0.35
out k1*(a1+a2)
chnclear "reverb"

endin

instr 4

asig chnget "flanger"
k1 expsegr 1,1,1,1,0.001
adel oscili 0.001, 1, 1
a1 flanger asig, adel+0.001, 0.9
out k1*a1
chnclear "flanger"

endin

</CsInstruments>
<CsScore>
f1 0 16384 10 1

i1 0 0.1

</CsScore>
</CsoundSynthesizer>


On 19 Nov 2011, at 20:53, Anton Kholomiov wrote:

I'd like to write somehow

  instr 1
  ...
  ...
  out sig
  endin

  instr 2 
a1   subinstr {{
              i 1, 0, 1, ...
              i 1, 1, 1, ... }}  
  ...
  endin


  instr 3 
a1   subinstr {{
              i 1, 0, 1, ...
              i 1, 1, 1, ... }}  
  ...
  endin

2011/11/19 Anton Kholomiov <anton.kholomiov@gmail.com>
I can not use it that way. If I'm invoking 'instr 2' 
at the same time from two instruments in gabus
I'm getting consequences of both events while
I want to use them separately. 

Anton

2011/11/19 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
if you want to get the output of instruments, you can still use event and one of these

1) global audio signals
2) audio bus channels (chn* opcodes)
3) zak opcodes

For example (no.1 above)

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
0dbfs=1
gabus init 0

instr 1
kcnt init 0
start:
if kcnt > 10 kgoto end
event "i", 2, 0, 5, (kcnt+1)*0.005, (kcnt+1)*50 + 270
kcnt = kcnt + 1
kgoto start

end:
event "i",3,0,5
turnoff
endin

instr 2

k1 linen p4, 0.1,p3,0.1
k2 expon 1, p3, 0.5
a1 oscili k1, p5*k2, 1
out a1
gabus = gabus + a1

endin

instr 3

k1 expsegr 1,1,1,1,0.001
a1,a2 freeverb gabus, gabus, 0.9, 0.35
out k1*(a1+a2)

gabus = 0

endin

</CsInstruments>
<CsScore>
f1 0 16384 10 1

i1 0 0.1

</CsScore>
</CsoundSynthesizer>


Regards

Victor


On 19 Nov 2011, at 18:58, Anton Kholomiov wrote:

I want to combine the behaviour of event and subinstr
opcodes. event can play several notes, but gives no output
and subinstr can play only one note. 

I'd like to play several notes and get output of the instruments.
Is it possible with sime combination of opcodes? I can not use 
global variables or zak because I'd like to be able to invoke
several instances of the same instruments.


Anton

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie






Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-11-20 15:33
FromAnton Kholomiov
SubjectRe: [Csnd] event + subinstr


2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
And what is the difference between instr 2 & 3? I don't follow. 

Difference is hidden by sequence of dots)
Your solution requires  one named channel per instance,
I've tried to do it another way and I've run into strange behavior.
I'm trying to redirect the output of instrument with SignalFlow
opcodes. Instrument B collects all notes for instrument A.
Then some another instrument invokes B with subinstr
opcode. But it doesn't work as expected. I'm invoking
instrument C twice, one is long note (it plays all A's notes)
and one is short note (it plays only one A's note), 
but I can hear both notes as if they are long notes.
What am I missing here?

Here is the code:

<CsoundSynthesizer>
<CsOptions>
-d -odac
</CsOptions>

<CsInstruments>

connect "A", "out", "B", "in"

    instr   A
k1  oscili  1, 1/p3, 21
a1  oscili  8000*k1, p4, 1
    outleta "out", a1
    endin
    
    instr   B
    event_i "i", "A", 0, 0.5, 440
    event_i "i", "A", 0.5, 0.5, 330
    event_i "i", "A", 1, 1, 220        
    event_i "i", "A", 2, 0.5, 220
    event_i "i", "A", 2.5, 0.5, 330
    event_i "i", "A", 3, 1, 440    

a1  inleta  "in"
    out a1
    endin
    

    instr C
a1  subinstr "B", 0, p3
    out p4*a1
    endin

</CsInstruments>

<CsScore>
f1 0 4096 10 1

f21 0 17 5 1 16 0.01 

i"C" 0 7 0.5
i"C" 0.25 0.2 1
e
</CsScore>
</CsoundSynthesizer>




Date2011-11-20 15:47
FromVictor Lazzarini
SubjectRe: [Csnd] event + subinstr
SignalFlow opcodes is Michael Gogins'  territory, so I will not be able to help you there...

Victor
On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
And what is the difference between instr 2 & 3? I don't follow. 

Difference is hidden by sequence of dots)
Your solution requires  one named channel per instance,
I've tried to do it another way and I've run into strange behavior.
I'm trying to redirect the output of instrument with SignalFlow
opcodes. Instrument B collects all notes for instrument A.
Then some another instrument invokes B with subinstr
opcode. But it doesn't work as expected. I'm invoking
instrument C twice, one is long note (it plays all A's notes)
and one is short note (it plays only one A's note), 
but I can hear both notes as if they are long notes.
What am I missing here?

Here is the code:

<CsoundSynthesizer>
<CsOptions>
-d -odac
</CsOptions>

<CsInstruments>

connect "A", "out", "B", "in"

    instr   A
k1  oscili  1, 1/p3, 21
a1  oscili  8000*k1, p4, 1
    outleta "out", a1
    endin
    
    instr   B
    event_i "i", "A", 0, 0.5, 440
    event_i "i", "A", 0.5, 0.5, 330
    event_i "i", "A", 1, 1, 220        
    event_i "i", "A", 2, 0.5, 220
    event_i "i", "A", 2.5, 0.5, 330
    event_i "i", "A", 3, 1, 440    

a1  inleta  "in"
    out a1
    endin
    

    instr C
a1  subinstr "B", 0, p3
    out p4*a1
    endin

</CsInstruments>

<CsScore>
f1 0 4096 10 1

f21 0 17 5 1 16 0.01 

i"C" 0 7 0.5
i"C" 0.25 0.2 1
e
</CsScore>
</CsoundSynthesizer>




Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-11-20 16:16
FromAnton Kholomiov
SubjectRe: [Csnd] event + subinstr
It happens because event_i adds score events at
initialisation of an instrument. And SignalFlow opcodes
work like global variables every new instance of instrument
A adds data to instrument B, so the second note 

i"C" 0.25 0.2 1

writes all new notes of instrument A, and we can 
hear them in the note

i"C" 0 7 0.5

because instrument B is still listening on the channel "in".
Global variables (sigh)



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
SignalFlow opcodes is Michael Gogins'  territory, so I will not be able to help you there...

Victor

On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
And what is the difference between instr 2 & 3? I don't follow. 

Difference is hidden by sequence of dots)
Your solution requires  one named channel per instance,
I've tried to do it another way and I've run into strange behavior.
I'm trying to redirect the output of instrument with SignalFlow
opcodes. Instrument B collects all notes for instrument A.
Then some another instrument invokes B with subinstr
opcode. But it doesn't work as expected. I'm invoking
instrument C twice, one is long note (it plays all A's notes)
and one is short note (it plays only one A's note), 
but I can hear both notes as if they are long notes.
What am I missing here?

Here is the code:

<CsoundSynthesizer>
<CsOptions>
-d -odac
</CsOptions>

<CsInstruments>

connect "A", "out", "B", "in"

    instr   A
k1  oscili  1, 1/p3, 21
a1  oscili  8000*k1, p4, 1
    outleta "out", a1
    endin
    
    instr   B
    event_i "i", "A", 0, 0.5, 440
    event_i "i", "A", 0.5, 0.5, 330
    event_i "i", "A", 1, 1, 220        
    event_i "i", "A", 2, 0.5, 220
    event_i "i", "A", 2.5, 0.5, 330
    event_i "i", "A", 3, 1, 440    

a1  inleta  "in"
    out a1
    endin
    

    instr C
a1  subinstr "B", 0, p3
    out p4*a1
    endin

</CsInstruments>

<CsScore>
f1 0 4096 10 1

f21 0 17 5 1 16 0.01 

i"C" 0 7 0.5
i"C" 0.25 0.2 1
e
</CsScore>
</CsoundSynthesizer>




Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Date2011-11-20 16:25
FromVictor Lazzarini
SubjectRe: [Csnd] event + subinstr
Maybe what you want to do is better served by UDOs?

Victor

On 20 Nov 2011, at 16:16, Anton Kholomiov wrote:

It happens because event_i adds score events at
initialisation of an instrument. And SignalFlow opcodes
work like global variables every new instance of instrument
A adds data to instrument B, so the second note 

i"C" 0.25 0.2 1

writes all new notes of instrument A, and we can 
hear them in the note

i"C" 0 7 0.5

because instrument B is still listening on the channel "in".
Global variables (sigh)



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
SignalFlow opcodes is Michael Gogins'  territory, so I will not be able to help you there...

Victor

On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
And what is the difference between instr 2 & 3? I don't follow. 

Difference is hidden by sequence of dots)
Your solution requires  one named channel per instance,
I've tried to do it another way and I've run into strange behavior.
I'm trying to redirect the output of instrument with SignalFlow
opcodes. Instrument B collects all notes for instrument A.
Then some another instrument invokes B with subinstr
opcode. But it doesn't work as expected. I'm invoking
instrument C twice, one is long note (it plays all A's notes)
and one is short note (it plays only one A's note), 
but I can hear both notes as if they are long notes.
What am I missing here?

Here is the code:

<CsoundSynthesizer>
<CsOptions>
-d -odac
</CsOptions>

<CsInstruments>

connect "A", "out", "B", "in"

    instr   A
k1  oscili  1, 1/p3, 21
a1  oscili  8000*k1, p4, 1
    outleta "out", a1
    endin
    
    instr   B
    event_i "i", "A", 0, 0.5, 440
    event_i "i", "A", 0.5, 0.5, 330
    event_i "i", "A", 1, 1, 220        
    event_i "i", "A", 2, 0.5, 220
    event_i "i", "A", 2.5, 0.5, 330
    event_i "i", "A", 3, 1, 440    

a1  inleta  "in"
    out a1
    endin
    

    instr C
a1  subinstr "B", 0, p3
    out p4*a1
    endin

</CsInstruments>

<CsScore>
f1 0 4096 10 1

f21 0 17 5 1 16 0.01 

i"C" 0 7 0.5
i"C" 0.25 0.2 1
e
</CsScore>
</CsoundSynthesizer>




Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-11-20 16:47
FromAnton Kholomiov
SubjectRe: [Csnd] event + subinstr
I don't know how can it help. UDOs build combination
of existing opcodes. But there is no such combination.
I'm trying to read output of several instruments. Often
globals are used for this task, but globals merge things 
together.


Anton



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Maybe what you want to do is better served by UDOs?

Victor

On 20 Nov 2011, at 16:16, Anton Kholomiov wrote:

It happens because event_i adds score events at
initialisation of an instrument. And SignalFlow opcodes
work like global variables every new instance of instrument
A adds data to instrument B, so the second note 

i"C" 0.25 0.2 1

writes all new notes of instrument A, and we can 
hear them in the note

i"C" 0 7 0.5

because instrument B is still listening on the channel "in".
Global variables (sigh)



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
SignalFlow opcodes is Michael Gogins'  territory, so I will not be able to help you there...

Victor

On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
And what is the difference between instr 2 & 3? I don't follow. 

Difference is hidden by sequence of dots)
Your solution requires  one named channel per instance,
I've tried to do it another way and I've run into strange behavior.
I'm trying to redirect the output of instrument with SignalFlow
opcodes. Instrument B collects all notes for instrument A.
Then some another instrument invokes B with subinstr
opcode. But it doesn't work as expected. I'm invoking
instrument C twice, one is long note (it plays all A's notes)
and one is short note (it plays only one A's note), 
but I can hear both notes as if they are long notes.
What am I missing here?

Here is the code:

<CsoundSynthesizer>
<CsOptions>
-d -odac
</CsOptions>

<CsInstruments>

connect "A", "out", "B", "in"

    instr   A
k1  oscili  1, 1/p3, 21
a1  oscili  8000*k1, p4, 1
    outleta "out", a1
    endin
    
    instr   B
    event_i "i", "A", 0, 0.5, 440
    event_i "i", "A", 0.5, 0.5, 330
    event_i "i", "A", 1, 1, 220        
    event_i "i", "A", 2, 0.5, 220
    event_i "i", "A", 2.5, 0.5, 330
    event_i "i", "A", 3, 1, 440    

a1  inleta  "in"
    out a1
    endin
    

    instr C
a1  subinstr "B", 0, p3
    out p4*a1
    endin

</CsInstruments>

<CsScore>
f1 0 4096 10 1

f21 0 17 5 1 16 0.01 

i"C" 0 7 0.5
i"C" 0.25 0.2 1
e
</CsScore>
</CsoundSynthesizer>




Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Date2011-11-20 18:54
FromVictor Lazzarini
SubjectRe: [Csnd] event + subinstr
you just have to make your instruments into UDOs. UDOs can be recursive, so you can spawn a number of parallel instances, that might help.

Victor
On 20 Nov 2011, at 16:47, Anton Kholomiov wrote:

I don't know how can it help. UDOs build combination
of existing opcodes. But there is no such combination.
I'm trying to read output of several instruments. Often
globals are used for this task, but globals merge things 
together.


Anton



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Maybe what you want to do is better served by UDOs?

Victor

On 20 Nov 2011, at 16:16, Anton Kholomiov wrote:

It happens because event_i adds score events at
initialisation of an instrument. And SignalFlow opcodes
work like global variables every new instance of instrument
A adds data to instrument B, so the second note 

i"C" 0.25 0.2 1

writes all new notes of instrument A, and we can 
hear them in the note

i"C" 0 7 0.5

because instrument B is still listening on the channel "in".
Global variables (sigh)



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
SignalFlow opcodes is Michael Gogins'  territory, so I will not be able to help you there...

Victor

On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:



2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
And what is the difference between instr 2 & 3? I don't follow. 

Difference is hidden by sequence of dots)
Your solution requires  one named channel per instance,
I've tried to do it another way and I've run into strange behavior.
I'm trying to redirect the output of instrument with SignalFlow
opcodes. Instrument B collects all notes for instrument A.
Then some another instrument invokes B with subinstr
opcode. But it doesn't work as expected. I'm invoking
instrument C twice, one is long note (it plays all A's notes)
and one is short note (it plays only one A's note), 
but I can hear both notes as if they are long notes.
What am I missing here?

Here is the code:

<CsoundSynthesizer>
<CsOptions>
-d -odac
</CsOptions>

<CsInstruments>

connect "A", "out", "B", "in"

    instr   A
k1  oscili  1, 1/p3, 21
a1  oscili  8000*k1, p4, 1
    outleta "out", a1
    endin
    
    instr   B
    event_i "i", "A", 0, 0.5, 440
    event_i "i", "A", 0.5, 0.5, 330
    event_i "i", "A", 1, 1, 220        
    event_i "i", "A", 2, 0.5, 220
    event_i "i", "A", 2.5, 0.5, 330
    event_i "i", "A", 3, 1, 440    

a1  inleta  "in"
    out a1
    endin
    

    instr C
a1  subinstr "B", 0, p3
    out p4*a1
    endin

</CsInstruments>

<CsScore>
f1 0 4096 10 1

f21 0 17 5 1 16 0.01 

i"C" 0 7 0.5
i"C" 0.25 0.2 1
e
</CsScore>
</CsoundSynthesizer>




Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-11-21 08:39
FromTito Latini
SubjectRe: [Csnd] event + subinstr
AttachmentsNone  

Date2011-11-21 08:50
Fromjoachim heintz
SubjectRe: [Csnd] event + subinstr
i don't understand why victor's example with the chn opcodes did not
work for you. they are like busses, and you can do whatever you want:
merging or not, sending globals or seperate channels. i am pretty sure
that you can get what you want with them. i might help you, too, but i
didn't understand your point yet. if you like, please give a reduced
example.
best -
	joachim



Am 20.11.2011 17:47, schrieb Anton Kholomiov:
> I don't know how can it help. UDOs build combination
> of existing opcodes. But there is no such combination.
> I'm trying to read output of several instruments. Often
> globals are used for this task, but globals merge things 
> together.
> 
> 
> Anton
> 
> 
> 
> 2011/11/20 Victor Lazzarini  >
> 
>     Maybe what you want to do is better served by UDOs?
> 
>     Victor
> 
>     On 20 Nov 2011, at 16:16, Anton Kholomiov wrote:
> 
>>     It happens because event_i adds score events at
>>     initialisation of an instrument. And SignalFlow opcodes
>>     work like global variables every new instance of instrument
>>     A adds data to instrument B, so the second note 
>>
>>     i"C" 0.25 0.2 1
>>
>>     writes all new notes of instrument A, and we can 
>>     hear them in the note
>>
>>     i"C" 0 7 0.5
>>
>>     because instrument B is still listening on the channel "in".
>>     Global variables (sigh)
>>
>>
>>
>>     2011/11/20 Victor Lazzarini >     >
>>
>>         SignalFlow opcodes is Michael Gogins'  territory, so I will
>>         not be able to help you there...
>>
>>         Victor
>>
>>         On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:
>>
>>>
>>>
>>>         2011/11/20 Victor Lazzarini >>         >
>>>
>>>             And what is the difference between instr 2 & 3? I don't
>>>             follow. 
>>>
>>>         Difference is hidden by sequence of dots)
>>>         Your solution requires  one named channel per instance,
>>>         I've tried to do it another way and I've run into strange
>>>         behavior.
>>>         I'm trying to redirect the output of instrument with SignalFlow
>>>         opcodes. Instrument B collects all notes for instrument A.
>>>         Then some another instrument invokes B with subinstr
>>>         opcode. But it doesn't work as expected. I'm invoking
>>>         instrument C twice, one is long note (it plays all A's notes)
>>>         and one is short note (it plays only one A's note), 
>>>         but I can hear both notes as if they are long notes.
>>>         What am I missing here?
>>>
>>>         Here is the code:
>>>
>>>         
>>>         
>>>         -d -odac
>>>         
>>>
>>>         
>>>
>>>         connect "A", "out", "B", "in"
>>>
>>>             instr   A
>>>         k1  oscili  1, 1/p3, 21
>>>         a1  oscili  8000*k1, p4, 1
>>>             outleta "out", a1
>>>             endin
>>>             
>>>             instr   B
>>>             event_i "i", "A", 0, 0.5, 440
>>>             event_i "i", "A", 0.5, 0.5, 330
>>>             event_i "i", "A", 1, 1, 220        
>>>             event_i "i", "A", 2, 0.5, 220
>>>             event_i "i", "A", 2.5, 0.5, 330
>>>             event_i "i", "A", 3, 1, 440    
>>>
>>>         a1  inleta  "in"
>>>             out a1
>>>             endin
>>>             
>>>
>>>             instr C
>>>         a1  subinstr "B", 0, p3
>>>             out p4*a1
>>>             endin
>>>
>>>         
>>>
>>>         
>>>         f1 0 4096 10 1
>>>
>>>         f21 0 17 5 1 16 0.01 
>>>
>>>         i"C" 0 7 0.5
>>>         i"C" 0.25 0.2 1
>>>         e
>>>         
>>>         
>>>
>>>
>>>
>>
>>         Dr Victor Lazzarini
>>         Senior Lecturer
>>         Dept. of Music
>>         NUI Maynooth Ireland
>>         tel.: +353 1 708 3545
>>         Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
> 
>     Dr Victor Lazzarini
>     Senior Lecturer
>     Dept. of Music
>     NUI Maynooth Ireland
>     tel.: +353 1 708 3545
>     Victor dot Lazzarini AT nuim dot ie
> 
> 
> 
> 


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-11-22 17:37
FromAnton Kholomiov
SubjectRe: [Csnd] event + subinstr
to Victor

Sorry but I don't understand how can it help.
I can make A-instrument into UDO. But I can not
express the sequence of notes (what event-opcode does)
and get the cumulative signal.

to Tito:

Your example is the same as mine, you have
switched from one globals to another ones. 
It sounds the same.

to Joachim 

With globals I can not play two instances of the same
instrument simultaneously. They all merged into one 
named-channel. I have to reserve names for all 
invokations. 


2011/11/21 joachim heintz <jh@joachimheintz.de>
i don't understand why victor's example with the chn opcodes did not
work for you. they are like busses, and you can do whatever you want:
merging or not, sending globals or seperate channels. i am pretty sure
that you can get what you want with them. i might help you, too, but i
didn't understand your point yet. if you like, please give a reduced
example.
best -
       joachim



Am 20.11.2011 17:47, schrieb Anton Kholomiov:
> I don't know how can it help. UDOs build combination
> of existing opcodes. But there is no such combination.
> I'm trying to read output of several instruments. Often
> globals are used for this task, but globals merge things
> together.
>
>
> Anton
>
>
>
> 2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie
> <mailto:Victor.Lazzarini@nuim.ie>>
>
>     Maybe what you want to do is better served by UDOs?
>
>     Victor
>
>     On 20 Nov 2011, at 16:16, Anton Kholomiov wrote:
>
>>     It happens because event_i adds score events at
>>     initialisation of an instrument. And SignalFlow opcodes
>>     work like global variables every new instance of instrument
>>     A adds data to instrument B, so the second note
>>
>>     i"C" 0.25 0.2 1
>>
>>     writes all new notes of instrument A, and we can
>>     hear them in the note
>>
>>     i"C" 0 7 0.5
>>
>>     because instrument B is still listening on the channel "in".
>>     Global variables (sigh)
>>
>>
>>
>>     2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie
>>     <mailto:Victor.Lazzarini@nuim.ie>>
>>
>>         SignalFlow opcodes is Michael Gogins'  territory, so I will
>>         not be able to help you there...
>>
>>         Victor
>>
>>         On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:
>>
>>>
>>>
>>>         2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie
>>>         <mailto:Victor.Lazzarini@nuim.ie>>
>>>
>>>             And what is the difference between instr 2 & 3? I don't
>>>             follow.
>>>
>>>         Difference is hidden by sequence of dots)
>>>         Your solution requires  one named channel per instance,
>>>         I've tried to do it another way and I've run into strange
>>>         behavior.
>>>         I'm trying to redirect the output of instrument with SignalFlow
>>>         opcodes. Instrument B collects all notes for instrument A.
>>>         Then some another instrument invokes B with subinstr
>>>         opcode. But it doesn't work as expected. I'm invoking
>>>         instrument C twice, one is long note (it plays all A's notes)
>>>         and one is short note (it plays only one A's note),
>>>         but I can hear both notes as if they are long notes.
>>>         What am I missing here?
>>>
>>>         Here is the code:
>>>
>>>         <CsoundSynthesizer>
>>>         <CsOptions>
>>>         -d -odac
>>>         </CsOptions>
>>>
>>>         <CsInstruments>
>>>
>>>         connect "A", "out", "B", "in"
>>>
>>>             instr   A
>>>         k1  oscili  1, 1/p3, 21
>>>         a1  oscili  8000*k1, p4, 1
>>>             outleta "out", a1
>>>             endin
>>>
>>>             instr   B
>>>             event_i "i", "A", 0, 0.5, 440
>>>             event_i "i", "A", 0.5, 0.5, 330
>>>             event_i "i", "A", 1, 1, 220
>>>             event_i "i", "A", 2, 0.5, 220
>>>             event_i "i", "A", 2.5, 0.5, 330
>>>             event_i "i", "A", 3, 1, 440
>>>
>>>         a1  inleta  "in"
>>>             out a1
>>>             endin
>>>
>>>
>>>             instr C
>>>         a1  subinstr "B", 0, p3
>>>             out p4*a1
>>>             endin
>>>
>>>         </CsInstruments>
>>>
>>>         <CsScore>
>>>         f1 0 4096 10 1
>>>
>>>         f21 0 17 5 1 16 0.01
>>>
>>>         i"C" 0 7 0.5
>>>         i"C" 0.25 0.2 1
>>>         e
>>>         </CsScore>
>>>         </CsoundSynthesizer>
>>>
>>>
>>>
>>
>>         Dr Victor Lazzarini
>>         Senior Lecturer
>>         Dept. of Music
>>         NUI Maynooth Ireland
>>         tel.: +353 1 708 3545
>>         Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>
>     Dr Victor Lazzarini
>     Senior Lecturer
>     Dept. of Music
>     NUI Maynooth Ireland
>     tel.: +353 1 708 3545
>     Victor dot Lazzarini AT nuim dot ie
>
>
>
>


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-11-22 17:45
FromAdam Puckett
SubjectRe: [Csnd] event + subinstr
You just have to have a global variable for each instrument, add the
instrument signal to the designated global variable, and then feed
them all to a mixer and output them, like this:

gavar1 init 0
gavar2 init 0
gavar3 init 0
instr 1
...
gavar1 = gavar1 + asig
endin
instr 2
...
gavar2 = gavar2 + asig
endin
instr 3
...
gavar3 = gavar3 + asig
endin
...
instr 99
asig = gavar1+gavar2+gavar3
out asig
; Don't forget to clear each global variable!
gavar1 = 0
gavar2 = 0
gavar3 = 0
; Also, probably beside the point, note the difference between "=" and "init"
endin


On 11/22/11, Anton Kholomiov  wrote:
> to Victor
>
> Sorry but I don't understand how can it help.
> I can make A-instrument into UDO. But I can not
> express the sequence of notes (what event-opcode does)
> and get the cumulative signal.
>
> to Tito:
>
> Your example is the same as mine, you have
> switched from one globals to another ones.
> It sounds the same.
>
> to Joachim
>
> With globals I can not play two instances of the same
> instrument simultaneously. They all merged into one
> named-channel. I have to reserve names for all
> invokations.
>
>
> 2011/11/21 joachim heintz 
>
>> i don't understand why victor's example with the chn opcodes did not
>> work for you. they are like busses, and you can do whatever you want:
>> merging or not, sending globals or seperate channels. i am pretty sure
>> that you can get what you want with them. i might help you, too, but i
>> didn't understand your point yet. if you like, please give a reduced
>> example.
>> best -
>>        joachim
>>
>>
>>
>> Am 20.11.2011 17:47, schrieb Anton Kholomiov:
>> > I don't know how can it help. UDOs build combination
>> > of existing opcodes. But there is no such combination.
>> > I'm trying to read output of several instruments. Often
>> > globals are used for this task, but globals merge things
>> > together.
>> >
>> >
>> > Anton
>> >
>> >
>> >
>> > 2011/11/20 Victor Lazzarini > > >
>> >
>> >     Maybe what you want to do is better served by UDOs?
>> >
>> >     Victor
>> >
>> >     On 20 Nov 2011, at 16:16, Anton Kholomiov wrote:
>> >
>> >>     It happens because event_i adds score events at
>> >>     initialisation of an instrument. And SignalFlow opcodes
>> >>     work like global variables every new instance of instrument
>> >>     A adds data to instrument B, so the second note
>> >>
>> >>     i"C" 0.25 0.2 1
>> >>
>> >>     writes all new notes of instrument A, and we can
>> >>     hear them in the note
>> >>
>> >>     i"C" 0 7 0.5
>> >>
>> >>     because instrument B is still listening on the channel "in".
>> >>     Global variables (sigh)
>> >>
>> >>
>> >>
>> >>     2011/11/20 Victor Lazzarini > >>     >
>> >>
>> >>         SignalFlow opcodes is Michael Gogins'  territory, so I will
>> >>         not be able to help you there...
>> >>
>> >>         Victor
>> >>
>> >>         On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:
>> >>
>> >>>
>> >>>
>> >>>         2011/11/20 Victor Lazzarini > >>>         >
>> >>>
>> >>>             And what is the difference between instr 2 & 3? I don't
>> >>>             follow.
>> >>>
>> >>>         Difference is hidden by sequence of dots)
>> >>>         Your solution requires  one named channel per instance,
>> >>>         I've tried to do it another way and I've run into strange
>> >>>         behavior.
>> >>>         I'm trying to redirect the output of instrument with
>> >>> SignalFlow
>> >>>         opcodes. Instrument B collects all notes for instrument A.
>> >>>         Then some another instrument invokes B with subinstr
>> >>>         opcode. But it doesn't work as expected. I'm invoking
>> >>>         instrument C twice, one is long note (it plays all A's notes)
>> >>>         and one is short note (it plays only one A's note),
>> >>>         but I can hear both notes as if they are long notes.
>> >>>         What am I missing here?
>> >>>
>> >>>         Here is the code:
>> >>>
>> >>>         
>> >>>         
>> >>>         -d -odac
>> >>>         
>> >>>
>> >>>         
>> >>>
>> >>>         connect "A", "out", "B", "in"
>> >>>
>> >>>             instr   A
>> >>>         k1  oscili  1, 1/p3, 21
>> >>>         a1  oscili  8000*k1, p4, 1
>> >>>             outleta "out", a1
>> >>>             endin
>> >>>
>> >>>             instr   B
>> >>>             event_i "i", "A", 0, 0.5, 440
>> >>>             event_i "i", "A", 0.5, 0.5, 330
>> >>>             event_i "i", "A", 1, 1, 220
>> >>>             event_i "i", "A", 2, 0.5, 220
>> >>>             event_i "i", "A", 2.5, 0.5, 330
>> >>>             event_i "i", "A", 3, 1, 440
>> >>>
>> >>>         a1  inleta  "in"
>> >>>             out a1
>> >>>             endin
>> >>>
>> >>>
>> >>>             instr C
>> >>>         a1  subinstr "B", 0, p3
>> >>>             out p4*a1
>> >>>             endin
>> >>>
>> >>>         
>> >>>
>> >>>         
>> >>>         f1 0 4096 10 1
>> >>>
>> >>>         f21 0 17 5 1 16 0.01
>> >>>
>> >>>         i"C" 0 7 0.5
>> >>>         i"C" 0.25 0.2 1
>> >>>         e
>> >>>         
>> >>>         
>> >>>
>> >>>
>> >>>
>> >>
>> >>         Dr Victor Lazzarini
>> >>         Senior Lecturer
>> >>         Dept. of Music
>> >>         NUI Maynooth Ireland
>> >>         tel.: +353 1 708 3545
>> >>         Victor dot Lazzarini AT nuim dot ie
>> >>
>> >>
>> >>
>> >>
>> >
>> >     Dr Victor Lazzarini
>> >     Senior Lecturer
>> >     Dept. of Music
>> >     NUI Maynooth Ireland
>> >     tel.: +353 1 708 3545
>> >     Victor dot Lazzarini AT nuim dot ie
>> >
>> >
>> >
>> >
>>
>>
>> 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"
>
>


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-11-22 18:14
FromKelly Hirai
SubjectRe: [Csnd] event + subinstr
On 11/19/11 13:58, Anton Kholomiov wrote:
I want to combine the behaviour of event and subinstr
opcodes. event can play several notes, but gives no output
and subinstr can play only one note. 

I'd like to play several notes and get output of the instruments.
Is it possible with sime combination of opcodes? I can not use 
global variables or zak because I'd like to be able to invoke
several instances of the same instruments.


Anton

if you are need k-rate i/o, you can take a global ftable and use an event instance number to index into the table.  a-rate might be more challenging as you are have to allocate block sized buffers, i haven't really looked into the a-rate case. recovering finished event instances and recycling their numbers is another aspect of the problem. there is a table of event instance numbers that needs to be maintained so the "gathering" process knows what blocks in the global ftable are valid. technically, i believe it is a "scatter gather" problem which is well defined and thus has some well defined solutions. i had to do this somewhere, let me see if i can find it. maybe what you need is a sparse dynamic zak patch system?

kelly



Date2011-11-22 18:25
FromVictor Lazzarini
SubjectRe: [Csnd] event + subinstr
Well, depending on what you want to do, you can:

opcode Accum, a, kkpp

 k1,k2,ibnd,icnt xin

 if (icnt >= ibnd) goto bank

 abnd Accum  k1,k2,ibnd,icnt+1

bank:

 ao ....  ; do your synthesis here, use k1, k2

 amix = ao + abnd

xout amix

endop


instr 1

...

inum =    .... ; number of recursive UDO calls
asig Accum  k1,k2, inum

     out asig

endin




On 22 Nov 2011, at 17:37, Anton Kholomiov wrote:

to Victor

Sorry but I don't understand how can it help.
I can make A-instrument into UDO. But I can not
express the sequence of notes (what event-opcode does)
and get the cumulative signal.

to Tito:

Your example is the same as mine, you have
switched from one globals to another ones. 
It sounds the same.

to Joachim 

With globals I can not play two instances of the same
instrument simultaneously. They all merged into one 
named-channel. I have to reserve names for all 
invokations. 


2011/11/21 joachim heintz <jh@joachimheintz.de>
i don't understand why victor's example with the chn opcodes did not
work for you. they are like busses, and you can do whatever you want:
merging or not, sending globals or seperate channels. i am pretty sure
that you can get what you want with them. i might help you, too, but i
didn't understand your point yet. if you like, please give a reduced
example.
best -
       joachim



Am 20.11.2011 17:47, schrieb Anton Kholomiov:
> I don't know how can it help. UDOs build combination
> of existing opcodes. But there is no such combination.
> I'm trying to read output of several instruments. Often
> globals are used for this task, but globals merge things
> together.
>
>
> Anton
>
>
>
> 2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie
> <mailto:Victor.Lazzarini@nuim.ie>>
>
>     Maybe what you want to do is better served by UDOs?
>
>     Victor
>
>     On 20 Nov 2011, at 16:16, Anton Kholomiov wrote:
>
>>     It happens because event_i adds score events at
>>     initialisation of an instrument. And SignalFlow opcodes
>>     work like global variables every new instance of instrument
>>     A adds data to instrument B, so the second note
>>
>>     i"C" 0.25 0.2 1
>>
>>     writes all new notes of instrument A, and we can
>>     hear them in the note
>>
>>     i"C" 0 7 0.5
>>
>>     because instrument B is still listening on the channel "in".
>>     Global variables (sigh)
>>
>>
>>
>>     2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie
>>     <mailto:Victor.Lazzarini@nuim.ie>>
>>
>>         SignalFlow opcodes is Michael Gogins'  territory, so I will
>>         not be able to help you there...
>>
>>         Victor
>>
>>         On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:
>>
>>>
>>>
>>>         2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie
>>>         <mailto:Victor.Lazzarini@nuim.ie>>
>>>
>>>             And what is the difference between instr 2 & 3? I don't
>>>             follow.
>>>
>>>         Difference is hidden by sequence of dots)
>>>         Your solution requires  one named channel per instance,
>>>         I've tried to do it another way and I've run into strange
>>>         behavior.
>>>         I'm trying to redirect the output of instrument with SignalFlow
>>>         opcodes. Instrument B collects all notes for instrument A.
>>>         Then some another instrument invokes B with subinstr
>>>         opcode. But it doesn't work as expected. I'm invoking
>>>         instrument C twice, one is long note (it plays all A's notes)
>>>         and one is short note (it plays only one A's note),
>>>         but I can hear both notes as if they are long notes.
>>>         What am I missing here?
>>>
>>>         Here is the code:
>>>
>>>         <CsoundSynthesizer>
>>>         <CsOptions>
>>>         -d -odac
>>>         </CsOptions>
>>>
>>>         <CsInstruments>
>>>
>>>         connect "A", "out", "B", "in"
>>>
>>>             instr   A
>>>         k1  oscili  1, 1/p3, 21
>>>         a1  oscili  8000*k1, p4, 1
>>>             outleta "out", a1
>>>             endin
>>>
>>>             instr   B
>>>             event_i "i", "A", 0, 0.5, 440
>>>             event_i "i", "A", 0.5, 0.5, 330
>>>             event_i "i", "A", 1, 1, 220
>>>             event_i "i", "A", 2, 0.5, 220
>>>             event_i "i", "A", 2.5, 0.5, 330
>>>             event_i "i", "A", 3, 1, 440
>>>
>>>         a1  inleta  "in"
>>>             out a1
>>>             endin
>>>
>>>
>>>             instr C
>>>         a1  subinstr "B", 0, p3
>>>             out p4*a1
>>>             endin
>>>
>>>         </CsInstruments>
>>>
>>>         <CsScore>
>>>         f1 0 4096 10 1
>>>
>>>         f21 0 17 5 1 16 0.01
>>>
>>>         i"C" 0 7 0.5
>>>         i"C" 0.25 0.2 1
>>>         e
>>>         </CsScore>
>>>         </CsoundSynthesizer>
>>>
>>>
>>>
>>
>>         Dr Victor Lazzarini
>>         Senior Lecturer
>>         Dept. of Music
>>         NUI Maynooth Ireland
>>         tel.: +353 1 708 3545
>>         Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>
>     Dr Victor Lazzarini
>     Senior Lecturer
>     Dept. of Music
>     NUI Maynooth Ireland
>     tel.: +353 1 708 3545
>     Victor dot Lazzarini AT nuim dot ie
>
>
>
>


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"



Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-11-22 21:35
FromTito Latini
SubjectRe: [Csnd] event + subinstr
AttachmentsNone  

Date2011-12-01 19:46
FromAnton Kholomiov
SubjectRe: [Csnd] event + subinstr
Tito :

Brute force is difficult to scale for more general cases.

Adam :

I'm not sure that it works. You don't know how many times
subinstruments were invoked. For example you can not route 
them to two different effects. All simultaneous invocations get mixed up.

------------

I've suddenly stumbled upon Nyquist. It's doing magic with notes
and signals. There is no score/instrument barrier. You can mix
some notes into signal an use it in its own local scope. 
I have not done anything with it yet, only read some articles,
but it's fantastic.

It's probably stupid to advertise Nyquist so much on Csound channel
but can we do something like this? Is it feasible to define
opcode subinstr which takes several notes and gives 
local copy of a mixed signal? 
And it stops playing when instrument that invokes it 
gets interrupted. 


Anton



2011/11/23 Tito Latini <tito.01beta@gmail.com>
brute force

<CsoundSynthesizer>
<CsOptions>
-d -odac
</CsOptions>

<CsInstruments>

#define NBUS #16#
gigrobot ftgen 2, 0, $NBUS, 2, 0
gandx init -1

   instr   A
   gandx init (gandx+1)%$NBUS
k1  oscili  1, 1/p3, 21
a1  oscili  8000*k1, p4, 1
   tablew a1, gandx, 2
   ;; clear bus
   event_i "i", "D", p3, 0.01, gandx
   endin

   instr   B
   event_i "i", "A", 0, 0.5, 440
   event_i "i", "A", 0.5, 0.5, 330
   event_i "i", "A", 1, 1, 220
   event_i "i", "A", 2, 0.5, 220
   event_i "i", "A", 2.5, 0.5, 330
   event_i "i", "A", 3, 1, 440

   aout tablera 2, 0, 0
   out aout
   endin

   instr C
a1  subinstr "B", 0, p3
   out p4*a1
   endin

   instr D  ; clear bus
   tableiw 0, p4, 2
   endin

</CsInstruments>

<CsScore>
f1 0 4096 10 1
f21 0 17 5 1 16 0.01

i"C" 0 4 0.5
i"C" 0.3 0.2 1
i"C" 0.7 0.2 1
i"C" 2 0.2 1
e
</CsScore>
</CsoundSynthesizer>

tito

On Tue, Nov 22, 2011 at 08:37:37PM +0300, Anton Kholomiov wrote:
> to Victor
>
> Sorry but I don't understand how can it help.
> I can make A-instrument into UDO. But I can not
> express the sequence of notes (what event-opcode does)
> and get the cumulative signal.
>
> to Tito:
>
> Your example is the same as mine, you have
> switched from one globals to another ones.
> It sounds the same.
>
> to Joachim
>
> With globals I can not play two instances of the same
> instrument simultaneously. They all merged into one
> named-channel. I have to reserve names for all
> invokations.
>
>
> 2011/11/21 joachim heintz <jh@joachimheintz.de>
>
> > i don't understand why victor's example with the chn opcodes did not
> > work for you. they are like busses, and you can do whatever you want:
> > merging or not, sending globals or seperate channels. i am pretty sure
> > that you can get what you want with them. i might help you, too, but i
> > didn't understand your point yet. if you like, please give a reduced
> > example.
> > best -
> >        joachim
> >
> >
> >
> > Am 20.11.2011 17:47, schrieb Anton Kholomiov:
> > > I don't know how can it help. UDOs build combination
> > > of existing opcodes. But there is no such combination.
> > > I'm trying to read output of several instruments. Often
> > > globals are used for this task, but globals merge things
> > > together.
> > >
> > >
> > > Anton
> > >
> > >
> > >
> > > 2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie
> > > <mailto:Victor.Lazzarini@nuim.ie>>
> > >
> > >     Maybe what you want to do is better served by UDOs?
> > >
> > >     Victor
> > >
> > >     On 20 Nov 2011, at 16:16, Anton Kholomiov wrote:
> > >
> > >>     It happens because event_i adds score events at
> > >>     initialisation of an instrument. And SignalFlow opcodes
> > >>     work like global variables every new instance of instrument
> > >>     A adds data to instrument B, so the second note
> > >>
> > >>     i"C" 0.25 0.2 1
> > >>
> > >>     writes all new notes of instrument A, and we can
> > >>     hear them in the note
> > >>
> > >>     i"C" 0 7 0.5
> > >>
> > >>     because instrument B is still listening on the channel "in".
> > >>     Global variables (sigh)
> > >>
> > >>
> > >>
> > >>     2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie
> > >>     <mailto:Victor.Lazzarini@nuim.ie>>
> > >>
> > >>         SignalFlow opcodes is Michael Gogins'  territory, so I will
> > >>         not be able to help you there...
> > >>
> > >>         Victor
> > >>
> > >>         On 20 Nov 2011, at 15:33, Anton Kholomiov wrote:
> > >>
> > >>>
> > >>>
> > >>>         2011/11/20 Victor Lazzarini <Victor.Lazzarini@nuim.ie
> > >>>         <mailto:Victor.Lazzarini@nuim.ie>>
> > >>>
> > >>>             And what is the difference between instr 2 & 3? I don't
> > >>>             follow.
> > >>>
> > >>>         Difference is hidden by sequence of dots)
> > >>>         Your solution requires  one named channel per instance,
> > >>>         I've tried to do it another way and I've run into strange
> > >>>         behavior.
> > >>>         I'm trying to redirect the output of instrument with SignalFlow
> > >>>         opcodes. Instrument B collects all notes for instrument A.
> > >>>         Then some another instrument invokes B with subinstr
> > >>>         opcode. But it doesn't work as expected. I'm invoking
> > >>>         instrument C twice, one is long note (it plays all A's notes)
> > >>>         and one is short note (it plays only one A's note),
> > >>>         but I can hear both notes as if they are long notes.
> > >>>         What am I missing here?
> > >>>
> > >>>         Here is the code:
> > >>>
> > >>>         <CsoundSynthesizer>
> > >>>         <CsOptions>
> > >>>         -d -odac
> > >>>         </CsOptions>
> > >>>
> > >>>         <CsInstruments>
> > >>>
> > >>>         connect "A", "out", "B", "in"
> > >>>
> > >>>             instr   A
> > >>>         k1  oscili  1, 1/p3, 21
> > >>>         a1  oscili  8000*k1, p4, 1
> > >>>             outleta "out", a1
> > >>>             endin
> > >>>
> > >>>             instr   B
> > >>>             event_i "i", "A", 0, 0.5, 440
> > >>>             event_i "i", "A", 0.5, 0.5, 330
> > >>>             event_i "i", "A", 1, 1, 220
> > >>>             event_i "i", "A", 2, 0.5, 220
> > >>>             event_i "i", "A", 2.5, 0.5, 330
> > >>>             event_i "i", "A", 3, 1, 440
> > >>>
> > >>>         a1  inleta  "in"
> > >>>             out a1
> > >>>             endin
> > >>>
> > >>>
> > >>>             instr C
> > >>>         a1  subinstr "B", 0, p3
> > >>>             out p4*a1
> > >>>             endin
> > >>>
> > >>>         </CsInstruments>
> > >>>
> > >>>         <CsScore>
> > >>>         f1 0 4096 10 1
> > >>>
> > >>>         f21 0 17 5 1 16 0.01
> > >>>
> > >>>         i"C" 0 7 0.5
> > >>>         i"C" 0.25 0.2 1
> > >>>         e
> > >>>         </CsScore>
> > >>>         </CsoundSynthesizer>
> > >>>
> > >>>
> > >>>
> > >>
> > >>         Dr Victor Lazzarini
> > >>         Senior Lecturer
> > >>         Dept. of Music
> > >>         NUI Maynooth Ireland
> > >>         tel.: +353 1 708 3545
> > >>         Victor dot Lazzarini AT nuim dot ie
> > >>
> > >>
> > >>
> > >>
> > >
> > >     Dr Victor Lazzarini
> > >     Senior Lecturer
> > >     Dept. of Music
> > >     NUI Maynooth Ireland
> > >     tel.: +353 1 708 3545
> > >     Victor dot Lazzarini AT nuim dot ie
> > >
> > >
> > >
> > >
> >
> >
> > 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"
>


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-12-01 20:18
FromVictor.Lazzarini@nuim.ie
SubjectRe: [Csnd] event + subinstr
AttachmentsNone  

Date2011-12-01 20:35
FromVictor.Lazzarini@nuim.ie
SubjectRe: [Csnd] event + subinstr
AttachmentsNone