4 from aubio import source, sink, pvoc, tss
6 if __name__ == '__main__':
8 print 'usage: %s <inputfile> <outputfile_transient> <outputfile_steady>' % sys.argv[0]
12 win_s = 1024 # fft size
13 hop_s = win_s / 4 # block size
16 f = source(sys.argv[1], samplerate, hop_s)
17 g = sink(sys.argv[2], samplerate)
18 h = sink(sys.argv[3], samplerate)
20 pva = pvoc(win_s, hop_s) # a phase vocoder
21 pvb = pvoc(win_s, hop_s) # another phase vocoder
22 t = tss(win_s, hop_s) # transient steady state separation
24 t.set_threshold(threshold)
29 samples, read = f() # read file
30 spec = pva(samples) # compute spectrum
31 trans_spec, stead_spec = t(spec) # transient steady-state separation
32 transients = pva.rdo(trans_spec) # overlap-add synthesis of transients
33 steadstate = pvb.rdo(stead_spec) # overlap-add synthesis of steady states
34 g(transients, read) # write transients to output
35 h(steadstate, read) # write steady states to output
37 del f, g, h # finish writing the files now
39 from demo_spectrogram import get_spectrogram
40 from pylab import subplot, show
42 get_spectrogram(sys.argv[1])
44 get_spectrogram(sys.argv[2])
46 get_spectrogram(sys.argv[3])