@@ -0,0 +1,1053 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom pydub import AudioSegment%0Aimport os, glob%0A%0A%0Amp3_path = 'path_to/mp3'%0Aroot_output = 'audios'%0Awav_path = os.path.join(root_output, 'wav')%0Aogg_path = os.path.join(root_output, 'ogg')%0A%0A%0Adef main():%0A%09for mp3 in glob.glob(os.path.join(mp3_path,'*.mp3') ):%0A%09# for mp3 in mp3s:%0A%09%09%22%22%22 convert mp3 to wav %22%22%22%0A%09%09wav_name =  mp3.split('/')%5B-1%5D.replace('.mp3', '.wav')%0A%09%09ogg_name =  mp3.split('/')%5B-1%5D.replace('.mp3', '.ogg')%0A%09%09src_wav = os.path.join(wav_path, wav_name)%0A%09%09src_ogg = os.path.join(ogg_path, ogg_name)%0A%09%09%0A%09%09sound = AudioSegment.from_mp3(mp3)%0A%09%09sound.export(src_ogg, format=%22ogg%22)%0A%09%09sound = sound.set_channels(1) # set to mono%0A%09%09sound.export(src_wav, format=%22wav%22)%0A%0A%0Aif __name__ == %22__main__%22:%0A%09if not os.path.isdir(root_output):%0A%09    %22%22%22 Check if OUTPUT_DIR exits %22%22%22%0A%09    os.mkdir(root_output)%0A%0A%09if not os.path.isdir(wav_path):%0A%09    %22%22%22 Check if OUTPUT_DIR exits %22%22%22%0A%09    os.mkdir(wav_path)%0A%09%0A%09if not os.path.isdir(ogg_path):%0A%09    %22%22%22 Check if OUTPUT_DIR exits %22%22%22%0A%09    os.mkdir(ogg_path)%0A%09%0A%09main()%0A

Create mp3_to_wavogg.py