Forums > MaxMSP

changing system audio device from max

April 21, 2006 | 9:12 am


April 21, 2006 | 9:26 am

I asked this question recently too, and I’m still
hoping for an answer; it would be useful to be able to
do this when outputting via speech objects,
cheers
Roger



f
April 22, 2006 | 12:16 pm

if you’re on osx you can do this with applescript. but it’ll be pretty
slow switching and you’ll need to check the ‘enable access for
assistive devices’ in systemprefs/universal access for it to work.
probably possible to also do this with the terminal command defaults
write com.apple.sound… or something similar but i haven’t tried that.
example scripts below.

>> shell object? what command?

–save as outputDeviceInternal.scpt in home dir (make different scripts
for each device and just change the first line)

set outputDevice to "Internal speakers"
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
tell application "System Events"
tell process "System Preferences"
tell tab group 1 in window "sound"
click radio button "Output"
repeat with r in every row of table 1 of scroll area 1
if (value of text field 1 of r) is equal to outputDevice then
select r
end if
end repeat
end tell
end tell
end tell
end tell

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 98 189 31 196617 shell;
#P message 98 150 182 196617 osascript ~/outputDeviceInternal.scpt;
#P newex 98 217 32 196617 print;
#P connect 2 1 0 0;
#P connect 1 0 2 0;
#P window clipboard copycount 3;

#|
fredrikolofsson.com klippav.org musicalfieldsforever.com
|#


Viewing 3 posts - 1 through 3 (of 3 total)