BatchReader class
Batch reader class with below blueprint would be useful to have. Implementation could largely be adapted from filter_analyzer.py
class BatchReader:
""" Audio file batch reader.
Reads audio file(s) and serves them in batches.
Args:
input: str
File name, list of file names, or directory name
rate: float
Sampling rate in Hz
dt_format: str
Format for parsing date-time data from file names
overlap: int
Size of overlap region (number of samples) used for smoothly joining audio signals
"""
def __init__(self, input, rate, dt_format=None, overlap=100):
self.rate = rate
self.overlap = overlap
self.index = 0
self.times = list()
load(input=input, dt_format=dt_format)
def load(input, dt_format=None):
if input is file:
files = [input]
elif input is list of files:
files = input
else: # input is directory
# find files
if dt_format is not None:
# attempt to parse date-time data
# sort chronologically
def next(int max_size=None):
# loop over files, read and merge, stop when size > max_size
# return copy of merged signal and update file counter
# clear local copy of merged signal
# return None, if there are no more files to read
def reset()
self.index = 0
self.times = list()
def log():
# return pandas dataframe with filenames and start times
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information