Controlling p2 of 80 soundin

Hello, I need to play 80 soundin to control 80 different soundfiles.
I am going to use 2 sliders for each soundin to control the level and the pan:

kamp1 invalue “amp1”
kpan1 invalue “pan1”
aL1, aR1 soundin “Do3_01.aif”, 0
a1L = aL1 * kpan1 * kamp1
a1R = aR1 * (1 - kpan1) * kamp1

I’d like to have a third real-time control to set a parameter corresponding to p2 field in the score, so each player can start in a different moment.
But I don’t have any idea if it’s possible.

sure — everything is possible =)

when you can describe more in detail what it means “to set a parameter
corresponding to p2 field in the score”, i might be able to help you.

For instance I want soundin#1 to start 1 second later, like if the score statement was “i1 1”. But I’d like to set it by a slider, in the same way I did with level and pan. So, for each soundin I set onset, level and pan, and then play the whole instrument.

one possibility would be to seperate the jobs between two instruments:

  • one instrument receives the onset and calls
  • the other instrument which then plays back the sound file.

so in some not tested code:

instr Receive
kOnset invalue “onset”
schedulek “Play”,kOnset,1
turnoff
endin

instr Play
p3 filelen “Do3_01.aif”

endin

depending on your situation, there are als other possibilities. perhaps
the most simple one is a delay:

kamp1 invalue “amp1”
kpan1 invalue “pan1”
kOnset invalue “onset”
iDelay = i(kOnset)
aL1, aR1 soundin “Do3_01.aif”, 0
aL1 delay aL1, iDelay
aR1 delay aR1, iDelay
a1L = aL1 * kpan1 * kamp1
a1R = aR1 * (1 - kpan1) * kamp1

hope some of this might help to find a solution …

joachim

Hello Joachim,

thank you a lot for your help. I was looking for something complicated and didn’t think about the delay option, that is quite smart.
I have tried with it and it works very fine, thank you again. But I will try the first option as well and let you know.

Best regards,

G.

Hello to the community!

Regarding the topic of this post I created the following orc., with 80 players:

strset 1, “Do3_01.aif”
;…
strset 80, “Si4_02.aif”

instr 1

kamp1 invalue “amp1”
kpan1 invalue “pan1”
konset1 invalue “onset1”
iDelay1 = i(konset1)

aL1, aR1 soundin 1, 0
aL1 delay aL1, iDelay1
aR1 delay aR1, iDelay1
a1L = aL1 * kpan1 * kamp1
a1R = aR1 * (1 - kpan1) * kamp1
;…
kamp80 invalue “amp80”
kpan80 invalue “pan80”
konset80 invalue “onset80”
iDelay80 = i(konset80)

aL80, aR80 soundin 80, 0
aL80 delay aL80, iDelay80
aR80 delay aR80, iDelay80
a80L = aL80 * kpan80 * kamp80
a80R = aR80 * (1 - kpan80) * kamp80

I have been working fine with it for a while, then suddenly I got this error message:

WARNING: InputChannelCallback not set.
WARNING: InputChannelCallback not set.
WARNING: InputChannelCallback not set.
WARNING: InputChannelCallback not set.
diskin2: opened ‘Do3_01.aif’:
96000 Hz, 2 channel(s), 3185863 sample frames
INIT ERROR in instr 1: illegal delay time
aL1 delay aL1 iDelay1 0
INIT ERROR in instr 1: illegal delay time
aR1 delay aR1 iDelay1 0

WARNING: InputChannelCallback not set.
WARNING: InputChannelCallback not set.
WARNING: InputChannelCallback not set.
diskin2: opened ‘Si4_02.aif’:
96000 Hz, 2 channel(s), 9216593 sample frames
INIT ERROR in instr 1: illegal delay time
aL80 delay aL80 iDelay80 0
INIT ERROR in instr 1: illegal delay time
aR80 delay aR80 iDelay80 0
B 0.000 - note deleted. i1 had 160 init errors
Score finished in csoundPerformKsmps() with 2.
inactive allocs returned to freespace
end of score. overall amps: 0.00000 0.00000
overall samples out of range: 0 0
1 errors in performance

Do you have any idea what could have happened?

Thank you

i think it has nothing to do with p2 but with the delay:

INIT ERROR in instr 1: illegal delay time
aL1 delay aL1 iDelay1 0

can you do print(iDelay1) and see what is the delay time here?
if negative, it would be the reason.
perhaps even zero should be avoided.

Thank you. It says
instr 1: iDelay1 = 0.000
But the slider is set on a positive number.

perhaps it works if you write iDelay1 invalue "onset1"?
(it is possible to get i-values from invalue, too.)

if not, you can use limit to avoid zero for iDelay1:
iDelay1 limit iDelay1, 0.001, 100

or program your own limit like this:
iDelay1 = (iDelay1<=0) ? 0.001 : iDelay1

Thank you! This one works:
iDelay1 limit iDelay1, 0.001, 100
Now I don’t get error messages, only this warning:
WARNING: InputChannelCallback not set.
WARNING: InputChannelCallback not set.
WARNING: InputChannelCallback not set.
diskin2: opened ‘Si4_02.aif’:
96000 Hz, 2 channel(s), 9216593 sample frames

What does it mean? is it maybe the reason why there is no sound?

how do you use csound (via cabbage, csoundqt, blue, …)? which version
of csound did you install?

i would guess that when you get your values via invalue, the warning is
not relevant for you. and i don’t understand what you mean by “there is
no sound”.

I am using Csound 6.10 it via CsoundQt (Version 0.9.5). I currently use the two softwares playing several .csd files without any problem.
No sound means that I can’t hear any sound output.
But the oddest thing is that the original orchestra - without setting limits for the delay - worked fine for weeks, I also produced many sounds with it.

hmmm ---- 6.10 is really old.
i’d recommend this: make a simple test with invalue to see if it is
working at all.
if you can, upgrade to a more recent csound version.
another option is to use the chn opcodes instead of invalue/outvalue.