Changeset 62336bb for python


Ignore:
Timestamp:
Dec 21, 2016, 10:19:22 PM (8 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, yinfft+
Children:
93bd9a7
Parents:
e7da8ba
Message:

python/demos/demo_pyaudio.py: add some comments, avoid overwriting aubio.pitch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_pyaudio.py

    re7da8ba r62336bb  
    11#! /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
    211
    312import pyaudio
    413import sys
    514import numpy as np
    6 from aubio import pitch, sink
     15import aubio
    716
    817# initialise pyaudio
     
    2433    output_filename = sys.argv[1]
    2534    record_duration = 5 # exit 1
    26     outputsink = sink(sys.argv[1], samplerate)
     35    outputsink = aubio.sink(sys.argv[1], samplerate)
    2736    total_frames = 0
    2837else:
     
    3544win_s = 4096 # fft size
    3645hop_s = buffer_size # hop size
    37 pitch_o = pitch("default", win_s, hop_s, samplerate)
     46pitch_o = aubio.pitch("default", win_s, hop_s, samplerate)
    3847pitch_o.set_unit("midi")
    3948pitch_o.set_tolerance(tolerance)
Note: See TracChangeset for help on using the changeset viewer.