Csound Csound-dev Csound-tekno Search About

[Csnd] question re ksmps, spout, and score timing

Date2011-12-23 03:30
FromIain Duncan
Subject[Csnd] question re ksmps, spout, and score timing
I'm wondering if any gurus can answer a question about timing of note events within a ksmp sized buffer. The situation:

- jack app has buffer size of 128 
- csound ksmp is 64, meaning a ksmp is 1.5ms roughly
- host has a clock that is self correcting, and stays accurate limited only by precision of system float.
- host will call csoundPerformKsmp twice per jack buffer
- the host will send events to csound as it loops through it's clock, which uses a single sample update

Am I correct in assuming that to csound, if I send a batch of score events with time 'now', they will all get rendered as if their internal score time in csound is the top of the next ksmp?

I'm pretty sure csound score time can be more accurate than ksmp, correct? I.E. score times are not jittered on to ksmp barriers?

What would be the correct way to compensate for this, can I post score events to csound with a time offset so that they stagger properly within one ksmp buffer? And if so, what is the recommended way of doing this, do I need to have the host keep track of what time each csound instance thinks it is in local score time, or is there an elegant way to say time 'now + 50 samples'?

Thanks!
Iain

Date2011-12-23 03:37
FromAdam Puckett
SubjectRe: [Csnd] question re ksmps, spout, and score timing
You can set ksmps  = 1, and you'll have the accuracy you need. The
score event would look like this (here $SR is assumed to be your
orchestra sr, which you would define like so: #define SR 44100):

i1 ^+[50/$SR] $duration ;... extra p-fields

Hope this helps,

Adam

On 12/22/11, Iain Duncan  wrote:
> I'm wondering if any gurus can answer a question about timing of note
> events within a ksmp sized buffer. The situation:
>
> - jack app has buffer size of 128
> - csound ksmp is 64, meaning a ksmp is 1.5ms roughly
> - host has a clock that is self correcting, and stays accurate limited only
> by precision of system float.
> - host will call csoundPerformKsmp twice per jack buffer
> - the host will send events to csound as it loops through it's clock, which
> uses a single sample update
>
> Am I correct in assuming that to csound, if I send a batch of score events
> with time 'now', they will all get rendered as if their internal score time
> in csound is the top of the next ksmp?
>
> I'm pretty sure csound score time can be more accurate than ksmp, correct?
> I.E. score times are not jittered on to ksmp barriers?
>
> What would be the correct way to compensate for this, can I post score
> events to csound with a time offset so that they stagger properly within
> one ksmp buffer? And if so, what is the recommended way of doing this, do I
> need to have the host keep track of what time each csound instance thinks
> it is in local score time, or is there an elegant way to say time 'now + 50
> samples'?
>
> Thanks!
> Iain
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-12-23 07:43
FromIain Duncan
SubjectRe: [Csnd] question re ksmps, spout, and score timing
Thanks Adam, what I'm actually interested in though is what happens when ksmps is large. Are all score event start times jittered to the top of a ksmp multiple of samples or is event start time calculated at audio rate?

iain

On Thu, Dec 22, 2011 at 7:37 PM, Adam Puckett <adotsdothmusic@gmail.com> wrote:
You can set ksmps  = 1, and you'll have the accuracy you need. The
score event would look like this (here $SR is assumed to be your
orchestra sr, which you would define like so: #define SR 44100):

i1 ^+[50/$SR] $duration ;... extra p-fields

Hope this helps,

Adam

On 12/22/11, Iain Duncan <iainduncanlists@gmail.com> wrote:
> I'm wondering if any gurus can answer a question about timing of note
> events within a ksmp sized buffer. The situation:
>
> - jack app has buffer size of 128
> - csound ksmp is 64, meaning a ksmp is 1.5ms roughly
> - host has a clock that is self correcting, and stays accurate limited only
> by precision of system float.
> - host will call csoundPerformKsmp twice per jack buffer
> - the host will send events to csound as it loops through it's clock, which
> uses a single sample update
>
> Am I correct in assuming that to csound, if I send a batch of score events
> with time 'now', they will all get rendered as if their internal score time
> in csound is the top of the next ksmp?
>
> I'm pretty sure csound score time can be more accurate than ksmp, correct?
> I.E. score times are not jittered on to ksmp barriers?
>
> What would be the correct way to compensate for this, can I post score
> events to csound with a time offset so that they stagger properly within
> one ksmp buffer? And if so, what is the recommended way of doing this, do I
> need to have the host keep track of what time each csound instance thinks
> it is in local score time, or is there an elegant way to say time 'now + 50
> samples'?
>
> Thanks!
> Iain
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2011-12-23 09:17
FromVictor Lazzarini
SubjectRe: [Csnd] question re ksmps, spout, and score timing
Events are quantised to ksmps blocks, just like in other vector-based engines (e.g. PD).

Victor

On 23 Dec 2011, at 07:43, Iain Duncan wrote:

Thanks Adam, what I'm actually interested in though is what happens when ksmps is large. Are all score event start times jittered to the top of a ksmp multiple of samples or is event start time calculated at audio rate?

iain

On Thu, Dec 22, 2011 at 7:37 PM, Adam Puckett <adotsdothmusic@gmail.com> wrote:
You can set ksmps  = 1, and you'll have the accuracy you need. The
score event would look like this (here $SR is assumed to be your
orchestra sr, which you would define like so: #define SR 44100):

i1 ^+[50/$SR] $duration ;... extra p-fields

Hope this helps,

Adam

On 12/22/11, Iain Duncan <iainduncanlists@gmail.com> wrote:
> I'm wondering if any gurus can answer a question about timing of note
> events within a ksmp sized buffer. The situation:
>
> - jack app has buffer size of 128
> - csound ksmp is 64, meaning a ksmp is 1.5ms roughly
> - host has a clock that is self correcting, and stays accurate limited only
> by precision of system float.
> - host will call csoundPerformKsmp twice per jack buffer
> - the host will send events to csound as it loops through it's clock, which
> uses a single sample update
>
> Am I correct in assuming that to csound, if I send a batch of score events
> with time 'now', they will all get rendered as if their internal score time
> in csound is the top of the next ksmp?
>
> I'm pretty sure csound score time can be more accurate than ksmp, correct?
> I.E. score times are not jittered on to ksmp barriers?
>
> What would be the correct way to compensate for this, can I post score
> events to csound with a time offset so that they stagger properly within
> one ksmp buffer? And if so, what is the recommended way of doing this, do I
> need to have the host keep track of what time each csound instance thinks
> it is in local score time, or is there an elegant way to say time 'now + 50
> samples'?
>
> Thanks!
> Iain
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2011-12-23 19:53
FromIain Duncan
SubjectRe: [Csnd] question re ksmps, spout, and score timing
Thanks Victor. 

Iain

On Fri, Dec 23, 2011 at 1:17 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
Events are quantised to ksmps blocks, just like in other vector-based engines (e.g. PD).

Victor

On 23 Dec 2011, at 07:43, Iain Duncan wrote:

Thanks Adam, what I'm actually interested in though is what happens when ksmps is large. Are all score event start times jittered to the top of a ksmp multiple of samples or is event start time calculated at audio rate?

iain

On Thu, Dec 22, 2011 at 7:37 PM, Adam Puckett <adotsdothmusic@gmail.com> wrote:
You can set ksmps  = 1, and you'll have the accuracy you need. The
score event would look like this (here $SR is assumed to be your
orchestra sr, which you would define like so: #define SR 44100):

i1 ^+[50/$SR] $duration ;... extra p-fields

Hope this helps,

Adam

On 12/22/11, Iain Duncan <iainduncanlists@gmail.com> wrote:
> I'm wondering if any gurus can answer a question about timing of note
> events within a ksmp sized buffer. The situation:
>
> - jack app has buffer size of 128
> - csound ksmp is 64, meaning a ksmp is 1.5ms roughly
> - host has a clock that is self correcting, and stays accurate limited only
> by precision of system float.
> - host will call csoundPerformKsmp twice per jack buffer
> - the host will send events to csound as it loops through it's clock, which
> uses a single sample update
>
> Am I correct in assuming that to csound, if I send a batch of score events
> with time 'now', they will all get rendered as if their internal score time
> in csound is the top of the next ksmp?
>
> I'm pretty sure csound score time can be more accurate than ksmp, correct?
> I.E. score times are not jittered on to ksmp barriers?
>
> What would be the correct way to compensate for this, can I post score
> events to csound with a time offset so that they stagger properly within
> one ksmp buffer? And if so, what is the recommended way of doing this, do I
> need to have the host keep track of what time each csound instance thinks
> it is in local score time, or is there an elegant way to say time 'now + 50
> samples'?
>
> Thanks!
> Iain
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> 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 the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie