justinsalamon/scaper

Unhelpful warning for short BG sounds

justinsalamon opened this issue · 2 comments

Raised by @turpaultn

Currently using a BG sound shorter than the soundscape (which should get tiled) raises the following warning which isn't very helpful:

/anaconda3/envs/pytorch/lib/python3.6/site-packages/scaper/core.py:1433: ScaperWarning: freesound source time tuple (const, 0) could not be satisfied given source duration (2.91) and event duration (10.00), source time tuple changed to (const, 0) but was still not satisfiable, likely due to using 'normal' distribution with bounds too close to the start or end of the audio file
  ScaperWarning)

This makes sense for FG events but not BG events. Should be an easy fix to first determine if it's FG or BG and issue the relevant warning accordingly.

Might be unrelated or a diff PR, but here's another unhelpful warning that someone got:

scaper/core.py", line 1865, in generate
    jam.save(jams_path)
  File "/home/abugler/.conda/envs/nussl/lib/python3.7/site-packages/jams/core.py", line 1776, in save
    self.validate(strict=strict)
  File "/home/abugler/.conda/envs/nussl/lib/python3.7/site-packages/jams/core.py", line 1812, in validate
    valid &= ann.validate(strict=strict)
  File "/home/abugler/.conda/envs/nussl/lib/python3.7/site-packages/jams/core.py", line 778, in validate
    raise SchemaError(str(invalid))
jams.exceptions.SchemaError: -3 is less than the minimum of 0
Failed validating 'minimum' in schema['items']['properties']['value']['properties']['event_time']:
    {'minimum': 0, 'type': 'number'}
On instance[0]['value']['event_time']:
    -3

What happened here was an event_duration of 4 was requested when sc.duration = 1, thus -3. Took a while to track down so we can probably make this better. Thanks jams for validation, though! Otherwise this would have been a terrible bug.

So we can probably improve a couple warnings or catch a few more cases like above.

@pseeth I think the bigger issue here is that somewhere we're setting the event_time to -3 when we should have checks in place to ensure it never gets set to something less than 0. Can you please open a separate issue for with along with a MWE?

In the meanwhile I'll implement a fix for the unhelpful warning in a PR to address just that.