Changeset 0c6e3b0 for python/demos
- Timestamp:
- May 10, 2016, 10:09:02 PM (9 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- f6892d4
- Parents:
- 1e4d90f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/demos/demo_simple_robot_voice.py
r1e4d90f r0c6e3b0 5 5 6 6 if __name__ == '__main__': 7 if len(sys.argv) < 2:8 print 'usage: %s <inputfile> <outputfile>' % sys.argv[0]9 sys.exit(1)10 samplerate = 4410011 f = source(sys.argv[1], samplerate, 256)12 g = sink(sys.argv[2], samplerate)13 total_frames, read = 0, 2567 if len(sys.argv) < 2: 8 print 'usage: %s <inputfile> <outputfile>' % sys.argv[0] 9 sys.exit(1) 10 samplerate = 44100 11 f = source(sys.argv[1], samplerate, 256) 12 g = sink(sys.argv[2], samplerate) 13 total_frames, read = 0, 256 14 14 15 win_s = 512# fft size16 hop_s = win_s / 2# hop size17 pv = pvoc(win_s, hop_s)# phase vocoder15 win_s = 512 # fft size 16 hop_s = win_s / 2 # hop size 17 pv = pvoc(win_s, hop_s) # phase vocoder 18 18 19 while read:20 samples, read = f()21 spectrum = pv(samples)# compute spectrum22 #spectrum.norm *= .8# reduce amplitude a bit23 spectrum.phas[:] = 0.# zero phase24 new_samples = pv.rdo(spectrum)# compute modified samples25 g(new_samples, read)# write to output26 total_frames += read19 while read: 20 samples, read = f() 21 spectrum = pv(samples) # compute spectrum 22 #spectrum.norm *= .8 # reduce amplitude a bit 23 spectrum.phas[:] = 0. # zero phase 24 new_samples = pv.rdo(spectrum) # compute modified samples 25 g(new_samples, read) # write to output 26 total_frames += read 27 27 28 print "wrote", total_frames, "from", f.uri, "to", g.uri 29 30 28 print "wrote", total_frames, "from", f.uri, "to", g.uri
Note: See TracChangeset
for help on using the changeset viewer.