2024-04-21 00:43:49
+{
+ "cells": [
+{
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+""""n",
+"Bulk File Converter for the Yamaha FGDP
-50n",
+"n",
+"Requirements for loading audio files:n",
+"Sample format: WAV, AIFF (44.1 kHz, 16
-bit, mono/stereo)n",
+"Max. time: Up to approx. 20 seconds per file, approx. 300 seconds (stereo)/600 seconds (mono) in totaln",
+"n",
+""""n",
+"n",
+"import osn",
+"import subprocessn",
+"from tqdm import tqdmn",
+"n",
+"n",
+"# Bulk convert every file in the folders folders from mp3 to wavn",
+"n",
+"usb_drive = '/Volumes/NO NAME'n",
+"n",
+"folders = [n",
+"'/Users/mark/Downloads/Unsorted/Warner Bros. Sound Effects Library (1400
+ Sound FX) [RH]',n",
+"'/Users/mark/Downloads/Unsorted/Sound Ideas Sound Effects Library 1000 Series (28 CDs)'n",
+"]n",
+"n",
+"out_folder = '/Users/mark/Downloads/Unsorted/Converted'n",
+"# out_folder = usb_driven",
+"n",
+"ffmpeg_settings = {n",
+"'sample_rate': '44100',n",
+"'bit_rate': '16',n",
+"'channels': '2'n",
+"}n",
+"n",
+"# Make the out_folder if it doesn't existn",
+"n",
+"if not os.path.exists(out_folder):n",
+"os.makedirs(out_folder)n",
+"n",
+"folder_count = 0n",
+"for folder in folders:n",
+"for subfolder in os.listdir(folder):n",
+"folder_count
+= 1n",
+"n",
+"# Convert every mp3 file in the folders to wavn",
+"for folder in folders:n",
+"for subfolder in tqdm(os.listdir(folder), total=folder_count):n",
+"print(f'Converting {subfolder}...')n",
+"# Skip files, only convert foldersn",
+"# is subfolder a file?n",
+"if os.path.isfile(os.path.join(folder, subfolder)):n",
+"continuen",
+"else:n",
+"for file in os.listdir(os.path.join(folder, subfolder)):n",
+"if file.endswith('.mp3'):n",
+"in_file = os.path.join(folder, subfolder, file)n",
+"# Put folder name into file namen",
+"out_file = os.path.join(out_folder, subfolder
+ '_'
+ file.replace('.mp3', '.wav'))n",
+"subprocess.run(['ffmpeg', '
-i',n",
+"in_file, '
-ar',n",
+"ffmpeg_settings['sample_rate'],n",
+"'
-ac',n",
+"ffmpeg_settings['channels'],n",
+"'
-ab', ffmpeg_settings['bit_rate'],n",
+"out_file])n",
+"print(f'Converted {file} to {out_file}')"
+ ]
+}
+ ],
+ "metadata": {
+"kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+},
+"language_info": {
+ "codemirror_mode": {
+"name": "ipython",
+"version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x
-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.0.0"
+}
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
Read more...