Changeset 88432a9 for python/tests
- Timestamp:
- Jan 12, 2014, 2:59:49 AM (11 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, pitchshift, sampler, timestretch, yinfft+
- Children:
- bc24e9c
- Parents:
- 3f9e8e5
- Location:
- python/tests
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/utils.py
r3f9e8e5 r88432a9 19 19 f.close() 20 20 return yaml_data 21 22 def count_samples_in_file(file_path): 23 from aubio import source 24 hopsize = 256 25 s = source(file_path, 0, hopsize) 26 total_frames = 0 27 while True: 28 samples, read = s() 29 total_frames += read 30 if read < hopsize: break 31 return total_frames 32 33 def count_samples_in_directory(samples_dir): 34 import os 35 total_frames = 0 36 for f in os.walk(samples_dir): 37 if len(f[2]): 38 for each in f[2]: 39 file_path = os.path.join(f[0], each) 40 if file_path: 41 total_frames += count_samples_in_file(file_path) 42 return total_frames
Note: See TracChangeset
for help on using the changeset viewer.