Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_pitch.py

    r193dcbb r4120fbc  
    22
    33import sys
    4 from aubio import source, pitch, freqtomidi
     4from aubio import source, pitch
    55
    66if len(sys.argv) < 2:
    7     print "Usage: %s <filename> [samplerate]" % sys.argv[0]
     7    print("Usage: %s <filename> [samplerate]" % sys.argv[0])
    88    sys.exit(1)
    99
     
    1111
    1212downsample = 1
    13 samplerate = 44100 / downsample
     13samplerate = 44100 // downsample
    1414if len( sys.argv ) > 2: samplerate = int(sys.argv[2])
    1515
    16 win_s = 4096 / downsample # fft size
    17 hop_s = 512  / downsample # hop size
     16win_s = 4096 // downsample # fft size
     17hop_s = 512  // downsample # hop size
    1818
    1919s = source(filename, samplerate, hop_s)
     
    3737    confidence = pitch_o.get_confidence()
    3838    #if confidence < 0.8: pitch = 0.
    39     #print "%f %f %f" % (total_frames / float(samplerate), pitch, confidence)
     39    print("%f %f %f" % (total_frames / float(samplerate), pitch, confidence))
    4040    pitches += [pitch]
    4141    confidences += [confidence]
     
    4646
    4747#print pitches
     48import os.path
    4849from numpy import array, ma
    4950import matplotlib.pyplot as plt
     
    6465
    6566def array_from_text_file(filename, dtype = 'float'):
    66     import os.path
    67     from numpy import array
    6867    filename = os.path.join(os.path.dirname(__file__), filename)
    6968    return array([line.split() for line in open(filename).readlines()],
     
    7170
    7271ax2 = fig.add_subplot(312, sharex = ax1)
    73 import sys, os.path
    7472ground_truth = os.path.splitext(filename)[0] + '.f0.Corrected'
    7573if os.path.isfile(ground_truth):
Note: See TracChangeset for help on using the changeset viewer.