Skip to content

Commit

Permalink
Merge 54581e9 into b23f8aa
Browse files Browse the repository at this point in the history
  • Loading branch information
pseeth committed Jul 18, 2020
2 parents b23f8aa + 54581e9 commit f3688b0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ before_install:
fi
- conda install -c conda-forge ffmpeg
- conda install -c conda-forge sox
- sudo apt-get install libsndfile1
- pip install python-coveralls
- pip install pytest-faulthandler
- pip install pytest-cov
Expand Down
9 changes: 5 additions & 4 deletions scaper/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sox
import soundfile
import os
import warnings
import jams
Expand Down Expand Up @@ -1314,7 +1315,7 @@ def _instantiate_event(self, event, isbackground=False,
used_source_files.append(source_file)

# Get the duration of the source audio file
source_duration = sox.file_info.duration(source_file)
source_duration = soundfile.info(source_file).duration

# If this is a background event, the event duration is the
# duration of the soundscape.
Expand Down Expand Up @@ -1715,7 +1716,7 @@ def _generate_audio(self, audio_path, ann, reverb=None,
# statement can be removed from the calculation of
# ntiles.
source_duration = (
sox.file_info.duration(e.value['source_file']))
soundfile.info(e.value['source_file']).duration)
ntiles = int(
max(self.duration // source_duration + 1, 2))

Expand Down Expand Up @@ -1798,8 +1799,8 @@ def _generate_audio(self, audio_path, ann, reverb=None,
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)
fg_stretched_duration = soundfile.info(
tmpfiles_internal[-1].name).duration

# NOW compute LUFS
fg_lufs = get_integrated_lufs(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'sox>=1.3.3',
'jams>=0.3.2',
'numpy>=1.13.3',
'pysoundfile'
'soundfile'
],
extras_require={
'docs': [
Expand Down
1 change: 1 addition & 0 deletions tests/profile_results.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
time_of_run,scaper_version,python_version,system,machine,processor,n_cpu,n_workers,memory,n_soundscapes,execution_time,git_commit_hash
2020-07-17 14:13:46.982171,1.3.8,3.7.7,Darwin,x86_64,i386,8,1,16.0 GB,100,149.7468,e0c08d4f6eb10bc0b337a9d47f86b3b110ed0836
2020-07-17 14:59:33.707885,1.3.8,3.7.7,Darwin,x86_64,i386,8,1,16.0 GB,100,135.1724,c780d270b0ea0c691e1cc1dbf725d1c4b35e5299
2 changes: 1 addition & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ def test_scaper_instantiate_event():
instantiated_event = sc._instantiate_event(
fg_event10, disable_instantiation_warnings=True)
assert instantiated_event.source_time == 0
assert instantiated_event.event_duration == 0.806236
assert np.allclose(instantiated_event.event_duration, 0.806236, atol=1e-5)

# repeated label when not allowed throws error
sc = scaper.Scaper(10.0, fg_path=FG_PATH, bg_path=BG_PATH)
Expand Down

0 comments on commit f3688b0

Please sign in to comment.