pyao makes the right sound but why?

'2+ electriclightheads at gmail.com
Wed Mar 3 15:50:09 CET 2010


with my soy.py

tofu = soy.Bean()
x = tofu.pattern(44100 * 3)

creates x which is an array('h') and len(x) = 44100 * 6
this x is a stereo groove pattern that lasts 3 sec if samplerate is set to 44100
and since wave.py could save it to a_file.wav
i was wondering if

dev = ao.AudioDevice('alsa')
dev.play(x)

could launch me a semi realtime dj kinda sys
luckily .. it does seem to be making the right sound
but why?
the default of the samplerate and that 16bit happened to match with my thing x?
o but if i do

dev.play(x, len(x))

it only plays the half of the pattern
and

dev.play(x, 2 * len(x))

does the right thing

and the 2nd 4th 6th .. play gives me

ALSA underrun, at least 0ms

3rd, 5th, 7th does it fine

/usr/share/doc/python-pyao
doesn't teach me the answer
does somebody know more about pyao?

-- 
SaRiGaMa's Oil Vending Orchestra
is podcasting:
http://sarigama.namaste.jp/podcast/rss.xml



More information about the Python-list mailing list