On a Raspberry Pi 3 with as of today latest firmware and raspbian, I have e.g.
espeak "hi" or
aplay some.wav working after booting into a small loudspeaker plugged into the jack (this is headless, no X11 desktop; no HDMI monitor connected).
Now as soon as I use GPIO (e.g. https://github.com/pololu/dual-mc33926-motor-driver-rpi/blob/master/example.py to run a Motor), even after that's finished and released anything it has to release (or does it?), then sound won't work anymore (until I reboot); e.g. aplay fails with:
aplay: pcm_write:1939: write error: Input/output error
How are playing sound and GPIO related on the RPi, and what do you have to do you use both together?