justinsalamon / scaper

A library for soundscape synthesis and augmentation
BSD 3-Clause "New" or "Revised" License
383 stars 56 forks source link

Function to reset the event specification in the Scaper object #69

Closed pseeth closed 4 years ago

pseeth commented 4 years ago

It might be useful to have a way to reset the event specification in a Scaper object so that the same Scaper object can be used over and over to generate soundscapes, instead of making a Scaper object inside the loop for each soundscape like in the tutorial.

Current proposal is to add a function to the Scaper object called Scaper.reset_event_spec() which would accomplish this. Looking through Scaper._instantiate, the only objects that get touched that belong to self are self.bg_spec and self.fg_spec. As these are both lists, I think the body of reset_event_spec would look something like:

def reset_event_spec(self):
  self.fg_spec = []
  self.bg_spec = []

Which are their original settings in the init function.

We would need a corresponding test. Maybe generate something, then reset the object, then generate again? And make sure the generated soundscapes are different from one another?

justinsalamon commented 4 years ago

Yes, let's add this! A few comments:

How does this all sound?

pseeth commented 4 years ago

All sounds good. I'll fold this into #54!

justinsalamon commented 4 years ago

Added via #54