Ignore:
Timestamp:
Mar 10, 2017, 2:26:32 PM (7 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, sampler
Children:
ee8a57c
Parents:
00d0275 (diff), 67b6618 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into awhitening

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_simple_robot_voice.py

    r00d0275 r155cc10  
    55
    66if __name__ == '__main__':
    7   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
     7    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
    1414
    15   win_s = 512                 # fft size
    16   hop_s = win_s / 2           # hop size
    17   pv = pvoc(win_s, hop_s)                            # phase vocoder
     15    win_s = 512                          # fft size
     16    hop_s = win_s // 2                   # hop size
     17    pv = pvoc(win_s, hop_s)              # phase vocoder
    1818
    19   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
     19    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
    2727
    28   print "wrote", total_frames, "from", f.uri, "to", g.uri
    29 
    30  
     28    format_str = "read {:d} samples from {:s}, written to {:s}"
     29    print(format_str.format(total_frames, f.uri, g.uri))
Note: See TracChangeset for help on using the changeset viewer.