Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 May 2021 00:56:30 +0200
From:      Florian Walpen <dev@submerge.ch>
To:        multimedia@freebsd.org
Subject:   Re: Silent noise while running simple OSS program and moving mouse?
Message-ID:  <7619635.iDzAj6rjnq@z800>
In-Reply-To: <YKGWO6L9NTikr1ZI@vax.khramtsov.org>
References:  <YKGWO6L9NTikr1ZI@vax.khramtsov.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, May 17, 2021 12:01:31 AM CEST Evgeniy Khramtsov via freebsd-
multimedia wrote:
> Hi.
> 
> I wrote this simple OSS program that outputs sound from microphone back
> to the speakers (the close() and stuff is omitted):
> https://pastebin.com/raw/yX4gm5fL

Maybe not the culprit, but I'd definitely recommend to prefill the playback 
buffer with some silence before starting the loop. Like 3-4 times your buffer 
size of zeros. Otherwise you are very likely to produce underruns.

> 
> It works, though for some reason I get some silent noise while moving
> mouse around. Any ideas what could be wrong? Thanks.

You can check for underruns programmatically via SNDCTL_DSP_GETERROR, or 
through sndstat with:

sysctl hw.snd.verbose=2
cat /dev/sndstat

Hope that helps.

Florian Walpen







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7619635.iDzAj6rjnq>