Ignore:
Timestamp:
Oct 31, 2018, 5:16:30 PM (6 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
Children:
07382d8
Parents:
dc3f68d
Message:

[doc] improve demos used in examples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_source_simple.py

    rdc3f68d r78561f7  
    11#! /usr/bin/env python
    2 import sys, aubio
     2import sys
     3import aubio
    34
    4 samplerate = 0  # use original source samplerate
     5samplerate = 0 # use original source samplerate
    56hop_size = 256 # number of frames to read in one block
    6 s = aubio.source(sys.argv[1], samplerate, hop_size)
     7src = aubio.source(sys.argv[1], samplerate, hop_size)
    78total_frames = 0
    89
    9 while True: # reading loop
    10     samples, read = s()
    11     total_frames += read
     10while True:
     11    samples, read = src()     # read hop_size new samples from source
     12    total_frames += read      # increment total number of frames
    1213    if read < hop_size: break # end of file reached
    1314
    1415fmt_string = "read {:d} frames at {:d}Hz from {:s}"
    15 print (fmt_string.format(total_frames, s.samplerate, sys.argv[1]))
    16 
     16print (fmt_string.format(total_frames, src.samplerate, src.uri))
Note: See TracChangeset for help on using the changeset viewer.