Csound Csound-dev Csound-tekno Search About

[Csnd] Csound API and command line flag --tempo

Date2014-04-28 07:19
Fromfrancesco
Subject[Csnd] Csound API and command line flag --tempo
Hello All,
i was trying to use the tempo flags from the API (from Lua), but 
i'm not able to get it working.

I tried:
cs:SetOption("--tempo=120") and
cs:SetOption("-t240")

but without success.

I also tried to use t flags in score, something like
cs:ReadScore("t 0 120") that give me an error.

Is the tempo flag supposed to work using the API?

Thanks,
ciao,
francesco.






--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-API-and-command-line-flag-tempo-tp5734731.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2014-04-28 07:44
FromVictor Lazzarini
SubjectRe: [Csnd] Csound API and command line flag --tempo
The tempo option only works with a sorted score, so you will need to give a score to Csound before
you start it (via a CSD, or ReadScore(), but before calling csoundStart()).
For instance, in Python, 

Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import csnd6
>>> cs = csnd6.Csound()
virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 6.02.0 (double samples) Apr 26 2014
libsndfile-1.0.25
>>> cs.ReadScore("t 0 120 \n i1 0 10 \n")
0
>>> cs.CompileOrc("instr 1 \n a1 oscili 10000,440 \n out a1 \n endin \n")
0
>>> cs.Start()
rtaudio: PortAudio module enabled ... 
using callback interface
rtmidi: PortMIDI module enabled
--Csound version 6.02.0 (double samples) Apr 26 2014
graphics suppressed, ascii substituted
0dBFS level = 32768.0
orch now loaded
audio buffered in 1024 sample-frame blocks
writing 2048-byte blks of shorts to test.aif (AIFF)
SECTION 1:
0
>>> cs.Perform()
new alloc for instr 1:
B  0.000 .. 10.000 T  5.000 TT  5.000 M:  10000.0
Score finished in csoundPerform().
2
>>> quit()
inactive allocs returned to freespace
end of score.		   overall amps:  10000.0
	   overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 132.711s, CPU: 0.025s
1024 2048 sample blks of shorts written to test.aif (AIFF)
ligeti-2:debug victor$ sndfile-info test.aif 

Version : libsndfile-1.0.25

========================================
File : test.aif
Length : 441054
FORM : 441046
 AIFF
 COMM : 18
  Sample Rate : 44100
  Frames      : 220500
  Channels    : 1
  Sample Size : 16
  Encoding    : NONE
 SSND : 441008
  Offset     : 0
  Block Size : 0

----------------------------------------
Sample Rate : 44100
Frames      : 220500
Channels    : 1
Format      : 0x00020002
Sections    : 1
Seekable    : TRUE
Duration    : 00:00:05.000
Signal Max  : 10000 (-10.31 dB)


you see it worked as the 10-beat sound is 5 secs long with t0 120. Tempo only
affects the first sorted score.

========================
Dr Victor Lazzarini
Senior Lecturer
NUI Maynooth, Ireland
victor dot lazzarini at nuim dot ie




On 28 Apr 2014, at 07:19, francesco  wrote:

> Hello All,
> i was trying to use the tempo flags from the API (from Lua), but 
> i'm not able to get it working.
> 
> I tried:
> cs:SetOption("--tempo=120") and
> cs:SetOption("-t240")
> 
> but without success.
> 
> I also tried to use t flags in score, something like
> cs:ReadScore("t 0 120") that give me an error.
> 
> Is the tempo flag supposed to work using the API?
> 
> Thanks,
> ciao,
> francesco.
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Csound-API-and-command-line-flag-tempo-tp5734731.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 



Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2014-04-28 08:42
Fromfrancesco
Subject[Csnd] Re: Csound API and command line flag --tempo
Thank You Mr. Victor. I was a bit confused by the csoundStart command.
May i say trivially that when i call csoundStart i'm putting csound in
realtime?
I mean csoundStart initialize csound and then you can only work with events
(really trivially!).

i also noted that i cannot use
cs:ReadScore("t 0 60")
cs:ReadScore(sco)
but this is working right
cs:ReadScore("t 0 60\n" .. sco)
 
Thanks,
ciao,
francesco.



--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-API-and-command-line-flag-tempo-tp5734731p5734733.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2014-04-28 08:59
FromVictor Lazzarini
SubjectRe: [Csnd] Csound API and command line flag --tempo
Not exactly in realtime, but get it ready to perform (but not performing until you
start calling performKsmps(), perform() or put it in csoundPerformanceThread).

regarding readScore(), yes it’s the first call that matters. Everything after that will
be scheduled as events (and will not be in the sorted score).

So this is a summary:

1) the first score sent to Csound before csoundStart() gets sorted and placed
in memory. Tempo affects the sorting of the score.

2) any other calls to readScore() after that are not affected by tempo; readScore()
can sort, unroll loops, apply carry, expressions etc., but then it schedules 
everything as a series of events that is independent of the in-memory score.
It might be possible to modify Csound to apply tempo to this, but we would need to
investigate it.


========================
Dr Victor Lazzarini
Senior Lecturer
NUI Maynooth, Ireland
victor dot lazzarini at nuim dot ie




On 28 Apr 2014, at 08:42, francesco  wrote:

> Thank You Mr. Victor. I was a bit confused by the csoundStart command.
> May i say trivially that when i call csoundStart i'm putting csound in
> realtime?
> I mean csoundStart initialize csound and then you can only work with events
> (really trivially!).
> 
> i also noted that i cannot use
> cs:ReadScore("t 0 60")
> cs:ReadScore(sco)
> but this is working right
> cs:ReadScore("t 0 60\n" .. sco)
> 
> Thanks,
> ciao,
> francesco.
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Csound-API-and-command-line-flag-tempo-tp5734731p5734733.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 



Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2014-04-28 09:02
Fromfrancesco
Subject[Csnd] Re: Csound API and command line flag --tempo
Thanks, it seems i got it!

Ciao,
francesco.




--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-API-and-command-line-flag-tempo-tp5734731p5734735.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"