arifgursel / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Support for PCM files #711

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I think it would be great if pyglet could play raw audio. It already supports 
PCM-based WAV files I think it would be quite easy to add PCM support.

It could look like this:
pyglet.media.load(path_to_raw_file, format={'sample_rate': 44100, 
'bit_rate'=-8, 'channels'='1'})
Of course format would be by default {} so it won't change default behaviour. 
Negative bit rate tells that file uses signed values. Alternatively new 
function like load_raw or sth like that could be introduced. 

BTW, looking at riff.py file, I noticed that get_audio_data function is using 
bytes as variable name which is reserved word in Python 3. 

Hope you like the idea. Thanks for great work at pyglet.

Original issue reported on code.google.com by fen...@gmail.com on 5 Mar 2014 at 2:50