[Portaudio] How to obtain the time point when computer begins to record?

Ross Bencina rossb-lists at audiomulch.com
Sun Mar 20 20:39:48 EDT 2016


Hello Mengqi,

On 20/03/2016 7:58 AM, Mengqi Ren wrote:
> I'm using PortAudio to record audio signals. In my project, I need to
> know the exact time when computer begins to record.

There is no such thing as "exact time". What are your requirements? What 
is your use-case?

> Would you please
> tell me when the recordCallback function is involved and when the first
> frame of data enters the input buffer?

There are timestamps passed to the callback that you can use. Their 
accuracy will depend on the platform (you didn't mention your platform). 
At stream start time they are likely to be at their least accurate. You 
might need to collect many timestamps and then process them to estimate 
the start time.

> Is there an API that can return
> the computer time when microphone begins to record?

A combination of the callback timestamps and Pa_GetStreamTime() should 
get you there.

The rest depends on your requirements and the platform(s) that you are 
targeting.

This is old, but it might help:
http://www.rossbencina.com/static/writings/portaudio_sync_acmc2003.pdf


Ross.


More information about the Portaudio mailing list