Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Playback samples at a specific time on Intel HDA
@ 2019-02-21 19:19 Rajagopal Aravindan
  2019-02-21 21:16 ` Pierre-Louis Bossart
  0 siblings, 1 reply; 2+ messages in thread
From: Rajagopal Aravindan @ 2019-02-21 19:19 UTC (permalink / raw)
  To: alsa-devel

Hello,

I am trying to accomplish synchronized audio playback using ALSA &
gPTP, on an Intel SkyLake platform have Intel HDA.

I do understand that, starting with SkyLake platform, there is support
for querying link time.
But, how do I instruct to play the samples at a given (gPTP) time ?
Is this possible ?
Can someone please point me to code or doc, relevant to my goal ?
In essence, I would like to play the samples at the stroke of a given
(gPTP) time.

Also, the ALSA page says ...
"The link time can be directly measured if supported in hardware by
sample counters or wallclocks (e.g. with HDAudio 24MHz or PTP clock
for networked solutions)"

What is the connection between PTP clock and sound card here,
are there sound cards that can latch on to a PTP clock on a NIC or what ?

Thanks in advance.

Regards,
Rajagopal

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Playback samples at a specific time on Intel HDA
  2019-02-21 19:19 Playback samples at a specific time on Intel HDA Rajagopal Aravindan
@ 2019-02-21 21:16 ` Pierre-Louis Bossart
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre-Louis Bossart @ 2019-02-21 21:16 UTC (permalink / raw)
  To: Rajagopal Aravindan, alsa-devel



> I am trying to accomplish synchronized audio playback using ALSA &
> gPTP, on an Intel SkyLake platform have Intel HDA.
That's an ambitious goal, I hope you are aware of the technical 
complexity behind this one-line problem description.
>
> I do understand that, starting with SkyLake platform, there is support
> for querying link time.
That's correct.
> But, how do I instruct to play the samples at a given (gPTP) time ?
> Is this possible ?

Unfortunately this is not possible, the hardware doesn't provide such 
synchronization capabilities. ALSA provide timestamps, so does gPTP and 
you need a userspace part to tie them together. The only thing you can 
do is start a silent stream, query the system/audio synchronized 
timestamp and based on the information insert the samples at the 
relevant position. That latter part is unfortunately not very precise 
and will typically be impacted by the position of the DMA pointer. The 
timestamps are also only at the link level, and the delays introduced by 
the analog parts is also not modeled anywhere - and codec vendors 
usually don't provide this information.

You also want to take the audio timestamps in ns with a grain of salt, 
it turns out that the conversion uses a nominal value which introduces a 
bias compared to the actual value. This will be compensated for if your 
userspace component tracks clock drift.

> Can someone please point me to code or doc, relevant to my goal ?
> In essence, I would like to play the samples at the stroke of a given
> (gPTP) time.
>
> Also, the ALSA page says ...
> "The link time can be directly measured if supported in hardware by
> sample counters or wallclocks (e.g. with HDAudio 24MHz or PTP clock
> for networked solutions)"
>
> What is the connection between PTP clock and sound card here,
> are there sound cards that can latch on to a PTP clock on a NIC or what ?
There is no connection on an HDaudio platform. The audio clock is based 
on the 24 MHz PLL which is independent from any network clock.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-21 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-21 19:19 Playback samples at a specific time on Intel HDA Rajagopal Aravindan
2019-02-21 21:16 ` Pierre-Louis Bossart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox