header={ "chef": "BeatRig", "dependencies": "ffmpeg", "title": "Audio File Gain", "description": "Adjust all audio files with a custom gain level", "instructions": "", "recipe_version": "63", "tags": "", "type": "default", "os": "windows,macOS", "palette": "Clean Slate", "spice": "BQ==:G+Hy36kJcnQQYYavb/JV2Il6eCYr6h4hRJHCF9rRbhX5BcazL6cuTgUMdz0xA50VWA5PmmV0Q7aWkiUtNFtbk991l+t0e8IBXMReMIT1GNjnZZDv7n2YRAo0xcSQbY0ixjG6LLH4wGKnspKAoA/v69iLn6N2IH0XzIZwTGdHSo4=", "flavour": "JpXgedQRlVQWtDeYBiquqijeTD7YGw9PGamah31rGaWcQhGvBCQqTHLtUS5wiD/2Rpmz0AwuzmR87l/bq/k+FTf0mnQfeTI/RNavorvzTsWNvxYyOMMeChzTp7DZGu8o9BFG3tAX6WQ9UipHP5LCHATefSsjo3ghllWsDOrBp2I=", "time": 1736284365, "core_version": "0.7.2", "magnetron_version": "1.0.333", "functions": "main", "uuid": "936a08c09d4d4b82940734bedaa7712e" }; // ============================================================================= function main() { // ----------------------------- // CHECK IF FFMPEG AND FFPROBE ARE AVAILABLE if(getAllowedApps("ffmpeg") == '' ) abort("FFMPEG is not available"); if(getAllowedApps("ffprobe") == '' ) abort("FFMPEG is not available"); // ------------------------------------ setMainMessage("preparing"); setProgress(0); // ------------------------------------ // GET ALL FILES FROM THE APP var files = getFiles(); // ------------------------------------ // CHEK IF FILES ARE VALID files = validateFiles(files); // ------------------------------------ // CHECK IF THERE IS AT LEAST ONE FILE if(files.length < 1){ setFiles(files); abort("Add files before running the recipe.") } // ------------------------------------ // PREPARE DIALOG var opts = { "gain": { "type": "slider", "style": "slider_h", "visible": true, "range" : { "min": -99, "max" : 99, "interval" : 0.1, "decimals" : 1 }, "bounds" : { "w" : 300, "x" : 100, "y" : 100, }, "value": 0. }, "label" : { "type" : "text", "label" : "dB", "just" : "r", "bounds" : { "x": 340, "y" : -1, "w" : 100, }, }, "label" : { "type" : "text", "label" : " ", "just" : "r", "bounds" : { "x": 1, "y" : 400, "w" : 1, }, }, "confirm" : { "type" : "button", "label" : "ok", "returns" : 1 } }; var r = dialog("Adjust all files with the following gain", "", "i", opts ); // CANCELLED if ( r.confirm != 1 ) { return; } // ------------------------------------ let adjust = Math.round(parseFloat(r.gain) * 100) / 100; if ( adjust == 0. ) { abort("No gain applied"); } // ------------------------------------ // PROCESS THE FILES setMainMessage("processing"); // ------------------------------------ // PROCESS THE FILES for (i=0;i