factors out audio setup into separate function