[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] Panning in QuickTime Player



I'm trying to use two sliders to control the right and left levels of stereo audio in QuickTime Player.  The only controls QTP has, though, are volume and balance, and finding the proper conversion between the two sets of values (L & R to V & B) has been a little tough.  Right now, the best I've got is setting V = max(L, R) and B = R - L (the panning goes from -1 to 1), and then attempting to correct the remaining influence of the L value on the R output volume (and vice versa) but this seems like the wrong path.  The volume and balance controls are under A/V Controls in the Window menu of QTP, and I've attached some AppleScript below (just open it in Script Editor) which would easily allow for testing of different conversions.  It seems like it must be some common type of panning (equal power, etc), but I'm lost as to how test for what it is or how to apply the appropriate conversion.  I should note that the balance control in QTP seems to keep the left channel constant and changes only the right channel's volume when the balance is set to the right of 0 (and vice versa).  It's not an SC problem, I know, but other forums haven't been too helpful and I figured this would be cake to some SC users.  Any help would be greatly, greatly appreciated.

--an audio file should be opened in QTP for this to work
--l and r have ranges of [0,1]
--volume in QTP has a range of [0,256]
--balance in QTP has a range of [-128,128]

set l to 0.5
set r to 1

if (l ≥ r) then
    set v to l
else if (r > l) then
    set v to r
end if

set b to (r - l)

tell application "QuickTime Player"
    set sound volume of movie 1 to v * 256
    set sound balance of movie 1 to b * 128
end tell

return {"vol", v, "bal", b}