summaryrefslogtreecommitdiff
path: root/examples/residual.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/residual.py')
-rw-r--r--examples/residual.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/residual.py b/examples/residual.py
new file mode 100644
index 0000000..cd41dd4
--- /dev/null
+++ b/examples/residual.py
@@ -0,0 +1,17 @@
+import sys
+import numpy as np
+import scipy.io.wavfile as wav
+import simpl
+
+usage = 'Usage: python {0} <input wav file> <output wav file>'.format(__file__)
+if len(sys.argv) != 3:
+ print usage
+ sys.exit(1)
+
+audio = simpl.read_wav(sys.argv[1])[0]
+output_file = sys.argv[2]
+
+r = simpl.SMSResidual()
+audio_out = r.synth(audio)
+audio_out = np.asarray(audio_out * 32768, np.int16)
+wav.write(output_file, 44100, audio_out)