Reinitialize instruments in real time

View: New views
3 Messages — Rating Filter:   Alert me  

Reinitialize instruments in real time

by davistro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


 In the following code, we have a control variable used to star reproducing a sample (if gkControl is 1) and stop reproducing if gkControl is 2 here is where we want to reinitialize the state of the opcode diskin or others like pluck, line, linen, etc. How can we do that?


<CsoundSynthesizer>
<CsOptions>

   -o dac -+rtaudio=alsa

</CsOptions>

<CsInstruments>
   sr = 44100
   kr = 4410
   ksmps = 10
   nchnls = 2
   
   gkcontrol    init 0
   
   instr 1
       gkcontrol    chnget    "sample"
       
       if gkcontrol == 1 then
           a1,a2    diskin    "rep1.wav", 1,    0,    1,    0,    100
           outs a1, a2
       endif
       if gkcontrol == 2 then
           ;Reiniciar
       endif
   endin
   
   instr 2
       gkcontrol    =    p4
       
       printk2    gkcontrol
       
   endin



</CsInstruments>

<CsScore>

;reproduccion todos los instrumentos

i1    0    100
i2    0    50    1
i2    50  50    2  

</CsScore>

</CsoundSynthesizer>

Re: Re initialize instruments in real time

by Oeyvind Brandtsegg-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe like this (untested):

   if gkcontrol == 1 then
          myLabel:
          a1,a2    diskin    "rep1.wav", 1,    0,    1,    0,    100
          rireturn
          outs a1, a2
      endif
      if gkcontrol == 2 then
          reinit myLabel
      endif

Oeyvind

2009/5/28 davistro <davistro@...>:

>
>
>  In the following code, we have a control variable used to star reproducing
> a sample (if gkControl is 1) and stop reproducing if gkControl is 2 here is
> where we want to reinitialize the state of the opcode diskin or others like
> pluck, line, linen, etc. How can we do that?
>
>
> <CsoundSynthesizer>
> <CsOptions>
>
>   -o dac -+rtaudio=alsa
>
> </CsOptions>
>
> <CsInstruments>
>   sr = 44100
>   kr = 4410
>   ksmps = 10
>   nchnls = 2
>
>   gkcontrol    init 0
>
>   instr 1
>       gkcontrol    chnget    "sample"
>
>       if gkcontrol == 1 then
>           a1,a2    diskin    "rep1.wav", 1,    0,    1,    0,    100
>           outs a1, a2
>       endif
>       if gkcontrol == 2 then
>           ;Reiniciar
>       endif
>   endin
>
>   instr 2
>       gkcontrol    =    p4
>
>       printk2    gkcontrol
>
>   endin
>
>
>
> </CsInstruments>
>
> <CsScore>
>
> ;reproduccion todos los instrumentos
>
> i1    0    100
> i2    0    50    1
> i2    50  50    2
>
> </CsScore>
>
> </CsoundSynthesizer>
>
> --
> View this message in context: http://www.nabble.com/Reinitialize-instruments-in-real-time-tp23763800p23763800.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: Re initialize instruments in real time

by davistro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

       
Although the code is correct in syntax, the result is not what I expect, because the return value to 1 to hear that the sample does not start again if it continues playing.
I tried to turnon and turnoff opcodes but without results.

Thanks and I hope someone can help me: S.

Oeyvind Brandtsegg-2 wrote:
Maybe like this (untested):

   if gkcontrol == 1 then
          myLabel:
          a1,a2    diskin    "rep1.wav", 1,    0,    1,    0,    100
          rireturn
          outs a1, a2
      endif
      if gkcontrol == 2 then
          reinit myLabel
      endif

Oeyvind

2009/5/28 davistro <davistro@hotmail.com>:
>
>
>  In the following code, we have a control variable used to star reproducing
> a sample (if gkControl is 1) and stop reproducing if gkControl is 2 here is
> where we want to reinitialize the state of the opcode diskin or others like
> pluck, line, linen, etc. How can we do that?
>
>
> <CsoundSynthesizer>
> <CsOptions>
>
>   -o dac -+rtaudio=alsa
>
> </CsOptions>
>
> <CsInstruments>
>   sr = 44100
>   kr = 4410
>   ksmps = 10
>   nchnls = 2
>
>   gkcontrol    init 0
>
>   instr 1
>       gkcontrol    chnget    "sample"
>
>       if gkcontrol == 1 then
>           a1,a2    diskin    "rep1.wav", 1,    0,    1,    0,    100
>           outs a1, a2
>       endif
>       if gkcontrol == 2 then
>           ;Reiniciar
>       endif
>   endin
>
>   instr 2
>       gkcontrol    =    p4
>
>       printk2    gkcontrol
>
>   endin
>
>
>
> </CsInstruments>
>
> <CsScore>
>
> ;reproduccion todos los instrumentos
>
> i1    0    100
> i2    0    50    1
> i2    50  50    2
>
> </CsScore>
>
> </CsoundSynthesizer>
>
> --
> View this message in context: http://www.nabble.com/Reinitialize-instruments-in-real-time-tp23763800p23763800.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel