Changeset 254acce


Ignore:
Timestamp:
Nov 4, 2018, 8:58:16 PM (13 months ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master
Children:
eff63ab
Parents:
8ebcd3d
Message:

[py] improve style for demo_source_simple.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_source_simple.py

    r8ebcd3d r254acce  
    11#! /usr/bin/env python
     2
     3"""A simple example using aubio.source."""
     4
    25import sys
    36import aubio
    47
    5 samplerate = 0 # use original source samplerate
    6 hop_size = 256 # number of frames to read in one block
     8samplerate = 0  # use original source samplerate
     9hop_size = 256  # number of frames to read in one block
    710src = aubio.source(sys.argv[1], samplerate, hop_size)
    811total_frames = 0
    912
    1013while True:
    11     samples, read = src()     # read hop_size new samples from source
    12     total_frames += read      # increment total number of frames
    13     if read < hop_size: break # end of file reached
     14    samples, read = src()  # read hop_size new samples from source
     15    total_frames += read   # increment total number of frames
     16    if read < hop_size:    # end of file reached
     17        break
    1418
    1519fmt_string = "read {:d} frames at {:d}Hz from {:s}"
    16 print (fmt_string.format(total_frames, src.samplerate, src.uri))
     20print(fmt_string.format(total_frames, src.samplerate, src.uri))
Note: See TracChangeset for help on using the changeset viewer.