Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options to fix clipping and apply peak normalization to the generated soundscape #132

Merged
merged 25 commits into from
Sep 28, 2020

Conversation

justinsalamon
Copy link
Owner

@justinsalamon justinsalamon commented Sep 24, 2020

Right now, it's very easy for the user to generate a soundscape the clips if they're not careful with their choice of ref_db and the SNR values they give to foreground events.

This PR adds two new optional parameters to both generate and generate_from_jams:

  • fix_clipping - if True (default=False), will apply peak normalization in the case that the soundscape is clipping
  • peak_normalization - allows the user to apply peak normalization (abs(max) sample = 1) even if the soundscape isn't clipping

This PR addresses #131

Checklist:

generate:

  • modify soundscape audio
  • modify event audio
  • jams: update ref_db
  • jams: store fix_clipping and peak_normalization bools
  • jams: store scale_factor?

generate_from_jams:

  • modify soundscape audio
  • modify event audio
  • jams: update ref_db
  • jams: store fix_clipping and peak_normalization bools
  • jams: store scale_factor?

testing:

  • peak_normalize
  • generate
  • generate_from_jams

@justinsalamon
Copy link
Owner Author

justinsalamon commented Sep 24, 2020

NOTE: missing unit tests, coverage at 98% right now.

Copy link
Collaborator

@pseeth pseeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far, I've left some comments and thoughts.

scaper/audio.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
tests/test_audio.py Show resolved Hide resolved
tests/test_audio.py Show resolved Hide resolved
@pseeth
Copy link
Collaborator

pseeth commented Sep 25, 2020

If we can unpin pyrsistent in this PR as well, that'd be great. We pinned it to be compat with 2.7 and 3.4, but we dropped support for those a few versions ago, so we can unpin.

scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
tests/test_audio.py Show resolved Hide resolved
tests/test_audio.py Show resolved Hide resolved
tests/test_audio.py Show resolved Hide resolved
tests/test_core.py Show resolved Hide resolved
tests/test_core.py Show resolved Hide resolved
docs/changes.rst Show resolved Hide resolved
scaper/audio.py Show resolved Hide resolved
Copy link
Collaborator

@pseeth pseeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, there are a few tiny things that should be looked at before we merge, I think. See comments.

scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Outdated Show resolved Hide resolved
scaper/core.py Show resolved Hide resolved
@justinsalamon
Copy link
Owner Author

ok @pseeth I believe I've addressed all of your comments. Let's CR and SqM.

@justinsalamon justinsalamon merged commit c688a0f into master Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants