From d0faeca99e625a46e100d352e86d17b1c684d663 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 10 May 2016 19:02:47 +0200 Subject: [PATCH] python/demos/demo_tss.py: fix indent --- python/demos/demo_tss.py | 81 ++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/python/demos/demo_tss.py b/python/demos/demo_tss.py index 884dc9b5..b38f474f 100755 --- a/python/demos/demo_tss.py +++ b/python/demos/demo_tss.py @@ -4,44 +4,43 @@ import sys from aubio import source, sink, pvoc, tss if __name__ == '__main__': - if len(sys.argv) < 2: - print 'usage: %s ' % sys.argv[0] - sys.exit(1) - - samplerate = 44100 - win_s = 1024 # fft size - hop_s = win_s / 4 # block size - threshold = 0.5 - - f = source(sys.argv[1], samplerate, hop_s) - g = sink(sys.argv[2], samplerate) - h = sink(sys.argv[3], samplerate) - - pva = pvoc(win_s, hop_s) # a phase vocoder - pvb = pvoc(win_s, hop_s) # another phase vocoder - t = tss(win_s, hop_s) # transient steady state separation - - t.set_threshold(threshold) - - read = hop_s - - while read: - samples, read = f() # read file - spec = pva(samples) # compute spectrum - trans_spec, stead_spec = t(spec) # transient steady-state separation - transients = pva.rdo(trans_spec) # overlap-add synthesis of transients - steadstate = pvb.rdo(stead_spec) # overlap-add synthesis of steady states - g(transients, read) # write transients to output - h(steadstate, read) # write steady states to output - - del f, g, h # finish writing the files now - - from demo_spectrogram import get_spectrogram - from pylab import subplot, show - subplot(311) - get_spectrogram(sys.argv[1]) - subplot(312) - get_spectrogram(sys.argv[2]) - subplot(313) - get_spectrogram(sys.argv[3]) - show() + if len(sys.argv) < 2: + print 'usage: %s ' % sys.argv[0] + sys.exit(1) + + samplerate = 44100 + win_s = 1024 # fft size + hop_s = win_s / 4 # block size + threshold = 0.5 + + f = source(sys.argv[1], samplerate, hop_s) + g = sink(sys.argv[2], samplerate) + h = sink(sys.argv[3], samplerate) + + pva = pvoc(win_s, hop_s) # a phase vocoder + pvb = pvoc(win_s, hop_s) # another phase vocoder + t = tss(win_s, hop_s) # transient steady state separation + + t.set_threshold(threshold) + + read = hop_s + + while read: + samples, read = f() # read file + spec = pva(samples) # compute spectrum + trans_spec, stead_spec = t(spec) # transient steady-state separation + transients = pva.rdo(trans_spec) # overlap-add synthesis of transients + steadstate = pvb.rdo(stead_spec) # overlap-add synthesis of steady states + g(transients, read) # write transients to output + h(steadstate, read) # write steady states to output + + del f, g, h # finish writing the files now + + from demo_spectrogram import get_spectrogram + from pylab import subplot, show + subplot(311) + get_spectrogram(sys.argv[1]) + subplot(312) + get_spectrogram(sys.argv[2]) + subplot(313) + get_spectrogram(sys.argv[3]) -- 2.11.0