TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: R.WIESER
date: 2020-01-04 09:24:00
subject: Re: ALSA sound cut short

Eli,

> All four listings on that page work for me.

Thats strange to say the least: In the code I posted the link to I had to
initialize the "dir" variable (to zero) to get rid of an initial delay (in
the "snd_pcm_hw_params_set_rate_near( )" function).   Compiler differences ?
(I'm using gcc)

Besides that, the code worked alright for me too.   Up until I changed the
sample rate from 44100 to 8000 that is.  Than the sound became much shorter.

> So I have to wonder if you've introduced a bug in your code
> changes which you have described but not shared.

I just re-started with the code I took from the link I posted, and changed
the "val = 44100;" line into
val = 8000;
dir = 0;

Thats all I need to get the (much) shorter sound.

And just now, after re-adding the code to measure the time from the start of
the loop until after "snd_pcm_drain()", I noticed that even with the
origional bitrate of 44100 the sound now only goes for 4.3 seconds ...

> You might have more luck in a more general Linux group
> (comp.os.linux.misc gets a fair amount of traffic) or a programming
> group (comp.lang.c is active).  But include your actual code.

I have been thinking of that too, but I currently regard the problem as
being ALSA, and possibly Raspberry Pi specific, not one of the language
itself.

Regards,
Rudy Wieser

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.