Hi there,
We are doing some very high precision timing where we need to align the recorded input samples to the played output samples (we are not worried about latency or delays in starting the recording playback)- at the moment it seems that every time we start up the audio, the alignment in time between the input and output is different (e.g. if we play a pulse on the output, its position on the input is inconsistent). Is there a way that we can ensure that they both start at exactly the same clock cycle (or with exactly the same offset) every time? Alternatively can we get the time stamps to know when the samples were output/recorded (and from this work out the the offset)?
We are working with ALSA and a c-program on a Raspberry PI 3 with your stereo sound card.
Any help would be much appreciated.
Synchronization of IO
Moderator: flatmax
Re: Synchronization of IO
Hi there,
This is a common problem which is in ALSA land, independent of most sound cards.
In your code which interfaces ALSA, can you confirm that you are linking the playback and capture systems ?
For example in the FullDuplex class in gtkiostream , inside the function FullDuplex::go :
The intention in calling snd_pcm_link is to ensure that both playback and capture are started at the same point in time.
Matt
This is a common problem which is in ALSA land, independent of most sound cards.
In your code which interfaces ALSA, can you confirm that you are linking the playback and capture systems ?
For example in the FullDuplex class in gtkiostream , inside the function FullDuplex::go :
Code: Select all
if ((ret=link())<0)
Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Re: Synchronization of IO
Hi Matt,
Thanks so much for your advice. I hadn't found the snd_pcm_link functionality in the ALSA docs. It sounds like exactly what I need.
However, calling snd_pcm_link returns an error code of -22 (Invalid argument). I am attempting to link the playback/capture pcm devices after opening them both with snd_pcm_open and setting various hw/sw params. So, they are valid and configured pcm devices that are being passed in.
Do you have any idea why I'd get an invalid argument error when calling snd_pcm_link? I am using the RCA channel on the stereo soundcard with an external powered microphone.
Thanks!
Thanks so much for your advice. I hadn't found the snd_pcm_link functionality in the ALSA docs. It sounds like exactly what I need.
However, calling snd_pcm_link returns an error code of -22 (Invalid argument). I am attempting to link the playback/capture pcm devices after opening them both with snd_pcm_open and setting various hw/sw params. So, they are valid and configured pcm devices that are being passed in.
Do you have any idea why I'd get an invalid argument error when calling snd_pcm_link? I am using the RCA channel on the stereo soundcard with an external powered microphone.
Thanks!
Re: Synchronization of IO
Hi there,
Not sure what the problem is. Have you considered cross checking your code against the ALSA::FullDuplex code here :
thanks
Matt
Not sure what the problem is. Have you considered cross checking your code against the ALSA::FullDuplex code here :
Code: Select all
http://gtkiostream.flatmax.org/FullDuplex_8H_source.html
Matt
Check out our audiophile quality crossovers : https://bit.ly/2kb1nzZ
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector
Who is online
Users browsing this forum: No registered users and 4 guests