From c794e2f48748aad7979447b1bfd9c1373d064615 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 14 Aug 2011 19:48:06 -0400 Subject: oh, that too --- simple_audio_python.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 simple_audio_python.py diff --git a/simple_audio_python.py b/simple_audio_python.py new file mode 100644 index 0000000..99bc57d --- /dev/null +++ b/simple_audio_python.py @@ -0,0 +1,28 @@ +noise_output = wave.open('noise2.wav', 'w') +noise_output.setparams((2, 2, 44100, 0, 'NONE', 'not compressed')) + +values = [] + +for i in range(0, SAMPLE_LEN): + value = random.randint(-32767, 32767) + packed_value = struct.pack('h', value) + values.append(packed_value) + values.append(packed_value) + +value_str = ''.join(values) +noise_output.writeframes(value_str) + +noise_output.close() + +# ---------------- + +noise_output = wave.open('noise.wav', 'w') +noise_output.setparams((2, 2, 44100, 0, 'NONE', 'not compressed')) + +for i in range(0, SAMPLE_LEN): + value = random.randint(-32767, 32767) + packed_value = struct.pack('h', value) + noise_output.writeframes(packed_value) + noise_output.writeframes(packed_value) + +noise_output.close() -- cgit v1.2.3