Controlling audio output's sample/bit rate on OSX from command prompt
Here is an AppleScript that fixes the default audio format of the default output card before launching Spotify (tested on El Capitan only), but I prefer very much a solution that does not depend on GUI:

set desiredRate to "44100.0 Hz"
set desiredDepth to "2ch-16bit Integer"

tell application "Audio MIDI Setup" to activate
tell application "System Events"
    tell application process "Audio MIDI Setup"
        if not (window "Audio Devices" exists) then
            click menu item "Show Audio Devices" of menu "Window" of menu bar item "Window" of menu bar 1
        end if
        tell group 1 of tab group 1 of group 1 of splitter group 1 of window "Audio Devices"
            click button 1 of combo box 1
            select (text field 1 of list 1 of scroll area 1 of combo box 1 whose value is desiredRate)
            keystroke return
            click pop up button 2
            click menu item desiredDepth of menu 1 of pop up button 2
        end tell
    end tell
end tell
tell application "Audio MIDI Setup" to quit
tell application "Spotify" to activate