0

I want to convert multiple audio file formats from a folder (named as "aud_test") to a unique WAV format using python 3. After this, Save all files in another folder (named as "re_test") as mentioned in the below code.

    import os              
    from pydub import AudioSegment  
    wrong_folder_path = "/output/aud_test"      
    right_folder_path = "/output/re_test"    
    
    def make_wav(wrong_folder_path, right_folder_path):           
        for file in os.scandir(wrong_folder_path):                 
            if (ext == ".mp3" or ext == ".m4a" or ext == ".aac" or ext == ".opus" or ext == ".ogg" or ext == ".wma"):         
                out_file=right_folder_path+'/'+os.path.splitext(os.path.basename(file.path))[0]+".wav"      
            AudioSegment.from_file(file.path).export(out_file, format="wav")   
            print(f"{out_file}")

Getting an Error message as mentioned below:

TypeError: Traceback (most recent call last) <ipython-input-4-ad47c4ef00c8> in <module> ----> 1 "".join(1,2,3)  TypeError: join() takes exactly one argument (3 given) 
Pikaschu
  • 11
  • 4
  • And the error is...? – qmeeus Oct 05 '20 at 15:00
  • Unable to create the files in wav format in right_folder_path – Pikaschu Oct 05 '20 at 17:11
  • An error nessage looks like this: `--------------------------------------------------------------------------- TypeError Traceback (most recent call last) in ----> 1 "".join(1,2,3) TypeError: join() takes exactly one argument (3 given) `. It gives you 1) an error class (TypeError, ValueError, etc.), 2) the exact line where the error occured and 3) a nice message explaining why the error occured... So back to my question, what is the error? – qmeeus Oct 06 '20 at 10:12
  • Yeah absolutely right. – Pikaschu Oct 12 '20 at 17:03
  • @qmeeus Can you vote my question to get an access to ask questions as its banned as of now? – Pikaschu Jan 05 '22 at 06:48

0 Answers0