you can use GUI scripting for this, e.g. this gets you the current speakers:
tell application "System Preferences"
reveal pane id "com.apple.preference.sound"
tell application "System Events"
tell application process "System Preferences"
tell tab group 1 of window "Sound"
click radio button "Output"
tell table 1 of scroll area 1
set selected_row to (first UI element whose selected is true)
set currentOutput to value of text field 1 of selected_row as text
display dialog currentOutput
if application "System Preferences" is running then
tell application "System Preferences" to quit
GUI script elements might be located differently on different MacOS releases.