ossaudiodev problem: sawtooth noise

Peter Pearson ppearson at nowhere.invalid
Sat Jan 24 14:43:54 EST 2009


On Fri, 23 Jan 2009 14:55:36 -0200, Gabriel Genellina wrote:
> En Fri, 23 Jan 2009 14:36:46 -0200, Peter Pearson  
><ppearson at nowhere.invalid> escribió:
>> On Thu, 22 Jan 2009 20:58:14 -0200, Gabriel Genellina wrote:
>>> En Mon, 19 Jan 2009 21:57:04 -0200, Peter Pearson
>>> <ppearson at nowhere.invalid> escribió:
>>>
>>>> The following code uses ossaudiodev to read 1000 values from
>>>> my sound card at a rate of 12,000 samples per second:
>>>>
>>>> When I select a sample rate that is not a power of 2 times
>>>> 3000 samples/second, a strong and very regular sawtooth is
>>>> superimposed on the signal.  At some sampling frequencies,
>>>> it appears as a rising sawtooth, and at other sampling
>>>> frequencies it is a declining sawtooth, so I'm presumably
>>>> lost in some aliasing wilderness.  As best I can tell,
>>>> it's a 48 KHz sawtooth.
>>>
>>> That could be a hardware and/or driver limitation. By example, an
>>> AC97-compliant chipset may provide a fixed rate of 48000 samples/second  
>>> any sample rate conversion must be done by other means, if possible at  
>>> all.
>>
>> Oh!  As a matter of fact, my "soundcard" *is* AC97-compliant
>> ("VT8233/A/8235/8237", according to Sysinfo).  So . . . this
>> sawtooth might result from some software, somewhere in the bucket
>> brigade between me and the hardware, attempting to perform
>> sample-rate conversion?  The 48 KHz coincidence seems very
>> significant.
>
> Yep. Google found this for me:
> http://mail-index.netbsd.org/port-i386/2003/02/18/0003.html
>
> Using a sample rate that is a sub-multiple of 48000 is perhaps a safe  
> approach.

Back around the time I installed Ubuntu's Hardy Heron, several
copies of this line appeared in /var/log/user.log.0:
    Jan  4 21:32:53 eleodes pulseaudio[6437]: alsa-util.c: \
       Device front:0 doesn't support 44100 Hz, changed to 48000 Hz.

So I suppose I'll just restrict myself to well-behaved frequencies.
I'm not sure what "sub-multiple" means, but all the successful
frequencies I've found over 1 KHz have been multiples of 1.5 KHz that
evenly divide 48 KHz.  Frequencies showing large sawtooths include
2, 4, 8, 10, and 16 KHz.

-- 
To email me, substitute nowhere->spamcop, invalid->net.



More information about the Python-list mailing list