NetBSD Problem Report #51784

From paul@whooppee.com  Fri Jan  6 03:08:26 2017
Return-Path: <paul@whooppee.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6C5557A289
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  6 Jan 2017 03:08:26 +0000 (UTC)
Message-Id: <20170106030823.F2EDC16E62@speedy.whooppee.com>
Date: Fri,  6 Jan 2017 11:08:23 +0800 (PHT)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: "Synthesized" speaker hums
X-Send-Pr-Version: 3.95

>Number:         51784
>Category:       kern
>Synopsis:       "synthesized" speaker hums
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    nat
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 06 03:10:00 +0000 2017
>Closed-Date:    Tue May 30 00:24:10 +0000 2017
>Last-Modified:  Tue May 30 00:25:01 +0000 2017
>Originator:     Paul Goyette
>Release:        NetBSD 7.99.53
>Organization:
+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+
>Environment:


System: NetBSD speedy.whooppee.com 7.99.53 NetBSD 7.99.53 (SPEEDY 2016-12-31 23:00:24) #1: Sun Jan 1 01:39:34 UTC 2017 paul@speedy.whooppee.com:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY amd64
Architecture: x86_64
Machine: amd64
>Description:

When outputting a sustained tone to the synthesized speaker (attached at
audio?), there is a distinct "hum" or "buzz", typical of "60-cycle power
line hum" from the old days!
>How-To-Repeat:
echo T60L1CP1CP1C > /dev/speaker

>Fix:
unknown


>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->nat
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Mon, 23 Jan 2017 22:04:02 +0000
Responsible-Changed-Why:
I'll take this.


From: Paul Goyette <paul@whooppee.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/51784: "Synthesized" speaker hums
Date: Mon, 22 May 2017 19:05:36 +0800 (+08)

 FWIW, this is still an issue with 7.99.72


From: Nathanial Sloss <nat@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 paul@whooppee.com
Subject: Re: kern/51784: "Synthesized" speaker hums
Date: Wed, 24 May 2017 10:13:21 +1000

 Hi,

 I've just finished a better implemetation of audiobell that should have little 
 to no hum.  The probelm with the existing audiobell.c is that the maximum bell 
 pitch is just 4 kHz with the patch it would be 22 kHz.

 The resolution of the data used to generate the sine wave has been increased 
 from 65 bytes to 2049 bytes, as the original 65 byte version genetated a 
 rather square-ish sinewave at some frequencies and the hum would be a 
 harminic.

 The hires version generates a better looking sine wave.

 To use apply this patch:
 ftp.netbsd.org/pub/NetBSD/misc/nat/hiresbell.diff
 and add the following to your kernel config:
 options HIRES_BELL

 Please let me know if this resolves the "hum".

 Best regards,

 Nat


 On Mon, 22 May 2017 21:10:00 Paul Goyette wrote:
 > The following reply was made to PR kern/51784; it has been noted by GNATS.
 > 
 > From: Paul Goyette <paul@whooppee.com>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: kern/51784: "Synthesized" speaker hums
 > Date: Mon, 22 May 2017 19:05:36 +0800 (+08)
 > 
 >  FWIW, this is still an issue with 7.99.72

From: Paul Goyette <paul@whooppee.com>
To: Nathanial Sloss <nat@netbsd.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/51784: "Synthesized" speaker hums
Date: Wed, 24 May 2017 11:13:29 +0800 (+08)

 On Wed, 24 May 2017, Nathanial Sloss wrote:

 > Hi,
 >
 > I've just finished a better implemetation of audiobell that should have little
 > to no hum.  The probelm with the existing audiobell.c is that the maximum bell
 > pitch is just 4 kHz with the patch it would be 22 kHz.
 >
 > The resolution of the data used to generate the sine wave has been increased
 > from 65 bytes to 2049 bytes, as the original 65 byte version genetated a
 > rather square-ish sinewave at some frequencies and the hum would be a
 > harminic.
 >
 > The hires version generates a better looking sine wave.
 >
 > To use apply this patch:
 > ftp.netbsd.org/pub/NetBSD/misc/nat/hiresbell.diff
 > and add the following to your kernel config:
 > options HIRES_BELL
 >
 > Please let me know if this resolves the "hum".

 Sorry, it does _not_ resolve the "hum" problem.


 +------------------+--------------------------+----------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
 +------------------+--------------------------+----------------------------+

From: Nathanial Sloss <nat@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 paul@whooppee.com
Subject: Re: kern/51784: "Synthesized" speaker hums
Date: Thu, 25 May 2017 18:55:17 +1000

 Hi,

 I've since found there is quality loss converting from ulaw to signed linear.

 I now have a 16 bit 1 channel signed linear bell.

 To use apply this patch:
 ftp.netbsd.org/pub/NetBSD/misc/nat/hiresbell-linear.diff
 and add the following to your kernel config:
 options HIRES_BELL

 Please let me know if this resolves the "hum" this time?

 Best regards,

 Nat

From: Paul Goyette <paul@whooppee.com>
To: Nathanial Sloss <nat@netbsd.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/51784: "Synthesized" speaker hums
Date: Thu, 25 May 2017 17:18:41 +0800 (+08)

 > I've since found there is quality loss converting from ulaw to signed linear.
 >
 > I now have a 16 bit 1 channel signed linear bell.
 >
 > To use apply this patch:
 > ftp.netbsd.org/pub/NetBSD/misc/nat/hiresbell-linear.diff
 > and add the following to your kernel config:
 > options HIRES_BELL
 >
 > Please let me know if this resolves the "hum" this time?

 Unfortunately the hum persists.

 Interestingly, there is no hum when doing "normal" audio/video playback 
 (such as running mplayer, or visiting a video clip in firefox!).  It is 
 only a problem when executing a command similar to

  	# echo  T60L1CP1CP1C > /dev/speaker


 +------------------+--------------------------+----------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
 +------------------+--------------------------+----------------------------+

From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51784 CVS commit: src/sys/dev
Date: Sat, 27 May 2017 10:54:47 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Sat May 27 10:54:47 UTC 2017

 Modified Files:
 	src/sys/dev: audiobell.c
 Added Files:
 	src/sys/dev: audiobelldata.h

 Log Message:
 The audio bell is now in 16 bit slinear format.

 It is possible to use a frequency of 44.1 kHz as apposed to 8 kHz if
 you specifiy:

 options HIRES_BELL

 in your kernel config file.

 Changes to the way in which the wave is generated help reducing pops and
 ticks in the bell.

 The output of the high resolution bell has been tested extensively using
 frequency spectographs generated by pkgsrc package audio/audacity.

 This addresses PR kern/51784.


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 src/sys/dev/audiobell.c
 cvs rdiff -u -r0 -r1.1 src/sys/dev/audiobelldata.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Paul Goyette <paul@whooppee.com>
To: Nathanial Sloss <nat@netbsd.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: PR/51784 CVS commit: src/sys/dev
Date: Sun, 28 May 2017 10:02:07 +0800 (+08)

 OK, I just rebuilt a clean GENERIC kernel and tried it out.  The results 
 are somewhat inconclusive....  :)

 Previously, with all default settings, the _volume_ on the /dev/speaker 
 was very high.  Possibly it was so high that the "hum" might have been 
 overdriving of the D-A converter.

 Now, with the current kernel, the volume on /dev/speaker is very low, 
 almost inaudible!  So it is not possible for me to determine if the hum 
 has disappeared, or if it has just been reduced proportionately in its 
 amplitude.

 Has the Hi-Res-Bell stuff also affected the audio levels?  Perhaps some 
 sort of scaling factor?  Or high-order vs low-order byte values?  (I'm 
 just guessing, I actually have no idea how audio stuff really works!)



 +------------------+--------------------------+----------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
 +------------------+--------------------------+----------------------------+

State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Tue, 30 May 2017 00:24:10 +0000
State-Changed-Why:
Problem resolved


From: Paul Goyette <paul@whooppee.com>
To: Nathanial Sloss <nat@netbsd.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: PR/51784 CVS commit: src/sys/dev
Date: Tue, 30 May 2017 08:23:09 +0800 (+08)

 I have no clue why previous tests did not work, but...

 I upgraded my kernel (and modules) overnight to 7.99.75, and the volume 
 of /dev/speaker is back to its previous levels.

 Furthermore, the quality of the sound produced is excellent, with no 
 discernible "hum".


 +------------------+--------------------------+----------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
 +------------------+--------------------------+----------------------------+

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.