I started out by imaging retropie-buster-4.7.1-rpi2_3.img.gz onto an SD card for a Raspberry Pi 3 B. Then I updated the software using the menus in EmulationStation. Then I installed the desktop environment, again with the ES menus. What resulted was audio no longer working in EmulationStation and the console emulators. I did a whole bunch of things to troubleshoot, so I'm not sure what actually made it work.
/boot/config:
hdmi_drive=2
hdmi_force_hotplug=1
hdmi_force_edid_audio=1
Install:
sudo apt install pavucontrol pulseaudio-utils
sudo apt-get install lxplug-volumepulse
In the desktop environment, add Volume Control panel to the menu bar.
In EmulationStation, Audio Card: hw, Audio Device: HDMI.
Troubleshooting
Play audio with Alsa:
sudo aplay /usr/share/sounds/alsa/Front_Center.wav
Speaker test:
speaker-test -D sysdefault -t wav