Skip to content

Commit

Permalink
Crop synthesized audio in fast_fluidsynth
Browse files Browse the repository at this point in the history
Sometimes (maybe .1% of the time), fluidsynth would pad a bunch of
silence to the end of a synthesis.  This resulted in a CQT with a big
silent block, which would result in false matches to the 2 (+?) tracks
in the MSD whose 7digital preview clips were silent (they have hidden
tracks).  Probably causes issues elsewhere, too.
  • Loading branch information
craffel committed Apr 5, 2016
1 parent 394b5bc commit 476fc68
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions feature_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def fast_fluidsynth(m, fs):
temp_mid.name], stderr=devnull)
# Load from temp wav file
audio, _ = librosa.load(temp_wav.name, sr=fs)
# Occasionally, fluidsynth pads a lot of silence on the end, so here we
# crop to the length of the midi object
audio = audio[:int(m.get_end_time() * fs)]
# Close/delete temp files
temp_mid.close()
temp_wav.close()
Expand Down

0 comments on commit 476fc68

Please sign in to comment.