37 lines · 877 B · Python
RawDownload
#! /usr/bin/env python import sysfrom aubio import source, notes if len(sys.argv) < 2:    print("Usage: %s <filename> [samplerate]" % sys.argv[0])    sys.exit(1) filename = sys.argv[1] downsample = 1samplerate = 44100 // downsampleif len( sys.argv ) > 2: samplerate = int(sys.argv[2]) win_s = 512 // downsample # fft sizehop_s = 256 // downsample # hop size s = source(filename, samplerate, hop_s)samplerate = s.samplerate tolerance = 0.8 notes_o = notes("default", win_s, hop_s, samplerate) print("%8s" % "time","[ start","vel","last ]") # total number of frames readtotal_frames = 0while True:    samples, read = s()    new_note = notes_o(samples)    if (new_note[0] != 0):        note_str = ' '.join(["%.2f" % i for i in new_note])        print("%.6f" % (total_frames/float(samplerate)), new_note)    total_frames += read    if read < hop_s: break

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t