Skip to content

Commit

Permalink
Merge c3bc3f2 into 6a0a1fd
Browse files Browse the repository at this point in the history
  • Loading branch information
justinsalamon committed Mar 27, 2019
2 parents 6a0a1fd + c3bc3f2 commit 356b4f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scaper/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,10 @@ def _generate_audio(self, audio_path, ann, reverb=None,
# synthesize edited foreground sound event
tfm.build(e.value['source_file'],
tmpfiles_internal[-1].name)
# if time stretched get actual new duration
if e.value['time_stretch'] is not None:
fg_stretched_duration = sox.file_info.duration(
tmpfiles_internal[-1].name)

# NOW compute LUFS
fg_lufs = get_integrated_lufs(
Expand All @@ -1585,8 +1589,7 @@ def _generate_audio(self, audio_path, ann, reverb=None,
postpad = max(
0, self.duration - (
e.value['event_time'] +
e.value['event_duration'] *
e.value['time_stretch']))
fg_stretched_duration))
tfm.pad(prepad, postpad)

# Finally save result to a tmp file
Expand Down

0 comments on commit 356b4f6

Please sign in to comment.