| Thank you, Joachim. Yes, in real time p3 is the main question to solve
for 'schedule'.
But your version with this opcode is excellent with score instruction.
Greetings
Andrea S.
Il 29/12/2016 23:00, joachim heintz ha scritto:
> well, i did not know you wanted to work with midi real time input. if
> it then works for you with timout adjusted, it' s all good.
>
> actually, a real time midi note-on message has the same effect as
> schedule: it turns one instance of an instrument on. but of course
> you don't know about your p3 duration; this is the main difference.
>
> joachim
>
>
> On 29/12/16 16:48, Andrea Strappa wrote:
>> to complete my last message... which is my error when I use 'schedule'
>> in midi real time?
>>
>> Or... there's a good example about 'schedule' with midi real time and
>> reinit pass?
>>
>> Greetings
>>
>> Andrea S.
>>
>>
>> Il 28/12/2016 22:39, Andrea Strappa ha scritto:
>>> I worked on 'schedule'. I found a way for rtmidi with 'pset' opcode.
>>> But:
>>>
>>> If I play many notes I listen some drops and I cannot turnoff the
>>> instrument upper a frequency threshold (two file attached).
>>>
>>> With 'timout' opcode I found a well working solution (third file
>>> attached), whitout drops and with working freq threshold.
>>>
>>> Andrea S.
>>>
>>>
>>>
>>> Il 27/12/2016 22:09, Andrea Strappa ha scritto:
>>>> Thank you very much, Joachim, i'll study your solution.
>>>>
>>>> Just now I found a solution with a conditional branch:
>>>>
>>>> if ifollowingdur = initialdur goto next
>>>> ifreq = ifreq * igoldenr
>>>> next:
>>>>
>>>> this is the complete .csd:
>>>>
>>>>
>>>>
>>>>
>>>> -odac -M0 -B4096 -b400 --midi-velocity-amp=4 --midi-key-cps=5
>>>> ;-+rtmidi=mme
>>>> ;-odac
>>>>
>>>>
>>>>
>>>> sr = 44100
>>>> kr = 4410
>>>> ksmps = 10
>>>> 0dbfs = 1
>>>> nchnls = 2
>>>>
>>>> instr 1
>>>> igoldenr = (1 + sqrt(5))/2 ;phi (golden ratio)
>>>> ;print igoldenr
>>>> initialdur = .5
>>>> ifollowingdur = initialdur
>>>> iamp = p4
>>>> ;iamp ampmidi .3
>>>> ifreq = p5
>>>> ;ifreq cpsmidi
>>>>
>>>> kenv1 madsr .01, .01, iamp, 1
>>>>
>>>> nextdur:
>>>>
>>>> timout 0, ifollowingdur, makenote
>>>>
>>>> reinit nextdur
>>>>
>>>> makenote:
>>>> print ifollowingdur
>>>> print ifreq
>>>> ;print iamp
>>>>
>>>> kenv2 linseg 0, ifollowingdur*.1, .1, ifollowingdur*.8, .1,
>>>> ifollowingdur*.1, 0
>>>> asig poscil kenv2, ifreq
>>>> outs asig*kenv1, asig*kenv1
>>>>
>>>>
>>>> if ifollowingdur = initialdur goto next
>>>> ifreq = ifreq * igoldenr
>>>> next:
>>>> ifollowingdur = ifollowingdur * igoldenr
>>>>
>>>> if ifollowingdur > 3 then
>>>> turnoff
>>>> endif
>>>>
>>>> endin
>>>>
>>>>
>>>>
>>>>
>>>> ;f0 z
>>>> i1 0 8 .4 220
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Il 27/12/2016 21:59, joachim heintz ha scritto:
>>>>> hi andrea -
>>>>>
>>>>> as far as i understand, the ifreq which has been printed out is not
>>>>> used by the first timout cycle, because it has been set by the
>>>>> statement ifreq = ifreq * igoldenr to a new value which is then used
>>>>> by the oscillator. this is probably what victor means, too.
>>>>>
>>>>> i must say that i find the syntax of timout very obscur and would
>>>>> recommend another way of programming. i think what you want is: to
>>>>> start one note with a certain duration and frequency, and apply the
>>>>> igoldenr for both for the next note, and so on, until a certain
>>>>> duration has passed.
>>>>>
>>>>> so actually you play one note, and from inside this instrument, you
>>>>> call the next instance with the new duration and frequency, as long
>>>>> as the condition for the duration is satisfied.
>>>>>
>>>>> you can do this straightforward in csound with schedule (or
>>>>> event_i). below is an example code, which i believe is clearer than
>>>>> the usage of timout.
>>>>>
>>>>> best -
>>>>> joachim
>>>>>
>>>>> instr 1
>>>>> igoldenr = (1 + sqrt(5))/2 ;phi (golden ratio)
>>>>> istart = p2
>>>>> idur = p3
>>>>> iamp = p4
>>>>> ifreq = p5
>>>>> imaxdur = 3
>>>>> print istart, idur, ifreq
>>>>>
>>>>> if idur > imaxdur then
>>>>> turnoff
>>>>> else
>>>>> schedule 1, idur, idur*igoldenr, iamp, ifreq*igoldenr
>>>>> endif
>>>>>
>>>>> kenv1 madsr .01, .01, iamp, 1
>>>>> kenv2 linseg 0, idur*.1, .1, idur*.8, .1, idur*.1, 0
>>>>> asig poscil kenv2, ifreq
>>>>> outs asig*kenv1, asig*kenv1
>>>>>
>>>>> endin
>>>>> schedule(1, 0, .5, .4, 220)
>>>>>
>>>>>
>>>>>
>>>>> On 27/12/16 12:19, Andrea Strappa wrote:
>>>>>> Hi list,
>>>>>> In this csd test I expect to listen ifreq at the beginning, but I
>>>>>> listen
>>>>>> ifreq*igoldenr. Why?
>>>>>> What is the right way to listen ifreq at the beginning?
>>>>>> Andrea S.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ;-odac -M0 -B4096 -b400 --midi-velocity-amp=4 --midi-key-cps=5
>>>>>> ;-+rtmidi=mme
>>>>>> -odac
>>>>>>
>>>>>>
>>>>>>
>>>>>> sr = 44100
>>>>>> kr = 4410
>>>>>> ksmps = 10
>>>>>> 0dbfs = 1
>>>>>> nchnls = 2
>>>>>>
>>>>>> instr 1
>>>>>> igoldenr = (1 + sqrt(5))/2 ;phi (golden ratio)
>>>>>> ;print igoldenr
>>>>>> idur = .5
>>>>>> iamp = p4
>>>>>> ifreq = p5
>>>>>>
>>>>>> kenv1 madsr .01, .01, iamp, 1
>>>>>>
>>>>>> nextdur:
>>>>>> timout 0, idur, makenote
>>>>>> reinit nextdur
>>>>>> makenote:
>>>>>> print idur
>>>>>> print ifreq
>>>>>> print iamp
>>>>>>
>>>>>> kenv2 linseg 0, idur*.1, .1, idur*.8, .1, idur*.1, 0
>>>>>> asig poscil kenv2, ifreq
>>>>>> outs asig*kenv1, asig*kenv1
>>>>>> idur = idur * igoldenr
>>>>>> ifreq = ifreq * igoldenr
>>>>>>
>>>>>> if idur > 3 then
>>>>>> turnoff
>>>>>> endif
>>>>>>
>>>>>> endin
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ;f0 z
>>>>>> i1 0 8 .4 220
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 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
>>>>>
>>>>
>>>> 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
>>
>> 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
>
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 |