Created
August 2, 2020 09:22
-
-
Save pofulu/6286bc4d5ef7f2c9db01b8154bbead6c to your computer and use it in GitHub Desktop.
Audio to Spark AR (AppleScript - JXA)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const FFMPEG_PATH = 'usr/local/bin/ffmpeg'; | |
| //–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– | |
| const app = Application.currentApplication() | |
| app.includeStandardAdditions = true | |
| function openDocuments(droppedItems) { | |
| const changeExtension = (file, newExtension) => file.substr(0, file.lastIndexOf(".")) + `.${newExtension}`; | |
| droppedItems.forEach(file => { | |
| const intput = file.toString(); | |
| const output = changeExtension(intput, 'm4a'); | |
| const cmd = `${FFMPEG_PATH} -i '${intput}' -b:a 128k -ar 44100 -ac 1 '${output}'`; | |
| app.doShellScript(cmd); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment