Csound Csound-dev Csound-tekno Search About

[Csnd] trigger other instrument by midi

Date2018-12-08 11:33
FromRichard
Subject[Csnd] trigger other instrument by midi
I am trying to record midi to a file and at the same time trigger 
another instrument.
The following code is based on the example on multiple triggering (with 
velocity added) :

instrnum = 11
inote notnum
ivel veloc

event_i "i", instrnum, 0, -1, inote, ivel    ;call with indefinite duration
kend release ;get a "1" if instrument is turned off
if kend == 1 then
event "i", -instrnum, 0, 1 ;then turn this instance off
endif

When I use this, there is no polyphony. Only when I change the -1 in the 
first event_i call to say a 1, there is polyphony,
but the note is not turned off when I release the key.

I also get these error messages:

could not find playing instr 11.000000
could not find playing instr 11.000000
could not find playing instr 11.000000

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-12-08 11:43
From"Jeanette C."
SubjectRe: [Csnd] trigger other instrument by midi
Dec 8 2018, Richard has written:
...
> instrnum = 11
> inote notnum
> ivel veloc
>
> event_i "i", instrnum, 0, -1, inote, ivel    ;call with indefinite duration
> kend release ;get a "1" if instrument is turned off
> if kend == 1 then
> event "i", -instrnum, 0, 1 ;then turn this instance off
> endif
...
> but the note is not turned off when I release the key.
...
Hi Richard,
I am no expert, but I _THINK_ you might need some voice management. In
the polyphonic case you have different instances of instrument 11. I
believe these can be specified by a number after the decimal point.

Take it with a big pinch of salt though.

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

You should take me as I am
'Cause I can promise you
Baby, what you see is what ytou get <3
(Britney Spears)

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-12-08 11:46
FromRichard
SubjectRe: [Csnd] trigger other instrument by midi
Well, the original example does talk about fractional instruments, but 
later says that it is an example.
So I thought maybe it would work without fractional instruments...

On 08/12/2018 12:43, Jeanette C. wrote:
> Dec 8 2018, Richard has written:
> ...
>> instrnum = 11
>> inote notnum
>> ivel veloc
>>
>> event_i "i", instrnum, 0, -1, inote, ivel    ;call with indefinite 
>> duration
>> kend release ;get a "1" if instrument is turned off
>> if kend == 1 then
>> event "i", -instrnum, 0, 1 ;then turn this instance off
>> endif
> ...
>> but the note is not turned off when I release the key.
> ...
> Hi Richard,
> I am no expert, but I _THINK_ you might need some voice management. In
> the polyphonic case you have different instances of instrument 11. I
> believe these can be specified by a number after the decimal point.
>
> Take it with a big pinch of salt though.
>
> Best wishes,
>
> Jeanette
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-12-08 11:53
FromRichard
SubjectRe: [Csnd] trigger other instrument by midi
Found out I DO need fractional instruments for this, so this works:

inote notnum
ivel veloc
instrnum = 11 + inote/100 + ivel/100000
event_i "i", instrnum, 0, -1, inote, ivel ;call with indefinite duration
kend release ;get a "1" if instrument is turned off
if kend == 1 then
event "i", -instrnum, 0, 1 ;then turn this instance off
endif

On 08/12/2018 12:43, Jeanette C. wrote:
> Dec 8 2018, Richard has written:
> ...
>> instrnum = 11
>> inote notnum
>> ivel veloc
>>
>> event_i "i", instrnum, 0, -1, inote, ivel    ;call with indefinite 
>> duration
>> kend release ;get a "1" if instrument is turned off
>> if kend == 1 then
>> event "i", -instrnum, 0, 1 ;then turn this instance off
>> endif
> ...
>> but the note is not turned off when I release the key.
> ...
> Hi Richard,
> I am no expert, but I _THINK_ you might need some voice management. In
> the polyphonic case you have different instances of instrument 11. I
> believe these can be specified by a number after the decimal point.
>
> Take it with a big pinch of salt though.
>
> Best wishes,
>
> Jeanette
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-12-08 12:03
From"Jeanette C."
SubjectRe: [Csnd] trigger other instrument by midi
Dec 8 2018, Richard has written:

> Found out I DO need fractional instruments for this, so this works:
>
> inote notnum
> ivel veloc
> instrnum = 11 + inote/100 + ivel/100000
...
Interesting way of getting your instance numbers. Neat, if you're not
restricted by a specific voice count.
Glad it worked out for you.

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

You should take me as I am
'Cause I can promise you
Baby, what you see is what ytou get <3
(Britney Spears)

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here