Closed lostanlen closed 7 years ago
Yup, that makes sense, thanks for catching it! We recently hit almost the same issue over in pumpp
, so it's not too surprising. Do you have any interest in doing a PR for this?
Yes, I will write a PR later today.
On second thought, this looks more like an off-by-one error. The fix would then be:
start = np.random.randint(0, 1 + len(soundf) - n_target)
That would be a breaking change, though.
That would be a breaking change, though.
That's fine -- it's broken as is. I bumped the milestone for this to 0.2, so it's okay to not be backward-compatible with the 0.1 series.
I have a dataset of audio clips of the same length. Half of these clips are positive (contain a bird flight call), while the other half is negative (contain only background noise). I want to augment the dataset by mixing clips together, without changing the label.
But I ran into an error in 'muda.deformers.background.sample_clip_indices'. If I understand the stack trace correctly (see below my signature), the error happens when executing
start = np.random.randint(0, len(soundf) - n_target)
withlen(soundf) - n_target
equal to zero.I made a Gist to reproduce the bug: https://gist.github.com/lostanlen/15fe9c879fdd24fe9023fa430314cd51 It disappears when the difference in lengths is strictly larger than zero.
Is this expected behavior? It seems to me that my issue could be fixed with
Best, Vincent.