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

Fix imports of AudioSegments in stereo_to_ms and ms_to_stereo #707

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ghostkeeper
Copy link

There is no symbol AudioSegment defined in the stereo_to_ms and ms_to_stereo functions. Calling them results in:

NameError: name 'AudioSegment' is not defined. Did you mean: 'audio_segment'?

We cannot import AudioSegment at the top of the module, so we must import it inside of this function.

Here is some example code that triggers the error. This is more or less how I discovered the mistake.

from pydub import AudioSegment
import pydub.scipy_effects
song = AudioSegment.from_mp3("song.mp3")
song = song.eq(100, gain_dB=4, channel_mode="M+S")  # This channel mode causes stereo_to_ms and ms_to_stereo to be called.

This error was introduced with this change: #492

There is no symbol AudioSegment defined in these functions. Calling them results in:
  NameError: name 'AudioSegment' is not defined. Did you mean: 'audio_segment'?
We cannot import AudioSegment at the top of the module, so we must import it inside of this function.
To be consistent with the rest of the function, I'm using tabs as indentation here. We could consider turning the indentation into spaces.
If this PR gets accepted, then I am a contributor too.
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

Successfully merging this pull request may close these issues.

None yet

1 participant