#463 and #334 show that perhaps libao has some issues.
Given it seems to be almost abandoned now perhaps it might be good to replace it with miniaudio. This actually drops a build dep requirement as miniuadio is a single header library and has wav encoding built in.