Skip to content

Adding default values for event parameters #51

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

beasteers
Copy link
Contributor

@beasteers beasteers commented Apr 2, 2019

Here is a summary of the defaults that I added:

# Background:
label: ('choose', [])
source_file: ('choose', [])
source_time: ('uniform', 0, source_duration - duration)
snr: ('const', 0)

# Foreground
label: ('choose', [])
source_file: ('choose', [])
source_time: ('const', 0)
event_time: ('uniform', 0, duration - event_duration)
event_duration: ('const', source_duration)
snr: ('const', 0)
pitch_shift: None
time_stretch: None

The ones that are most beneficial are the source_time, event_time, and the event_duration, as they can help sample evenly from recordings with differing lengths with fewer manually set values, but defaults in general seem like a nice convenience.


This change is Reviewable

@beasteers
Copy link
Contributor Author

This is in reference to #41

@coveralls
Copy link

coveralls commented Apr 2, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 90e2f00 on bensteers:event_defaults into 3c83bba on justinsalamon:master.

@pseeth
Copy link
Collaborator

pseeth commented Apr 2, 2019

This looks somewhat related to the changes in #53, if you want to take a look at that. Instead of hard-coding defaults for source_time, you can pass in something like ('uniform', 0, 100000), where the last number is just some number bigger than the duration of all your source files and it'll fall back to doing ('uniform', 0, source_duration - event_duration). Similar logic is implemented for the other supported distributions.

@beasteers
Copy link
Contributor Author

Oh wow that's some timing lol. K, I'll look into it when I can get a minute. Hopefully we can merge them, because I still think having default values across the board is intuitive, like I think you should be able to do:

sc.add_background(label=('const', 'street'))
sc.add_event(label=('const', 'bird'))
sc.add_event(label=('const', 'car_honking'))
sc.add_event() # any random event

and have it generate valid soundscapes based on the limited information you give it.

@justinsalamon
Copy link
Owner

See my latest comment on #41

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.

4 participants