How to Solve NameError: name 'AudioSegment' is not defined -- pydub
Solution: Import the 'AudioSegment' module
To Solve the error, add the following line to the top of your code.
from pydub import AudioSegment
For more information:
Python pydub AudioSegment