Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_source_simple.py

    re6ce204 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.