def compute(self, *args): key = args[2] outs = pyloudness.get_loudness(args[0].routes[key]) integratedLoudness = outs['Integrated Loudness']['I'] loudnessRange = outs['Loudness Range']['LRA'] return esarr([integratedLoudness, loudnessRange])
def stats(file): '''Takes a file path and outputs Loudness and Peak to terminal''' loudness_stats = pyloudness.get_loudness(file) print("File : " + os.path.basename(file)) print("_________________") print("Loudness : " + str(loudness_stats["Integrated Loudness"]["I"])) print("Peak : " + str(loudness_stats["True Peak"]["Peak"])) print("_________________") print(" ")
def _work(self): tts.say("Time to work! The LED lights will turn off as time elapses.") self._board.led.state = Led.PULSE_SLOW record_file( AudioFormat.CD, filename=self._file, wait=self._wait, filetype="wav", ) self._done.clear() session_score = pyloudness.get_loudness(self._file)["Loudness Range"]["LRA"] tts.say("Session score: {:.2}".format(session_score)) if session_score > 5: tts.say("Try to be a little more quiet next round") self._score += session_score
def _work(self): tts.say("Time to work!") self._board.led.state = Led.PULSE_SLOW record_file( AudioFormat.CD, filename=self._file, wait=self._wait, filetype="wav", ) tts.say("Session ended") self._done.clear() session_score = pyloudness.get_loudness( self._file)["Loudness Range"]["LRA"] if session_score > 40: tts.say("Try to be a little more quiet next round") self._score += session_score
model = model_from_json(model_json) model.load_weights("{}.h5".format(args.model)) print("Using model: {}".format(args.model)) print("Architecture:") print(model.summary()) records = [] for input_file in tqdm.tqdm(filenames): # For duration extraction (using librosa and essentia at the same time seems) # overkill however we need to deal with it at the current version audio = essentia.standard.MonoLoader(filename=input_file, sampleRate=22050)() # Loudness extractors loudness_dict = ld.get_loudness(input_file) true_peak = loudness_dict['True Peak']['Peak'] integrated_loudness = loudness_dict['Integrated Loudness']['I'] # Music/Speech/Sfx discrimination frameGenerator = essentia.standard.FrameGenerator(audio, frameSize=frameSize, hopSize=hopSize, startFromZero=True) w = essentia.standard.Windowing(size=frameSize) rmsx = essentia.standard.RMS() rms = [] for frame in frameGenerator: rms.append(rmsx(frame))