From owner-freebsd-multimedia Fri Mar 29 13:16:44 2002 Delivered-To: freebsd-multimedia@freebsd.org Received: from postfix2-1.free.fr (postfix2-1.free.fr [213.228.0.9]) by hub.freebsd.org (Postfix) with ESMTP id 1103E37B41A for ; Fri, 29 Mar 2002 13:16:38 -0800 (PST) Received: from bluerondo.a.la.turk (nas-cbv-3-136-35.dial.proxad.net [62.147.136.35]) by postfix2-1.free.fr (Postfix) with ESMTP id 3F0E94B1 for ; Fri, 29 Mar 2002 22:16:35 +0100 (CET) Received: (qmail 858 invoked by uid 1001); 29 Mar 2002 21:16:28 -0000 Date: Fri, 29 Mar 2002 22:16:28 +0100 From: Rahul Siddharthan To: "Adam D. Gorski" Cc: freebsd-multimedia@FreeBSD.ORG Subject: Re: SB problem (was: Cat'ing /dev/audio) Message-ID: <20020329211628.GA824@lpt.ens.fr> References: <20020329191527.B77860@lpt.ens.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.27i X-Operating-System: FreeBSD 4.5-STABLE i386 Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Adam D. Gorski said on Mar 29, 2002 at 16:06:02: > Ok.. I converted an 8Khz wav file to Ogg, and that played fine... > > I converted a 44Khz Ogg to wav... I got the popping/screeching > > So basically it goes along with the suggestion that it's a sampling > problem... but is this a BSD-only issue? Everything played like a charm for > me under Linux, no matter what my current CPU load was, never a single skip. It's an issue, as I understand, with the way the PCM sound driver in FreeBSD handles sampling rate conversion: it doesn't do it very well. The only solution I found which worked reliably for me was playing it through arts, specifying the correct output rate (I also tried esd but that didn't work). > Oh, almost forgot.. when I play that 128bps/44Khz Ogg in XMMS, the bitrate > fluctuates.. meaning it goes from like 98 to 114 to 104 to 112 and so forth, > which is accompanied by the screeching. That's a red herring, it doesn't mean anything. The bit rate isn't the sampling rate; the sampling rate is the "output" and is constant, the bit rate is the effective number of bits per second in the encoded file and can vary according to what compression scheme you're using. Basically, the maximum frequency you can reproduce (Nyquist frequency) is set by your sampling rate. When you "upsample" (convert a lower sampling rate to a higher one) you're doing some sort of interpolation, if it's not very good you'll get a bit of distortion but no more. But when you "downsample" some frequencies in your original signal may now be higher than your new Nyqvist frequency -- then if you're not doing it carefully, they get "aliased" into lower frequencies, mixing up with what was already there, and resulting in plenty of noise like what you hear. I think there's no OS-level fix for this problem except digging into the pcm driver, which I'm not competent to do. As a user, you can either look for some sound software which does high-quality sampling rate conversion before output, or play everything through arts. (Even if you're not using kde you can run artsd separately from the command line, and xmms and ogg123 both have arts plugins.) HTH, Rahul To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message