Skip to content

Instantly share code, notes, and snippets.

@troygrosfield
Created February 6, 2015 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troygrosfield/713021a6f320bfcb794c to your computer and use it in GitHub Desktop.
Save troygrosfield/713021a6f320bfcb794c to your computer and use it in GitHub Desktop.
Create empty audio files using applescript
global duration
set duration to 43
set endDuration to 46
repeat until duration = endDuration
set recordName to "empty-" & duration & "sec.m4a"
set newPath to "~/Users/troy/Desktop/audios/" & recordName
set duration2 to duration
tell application "Finder"
set savePath to (path to desktop as text) & recordName
tell application "QuickTime Player"
activate
set doku to new audio recording
start doku
repeat until duration2 = 0
delay 1
set duration2 to (duration2 - 1)
end repeat
delay 0.03
#delay duration
stop doku
set newDoc to last item of (documents whose name contains "Untitled")
export newDoc in file savePath using settings preset "Audio Only"
#close every document without saving
end tell
end tell
#move file savePath to file newPath with replacing
set duration to (duration + 1)
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment