[Csnd] external tempo change

Hi folks!
I am doing some experiments with a Python app to play CsScore. I wonder if it is ever possible to have a relative tempo control, which would consider the t-line of the CsScore and just let it run say 1.57 times faster or slower? and if the answer is negative, then if it is possible to just have a soft of tempo controller which would change the tempo in real-time for the score currently played? In other words, how could I update the tempo from the API (without re-compiling with new -t value)?

Thanks for any ideas!

Gleb

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

Does this help?

[

tempo
csound.com

](tempo)

Prof. Victor Lazzarini
Maynooth University
Ireland

Hi, Victor!
I am afraid no. The need for the previous tempo value is a bit confusing. Especially having istartempo as an i-value. I actually tried it, but it was a bit away from smooth accelerando..

вс, 5 янв. 2025 г. в 01:51, Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie>:

Does this help?

[

tempo
csound.com

](https://csound.com/manual/tempo.html)

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning

This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.

Hi folks!
I am doing some experiments with a Python app to play CsScore. I wonder if it is ever possible to have a relative tempo control, which would consider the t-line of the CsScore and just let it run say 1.57 times faster or slower? and if the answer is negative, then if it is possible to just have a soft of tempo controller which would change the tempo in real-time for the score currently played? In other words, how could I update the tempo from the API (without re-compiling with new -t value)?

Thanks for any ideas!

Gleb

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

It seems smooth enough to me in this test

<CsoundSynthesizer>
<CsOptions>
-odac -t 60
</CsOptions>
<CsInstruments>
0dbfs = 1

instr 1
a1 oscili p4, p5
    out linenr(a1*0.1,0.01,0.1,0.01)
endin

gkt init 60
instr 2
tempo p4, i(gkt)
schedule(2,1,1/kr,p4+20)
gkt = p4
endin

schedule(2,2,1/kr,i(gkt))

</CsInstruments>
<CsScore>
{ 100 CNT
i1 [$CNT*2] 1 0.5 440
i1 [$CNT*2+1] 1 0.5 880
}
</CsScore>
</CsoundSynthesizer>

Thanks Victor!
It works nice in Csound, though for some reason it does not function when I run Csound through the API. The active opcode shows that instr 2 was activated just one time.

But at least this could be a nice example of using tempo for the manual.

вс, 5 янв. 2025 г. в 02:51, vlz <viclazzarini@gmail.com>:

It seems smooth enough to me in this test

-odac -t 60 0dbfs = 1

instr 1
a1 oscili p4, p5
out linenr(a1*0.1,0.01,0.1,0.01)
endin

gkt init 60
instr 2
tempo p4, i(gkt)
schedule(2,1,1/kr,p4+20)
gkt = p4
endin

schedule(2,2,1/kr,i(gkt))

{ 100 CNT i1 [$CNT*2] 1 0.5 440 i1 [$CNT*2+1] 1 0.5 880 }

Hi, Victor!
I am afraid no. The need for the previous tempo value is a bit confusing. Especially having istartempo as an i-value. I actually tried it, but it was a bit away from smooth accelerando..

вс, 5 янв. 2025 г. в 01:51, Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie>:
Does this help?
tempo
csound.com

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning
This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
Hi folks!
I am doing some experiments with a Python app to play CsScore. I wonder if it is ever possible to have a relative tempo control, which would consider the t-line of the CsScore and just let it run say 1.57 times faster or slower? and if the answer is negative, then if it is possible to just have a soft of tempo controller which would change the tempo in real-time for the score currently played? In other words, how could I update the tempo from the API (without re-compiling with new -t value)?

Thanks for any ideas!

Gleb
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

Just make sure you don’t use sections in the score, I think scheduled RT events are cleared at section boundaries, so the recursion won’t work.

If you are using the API, then the best approach is to leave the recursion and run instr 2 (whatever) to change the tempo whenever you need it. That’ll work if your code is written correctly.

Prof. Victor Lazzarini
Maynooth University
Ireland

I hope that Menno will add it to the manual!

I wonder was just testing the tempo opcode in these days!
I add on this experience some perhaps obvious remarks:

  1. as the duration p3 act at initialisation time, altering in between the tempo can result in overlapping duration or empty instead e.g. a legato flow of events. It’s better in this case two separate scheduling: an hold command and a turnoff.
  2. Also the time parameters of envelopes and so on are not altered following general modified tempo.

Perhaps can be useful for manual or for user of unstable tempos.

I tested that by scratching on the good example of Lazzarini.
Greetings
Giovanni

Notice also that tempo only affects events given in the score. The p3 value in this case is in beats, so it
is interpreted according to the current tempo value. However, as you said if you have an envelope segment (e.g. attack)
time set in seconds, it will not change. There’s tempoval to get the current tempo if any scaling is required.

In contrast, realtime scheduled events are always in seconds. So we can have as in the example I showed, an
instrument for setting the tempo that is not called by the score and so it is not affected by these changes.

For my own use, I never bother with the numeric orchestra, it’s too inflexible and lacks real means of programming,
besides its fairly archaic mechanism.

I do everything in Csound code so if there is any need to set a tempo, change it, speed up or slow down, it’s all done
in a programmatic way.