- Timestamp:
- Dec 21, 2016, 10:19:22 PM (8 years ago)
- 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, yinfft+
- Children:
- 93bd9a7
- Parents:
- e7da8ba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/demos/demo_pyaudio.py
re7da8ba r62336bb 1 1 #! /usr/bin/env python 2 3 # Use pyaudio to open the microphone and run aubio.pitch on the stream of 4 # incoming samples. If a filename is given as the first argument, it will 5 # record 5 seconds of audio to this location. Otherwise, the script will 6 # run until Ctrl+C is pressed. 7 8 # Examples: 9 # $ ./python/demos/demo_pyaudio.py 10 # $ ./python/demos/demo_pyaudio.py /tmp/recording.wav 2 11 3 12 import pyaudio 4 13 import sys 5 14 import numpy as np 6 from aubio import pitch, sink 15 import aubio 7 16 8 17 # initialise pyaudio … … 24 33 output_filename = sys.argv[1] 25 34 record_duration = 5 # exit 1 26 outputsink = sink(sys.argv[1], samplerate)35 outputsink = aubio.sink(sys.argv[1], samplerate) 27 36 total_frames = 0 28 37 else: … … 35 44 win_s = 4096 # fft size 36 45 hop_s = buffer_size # hop size 37 pitch_o = pitch("default", win_s, hop_s, samplerate)46 pitch_o = aubio.pitch("default", win_s, hop_s, samplerate) 38 47 pitch_o.set_unit("midi") 39 48 pitch_o.set_tolerance(tolerance)
Note: See TracChangeset
for help on using the changeset viewer.