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

Option to return offsets with audio segments when splitting on silence #773

Open
JakeBamrah opened this issue Jan 17, 2024 · 0 comments
Open

Comments

@JakeBamrah
Copy link

Feature request

At the moment split_on_silence() returns separate non-silent audio segments only. I think it would be useful to provide an option to return the starting offsets (in ms) for each audio segment that is created at each split.

For example, a 20s audio clip that is split into three non-silent segments at 3s, 9s and 15s would be accompanied by their starting offsets (3s, 9s and 15s). Such a feature would allow you to keep track of where the split segment sits in relation to the original audio clip (pre-splitting).

Implementation ideas

This could be done by returning a separate array of starting offsets with each AudioSegment or possibly returning a tuple of (AudioSegment, start_offset) by passing a keyword argument to split_on_silence(provide_starting_offsets=True). Another option would be to consider adding an offset property to AudioSegment itself which can be assigned to when split.

Note: This would not be the default behaviour for split_on_silence() because it would create backwards incompatibility but an option specified.

This is something that I have ran into personally at work and thought it was worth opening a discussion about to see if others would find this useful. I would be happy to submit a PR if this would be considered useful to others. If not, feel free to disregard and close this issue.

Finally, thank you very much for your efforts, this library is incredibly useful and a joy to use.

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

No branches or pull requests

1 participant