[Portaudio] Sample accurate align of recorded track to existing tracks?

info at sagantech.biz info at sagantech.biz
Tue Oct 19 15:46:28 EDT 2010


Hello Dmitry,

Thank you for the super fast reply. It is likely I am using outdated
sources as I tend to not change things unless they are badly broken.
Could you please recommend a link to obtain the most recent stable source
for best WASAPI support since that interests me most?

-		&gInputParameters	0x00747f74 gInputParameters {device=38 channelCount=2
sampleFormat=8 ...}	PaStreamParameters *
		device	       38	int
		channelCount	2	int
		sampleFormat	8	unsigned long
		suggestedLatency	0.0030000000000000001	double
		hostApiSpecificStreamInfo	0x00000000	void *

-		gOutputParameters	{device=29 channelCount=2 sampleFormat=1
...}	PaStreamParameters
		device	        29	int
		channelCount	2	int
		sampleFormat	1	unsigned long
		suggestedLatency	0.0030000000000000001	double
		hostApiSpecificStreamInfo	0x00000000	void *

The device is a firewire Phonic Helix 24. I have tried with other devices
as well. Pa_OpenStream is called with 44.1k samplerate and as for
framesperbuffers it is a variable that is a power of 2 between 64 and 4096.
None of these parameters make a difference in getting a consistent input to
output sample offset.

Thanks again,
Jeremy

On Tue, 19 Oct 2010 22:16:28 +0300, "Dmitry Kostjuchenko"
<dmitrykos at iauxsoft.com> wrote:
> Hello Jeremy,
> 
> Thanks for your kind report. As I am in charge of WASAPI we will work 
> together on your issue. Before I get down to code please describe
> parameters 
> you used for Input and Output streams, e.g. provide two
PaStreamParameters 
> with values so I could analyze and comment (sample rate/type, channels, 
> interleaved or not).
> 
> Also, which PA code version are you using? 'serious problem #2' block is

> commented out in current version. Are you using sources from SVN?
Current 
> revision is at 1544. Please kindly comment on this as I suspect you are 
> using some outdated sources.
> 
> Best regards,
> Dmitry.
> 
> ----- Original Message ----- 
> From: <info at sagantech.biz>
> To: <portaudio at music.columbia.edu>
> Sent: Tuesday, October 19, 2010 9:58 PM
> Subject: [Portaudio] Sample accurate align of recorded track to existing

> tracks?
> 
> 
>> Hello List,
>>
>> I am a PA newbie. I have a few questions.
>>
>> I have a seasoned app that I ported to the PC from Mac last year. I
>> handle
>> ASIO support internally so I am not using PA for that. Since ASIO does
>> not
>> (usually) allow devices to be shared I need to support a low latency
>> protocol. Currently I support whatever PA 1.9 provides with ASIO
stripped
>> out; MME, DS, WASAPI.
>>
>> WASAPI works very well after I added a couple of things (listed at end
of
>> message).
>>
>> How do I contribute my changes to this project? I would gladly submit
>> them
>> in a proper way if I knew how.
>>
>> Now here are the problems that I am currently stuck on.
>>
>> I would simply like to record an audio track using Por<script
type="text/javascript"
src="http://www.sagantech.biz:2095/3rdparty/roundcube/program/js/tiny_mce/themes/advanced/langs/en.js?s=1240817786"></script>t
Audio and be able
>> to precisely align the recorded track to existing tracks and be sample
>> accurate using a fixed framesPerBuffer. Currently I have tried many
>> things
>> all unsuccessfully.
>>
>> First of all, I cannot use WASAPI in full duplex mode. It will always
>> return an error because of serious problem #2
>> // serious problem #2
>> if (stream->out.framesPerHostCallback !=
>> stream->in.framesPerHostCallback)
>> even if I set the inputparameters and outputparameters the same in
terms
>> of sample size, sample rate, etc. The device input and output are 
>> different
>> PADevice indexes but the same external audio device.
>>
>> So resorting to half duplex, I have tried using timeinfo, which appears
>> to
>> be quite unreliable and is also apparently using different time bases
for
>> each stream. I also tried calling startstream for the output from
within
>> the input callback. In all cases, I always get quite a bit of jitter.
Any
>> help here would be greatly appreciated. Am I overlooking something
simple
>> here?
>>
>> Thanks,
>>
>> Jeremy Sagan
>> Sagan Technology
>> www.sagantech.biz
>>
>> Things added to get WASAPI to work for me:
>> In pa_win_wasapi.cpp line 2020:
>>
>> error:
>> if (stream)
>> {
>> if (result == paNoError)
>> {//JS:
>> PRINT(("WASAPI: OpenStream: was erroneously returning noErr\n"));
>> result = paInternalError;
>> }
>> CloseStream(stream);
>> PaUtil_FreeMemory(stream);
>> }
>> return result;
>> }
>>
>> and in pa_win_wasapi.cpp line 2728
>> static __forceinline HRESULT FillOutputBuffer...
>>
>> I had to change the #if 0 to #if 1 so that GetCurrentPadding is called
>> otherwise I just get silence.
>>
>> _______________________________________________
>> Portaudio mailing list
>> Portaudio at music.columbia.edu
>> http://music.columbia.edu/mailman/listinfo/portaudio
>> 
> 
> _______________________________________________
> Portaudio mailing list
> Portaudio at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/portaudio


More information about the Portaudio mailing list