Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
#!/usr/bin/python |
| 2 |
# coding: utf-8 |
| 3 |
import os |
| 4 |
import sys |
| 5 |
import struct |
| 6 |
from math import sin, pi |
| 7 |
|
| 8 |
def produce_audio(basedir): |
| 9 |
filename = os.path.join(basedir, 'testaudio') |
| 10 |
os.system(u'mkfifo %s' % filename) |
| 11 |
if not os.path.exists(basedir): |
| 12 |
print "missing fifo dir %s" % repr(basedir) |
| 13 |
f=open(filename,'w') |
| 14 |
singen = lambda f: lambda t: (int(min(32767, 32768*sin(t*f/1000.0*pi))), int(min(32767, 32768*sin(t*f/1000.0*pi)))) |
| 15 |
f.write(''.join( struct.pack('hh', *singen(40)(t)) for t in xrange(44100) ) ) |
| 16 |
os.unlink(filename) |
| 17 |
|
| 18 |
if __name__ == '__main__': |
| 19 |
produce_audio(sys.argv[-1] if len(sys.argv) > 1 else '/tmp/xspice-audio/') |