[nas] [maddog at mir.com: Bug#168814: nasd always opens audio device at max sample rate]

Steve McIntyre steve at einval.com
Wed Dec 4 13:42:54 MST 2002


An odd-sounding bug report from a Debian user:

----- Forwarded message from Matto Marjanovic <maddog at mir.com> -----

From: Matto Marjanovic <maddog at mir.com>
Date: Tue, 12 Nov 2002 12:25:55 -0500
To: Debian Bug Tracking System <submit at bugs.debian.org>
Reply-To: Matto Marjanovic <maddog at mir.com>, 168814 at bugs.debian.org
Subject: Bug#168814: nasd always opens audio device at max sample rate
X-Debian-PR-Message: report 168814
X-Debian-PR-Package: nas
X-Debian-PR-Keywords: 
X-Spam-Level: 
X-Spam-Status: No, hits=-4.5 required=5.0 tests=SENT_BY_BTS,FORGED_RCVD_FOUND version=2.20
X-Spam-Level: 
X-Keywords:                 
X-UID: 151


Package: nas
Version: 1.6-3
Severity: normal

Hiya,

I've had this problem for quite a while (over a year?), but, lazy me, I'm 
 just investigating/reporting it now:

     nasd seems to always open the audio output device at the
     maximum sample rate specified in /etc/nasd/nasd.conf.


If I try to play a sound file with a *higher* sample rate than this
 specification, it sounds alright (i.e. it is being automatically
 downsampled somewhere).  However, if I try to play a sound file with
 a *lower* sample rate, it is played too fast (i.e. no upsampling has
 been done).

By setting the maximum sample rate in nasd.conf to equal the minimum rate,
 sound files playback ok, being automatically up- or down-sampled as 
 appropriate.  (This is a convenient workaround, but the quality does
 suffer due to resampling.)

Also, it appears that there is no constraint that "max sample rate" must
 be higher than the "min sample rate" in nasd.conf.  If I make the max
 lower than the min, then sound files seem to get upsampled to the high
 'min' rate (if necessary) but them played at the low 'max' rate (very
 spooky).

And, last tidbit, the "forcerate" option, whatever it is supposed to do,
 has no effect on any of this.

(In my experiments, 'playing' means auplay or output generated by xfaces,
 which is my main NAS client.  auinfo reports the correct sample rates for
 the sound buckets created by xfaces.)


I don't remember having such a problem until I switched to my current sound
 card (SBLive soundcard, using stock kernel modules:  emu10k1, ac97_codec,
 sound, soundcore).
Indeed, I do not have this problem on another machine with an OPL3-SA2
 sound chip (opl3sa2, ad1848, mpu401; linux 2.4.18; and nas_1.5-1, however
 the problem machine suffered back in the 1.5 days as well).

Thanks for keeping NAS up and running,
-matt m.

ps:  Included at the end is some debugging output, along with a nasd.conf
      file.



-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux yoo-hoo 2.4.19 #1 Sat Aug 24 11:52:06 EDT 2002 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages nas depends on:
ii  debconf                       1.2.14     Debian configuration management sy
ii  libaudio2                     1.6-3      The Network Audio System (NAS). (s
ii  libc6                         2.3.1-3    GNU C Library: Shared libraries an
ii  xlibs                         4.2.1-3    X Window System client libraries

-- debconf information:
* nas/mixer: false
* nas/relinquish: true



Here is the "-d 1" output of nasd, from startup through a request from
  auplay to play a file with 11025 Hz:

AuInitPhysicalDevices();
Init: will close device when finished with stream.
Init: Leaving the mixer device options alone at startup.
openDevice OUT /dev/dsp mode 2
openDevice(1) IN /dev/dsp1 mode 0
setupSoundcard(...);
++ Setting up Output device
+++ requesting wordsize of 16, got 16
+++ requesting 2 channel(s), got 2 channel(s)
+++ Requesting minimum sample rate of 5000, got 8000
+++ Requesting maximum sample rate of 44100, got 44100
setupSoundcard(...);
++ Setting up Input device
+++ requesting wordsize of 8, got 8
+++ requesting 2 channel(s), got 2 channel(s)
+++ Requesting minimum sample rate of 4000, got 8000
+++ Requesting maximum sample rate of 44100, got 44100
setTimer(rate = 0);
createServerComponents(...);
closeDevice: out
closeDevice OUT /dev/dsp mode 2
closeDevice: in
closeDevice IN /dev/dsp en 2
closeDevice: mixer
  [--------------------------- playing starts here (mm) ---------------------]
setSampleRate(rate = 11025);
setTimer(rate = 11025);
enableProcessFlow();
openDevice
openDevice OUT /dev/dsp mode 2
setupSoundcard(...);
++ Setting up Output device
+++ requesting wordsize of 16, got 16
+++ requesting 2 channel(s), got 2 channel(s)
+++ Requesting minimum sample rate of 8000, got 8000
+++ Requesting maximum sample rate of 44100, got 44100
openDevice IN /dev/dsp mode 2
setupSoundcard(...);
++ Setting up Input device
+++ requesting wordsize of 16, got 16
+++ requesting 2 channel(s), got 2 channel(s)
+++ Requesting minimum sample rate of 8000, got 8000
+++ Requesting maximum sample rate of 44100, got 44100
setSampleRate(rate = 44100);
setTimer(rate = 44100);
disableProcessFlow() - starting
closeDevice: out
closeDevice OUT /dev/dsp mode 2
closeDevice: in
closeDevice IN /dev/dsp en 2
closeDevice: mixer
disableProcessFlow() - done;
serverReset();
setTimer(rate = 0);
closeDevice: out
closeDevice: output device already closed
closeDevice: in
closeDevice: input device already closed
closeDevice: mixer
closeDevice: mixerdevice already closed
AuInitPhysicalDevices();
Init: will close device when finished with stream.
Init: Leaving the mixer device options alone at startup.
setTimer(rate = 0);
createServerComponents(...);
serverReset();
setTimer(rate = 0);
closeDevice: out
closeDevice: output device already closed
closeDevice: in
closeDevice: input device already closed
closeDevice: mixer
closeDevice: mixerdevice already closed


And here is the nasd.conf file involved:

#
#	A sample config file for the NAS Audio Server
#
# $Id: nasd.conf.eg,v 1.8 2002/10/08 03:08:02 jon Exp $
# $NCDId: @(#)AUVoxConfig.eg,v 1.1 1996/04/24 17:00:06 greg Exp $
#


# set this to 0 for no debugging, a larger number equals more debugging
#  info...
Debug 0

# be verbose, comment out if you don't want it
Verbose

# set this to "yes" or "no" to indicate whether nasd should release the
#  audio device when finished playing a sound.
# Only the voxware, hpux, and sun servers understand this for now.
ReleaseDevice "yes"

# init the mixer on startup? Voxware only.
MixerInit "no"

# This is used on hpux.  Set to "INT" to use the internal speaker,
#  set to "EXT" to use the external device (headphone/speakers).
OutDevType	"EXT"

# These are all used by voxware, nowhere else yet.

inputsection

	device		"/dev/dsp1"		# The input device, usually
	mixer		"/dev/mixer1"		# mixer device
        gain            50                      # default input gain (0-100)
	maxrate		44100
	minrate		4000			# Kind of redundant
	maxfrags	3			# We want really low latency
	minfrags	2			# the default
	fragsize	256			# Again, for low latency
	wordsize	8			# It only handles 8 bits anyway
	numchans	2			# Glorious living mono
	forcerate	"no"			# forces input rate to current
	autoOpen        "yes"			# whether to open the dev
						# at init
	readwrite	"no"			# open read only if "no"
end

# These are used by voxware only for now.
outputsection
	device		"/dev/dsp"		# The output device, usually
	mixer		"/dev/mixer"		# mixer device
        gain            50                      # default output gain (0-100)
	maxrate		44100			# CD quality.
#	maxrate		8000			# CD quality.
#	maxrate		11025			# CD quality.
	minrate		5000			# Redundant again
#	minrate		44100			# Redundant again
#	minrate		11025			# Redundant again
	maxfrags	3			# Low latency (for doom!)
	minfrags	2			# redundant really.
	fragsize	256			# Low latency again..
	wordsize	16			# Yes!
	numchans	2			# HiFi Stereo!
#	forcerate	"no"			# forces output rate to current
	forcerate	"yes"			# forces output rate to current
	autoOpen        "yes"			# whether to open the dev
						# at init
	readwrite	"yes"			# open write only if "no"
end

#
#	An el cheapo full duplex setup could have the following output
#	section with the above inputsection, assuming that all they had
#	was an 8 bit SB and the PC speaker with the voxware server.
#
#       I really hope no one is saddled with this type of hardware in the
#       21st century.  If so, I sympathize.
#
#
#outputsection
#	device	"/dev/pcaudio"
#	maxrate		8000
#	minrate		8000
#	wordsize	8
#end




----- End forwarded message -----
-- 
Steve McIntyre, Cambridge, UK.                                steve at einval.com
Use Debian GNU/Linux - upgrade your Windoze box today!  http://www.debian.org/
"Can't keep my eyes from the circling sky,
"Tongue-tied & twisted, Just an earth-bound misfit, I..."



More information about the Nas mailing list