The No.1 Website for Pro Audio
 All  This Thread  Reviews  Gear Database  Gear for sale     Latest  Trending
Auto Bouncer, Applescript and PT12/Yosemite
Old 4th June 2015
  #31
Gear Guru
 
drBill's Avatar
Quote:
Originally Posted by Sam Watson View Post
I don't think we are totally out of the woods with the above. I found an error but solved it.



First: The above needs to be tweaked. Grep doesn't use the question mark for a wildcard. That is for commands in UNIX. Doh! (Hey, I'm a musician not a programmer!) Grep uses the period. I didn't catch this because I was testing with shorter clips. So the command always seemingly returned the correct answer that no files were open in Bounced Files. Tweak it to this:

set bouncing to do shell script "lsof | grep Bounced.Files/.*.wav | wc -l | sed 's/^[ ]*//'"


Second: The is a big gotcha with this approach. If you drag files into your timeline from the Bounced Files folder of your project or another then the above command will never return "0" since you indeed have a WAV file from a Bounced Files directory open via your session. Solution 1) In PT Preferences > Processing > Check "Automatically Copy Files on Import" so that any files are put in your Audio Files folder. I tend to like to work that way out of habit. You might not - particularly when doing mastering sessions. So that could get you!

Thus I thought: Why not check for the number of open files in the Bounced Files folder *just* before you bounce and tell the script to only start bouncing the next file if the open number of files is higher than that. In short: You can have every file in your bounced files folder re-imported to your session or open in Quicktime and the script will now account for that! (Attaching below!)

Third: I am getting good results with Real Time bounce. However, when doing Offline I noticed I am getting incorrect selection in the timeline. I think it has to do with an error message that Applescript is giving me while executing the do shell script command. It keeps returning error -10004 but then yielding the correct answer. Google yields nothing on that error number. *shrug* But somehow Offline Bounce moves the cursor to the beginning of the session and hence every bounce after the first has incorrectly selected regions. Probably have to make a separate Applescript to do Offline vs. Realtime bounces then. So consider this the REALTIME Only script.

Long story short: It works in realtime mode (which drBill is saying still sounds best) and is a bit more robust now. WHY doesn't PT have batch processing??

Anyway here is the script as text (Pro Tools Auto Bounce SW-v1.scpt):


display dialog "How many tracks are there in the Pro Tools session?" buttons {"OK"} default button 1 default answer "14"
set numberOfTracks to text returned of result
display dialog "Rewind your Pro Tools session to the beginning of the timeline, then press OK." buttons {"OK"} default button 1
set whichTrack to "0"

tell the application "Pro Tools 11"
activate
tell application "System Events" to keystroke tab
repeat numberOfTracks times
set whichTrack to whichTrack + 1
tell application "System Events" to keystroke tab using shift down
tell application "System Events" to keystroke tab using shift down
tell application "System Events" to keystroke tab using shift down
set currentlyOpenCount to do shell script "lsof | grep Bounced.Files/.*.wav | wc -l | sed 's/^[ ]*//'"
delay 2.0
tell application "System Events" to keystroke "b" using {option down, command down}
delay 0.5
tell application "System Events" to keystroke return
delay 0.5
set x to whichTrack as string
tell application "System Events" to keystroke x
delay 0.5
tell application "System Events" to keystroke return
-- this is where the bounce happens. we have to wait until protools is done before going to the next one.
repeat
delay 8
set bouncing to do shell script "lsof | grep Bounced.Files/.*.wav | wc -l | sed 's/^[ ]*//'"
if bouncing ≤ currentlyOpenCount then exit repeat
end repeat
delay 5
-- ok we're done waiting
tell application "System Events" to keystroke tab using option down
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke tab
end repeat
end tell


Sam, I only tested with short files as well. But I will now employ your new script, and I'm sure all will be great. Thanks again - MUCH!!!

bp

And yeah, I've been using this in real time. I did find I could pick out the real time bounces over off-line bounces "most" of the time.
Old 4th June 2015
  #32
Lives for gear
 

Quote:
Originally Posted by Sam Watson View Post
Good thought, but no luck! %20 is an HTML trick. Grep in BSD Unix (which is under the hood of OS X) doesn't seem recognize it.
Yes I confused HTML code with BASH scripting.... my programming is rusty.
Old 5th June 2015
  #33
Gear Addict
 

drBill, can you please add your original script for PT <11 in a zip? (instead of the jpeg)? Thanks..
Old 5th June 2015
  #34
Gear Guru
 
drBill's Avatar
Quote:
Originally Posted by Newmann View Post
drBill, can you please add your original script for PT <11 in a zip? (instead of the jpeg)? Thanks..
Sure, here it is. I used this on 8 and 9. Should work OK on 10. BTW, you can change .wav to .aiff if you're using aiff files.
Attached Files
File Type: zip ProTools Auto Bounce bp-old.zip (4.3 KB, 10 views)
Old 6th June 2015
  #35
Gear Addict
 

Thanks so much!
Old 15th July 2019
  #36
Here for the gear
 

Hi guys

Thanks for all your amazing works.

I found a strange thing, in the latest system (Mojave 10.14.5 + Protools 2019.6), the "lsof | grep Bounced?Files/.*.wav | wc -l | sed 's/^[ ]*//'" command is extremely slow, it takes more than one minute to process.

Does anyone have an idea how to speed it up?

Thanks
Old 15th July 2019
  #37
Lives for gear
 
iluvcapra's Avatar
Quote:
Originally Posted by Bowenmao View Post
Hi guys

Thanks for all your amazing works.

I found a strange thing, in the latest system (Mojave 10.14.5 + Protools 2019.6), the "lsof | grep Bounced?Files/.*.wav | wc -l | sed 's/^[ ]*//'" command is extremely slow, it takes more than one minute to process.

Does anyone have an idea how to speed it up?

Thanks
The first part of the command, replace "lsof" with "lsof -n". If that doesn't work, try "lsof -n -P"
Old 15th July 2019
  #38
Here for the gear
 

Quote:
Originally Posted by iluvcapra View Post
The first part of the command, replace "lsof" with "lsof -n". If that doesn't work, try "lsof -n -P"
Thanks! It's much better to add a -n here.

That's interesting. I tested both three command in terminal,

lsof -n -P | grep Bounced.Files/.*.wav | wc -l | sed 's/^[ ]*//'
0'28''

lsof -n | grep Bounced.Files/.*.wav | wc -l | sed 's/^[ ]*//'
0'28''

lsof | grep Bounced.Files/.*.wav | wc -l | sed 's/^[ ]*//'
1'24''

Overall, Mojave 10.14.5 is much slower than my old Mac G5 (10.6.8)
Old 15th July 2019
  #39
Lives for gear
 
iluvcapra's Avatar
Quote:
Originally Posted by Bowenmao View Post
Thanks! It's much better to add a -n here.

That's interesting. I tested both three command in terminal,

lsof -n -P | grep Bounced.Files/.*.wav | wc -l | sed 's/^[ ]*//'
0'28''

lsof -n | grep Bounced.Files/.*.wav | wc -l | sed 's/^[ ]*//'
0'28''

lsof | grep Bounced.Files/.*.wav | wc -l | sed 's/^[ ]*//'
1'24''

Overall, Mojave 10.14.5 is much slower than my old Mac G5 (10.6.8)
lsof doesn't just report open files, it also lists all the open TCP and UDP sockets your computer currently has open, along with a bunch of other kernel resources. When you pass "-n" this skips the step of resolving the IP addresses of the TCP and UDP connections to names, which is usually the slowest part, because it either has to find the name in a cache or hit the network.

"-P" similarly skips the step of resolving the TCP and UDP port numbers in the list to names.
Old 16th July 2019
  #40
Here for the gear
 

Thanks mate!
Topic:
Post Reply

Welcome to the Gearslutz Pro Audio Community!

Registration benefits include:
  • The ability to reply to and create new discussions
  • Access to members-only giveaways & competitions
  • Interact with VIP industry experts in our guest Q&As
  • Access to members-only sub forum discussions
  • Access to members-only Chat Room
  • Get INSTANT ACCESS to the world's best private pro audio Classifieds for only USD $20/year
  • Promote your eBay auctions and Reverb.com listings for free
  • Remove this message!
You need an account to post a reply. Create a username and password below and an account will be created and your post entered.


 
 
Slide to join now Processing…
Thread Tools
Search this Thread
Search this Thread:

Advanced Search
Forum Jump
Forum Jump