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
local variable 'start_ii' referenced before assignment #481
Comments
same error here |
1 similar comment
same error here |
Thanks for reporting. |
Thanks @GreyAlien502 I am also in the same situation... |
solves issue jiaaro#481
I observed this issue too. It occurs under two distinct circumstances:
One might need to handle those events separately as both result in an empty In the first case |
@florian-sattler, thanks for pointing out that fault in my fix. The problem with request #483 is that the existence of one sole non-silent segment does not mean that there is no silence before or after that segment; |
solves issue jiaaro#481
I really like your approach using I wonder if it would be better to add the clipping with explicit variables such as This way the clipping would be a bit clearer to maintain. Also consecutive negative values would be clipped as well. However I'm not sure they can even be generated by Also: Should the 135 ms fix really be a part of this? 😁 |
Hello, |
@florian-sattler,
The negative values don't come from detect_silence, they come from subtracting keep_silence from the range's start index.
It really shouldn't, but i was hoping it would fix the failed test, since we can't release till those are running, and i'd like to get a working version out as soon as possible. |
@bacloud14, there is no official fix released. pip install --upgrade git+https://github.com/jiaaro/pydub.git@refs/pull/482/merge If you decide to do this, there are a few caveats:
|
@GreyAlien502 Thank you for your changes. I checked out your code on windows too and am able to reproduce a failing test, however the error is different. As this error is clearly unrelated to this issue, is it possible to merge this fix? |
@florian-sattler, to merge despite failing tests, @jiaaro would have to take care of it & idk what exactly it would involve or when he'll have time. |
@GreyAlien502 @florian-sattler seems there is a bug in the development build (aka "latest") of ffmpeg. in #487 I switched the appveyor config to be pinned to ffmpeg 4.2.3, and added a single configuration that uses ffmpeg latest but allows failures |
@GreyAlien502 feel free to review and approve/merge if you think it's solid |
@jiaaro, thanks for the fix, i was getting really confounded by those failures. I'm working on a request for the change log and version bump so we can get this fix released. |
Version 0.24.1 has been published, so this should no longer be a problem for anyone running the latest version. |
Steps to reproduce
Expected behavior
I am running the code given in https://www.geeksforgeeks.org/python-speech-recognition-on-large-audio-files/ to transcribe large wav files
Actual behavior
But i am getting this error
UnboundLocalError Traceback (most recent call last)
in
100
101
--> 102 silence_based_conversion("creedoscar.wav")
103
in silence_based_conversion(path)
29 # consider it silent if quieter than -16 dBFS
30 # adjust this per requirement
---> 31 silence_thresh = -16
32 )
33
~/.local/lib/python3.6/site-packages/pydub/silence.py in split_on_silence(audio_segment, min_silence_len, silence_thresh, keep_silence, seek_step)
132 start_min = end_max
133
--> 134 chunks.append(audio_segment[max(start_min, start_ii - keep_silence):
135 min(len(audio_segment), end_ii + keep_silence)])
136
UnboundLocalError: local variable 'start_ii' referenced before assignment
Your System configuration
Is there an audio file you can include to help us reproduce?
You can include the audio file in this issue - just put it in a zip file and drag/drop the zip file into the github issue.
The text was updated successfully, but these errors were encountered: