Skip to content

Jazz-Sax.Com

Jazz-Sax, all things Jazz and Sax

  • About
  • Home
  • Gallery
  • Polls
  • Articles
  • Toggle search form

Applescript To Convert Files To 96Khz/24bit Files

Posted on December 16, 2012December 16, 2012 By ericdano No Comments on Applescript To Convert Files To 96Khz/24bit Files

My audio interface I use in the studio is capable of recording at 96khz. Now does recording in that higher rate make things sound good? Yes, it does. But one of the things that is a pain in the ass is converting things to get ready to record in Logic at 96Khz. I have a Logic template set up that defaults to being at 96khz, but if I drag say a Band in a Box generated background over, or want to use something I did that is in my iTunes, Logic will switch it to a lower rate. Ugh. So, I came up with this Applescript that I hacked together from various sites on the web, such as this one. It’s drag and drop, and will work with multiple files. Enjoy


property destlocation : missing value
property my_Folder : missing value
property s_a_folder : missing value
property command_start : "afconvert -f \"WAVEf\"" & space
property command_text_spec : space & "-d \"I24@96000\"" & space
property command_rate_spec : ""
property theitemname : missing value
property rootloc : missing value
property the_file : missing value
property the_data : missing value

on open these_items
my convert_audio(these_items)
end open

on convert_audio(these_items)

set command_rate_spec to ""
repeat with i from 1 to the count of these_items
set this_item to item i of these_items
set gen_item to this_item
set gen_info to info for gen_item
set gen_kind to folder of gen_info as Unicode text
if gen_kind is "true" then
tell me to set s_a_folder to true
else
set s_a_folder to false
end if
set rootloc to extract_parent_from(gen_item, s_a_folder)
if (rootloc as Unicode text) ends with ":" then
set rootloc to (rootloc as Unicode text)
else
set rootloc to ((rootloc & ":") as Unicode text)
end if
set destlocation to ((rootloc & "Converted_audio:") as Unicode text)
try
do shell script "mkdir" & space & (quoted form of (POSIX path of destlocation))
end try
if s_a_folder then
process_folder(this_item)
else
if (alias of gen_info is false) then
process_item(this_item)
end if
end if
end repeat
end convert_audio

on process_folder(this_folder)
set these_items to paragraphs of (do shell script "ls" & space & (quoted form of (POSIX path of this_folder)))
set this_folder to this_folder as Unicode text
repeat with i from 1 to the count of these_items
set this_item to (this_folder & (item i of these_items))
try
set the item_info to (info for (this_item as alias))
if folder of the item_info is true then
set this_item to this_item & ":"
process_folder(this_item)
else if (alias of the item_info is false) then
process_item(this_item as alias)
end if
on error the error_message number the error_number
if the error_number is in {-43, -2706, -2753, -48} then
else
display dialog the (error_number as string) & space & the error_message
end if
end try
end repeat
end process_folder

on process_item(this_item)
set my_Folder to (extract_parent_from(this_item, false) as Unicode text)
set sourcepath to (quoted form of (POSIX path of (this_item as Unicode text)))
set itemstring to replace_chars((my_Folder as Unicode text), rootloc, destlocation)
log rootloc
log destlocation
log itemstring
tell application "Finder"
set namepart to name extension of file this_item
set namefull to name of file this_item
end tell

set newname to replace_chars(namefull, namepart, "wav")
set destpath to (POSIX path of itemstring)
try
do shell script "mkdir -p" & space & (quoted form of destpath)
on error e1
display dialog e1 & namefull
end try
set the_out_file to (quoted form of (destpath & newname))
set full_command to command_start & sourcepath & command_text_spec & command_rate_spec & space & the_out_file

try
--log full_command
do shell script full_command
on error e3
display dialog "Error: " & the error_number & ". " & the error_message & return & namefull giving up after 5
end try
end process_item

on extract_parent_from(this_filepath, s_a_folder)
set alias_target to this_filepath as alias
tell application "Finder"
set _parent to container of alias_target
end tell
set parent_folder_path to _parent as string
return the parent_folder_path
end extract_parent_from

on replace_chars(this_text, bahad, goohood)
set AppleScript's text item delimiters to the bahad
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the goohood as Unicode text
set this_text to the item_list as Unicode text
set AppleScript's text item delimiters to ""
return this_text
end replace_chars

Articles Tags:Applescript, code, covert, OS X

Post navigation

Previous Post: What Do I Want For Xmas?
Next Post: A Kenny G Signed Saxophone…….

Leave a ReplyCancel reply

  • Articles
  • Featured
  • News
  • Reviews
  • Sheet Music
  • Sheet Of The Week
  • Videos

Akai Apple Bad Band-in-a-Box Big Band Brecker Computer Education EWI Finale gear History Humor iPad ipod itunes Jazz Katy Perry mac makemusic Maroon 5 Michael Brecker Music Obit Opinion OS X PGMusic pop Practicing protools Recommended Recording Saxophone Sheet Music Sheet Of The Week SmartMusic Software Taylor Swift technique Technology Technology video Wordpress wtf youtube

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Donate

Donate to Jazz-Sax.Com

Downloads

  • Zinn Practice Regimen III (592.7 KiB, 52,857 hits)
    You do not have permission to download this file. Go register first.
  • Zinn Practice Regimen (211.9 KiB, 20,275 hits)
    You do not have permission to download this file. Go register first.
  • Breckerisms - Michael Brecker Type Patterns (379.6 KiB, 15,068 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Bb (4.6 MiB, 12,511 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns Reference (600.9 KiB, 12,110 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Eb (4.7 MiB, 11,716 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Bb Pages 1 to 100 (1.7 MiB, 11,500 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Bb Pages 201 to 289 (1.6 MiB, 11,001 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Bb Pages 101 to 200 (1.9 MiB, 10,986 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Eb Pages 201 to 289 (1.6 MiB, 10,924 hits)
    You do not have permission to download this file. Go register first.

For computer Recording I use...

View Results

Loading ... Loading ...

Downloads

  • Zinn Practice Regimen III (592.7 KiB, 52,857 hits)
    You do not have permission to download this file. Go register first.
  • Zinn Practice Regimen (211.9 KiB, 20,275 hits)
    You do not have permission to download this file. Go register first.
  • Breckerisms - Michael Brecker Type Patterns (379.6 KiB, 15,068 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Bb (4.6 MiB, 12,511 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns Reference (600.9 KiB, 12,110 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Eb (4.7 MiB, 11,716 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Bb Pages 1 to 100 (1.7 MiB, 11,500 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Bb Pages 201 to 289 (1.6 MiB, 11,001 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Bb Pages 101 to 200 (1.9 MiB, 10,986 hits)
    You do not have permission to download this file. Go register first.
  • II-V-I Patterns in Eb Pages 201 to 289 (1.6 MiB, 10,924 hits)
    You do not have permission to download this file. Go register first.

Sites

  • A-NO-NE Music
  • Aebersold Music
  • AKG Headphones and Microphones
  • Apple
  • BopLand.org
  • Boston Sax Shop
  • Bret Primentel
  • Casa Valdez Studios
  • Charles McNeal
  • Create Digital Music
  • Dorico
  • Eric Dannewitz
  • EWI Musician
  • EWI Reason Sounds
  • EWI-EVI Page
  • Greg Fishman
  • Hollywood Saxophone Quartet
  • Horn Pedalboard Subreddit
  • iRockJazz
  • Jazz Standards
  • Jazz-Clarinet
  • Jazz-Flute
  • Jazz-Oboe
  • JazzBariSax.Com
  • Joe Allard.org
  • Kenyon Carter
  • M-Audio
  • McDSP
  • Metric Halo Labs
  • Michael Brecker
  • MOTU
  • Norbert Stein
  • PG Music
  • Phil Woods
  • Ricci Adams’ Musictheory
  • Sammy Nestico
  • Save A Bunny
  • Sax Pictures
  • Seventh String Software
  • Shure Notes
  • Sound On Sound
  • Tape Op
  • USA Horn

Copyright © 2025 Jazz-Sax.Com.

Powered by PressBook WordPress theme