From: Paul Brossier Date: Fri, 27 Jul 2012 17:32:09 +0000 (-0600) Subject: demo_simple_robot_voice.py: added simple phase zeroing demo X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e693b6c4c3158c9f8d0f944d01bc70fb31d455b1;p=aubio.git demo_simple_robot_voice.py: added simple phase zeroing demo --- diff --git a/interfaces/python/demo_simple_robot_voice.py b/interfaces/python/demo_simple_robot_voice.py new file mode 100755 index 00000000..79670100 --- /dev/null +++ b/interfaces/python/demo_simple_robot_voice.py @@ -0,0 +1,29 @@ +#! /usr/bin/python + +import sys +from aubio import source, sink, pvoc + +if __name__ == '__main__': + if len(sys.argv) < 2: + print 'usage: %s ' % sys.argv[0] + sys.exit(1) + samplerate = 44100 + f = source(sys.argv[1], samplerate, 256) + g = sink(sys.argv[2], samplerate) + total_frames, read = 0, 256 + + win_s = 512 # fft size + hop_s = win_s / 2 # hop size + pv = pvoc(win_s, hop_s) # phase vocoder + + while read: + samples, read = f() + spectrum = pv(samples) # compute spectrum + spectrum.phas[:] = 0. # zero phase + new_samples = pv.rdo(spectrum) # compute modified samples + g(new_samples, read) # write to output + total_frames += read + + print "wrote", total_frames, "from", f.uri, "to", g.uri + +