Subject: 48 kHz does not work on snapper(4) on NetBSD 3.1
To: None <port-macppc@NetBSD.ORG>
From: Marco Trillo <marcotrillo@gmail.com>
List: port-macppc
Date: 12/07/2006 12:43:00
Hi,

When playing an audio file at 48000 samples/sec on snapper(4) on
NetBSD 3.1, it plays at a speed of 44100 samples/sec (so it plays at
91% speed and with pitch distortion).

It's a eMac G4 (PowerMac6,4) with a TAS3004 audio hardware.

ununoctium: {9} uname -mrsv
NetBSD 3.1 NetBSD 3.1 (UNUNHEXIUM) #0: Fri Nov 24 22:12:41 UTC 2006
root@ununhexium:/usr/src/sys/arch/macppc/compile/UNUNHEXIUM macppc

ununoctium: {10} dmesg | grep snapper
snapper0 at obio0 offset 0x10000: irq 30,1,2
audio0 at snapper0: full duplex

These two files, 44100.au [1] and 48000.au [2] are exactly identical,
but one has the value 44100 on the sampling rate field and the other
has the value of 48000.

--- 44100.hex   2006-12-07 12:22:40.000000000 +0100
+++ 48000.hex   2006-12-07 12:22:50.000000000 +0100
@@ -1,5 +1,5 @@
 00000000  2e 73 6e 64 00 00 00 18  00 00 ac 44 00 00 00 1b  |.snd.......D....|
-00000010  00 00 ac 44 00 00 00 01  d5 f6 e6 e9 96 92 99 85  |...D............|
+00000010  00 00 bb 80 00 00 00 01  d5 f6 e6 e9 96 92 99 85  |................|
 00000020  87 81 83 8d 8f 8e 88 8a  b5 b5 b4 b4 b7 b7 b7 b6  |................|
 00000030  b6 b6 b6 b6 b7 b7 b7 b4  b4 b5 b5 8a 88 89 8f 8d  |................|
 00000040  83 81 87 85 99 9d 96 e8  e1 f0 d1 74 67 6e 17 12  |...........tgn..|

44100.au should be a 440 Hz sinewave and 48000.au should be approx. 480 Hz.
When playing on Mac OS X, they play both at the correct pitch/speed.

However, when playing on NetBSD, the 48000 version plays identical to
the 44100 version..

This of course happens with any audio file at 48000; it plays with a
speed of 44100.

% audioplay -V -d /dev/audio0 44100.au
44100.au: sample_rate=44100 channels=1 datasize=44100 precision=8 encoding=alaw
% audioplay -V -d /dev/audio0 48000.au
48000.au: sample_rate=48000 channels=1 datasize=44100 precision=8 encoding=alaw

Since the snapper(4) driver has some changes in -current, this may be
probably fixed. Or it may be a particular problem with this revision
of the chip not supporting 48000 or something similar.

Can you reproduce this ?

[1] http://www.telefonica.net/web2/marco2z/tmp/44100.au
[2] http://www.telefonica.net/web2/marco2z/tmp/48000.au


-- 
     Thanks!
     -Marco