Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mp3 To Wav
#1
Hello, I am trying convert Mp3 to Wav for my program.

 
from pydub import AudioSegment

# files                                                                         
src = 'C:\\Users\\resource\\Desktop\\Python\\API_Tesseract\\audio.mp3'
dst = 'C:\\Users\\resource\\Desktop\\Python\\API_Tesseract\\test.wav'

sound = AudioSegment.from_mp3("payload.mp3")
sound.export("payload2.wav", format="wav")
Error:
runfile('C:/Users/resource/Desktop/Python/API_Tesseract/convert/convertMP32Wav.py', wdir='C:/Users/resource/Desktop/Python/API_Tesseract/convert') Traceback (most recent call last): File "<ipython-input-30-9c5b8dc3f98a>", line 1, in <module> runfile('C:/Users/resource/Desktop/Python/API_Tesseract/convert/convertMP32Wav.py', wdir='C:/Users/resource/Desktop/Python/API_Tesseract/convert') File "C:\Users\resource\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile execfile(filename, namespace) File "C:\Users\resource\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "C:/Users/resource/Desktop/Python/API_Tesseract/convert/convertMP32Wav.py", line 7, in <module> sound = AudioSegment.from_mp3("payload.mp3") File "C:\Users\resource\Anaconda3\lib\site-packages\pydub\audio_segment.py", line 716, in from_mp3 return cls.from_file(file, 'mp3', parameters=parameters) File "C:\Users\resource\Anaconda3\lib\site-packages\pydub\audio_segment.py", line 665, in from_file info = mediainfo_json(orig_file) File "C:\Users\resource\Anaconda3\lib\site-packages\pydub\utils.py", line 263, in mediainfo_json res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE) File "C:\Users\resource\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 143, in __init__ super(SubprocessPopen, self).__init__(*args, **kwargs) File "C:\Users\resource\Anaconda3\lib\subprocess.py", line 775, in __init__ restore_signals, start_new_session) File "C:\Users\resource\Anaconda3\lib\subprocess.py", line 1178, in _execute_child startupinfo) FileNotFoundError: [WinError 2] O sistema não pode encontrar o arquivo especificado
Reply
#2
I think you can use: http://pydub.com/
input in any format
modify (if desired)
export in any format
Reply
#3
(Dec-16-2019, 05:11 PM)Larz60+ Wrote: I think you can use: http://pydub.com/
input in any format
modify (if desired)
export in any format

I am Trying, but nothing sucess Wall , Can are you help me ?
Reply
#4
You define src and dst files, but then you read and write to different files. Is this intentional?
Reply
#5
Is the file path mentioned correctly? From the error, can suspect that script is trying to locate the file where it couldn't find it
Reply
#6
(Dec-17-2019, 03:07 AM)jefsummers Wrote: src = 'C:\\Users\\resource\\Desktop\\Python\\API_Tesseract\\audio.mp3'
dst = 'C:\\Users\\resource\\Desktop\\Python\\API_Tesseract\\test.wav'
 
sound = AudioSegment.from_mp3("payload.mp3")
sound.export("payload2.wav", format="wav")

this is a test

(Dec-17-2019, 09:10 AM)Malt Wrote: Is the file path mentioned correctly? From the error, can suspect that script is trying to locate the file where it couldn't find it

the pathfile is ok, but don t convert
Reply
#7
Can you try copying that payload.mp3 to the path from where you are trying to run this script, if it is not already available there
Reply
#8
To verify you are getting the file, can you play it?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020