demo/aout: support also samples with only one channel
authorÉric Piel <piel@delmic.com>
Mon, 22 Oct 2012 14:07:32 +0000 (15:07 +0100)
committerW. Trevor King <wking@tremily.us>
Tue, 23 Oct 2012 13:21:22 +0000 (09:21 -0400)
scipy.io.wavfile returns a one dimension array if the wav file is only one channel

doc/demo/aout.py

index 7e74f3af04ab3d8739a21b0d5e313293c28c6de6..348c76257081b21dd8e3b1b69a0de6971be172ff 100755 (executable)
@@ -156,6 +156,8 @@ def run(filename, subdevice, channels, range, aref, mmap=False, files=[]):
         range=range, aref=aref)
     for filename in files:
         frequency,unit_output_signal = load(filename=filename)
+        if len(unit_output_signal.shape) == 1:
+            unit_output_signal.shape = (unit_output_signal.shape[0], 1)
         output_buffer = generate_output_buffer(
             ao_subdevice, ao_channels, unit_output_signal)
         setup_command(ao_subdevice, ao_channels, frequency, output_buffer)