Skip to contentSkip to conversation

Metering on record

DISCUSSION Erik de Castro Lopo 3 participants 5 messages Sep 28, 2003 – Sep 29, 2003

lore
Share & tools
lore
#0 lore raw

Hi all,

I was hoping someone might be able to shine some light on the following issue. I am currently opening an ALSA device for record say 44.1 kHz and reading 32k frames of data at a time.

Now with the above setup, if I want to do a meter, I can only only update the meter every 32k frames or a little more than once a second which makes for a very poor display.

So, looking at /usr/include/alsa/pcm.h I find some function definitions which seem like they are meant for metering purposes. Unfortunalety I can't seem to find any documentation on the ALSA site nor can I find example code showing how this stuff is used.

Am I missing something or does this stuff just not exist? Do these snd_pcm_meter_* functions work? Anybody have working code that uses these things?

Thanks,
Erik

Signature · 12 lines
+-----------------------------------------------------------+
  Erik de Castro Lopo  [email protected] (Yes it's valid)
+-----------------------------------------------------------+
"Anyone who says you can have a lot of widely dispersed people hack
away on a complicated piece of code and avoid total anarchy has never
managed a software project." - Andy Tanenbaum in 1992 on comp.os.minix


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#1 lore raw
Quoted 16 lines · Erik de Castro Lopo

Hi all,

I was hoping someone might be able to shine some light on the following issue. I am currently opening an ALSA device for record say 44.1 kHz and reading 32k frames of data at a time.

Now with the above setup, if I want to do a meter, I can only only update the meter every 32k frames or a little more than once a second which makes for a very poor display.

So, looking at /usr/include/alsa/pcm.h I find some function definitions which seem like they are meant for metering purposes. Unfortunalety I can't seem to find any documentation on the ALSA site nor can I find example code showing how this stuff is used.

Quoted 3 lines

Am I missing something or does this stuff just not exist? Do these snd_pcm_meter_* functions work? Anybody have working code that uses these things?

The examples are in alsa-lib/src/pcm/scopes directory, but don't expect a better response times, because the meter plugin is also activated when an application reads or writes data to device.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#2 lore raw
Quoted 3 lines · On Mon, 29 Sep 2003 10:37:56 +0200 (CEST) Jaroslav Kysela <[email protected]> wrote:

The examples are in alsa-lib/src/pcm/scopes directory, but don't expect a better response times, because the meter plugin is also activated when an application reads or writes data to device.

Does that mean that the only way to get better meter response is to read smaller blocks?

Erik

Signature · 11 lines
+-----------------------------------------------------------+
  Erik de Castro Lopo  [email protected] (Yes it's valid)
+-----------------------------------------------------------+
"The day Microsoft makes something that doesn't suck is probably the
day they start making vacuum cleaners." -- Ernst Jan Plugge


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#3 lore raw
Quoted 9 lines · Erik de Castro Lopo
Quoted 3 lines · On Mon, 29 Sep 2003 10:37:56 +0200 (CEST) Jaroslav Kysela <[email protected]> wrote:

The examples are in alsa-lib/src/pcm/scopes directory, but don't expect a better response times, because the meter plugin is also activated when an application reads or writes data to device.

Does that mean that the only way to get better meter response is to read smaller blocks?

Not really. The plugins are activated when snd_pcm_avail_update() is called, so if you write own meter plugin and call snd_pcm_avail_update more frequently in the read thread, you may get better results. But I think that it might be better to read small chunks, because samples are already processed when snd_pcm_avail_update() is called so there is no point to delay the processing in application. In other words, it's better to do additional (large) buffering in application to avoid xruns.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#4 lore raw

PDAudio-CF ALSA Driver Intermittent Failure

In reply to Jaroslav Kysela

On the Linux Audio User mailing list, Jamie Lutch wrote:

[Begin]

From: Jamie Lutch <jlutch@al...>
audioio-alsa error
2003-09-23 20:05
So I have my setup (pdaudiocf card>ecasound) running fine at 24/96, but every once in awhile it just stops mid-stream and gives the following
error:

(audioio-alsa) Unknown Device State!

it just scrolls this message frantically, I have to reboot to get the card to work again.

any suggestions on where to start troubleshooting? It seems to be random. I can sometimes record for hours before it happens, other times it happens sooner (like the other night, halfway through the first set of david
grisman
quintet :( )

thanks,
jamie

[End]

Might someone help us with this problem? What might we do to track down the cause of this failure?

Len Moskowitz
Core Sound
www.core-sound.com

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf