diff options
author | Guido van Rossum <guido@python.org> | 2000-10-08 00:20:20 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-10-08 00:20:20 (GMT) |
commit | 923ebe4dc6535cbf3ecf264af70a5b49dfb7223a (patch) | |
tree | c5d65c93d16883cd3132424558a7602d3166e913 /Lib/test/test_linuxaudiodev.py | |
parent | 830b37bd74f81420cbcb27491a4c4f6498cedd54 (diff) | |
download | cpython-923ebe4dc6535cbf3ecf264af70a5b49dfb7223a.zip cpython-923ebe4dc6535cbf3ecf264af70a5b49dfb7223a.tar.gz cpython-923ebe4dc6535cbf3ecf264af70a5b49dfb7223a.tar.bz2 |
It seems our sound cards can't play mulaw data. Use native-format
16-bit signed data instead. Hope this works for you; it works for me.
Diffstat (limited to 'Lib/test/test_linuxaudiodev.py')
-rw-r--r-- | Lib/test/test_linuxaudiodev.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_linuxaudiodev.py b/Lib/test/test_linuxaudiodev.py index 535f84c..7924a24 100644 --- a/Lib/test/test_linuxaudiodev.py +++ b/Lib/test/test_linuxaudiodev.py @@ -4,9 +4,11 @@ import errno import fcntl import linuxaudiodev import os +import sys import select import sunaudio import time +import audioop SND_FORMAT_MULAW_8 = 1 @@ -27,6 +29,15 @@ def play_sound_file(path): raise TestSkipped, msg raise TestFailed, msg + # convert the data to 16-bit signed + data = audioop.ulaw2lin(data, 2) + + # set the data format + if sys.byteorder == 'little': + fmt = linuxaudiodev.AFMT_S16_LE + else: + fmt = linuxaudiodev.AFMT_S16_BE + # at least check that these methods can be invoked a.bufsize() a.obufcount() @@ -35,7 +46,7 @@ def play_sound_file(path): a.fileno() # set parameters based on .au file headers - a.setparameters(rate, 8, nchannels, linuxaudiodev.AFMT_MU_LAW, 1) + a.setparameters(rate, 16, nchannels, fmt) a.write(data) a.flush() a.close() |