Discussion:
[Portaudio] Does PA support duplex between different devices on windows ?
Jean-Michaël Celerier
2018-07-13 07:10:43 UTC
Permalink
With ASIO, MME, WASAPI... I could not find in the doc.

Thanks !


-------
Jean-Michaël Celerier
http://www.jcelerier.name
Ross Bencina
2018-07-20 03:44:13 UTC
Permalink
Hello Jean-Michaël,
Does PA support duplex between different devices on windows ?
With ASIO, MME, WASAPI... I could not find in the doc.
ASIO: No. I'd like to support it but it requires some rework to bypass
the ASIO SDK limitation of on driver at a time.

MME: Yes, but all devices must share the same word clock, otherwise
clock drift will cause the stream to become unstable.

WASAPI: I don't know. Maybe someone else knows? You could look at the
source code, or try it and see.

Ross.
Jean-Michaël Celerier
2018-07-20 07:25:11 UTC
Permalink
Thanks for the answer !
This is to show only possible matching pairs of inputs / outputs to the
users of my software - I guess there will be some `if(Pa_MME)` somewhere
then.



-------
Jean-Michaël Celerier
http://www.jcelerier.name
Hello Jean-Michaël,
Does PA support duplex between different devices on windows ?
With ASIO, MME, WASAPI... I could not find in the doc.
ASIO: No. I'd like to support it but it requires some rework to bypass the
ASIO SDK limitation of on driver at a time.
MME: Yes, but all devices must share the same word clock, otherwise clock
drift will cause the stream to become unstable.
WASAPI: I don't know. Maybe someone else knows? You could look at the
source code, or try it and see.
Ross.
Leif Asbrink
2018-07-20 18:55:56 UTC
Permalink
Hello Ross and Jean-Michaël,

one can use a fractional resampler to support duplex
between any two devices. This is what we do in SDR (Software
Defined Radio.) Receiver input can be a soundcard, an
USB dongle (rtlsdr) or some other unit. Could be USB,
Ethernet or something else with sampling rates typically
in the range 48 kHz to 40 MHz. Output would typically be
a soundcard at one of the standard sampling rates feeding
a loudspeaker.

Here is a video showing the transmit side in Linrad with
a microphone to one soundcard and and the output of another
soundcard feeds the microphone input of a IC706 transceiver.


Linrad can run two duplex streams at the same time.
Typically a Delta 44 for Rx input, the motherboard
soundcard for Rx loudspeaker output. For Tx microphone
input would be the motherboard soundcard and for Tx
output the Delta44.

For output it is essential to use Portaudio to avoid
the horrible latency of Windows MME drivers. ASIO for
a Delta44 and WDM-KS or WASAPI for the motherboard.
For input it is better to use the MME drivers directly.

Both duplex streams use independent fractional resamplers.
The trick is to monitor the total number of samples that
reside in buffers between input and output. Typically
the corresponding time is not quite constant because
soundcards are a little different from their nominal
sampling frequencies. It is not difficult to adjust
the resampling rate of the fractional resampler for
the total time delay from input to output to become
constant.

This video shows a Softrock transceiver. It is a small
box connected to two soundcards and one antenna:

At 16:20 in the video you can see Rx setup, a Delta44
to digitize the audio to which the antenna signal is
converted and an Intel soundcard for the loudspeaker
output. Then comes the transmitter soundcard setup.
The video is showing Linux, but it works the same way
under Windows where Portaudio has to be selected for
the outputs to avoid excessive latency.

Regards

Leif
Post by Ross Bencina
Hello Jean-Michaël,
Does PA support duplex between different devices on windows ?
With ASIO, MME, WASAPI... I could not find in the doc.
ASIO: No. I'd like to support it but it requires some rework to bypass
the ASIO SDK limitation of on driver at a time.
MME: Yes, but all devices must share the same word clock, otherwise
clock drift will cause the stream to become unstable.
WASAPI: I don't know. Maybe someone else knows? You could look at the
source code, or try it and see.
Ross.
_______________________________________________
Portaudio mailing list
https://lists.columbia.edu/mailman/listinfo/portaudio
Gisle Vanem
2018-07-20 20:15:33 UTC
Permalink
Post by Leif Asbrink
For output it is essential to use Portaudio to avoid
the horrible latency of Windows MME drivers. ASIO for
a Delta44 and WDM-KS or WASAPI for the motherboard.
For input it is better to use the MME drivers directly.
Hello old Swede. You're still alive :-) ?

Why is the latency in MME so bad? How many milli-sec
are you speaking of and what about the latency in the
SDR reception chain or FFT-spectrum display? Nothing is
real-time when it comes to the human ear, eyes or brain.
--
--gv
Ross Bencina
2018-07-21 06:29:00 UTC
Permalink
Hello Leif and Jean-Michaël,

Leif, you make a good point: it is usually possible to open multiple
independent PA streams and perform some kind of buffering and
asynchronous sample rate conversion to create a fused "virtual" stream.

With PortAudio, the only issue with this that I can think of is that as
I already mentioned, the PA/ASIO implementation currently only supports
opening one stream at a time. So the fusion scheme wouldn't work if you
wanted to open two or more ASIO devices.

When implementing such a stream fusion scheme, monitoring buffer fill
levels is one approach. Another approach is clock recovery on buffer
timestamps. PortAudio provides callback timestamps to support this. In
any case, I think implementing stream fusion in the client is a
non-trivial amount of work, especially if you want robust, high-quality
results.

Ross.

P.S. Mac OS has a component called "aggregate devices" that lets the
user set up a virtual device that performs the fusion. On other
platforms this is something that you need to implement.
Post by Leif Asbrink
Hello Ross and Jean-Michaël,
one can use a fractional resampler to support duplex
between any two devices. This is what we do in SDR (Software
Defined Radio.) Receiver input can be a soundcard, an
USB dongle (rtlsdr) or some other unit. Could be USB,
Ethernet or something else with sampling rates typically
in the range 48 kHz to 40 MHz. Output would typically be
a soundcard at one of the standard sampling rates feeding
a loudspeaker.
Here is a video showing the transmit side in Linrad with
a microphone to one soundcard and and the output of another
soundcard feeds the microphone input of a IC706 transceiver.
http://youtu.be/VmxaZe3MM2A
Linrad can run two duplex streams at the same time.
Typically a Delta 44 for Rx input, the motherboard
soundcard for Rx loudspeaker output. For Tx microphone
input would be the motherboard soundcard and for Tx
output the Delta44.
For output it is essential to use Portaudio to avoid
the horrible latency of Windows MME drivers. ASIO for
a Delta44 and WDM-KS or WASAPI for the motherboard.
For input it is better to use the MME drivers directly.
Both duplex streams use independent fractional resamplers.
The trick is to monitor the total number of samples that
reside in buffers between input and output. Typically
the corresponding time is not quite constant because
soundcards are a little different from their nominal
sampling frequencies. It is not difficult to adjust
the resampling rate of the fractional resampler for
the total time delay from input to output to become
constant.
This video shows a Softrock transceiver. It is a small
http://youtu.be/6R9cg7PpA2s
At 16:20 in the video you can see Rx setup, a Delta44
to digitize the audio to which the antenna signal is
converted and an Intel soundcard for the loudspeaker
output. Then comes the transmitter soundcard setup.
The video is showing Linux, but it works the same way
under Windows where Portaudio has to be selected for
the outputs to avoid excessive latency.
Regards
Leif
Post by Ross Bencina
Hello Jean-Michaël,
Does PA support duplex between different devices on windows ?
With ASIO, MME, WASAPI... I could not find in the doc.
ASIO: No. I'd like to support it but it requires some rework to bypass
the ASIO SDK limitation of on driver at a time.
MME: Yes, but all devices must share the same word clock, otherwise
clock drift will cause the stream to become unstable.
WASAPI: I don't know. Maybe someone else knows? You could look at the
source code, or try it and see.
Ross.
_______________________________________________
Portaudio mailing list
https://lists.columbia.edu/mailman/listinfo/portaudio
_______________________________________________
Portaudio mailing list
https://lists.columbia.edu/mailman/listinfo/portaudio
Evan Balster
2018-07-20 19:54:37 UTC
Permalink
WASAPI: No. Only same-device duplexing. This is related to the "native
samplerate only" constraint with WASAPI — anything that potentially
involves resampling is the user's responsibility.

– Evan Balster
creator of imitone <http://imitone.com>
Hello Jean-Michaël,
Does PA support duplex between different devices on windows ?
With ASIO, MME, WASAPI... I could not find in the doc.
ASIO: No. I'd like to support it but it requires some rework to bypass the
ASIO SDK limitation of on driver at a time.
MME: Yes, but all devices must share the same word clock, otherwise clock
drift will cause the stream to become unstable.
WASAPI: I don't know. Maybe someone else knows? You could look at the
source code, or try it and see.
Ross.
_______________________________________________
Portaudio mailing list
https://lists.columbia.edu/mailman/listinfo/portaudio
Loading...