From owner-freebsd-multimedia@FreeBSD.ORG Wed Nov 9 16:10:37 2005 Return-Path: X-Original-To: freebsd-multimedia@freebsd.org Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9777916A41F for ; Wed, 9 Nov 2005 16:10:37 +0000 (GMT) (envelope-from skywizard@MyBSD.org.my) Received: from tomoyo.MyBSD.org.my (tomoyo.mybsd.org.my [202.157.186.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 975A143D48 for ; Wed, 9 Nov 2005 16:10:35 +0000 (GMT) (envelope-from skywizard@MyBSD.org.my) Received: from localhost (localhost [127.0.0.1]) by tomoyo.MyBSD.org.my (Postfix) with ESMTP id 73BCA6CC26; Thu, 10 Nov 2005 00:12:56 +0800 (MYT) Received: from tomoyo.MyBSD.org.my ([127.0.0.1]) by localhost (TOMOYO.MYBSD.ORG.MY [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 96039-02; Thu, 10 Nov 2005 00:12:55 +0800 (MYT) Received: from kasumi.MyBSD.org.my (kasumi.MyBSD.org.my [IPv6:2001:328:2002:aa2::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tomoyo.MyBSD.org.my (Postfix) with ESMTP id C0CD26CC23; Thu, 10 Nov 2005 00:12:54 +0800 (MYT) Date: Thu, 10 Nov 2005 00:10:41 +0800 From: Ariff Abdullah To: Watanabe Kazuhiro Message-Id: <20051110001041.7bc11d79.skywizard@MyBSD.org.my> In-Reply-To: <20051109134700.EF5FF25916@mail.asahi-net.or.jp> References: <20051109002013.4dcf3c0d.skywizard@MyBSD.org.my> <20051109134700.EF5FF25916@mail.asahi-net.or.jp> Organization: MyBSD X-Mailer: /usr/local/lib/ruby/1.8/net/smtp.rb Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by Amavisd AntiVirus & AntiSpam Scanner running on FreeBSD mailserver at TOMOYO.MYBSD.ORG.MY Cc: freebsd-multimedia@freebsd.org Subject: Re: [patch] stereo input is mixed to monaural via SoundBlaster16 recording mixer X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2005 16:10:37 -0000 On Wed, 09 Nov 2005 22:48:27 +0900 Watanabe Kazuhiro wrote: > At Tue, 08 Nov 2005 16:59:55 +0100, > Alexander Leidinger wrote: > > Watanabe Kazuhiro wrote: > > > > > if (src & SOUND_MASK_MIC) > > > - recdev |= 0x01; /* mono mic */ > > > + recdev_l |= 0x01; /* mono mic */ > > > + recdev_r |= 0x01; > > > > If I understand this correctly, this feeds the monaural signal to > > the left and the right channel. When we have a mono input, do we > > really want to have the same input doubled? I don't do any > > recording, so I don't know how most programs handle this, but IMHO > > it's a waste of resources and if the source is only able to > > deliver a mono-signal, the recording should only be possible in > > mono. > > The function sb16mix_setrecsrc() only manipulates the analog > recording mixer. So if we assign a mono input to the left and right > channel, it doesn't force for us to record a two-channel digitized > output. > > To decide a sampling format(stereo/mono, sample rate, bit length, > and so on) is not the mixer's role but DSP. > If this is about sample processing (mix, filter, rate, bit, mono->stereo, stereo->mono, etc), yes, you're correct. But mixer has its own purpose to route the pre(input) / post(output) processing (specifically stereo / mono), whether to discard or to allow any of left / right. > At Wed, 9 Nov 2005 00:20:13 +0800, > Ariff Abdullah wrote: > > Watanabe-san, I would suggest you to put braces along with the > > conditional statement so the code become much easier tu > > understand. Without it, it seems that recdev_r will always be set > > even if the condition is false. > > Oops... your indication is right and I'm wrong. The correct patch is > below. > > However, this patch is not perfect. After applied the patch, if I > try to record an monaural output (e.g. "wavrec -M mono.wav"), only > record the left channel sound. [ see below ] > > From the "Hardware Programming Reference" pp74: > "When recording in mono, note that samples will only be taken > from the left input mixer. > > So, if a mono recording of a stereo source is desired, the > switchs controlled by registers 0x3D and 0x3E must be > manipulated to enable both channels of a stereo source to be > mixed together first into the left input mixer before being > sampled." > > I'm just going to consider the problem. Perhaps it's difficult for > me to solve the problem... > Unfortunately, we're leaving in a *real* world. In a *perfect* world, we can assume that mono should be something like (left+right)/2, that is, mix all available channels and normalize it. But it has been decided (by most standards) that all channels (except left) will be discarded in order to achive mono input/output. So.. are there any differences (wavrec -M/S yada.wav) between patched and unpatched version? -- Ariff Abdullah MyBSD http://www.MyBSD.org.my (IPv6/IPv4) http://staff.MyBSD.org.my (IPv6/IPv4) http://tomoyo.MyBSD.org.my (IPv6/IPv4)