To python-dev: Sorry for the hiatus. To python-list: does someone who knows about audio and can run linux want to play with this (Ping and I fall into just one of these categories each!). Ka-Ping Yee <pingster@ilm.com> writes: > On 30 Jun 2000, Michael Hudson wrote: > > Yup, that works fine. Don't understand the details - and as I have my > > graduation ceremony tomorrow I'm going to go to bed and leave learning > > them until some other occasion! > > Cool. > > Okay, i just discovered sunau.py. Here's my real shot at > test_linuxaudiodev.py. Can you give this a try? > > > ---- test_linuxaudiodev.py ---- > from test_support import verbose, findfile, TestFailed > import linuxaudiodev > import os, sunau > > formats = {("ULAW", 1): linuxaudiodev.AFMT_MU_LAW, > ("NONE", 1): linuxaudiodev.AFMT_S8, > ("NONE", 2): linuxaudiodev.AFMT_S16_BE} > > def play_au_file(path): > au = sunau.open(path, "r") > data = au.readframes(sunau.AUDIO_UNKNOWN_SIZE) > au.close() > > spec = (au.getcomptype(), au.getsampwidth()) > if not has_key(formats, spec): ^^^^^^^ Oops? > raise "audio format not supported by linuxaudiodev" Maybe you mean: raise TestFailed, "audio format not supported by linuxaudiodev" ? I thought string exceptions were deprecated... > dsp = linuxaudiodev.open("w") > dsp.setparameters(au.getframerate(), au.getsampwidth() * 8, > au.getnchannels(), formats[spec]) > dsp.write(data) > dsp.close() > > def test(): > play_au_file(findfile('audiotest.au')) > > test() This doesn't work. I don't really understand why. For audiotest.au, |spec| is ("ULAW",2), which I don't think is right; file(1) says audiotest.au: Sun/NeXT audio data: 8-bit ISDN u-law, mono, 8000 Hz So I think this could be a bug in sunau. The other data (au.getframerate(), au.getnchannels()) agrees with file(1). Anybody have a better idea? Cheers, Michael Hudson, BA (as of today! woohoo!)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4