wave.setparams((2, 2, 44100, 44100 * 2 * 10, "NONE", "not compressed")) became more than 30secs

'2+ electriclightheads at gmail.com
Mon Jul 27 08:29:58 EDT 2009


thanx to rob .. who gave me an example of how to use the WAVE lib
now am on my way to use it as simple as i can

i wrote an oil.py the instance of which will behave like an oscillator
which constantly generates 7 different wave forms (non fixed)
i thought this code might produce 10secs of wave file but the result
was longer than 30secs
was testing if i could use the WAVE lib withount taking advantage of
StringIO
nor
struct
but maybe am doing totally wrong?

--8<---

import oil
import wave

a = oil.Sa()

w = wave.open("current.wav", "w")
w.setparams((2, 2, 44100, 44100 * 2 * 10, "NONE", "not compressed"))

for gas in range(44100 * 10):
    a.breath()
    r = int(32767 * (a.pulse(1) + a.pulse(2) + a.pulse(3)) / 3.0)
    l = int(32767 * (a.pulse(4) + a.pulse(5) + a.pulse(6)) / 3.0)
    w.writeframes(hex(r))
    w.writeframes(hex(l))
w.close()



-- 
SaRiGaMa's Oil Vending Orchestra
is podcasting:
http://sarigama.namaste.jp/podcast/rss.xml
and supplying oil.py for free:
http://oilpy.blogspot.com/



More information about the Python-list mailing list