From nobody Sun May 16 22:56:30 2021 X-Original-To: multimedia@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 71672854520 for ; Sun, 16 May 2021 22:56:43 +0000 (UTC) (envelope-from dev@submerge.ch) Received: from c3po.matrixx.ch (c3po.matrixx.ch [80.74.145.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjyLf1HKrz4gnR for ; Sun, 16 May 2021 22:56:41 +0000 (UTC) (envelope-from dev@submerge.ch) Received: from [145.40.200.44] (port=46559 helo=z800.localnet) by c3po.matrixx.ch with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1liPgU-0002VK-DI for multimedia@freebsd.org; Mon, 17 May 2021 00:56:32 +0200 From: Florian Walpen To: multimedia@freebsd.org Subject: Re: Silent noise while running simple OSS program and moving mouse? Date: Mon, 17 May 2021 00:56:30 +0200 Message-ID: <7619635.iDzAj6rjnq@z800> In-Reply-To: References: List-Id: Multimedia discussions List-Archive: http://lists.freebsd.org/multimedia List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-multimedia@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - c3po.matrixx.ch X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - submerge.ch X-Get-Message-Sender-Via: c3po.matrixx.ch: authenticated_id: florian.walpen@submerge.ch X-Authenticated-Sender: c3po.matrixx.ch: florian.walpen@submerge.ch X-Source: X-Source-Args: X-Source-Dir: X-Rspamd-Queue-Id: 4FjyLf1HKrz4gnR X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of dev@submerge.ch designates 80.74.145.109 as permitted sender) smtp.mailfrom=dev@submerge.ch X-Spamd-Result: default: False [1.87 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; HAS_X_SOURCE(0.00)[]; TO_DN_NONE(0.00)[]; HAS_X_ANTIABUSE(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; CTE_CASE(0.50)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[80.74.145.109:from]; R_DKIM_NA(0.00)[]; HAS_X_AS(0.00)[florian.walpen@submerge.ch]; ASN(0.00)[asn:21069, ipnet:80.74.144.0/20, country:CH]; SUBJECT_ENDS_QUESTION(1.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.62)[0.621]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[submerge.ch]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[80.74.145.109:from:127.0.2.255]; NEURAL_SPAM_LONG(0.55)[0.550]; HAS_X_GMSV(0.00)[florian.walpen@submerge.ch]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[multimedia] X-Spam: Yes 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