TL;DR: pcm.sh is a ~100 lines script that sets hardware parameters,
prepares the device, and forwards data to it, while being
POSIX-compliant, readable, and easily customizable.
The repository can be found at: <https://github.com/psqli/pcmsh.git>
Feel free to suggest changes.
Best regards!
pasquali