System architect at AraxaTech
It can be done using sysctl hw.snd.default_unit. Before that it is good idea to check contents of /dev/sndstat file.