summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Glover <j@johnglover.net>2012-08-12 17:44:57 +0100
committerJohn Glover <j@johnglover.net>2012-08-12 17:44:57 +0100
commit4f0a4f251ddbc466f14200202eff2213e30a5919 (patch)
treed32f150e97333f8c4a57d1558b4fbadca814f360
parentd9e5c35b9bbec5649d217ffc929cae7e4ee79f5a (diff)
downloadsimpl-4f0a4f251ddbc466f14200202eff2213e30a5919.tar.gz
simpl-4f0a4f251ddbc466f14200202eff2213e30a5919.tar.bz2
simpl-4f0a4f251ddbc466f14200202eff2213e30a5919.zip
Remove old timestretching code (now available in
Metamorph instead).
-rw-r--r--simpl/examples/timestretch.py26
-rw-r--r--simpl/fx.py21
2 files changed, 0 insertions, 47 deletions
diff --git a/simpl/examples/timestretch.py b/simpl/examples/timestretch.py
deleted file mode 100644
index f5870ac..0000000
--- a/simpl/examples/timestretch.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import simpl
-from simpl.fx import time_stretch
-from scipy.io.wavfile import read, write
-import numpy as np
-
-input_file = '../../tests/audio/flute.wav'
-output_file = 'flute_2x.wav'
-time_stretch_factor = 2
-
-audio_in_data = read(input_file)
-audio_in = simpl.asarray(audio_in_data[1]) / 32768.0 # values between -1 and 1
-sample_rate = audio_in_data[0]
-
-print "Time stretching", input_file, "by a factor of", time_stretch_factor
-pd = simpl.SndObjPeakDetection()
-pd.max_peaks = 100
-peaks = pd.find_peaks(audio_in)
-pt = simpl.SndObjPartialTracking()
-pt.max_partials = 10
-partials = pt.find_partials(peaks)
-partials = time_stretch(partials, time_stretch_factor)
-sndobj_synth = simpl.SndObjSynthesis()
-audio_out = sndobj_synth.synth(partials)
-audio_out = np.asarray(audio_out * 32768, np.int16)
-print "Writing output to", output_file
-write(output_file, 44100, audio_out)
diff --git a/simpl/fx.py b/simpl/fx.py
deleted file mode 100644
index a3ba065..0000000
--- a/simpl/fx.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from simpl import Partial
-import numpy as np
-
-
-def time_stretch(partials, factor):
- """Time stretch partials by factor."""
- stretched_partials = []
- step_size = 1.0 / factor
-
- for partial in partials:
- stretched_partial = Partial()
- stretched_partial.starting_frame = partial.starting_frame * factor
- stretched_partial.partial_id = partial.partial_id
- num_steps = int((partial.get_length() - 1) / step_size)
- current_step = 0
- for step in range(num_steps):
- current_peak = partial.peaks[int(np.floor(current_step))]
- stretched_partial.add_peak(current_peak)
- current_step += step_size
- stretched_partials.append(stretched_partial)
- return stretched_partials