Changeset d0faeca


Ignore:
Timestamp:
May 10, 2016, 7:02:47 PM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
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:
67e16c2
Parents:
a4575c4
Message:

python/demos/demo_tss.py: fix indent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_tss.py

    ra4575c4 rd0faeca  
    55
    66if __name__ == '__main__':
    7   if len(sys.argv) < 2:
    8     print 'usage: %s <inputfile> <outputfile_transient> <outputfile_steady>' % sys.argv[0]
    9     sys.exit(1)
     7    if len(sys.argv) < 2:
     8        print 'usage: %s <inputfile> <outputfile_transient> <outputfile_steady>' % sys.argv[0]
     9        sys.exit(1)
    1010
    11   samplerate = 44100
    12   win_s = 1024      # fft size
    13   hop_s = win_s / 4 # block size
    14   threshold = 0.5
     11    samplerate = 44100
     12    win_s = 1024      # fft size
     13    hop_s = win_s / 4 # block size
     14    threshold = 0.5
    1515
    16   f = source(sys.argv[1], samplerate, hop_s)
    17   g = sink(sys.argv[2], samplerate)
    18   h = sink(sys.argv[3], samplerate)
     16    f = source(sys.argv[1], samplerate, hop_s)
     17    g = sink(sys.argv[2], samplerate)
     18    h = sink(sys.argv[3], samplerate)
    1919
    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
     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
    2323
    24   t.set_threshold(threshold)
     24    t.set_threshold(threshold)
    2525
    26   read = hop_s
     26    read = hop_s
    2727
    28   while read:
    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
     28    while read:
     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
    3636
    37   del f, g, h                         # finish writing the files now
     37    del f, g, h                           # finish writing the files now
    3838
    39   from demo_spectrogram import get_spectrogram
    40   from pylab import subplot, show
    41   subplot(311)
    42   get_spectrogram(sys.argv[1])
    43   subplot(312)
    44   get_spectrogram(sys.argv[2])
    45   subplot(313)
    46   get_spectrogram(sys.argv[3])
    47   show()
     39    from demo_spectrogram import get_spectrogram
     40    from pylab import subplot, show
     41    subplot(311)
     42    get_spectrogram(sys.argv[1])
     43    subplot(312)
     44    get_spectrogram(sys.argv[2])
     45    subplot(313)
     46    get_spectrogram(sys.argv[3])
Note: See TracChangeset for help on using the changeset viewer.