def process_file(wav_file): sound_handler = SoundHandler( WAV_FILES_LOCATION, wav_file["name"], wav_file["wav_bits"], wav_file["sample_rate"], wav_file["n_channels"]) segment_size = int(SEGMENT_DURATION * wav_file["sample_rate"]) feature_generator = FeatureGenerator( sound_handler, wav_file["timestamp"], wav_file["sample_rate"], CALIBRATION_FACTOR, segment_size, WINDOW_SIZE, WINDOW_OVERLAP, NFFT) results = feature_generator.generate() # extract sound's id from sound file name # (sound's name follow convention described in test/resources/README.md) sound_id = wav_file["name"][:-4] resultsHandler = ResultsHandler( sound_id, RESULTS_DESTINATION, segment_size, WINDOW_SIZE, WINDOW_OVERLAP, NFFT ) resultsHandler.write(results)
def process_file(wav_config): print("Start processing {}".format(wav_config["name"])) tStart = time.time() sound_handler = SoundHandler( WAV_FILES_LOCATION, wav_config["name"], wav_config["wav_bits"], wav_config["sample_rate"], wav_config["n_channels"]) segment_size = int(SEGMENT_DURATION * wav_config["sample_rate"]) feature_generator = FeatureGenerator( sound_handler, wav_config["timestamp"], wav_config["sample_rate"], CALIBRATION_FACTOR, segment_size, WINDOW_SIZE, WINDOW_OVERLAP, NFFT) results = feature_generator.generate() # extract sound's id from sound file name # (sound's name follow convention described in test/resources/README.md) sound_id = wav_config["name"][:-4] resultsHandler = ResultsHandler( sound_id, RESULTS_DESTINATION, segment_size, WINDOW_SIZE, WINDOW_OVERLAP, NFFT ) resultsHandler.write(results) duration = time.time() - tStart print("Finished processing {} in {}".format(wav_config["name"], duration)) return duration
def process_file(task_config): print("Start processing {}".format(task_config["name"])) tStart = time() sound_handler = SoundHandler(task_config["location"], task_config["name"], task_config["wav_bits"], task_config["sample_rate"], task_config["n_channels"]) segment_size = int(task_config["segment_duration"] * task_config["sample_rate"]) feature_generator = FeatureGenerator( sound_handler, task_config["timestamp"], task_config["sample_rate"], task_config["calibration_factor"], segment_size, task_config["window_size"], task_config["window_overlap"], task_config["nfft"]) results = feature_generator.generate() # extract sound's id from sound file name # (sound's name follow convention described in test/resources/README.md) sound_id = task_config["name"][:-4] resultsHandler = ResultsHandler(sound_id, task_config["results_destination"], segment_size, task_config["window_size"], task_config["window_overlap"], task_config["nfft"]) resultsHandler.write(results) duration = time() - tStart print("Finished processing {} in {}".format(task_config["name"], duration)) return duration
WAV_FILES = [{ "name": file_metadata[0], "timestamp": parse(file_metadata[9] + " " + file_metadata[10] + " UTC"), "sample_rate": 32768.0, "wav_bits": 16, "n_channels": 1 } for file_metadata in pd.read_csv(METADATA_FILE_PATH, delimiter=";").values] for wav_file in WAV_FILES[:N_FILES]: sound_handler = SoundHandler(WAV_FILES_LOCATION, wav_file["name"], wav_file["wav_bits"], wav_file["sample_rate"], wav_file["n_channels"]) segment_size = int(SEGMENT_DURATION * wav_file["sample_rate"]) feature_generator = FeatureGenerator(sound_handler, wav_file["timestamp"], wav_file["sample_rate"], CALIBRATION_FACTOR, segment_size, WINDOW_SIZE, WINDOW_OVERLAP, NFFT) results = feature_generator.generate() # extract sound's id from sound file name # (sound's name follow convention described in test/resources/README.md) sound_id = wav_file["name"][:-4]