History

python/demos/demo_simple_robot_voice.py: indent

Paul Brossier committed 10 years ago

Commit 0c6e3b01 parent 1e4d90f1 file · +19 −21Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/demos/demo_simple_robot_voice.py+19−21
@@ -4,27 +4,25 @@ import sys · 3 unmodified lines
4from aubio import source, sink, pvoc4from aubio import source, sink, pvoc
5 5
6if __name__ == '__main__':6if __name__ == '__main__':
7 if len(sys.argv) < 2:7 if len(sys.argv) < 2:
8 print 'usage: %s <inputfile> <outputfile>' % sys.argv[0]8 print 'usage: %s <inputfile> <outputfile>' % sys.argv[0]
9 sys.exit(1)9 sys.exit(1)
10 samplerate = 4410010 samplerate = 44100
11 f = source(sys.argv[1], samplerate, 256)11 f = source(sys.argv[1], samplerate, 256)
12 g = sink(sys.argv[2], samplerate)12 g = sink(sys.argv[2], samplerate)
13 total_frames, read = 0, 25613 total_frames, read = 0, 256
14 14
15 win_s = 512 # fft size15 win_s = 512 # fft size
16 hop_s = win_s / 2 # hop size16 hop_s = win_s / 2 # hop size
17 pv = pvoc(win_s, hop_s) # phase vocoder17 pv = pvoc(win_s, hop_s) # phase vocoder
18 18
19 while read:19 while read:
20 samples, read = f()20 samples, read = f()
21 spectrum = pv(samples) # compute spectrum21 spectrum = pv(samples) # compute spectrum
22 #spectrum.norm *= .8 # reduce amplitude a bit22 #spectrum.norm *= .8 # reduce amplitude a bit
23 spectrum.phas[:] = 0. # zero phase23 spectrum.phas[:] = 0. # zero phase
24 new_samples = pv.rdo(spectrum) # compute modified samples24 new_samples = pv.rdo(spectrum) # compute modified samples
25 g(new_samples, read) # write to output25 g(new_samples, read) # write to output
26 total_frames += read26 total_frames += read
27 27
28 print "wrote", total_frames, "from", f.uri, "to", g.uri28 print "wrote", total_frames, "from", f.uri, "to", g.uri
29
30

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t