However, after obtained a numpy array using wav *= 32767 / max(0.01, np.max(np.abs(wav))), I want to convert it to a .mp3 file so that it will be easier to send it back as streaming response. Right now, I can convert .wav bytes object to a .mp3 file, but the problem is that I don't know how to convert the numpy array to a .wav bytes object.
To import pytube, we can use the commands according to the python version. For Python2 : pip install pytube For Python3 : pip3 install pytube For pyube3 : pip install pytube3 To save the audio file, we are using the os module and import by using the command given below :Convert wav to text. Im a newbie in python and im trying to do an app convert wav file but i dont know why my code cant run and it report this My code: import speech_recognition as sr r = sr.Recognizer () with sr.AudioFile ('idk.wav') as source: audio = r.record (source) try: s = r.recognize_google (audio) print (s) except: print ("try again Python Extract Audio (WAV) From Video (MP4) with Mono or Stereo – Python Tutorial Make Python 3.5 Support OpenSSL 1.1.1 Version: A Complete Guide – Python Tutorial Python Create GIF with Images Using ImageIO: A Complete Guide – Python Tutorial However, I think the OP's question boils down to "how can I download an audio file in mp4 format directly as an audio file in mp3 format", to which the answer is: you can't, you have to convert it. This is because mp3 is an audio only format, whereas an mp4 is a "digital multimedia container" format, and so an audio only mp4 file is still audio pXiW0Aj. 824 890 854 839 594 227 608 411