[Cs-dev] Start time of instrument
Date | 2011-05-21 20:44 |
From | Alex Weiss |
Subject | [Cs-dev] Start time of instrument |
Attachments | None None |
Hi, what is the easiest way to get a sample-accurate start time of the instrument event that calls my opcode? Should I simply read p2 from INSDS and multiply by the sample rate?
Thanks
|
Date | 2011-05-21 20:57 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Start time of instrument |
why don't you have an i-rate input where the start time can be fed into? Then an instrument can use time to do it. Victor On 21 May 2011, at 20:44, Alex Weiss wrote: > Hi, > > what is the easiest way to get a sample-accurate start time of the > instrument event that calls my opcode? Should I simply read p2 from > INSDS and multiply by the sample rate? > > Thanks > ------------------------------------------------------------------------------ > What Every C/C++ and Fortran developer Should Know! > Read this article and learn how Intel has extended the reach of its > next-generation tools to help Windows* and Linux* C/C++ and Fortran > developers boost performance applications - including clusters. > http://p.sf.net/sfu/intel-dev2devmay_______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ What Every C/C++ and Fortran developer Should Know! Read this article and learn how Intel has extended the reach of its next-generation tools to help Windows* and Linux* C/C++ and Fortran developers boost performance applications - including clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2011-05-21 22:00 |
From | Alex Weiss |
Subject | Re: [Cs-dev] Start time of instrument |
Attachments | None None |
Yes, that would certainly be a possibility, but I was hoping there would be a more elegant solution. And even then, the question remains how I would obtain a sample-accurate start time from that; it is my understanding that score times are not "evaluated" at the sample rate but instead at the control rate. So simply multiplying the start time by sr would give an inaccurate result.
What I'm trying to do is sync csound with video, using csound->icurTime as the reference time. The sample-accurate start time of the instrument would then be the offset that I can subtract from icurTime.
On Sat, May 21, 2011 at 9:57 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: why don't you have an i-rate input where the start time can be fed |
Date | 2011-05-21 22:23 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Start time of instrument |
Attachments | None None |
Well, at the default ksmps, you'd be maximally only 10 samples out of the exact start time (whatever 'exact' in this case means), which is 10/44100 = 0.227 ms. Can't you live with that? Victor On 21 May 2011, at 22:00, Alex Weiss wrote: Yes, that would certainly be a possibility, but I was hoping there would be a more elegant solution. And even then, the question remains how I would obtain a sample-accurate start time from that; it is my understanding that score times are not "evaluated" at the sample rate but instead at the control rate. So simply multiplying the start time by sr would give an inaccurate result. Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |
Date | 2011-05-22 11:46 |
From | Alex Weiss |
Subject | Re: [Cs-dev] Start time of instrument |
Attachments | None None |
You're right, that is quite low. I was just curious. But I also just realized something else: I've completely forgotten to take the latency of the output device into account, which would be necessary for accurate sync. I don't suppose there is any way for an opcode to obtain such information or calculate it? On Sat, May 21, 2011 at 11:23 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|
Date | 2011-05-22 12:54 |
From | Andres Cabrera |
Subject | Re: [Cs-dev] Start time of instrument |
Hi, You'd also need to calculate video latency to get it completely in sync... our best bet is to choose certain times and make sure your events are triggered at that time. Then when you render the file, it will sync up. Cheers, Andres On Sun, May 22, 2011 at 11:46 AM, Alex Weiss |
Date | 2011-05-22 12:54 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Start time of instrument |
Attachments | None None |
That'll be dependent on what IO module you are using. Portaudio has some latency calculation functions, but I don't think they are accessible via the Csound API. It is something to consider implementing. Victor On 22 May 2011, at 11:46, Alex Weiss wrote: You're right, that is quite low. I was just curious. But I also just realized something else: I've completely forgotten to take the latency of the output device into account, which would be necessary for accurate sync. I don't suppose there is any way for an opcode to obtain such information or calculate it? Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |
Date | 2011-05-22 13:26 |
From | Alex Weiss |
Subject | Re: [Cs-dev] Start time of instrument |
Attachments | None None |
True. Sync really is an ugly issue... I don't think I can determine video latency, so I'll have to leave it at that. But I think the least I could do is to account for the delay due to the audio output buffer. On Sun, May 22, 2011 at 1:54 PM, Andres Cabrera <mantaraya36@gmail.com> wrote: Hi, |
Date | 2011-05-22 13:29 |
From | Alex Weiss |
Subject | Re: [Cs-dev] Start time of instrument |
Attachments | None None |
Yes, Portaudio does have some functions, and CoreAudio does, too (I believe csound also has a CoreAudio output module). If at some point that could be implemented in csound, that would be fantastic. But I'm wondering: What else besides the size of the output buffer determines the final latency?
On Sun, May 22, 2011 at 1:54 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|