I have been trying for some time to record scripts in Audition and assign them to a keyboard shortcut that make repetitive tasks quicker and easier. Like, I suspect, many others I have been frustrated by the problems of making the cursor go where you want in the file you are working on. A script recorded whilst working on one WAV file doesn't move the cursor correctly in a different file. But now I think I have found the answer.
Firstly, when you record a script incorporating a cursor movement a line is generated thus:
Selected: none at x scaled y SR z
where x is the amount the cursor moves, y is the length of the file in samples and z is the sample rate in samples/sec.
For instance a script that moves the cursor forward by .5 of a second in a file lasting 1 minute recorded at 48K produces this:
Selected: none at 24000 scaled 2880000 SR 48000
This will only work on that length of file at that sample rate. In any other file the cursor will not end up in the correct place. The larger the difference in size between the original file and the new one the larger is the cursor's positional error.
However yesterday, in an Eureka moment, I discovered that if you edit the value of the scaled factor y to be 0 then the cursor will move the correct amount whatever the size of the file. ie.:
Selected: none at 24000 scaled 0 SR 48000
This will always move the cursor exactly .5 sec forward regardless of the length of the WAV file. So now the amount of movement is solely dependant on the sample rate z.
Amount cursor moves in samples = x/z secs.
In fact it turns out that it doesn't matter whether the value of z is the same as the real sample rate of your audio file or not.
Selected: none at 50 scaled 0 SR 100
works just as well. So now it seems that you can move the cursor accurately anywhere you want in a script for use on a file of any length at any sample rate.
Here is a small example of a complete script that selects an area .5 sec ahead of the cursor without altering the file length and silences it. Ideal for setting a clean in point to an audio cue.
Collection: test
Title: SilenceMinusHalfSecond
Description:
Mode: 2
Undo: 1
Selected: none at 0 scaled 0 SR 48000
Freq: Off
cmd: Channel Both
Selected: -24000 to 0 scaled 0 SR 48000
Freq: Off
cmd: Silence
End:
This would seem to open up endless possibilities for scripting in Audition. But I suggest you do some experimenting yourselves to make sure I haven't made any fundamental errors in my tests.
Good Scripting and a Happy Christmas.