Csound Csound-dev Csound-tekno Search About

[Csnd] dynamically triggering instrument with string and k-time parameters

Date2019-10-21 22:44
From"Jeanette C."
Subject[Csnd] dynamically triggering instrument with string and k-time parameters
Hey hey,
I think I need to have both the string and k-time parameters. event can do 
k-time, but doesn't accept S-type parameters. Schedule accepts Svariables, but 
parameters are i-time.

The scenario: I have a UDO that needs to create a given number of pulses, 
realised through a linseg. This UDO is wrapped in one instrument that will 
output the audio to a supplied channel/bus, therefore the Svariable in the 
parameter list.

I can do it like that or rewrite the UDO to have a mechanism to generate those 
pulses based on a trigger or something.

What would appear to be the most prudent solution here?

Best wishes and many thanks,

Jeanette

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

Open my eyes,
I look deep inside,
I run away... <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

Date2019-10-22 00:10
FromEduardo Moguillansky
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters

For exactly this kind of situation you can use the string cache opcodes, which allow you to internalize the strings and send them as integers.

So if you are using event at k-time:

ifoo cacheput "foo" ibar cacheput "bar" ktrig metro 10 if (ktrig == 1) then event "i", "myinstr", 0, -1, kval, ifoo, ibar endif

instr myinstr ival, ifoo, ibar passign 4 Sfoo cacheget ifoo Sbar cacheget ibar .... endin The cache* opcodes are here: https://csound-plugins.github.io/csound-plugins/opcodes/cacheput.html

On 21.10.19 23:44, Jeanette C. wrote:
Hey hey,
I think I need to have both the string and k-time parameters. event can do k-time, but doesn't accept S-type parameters. Schedule accepts Svariables, but parameters are i-time.

The scenario: I have a UDO that needs to create a given number of pulses, realised through a linseg. This UDO is wrapped in one instrument that will output the audio to a supplied channel/bus, therefore the Svariable in the parameter list.

I can do it like that or rewrite the UDO to have a mechanism to generate those pulses based on a trigger or something.

What would appear to be the most prudent solution here?

Best wishes and many thanks,

Jeanette


Date2019-10-22 02:54
Fromjoachim heintz
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters
or as traditional way, you can use strset.

i suggested to extend the schedule facility which can work with strings 
to extend to a k-ryte opcode so that we can overcome this restriction of 
the event opcode:
https://github.com/csound/csound/issues/994

	joachim



On 22/10/19 01:10, Eduardo Moguillansky wrote:
> For exactly this kind of situation you can use the string cache opcodes,
> which allow you to internalize the strings and send them as integers.
>
> So if you are using event at k-time:
>
> ifoo cacheput "foo" ibar cacheput "bar" ktrig metro 10 if (ktrig == 1)
> then event "i", "myinstr", 0, -1, kval, ifoo, ibar endif
>
> instr myinstr ival, ifoo, ibar passign 4 Sfoo cacheget ifoo Sbar
> cacheget ibar .... endin The cache* opcodes are here:
> https://csound-plugins.github.io/csound-plugins/opcodes/cacheput.html
>
> On 21.10.19 23:44, Jeanette C. wrote:
>> Hey hey,
>> I think I need to have both the string and k-time parameters. event
>> can do k-time, but doesn't accept S-type parameters. Schedule accepts
>> Svariables, but parameters are i-time.
>>
>> The scenario: I have a UDO that needs to create a given number of
>> pulses, realised through a linseg. This UDO is wrapped in one
>> instrument that will output the audio to a supplied channel/bus,
>> therefore the Svariable in the parameter list.
>>
>> I can do it like that or rewrite the UDO to have a mechanism to
>> generate those pulses based on a trigger or something.
>>
>> What would appear to be the most prudent solution here?
>>
>> Best wishes and many thanks,
>>
>> 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

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

Date2019-10-22 11:52
From"Jeanette C."
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters
Oct 22 2019, Eduardo Moguillansky has written:

> For exactly this kind of situation you can use the string cache opcodes, 
> which allow you to internalize the strings and send them as integers.
...
Thanks a lot Eduardo. This made me notice that I haven't installed the
extra plugins, which look to include a few very interesting opcodes.

Best wishes,

Jeanette

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

You know I'm one of a kind,
There'll never be another me <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

Date2019-10-22 11:53
From"Jeanette C."
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters
Oct 22 2019, joachim heintz has written:

> or as traditional way, you can use strset.

Thanks Joachim. I use strget all the time with p-fields and completely
ignored its counterpart.

> i suggested to extend the schedule facility which can work with strings to 
> extend to a k-ryte opcode so that we can overcome this restriction of the 
> event opcode:
> https://github.com/csound/csound/issues/994
Great! +1 :)

Best wishes,

Jeanette

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

You know I'm one of a kind,
There'll never be another me <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

Date2019-10-22 15:08
FromBernard Geyer
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters
strset is certainly a good idea.

But is there a reason why not using scoreline ?




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-10-22 18:48
FromBernard Geyer
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters
But ... the problem is that strget works only at i-time:

  kChn, kDur xin
  S_Chn strget kChn

error:  Unable to find opcode entry for 'strget' with matching argument
types:




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-10-22 19:08
From"Jeanette C."
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters
Oct 22 2019, Bernard Geyer has written:

> But ... the problem is that strget works only at i-time:
...
That however does not appear to be a problem. Honestly, I sometimes
still am confused by what can and can't happen in i- and k-time.

Best wishes and thanks,

Jeanette

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

I'm not that innocent... <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

Date2019-10-23 15:31
Fromjoachim heintz
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters
yes --- if you need a k-rate string, you can use a string channel (chn_S).

	j



On 22/10/19 19:48, Bernard Geyer wrote:
> But ... the problem is that strget works only at i-time:
>
>   kChn, kDur xin
>   S_Chn strget kChn
>
> error:  Unable to find opcode entry for 'strget' with matching argument
> types:
>
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> 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
>

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

Date2019-10-23 22:56
From"Jeanette C."
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters
Oct 23 2019, joachim heintz has written:

> yes --- if you need a k-rate string, you can use a string channel (chn_S).
Thanks for the tip, Joachim. I'll have to think about this, maybe chan_s
can be used in the system.

...

Best wishes,

Jeanette

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

Here I go, on my own now <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

Date2019-10-24 04:58
Fromjoachim heintz
SubjectRe: [Csnd] dynamically triggering instrument with string and k-time parameters
or if you have a predefined number of strings, you can even use a string 
array, and just refer to the index, like

gS_myFiles[] fillarray "one.wav", "two.wav", "three.wav"

instr Caller
  kTrig metro 1
  if kTrig==1 then
   kFile random 0, lenarray(gS_myfiles)+.999
   event "i", "Play", 0, 1, int(kFile)
  endif
endin

instr Play
  iFileIndex = p4
  S_file = gS_myfiles[iFileIndex]
  aL, aR diskin S_file
  out aL, aR
endin

(not tested, just as rough example.)

rorry's 'directory' opcode is a great tool to work with soundfiles in 
these situations.

best -
	joachim



On 23/10/19 23:56, Jeanette C. wrote:
> Oct 23 2019, joachim heintz has written:
>
>> yes --- if you need a k-rate string, you can use a string channel
>> (chn_S).
> Thanks for the tip, Joachim. I'll have to think about this, maybe chan_s
> can be used in the system.
>
> ...
>
> 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