Skip to contentSkip to conversation

read time information

DISCUSSION Men Muheim 2 participants 3 messages Nov 15, 2002 – Nov 18, 2002 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Men Muheim

author
#1 lore raw

For synchronization purpose I need the current time of my sound card (information on the sample that is currently played out might be sufficient / ADAT-Synch timecode) I did anticipate that the functions

      snd_pcm_status_alloca(&status);
	snd_pcm_status_get_tstamp(status, timestamp);

do help me with this, but obviously they only call gettimeofday() instead of returning a sound card time information (see
http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2latency_8c-example
.html#example_test_latency). From the API description I have found that

snd_pcm_hwsynch(...)
snd_pcm_delay(...)

must be used to get the current sample positions of the DAC/ADC. But these functions do not seem to work on my system (alsa-0.9.0rc5 and an RME9652 sound card). Besides that I want to read the ADAT-Synch timecode instead of the buffer relative sample offset.

Therefore I was looking for another solution to get the time. I tried to use the ALSA timer interface
(http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2timer_8c-example.
html#example_test_timer). But unfortunately I am getting a "timer time out!", which means that

snd_timer_poll_descriptors(...)

did fail. Is the timer interface implemented for the By the RME9652? By the way I do not understand how the sample number to the read time do correlate with each other.

I would appreciate any help with this because if I cannot solve this problem, I have to move to Windows ASIO (what a pitty!) ASIO provides the functions

ASIOGetSamplePosition(...)
bufferSwitchTimeInfo(...)

which do exactly what I need.

Regards,

Men

-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html

#2 lore raw
Quoted 3 lines

For synchronization purpose I need the current time of my sound card (information on the sample that is currently played out might be sufficient / ADAT-Synch timecode) I did anticipate that the functions

the code to read the ADAT sync timecode is written, but is not "exported" to a usable part of the ALSA API. it will likely show up as a readable PCM "control".

Quoted 1 line

snd_pcm_hwsynch(...)

never heard of that function. you learn something new every day :)

Quoted 6 lines

snd_pcm_delay(...)

must be used to get the current sample positions of the DAC/ADC. But these functions do not seem to work on my system (alsa-0.9.0rc5 and an RME9652 sound card). Besides that I want to read the ADAT-Synch timecode instead of the buffer relative sample offset.

they are two completely different things. one is not a substitute for the other.

Quoted 11 lines

Therefore I was looking for another solution to get the time. I tried to use the ALSA timer interface
(http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2timer_8c-example.
html#example_test_timer). But unfortunately I am getting a "timer time out!", which means that

snd_timer_poll_descriptors(...)

did fail. Is the timer interface implemented for the By the RME9652? By the way I do not understand how the sample number to the read time do correlate with each other.

the "timer" interface is part of the core of the ALSA drivers, its not specific to any particular driver. i have no idea how to use it however, and its not documented anywhere except for a few messages in the archives of this list and/or alsa-user.

but first you need to define what it is that you are trying to do. bringing the ADAT sync timecode into the picture greatly confuses things because this has nothing to do with the other functions you are describing. ADAT sync time can move backwards, can speed up, slow down etc.

Quoted 8 lines

I would appreciate any help with this because if I cannot solve this problem, I have to move to Windows ASIO (what a pitty!) ASIO provides the functions

ASIOGetSamplePosition(...)
bufferSwitchTimeInfo(...)

which do exactly what I need.

and what is it that you need? what are you trying to do?

--p

-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html

author
#3 lore raw

Two machines that are only connected through Ethernet should generate an impulse signal at a well defined global time. I want to measure the jitter between the two impulse signals.

For that purpose I have implemented an application with two threads. One thread is finding a mapping between the global time and the audio sample clock (a clock which is directly related to the playout of audio samples, e.g. a counter of currently played samples) by periodically measuring the current sample clock. Therefore an API method such as

snd_timer_info_get_ticks(...)
or
snd_pcm_delay(...)
or
snd_pcm_status_get_tstamp(...)

is needed.

The second thread generates an impulse at given sample clock. Therefore it must know, which sample clock corresponds to what offset in the snd_pcm_channel_area_t.

How do you think I could achieve that with the given API?

Regards, Men

PS: I was talking of ADAT synch, because in normal play mode the ADAT synch counts the number of samples currently played out.

Quoted 12 lines

-----Original Message-----
From: [email protected] [mailto:alsa-devel- [email protected]] On Behalf Of Paul Davis
Sent: Freitag, 15. November 2002 16:03
To: [email protected]
Cc: [email protected]
Subject: Re: [Alsa-devel] read time information

Quoted 3 lines

For synchronization purpose I need the current time of my sound card (information on the sample that is currently played out might be sufficient / ADAT-Synch timecode) I did anticipate that the functions

Quoted 12 lines

the code to read the ADAT sync timecode is written, but is not "exported" to a usable part of the ALSA API. it will likely show up as a readable PCM "control".

Quoted 1 line

snd_pcm_hwsynch(...)

never heard of that function. you learn something new every day :)

Quoted 4 lines

snd_pcm_delay(...)

must be used to get the current sample positions of the DAC/ADC. But these functions do not seem to work on my system (alsa-0.9.0rc5 and

an

Quoted 1 line
Quoted 1 line

RME9652 sound card). Besides that I want to read the ADAT-Synch

timecode

Quoted 6 lines
Quoted 1 line

instead of the buffer relative sample offset.

they are two completely different things. one is not a substitute for the other.

Quoted 1 line

Therefore I was looking for another solution to get the time. I tried

to

Quoted 3 lines
Quoted 1 line

use the ALSA timer interface

(http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2timer_8c-example

.

Quoted 1 line
Quoted 1 line

html#example_test_timer). But unfortunately I am getting a "timer

time

Quoted 5 lines
Quoted 5 lines

out!", which means that

snd_timer_poll_descriptors(...)

did fail. Is the timer interface implemented for the By the RME9652?

By

Quoted 32 lines
Quoted 2 lines

the way I do not understand how the sample number to the read time do correlate with each other.

the "timer" interface is part of the core of the ALSA drivers, its not specific to any particular driver. i have no idea how to use it however, and its not documented anywhere except for a few messages in the archives of this list and/or alsa-user.

but first you need to define what it is that you are trying to do. bringing the ADAT sync timecode into the picture greatly confuses things because this has nothing to do with the other functions you are describing. ADAT sync time can move backwards, can speed up, slow down etc.

Quoted 8 lines

I would appreciate any help with this because if I cannot solve this problem, I have to move to Windows ASIO (what a pitty!) ASIO provides the functions

ASIOGetSamplePosition(...)
bufferSwitchTimeInfo(...)

which do exactly what I need.

and what is it that you need? what are you trying to do?

--p

Quoted 8 lines

-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
Alsa-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html