ALSA Basics
Stuff is a lot harder than it needs to be. Hopefully this article will do something to make things with ALSA less difficult.
The internet is filled with all these "do this, do that, just type this", and it will work. It's hit and miss. Most people are well intentioned, but... Anyway, this is an attempt to get someone going quick with sound on Linux, specifically OpenWRT. Yup, the router OS. It does sound too! But its capabilities are somewhat neutered compared to other versions of Linux (Rocky Linux, Ubuntu, etc.)
Hardware
...coming soon
Drivers (Windows term there), AKA Firmware (Linux term there), and other Software (AKA Packages) to Install
opkg update
opkg install alsa, ...the rest coming soon
Basic Testing
There's no need to have anything defined in /etc/asound.conf right now, for basic testing. Later, with more complex setups, configuration will need to be done here. But for now it can be an empty file.
Ready? Nope, not yet. You need a 2 Channel .WAV File for this as the aplay Utility doesn't 'speak' MP3. And make sure to be in the same directory as the .WAV file intended to be played.
- aplay -D plug:dmix BeeGees.wav -vv ( -D = Device / AKA Plugin to use, where in this case a plugin is referred to as dmix)
- aplay -D hw:0,0 BeeGees.wav -vv ( -D = Device / AKA Plugin to use, where in this case the 'Hardware' PlugIn is being used and refers to a hardware device)
How do you know which hardware device to refer to?: aplay -l (which outputs the following information, or something similar if there is only one sound / audio device);
**** List of PLAYBACK Hardware Devices ****
card 0: ICUSBAUDIO7D [ICUSBAUDIO7D], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
...and no, even though it is makes it seem like the hw (Hardware Device) would be hw:1,1 the 1,1 only refers to the fact that below is 1 of 1 "Subdevices", whose number is 0 (zero). So hw:0,0 is translated as hw:Card:Subdevice (which can be obtained, after reading carefully, the aplay -l command output).
Two Cool Commands to Try
Here's something fun to try. Two command prompts / SSH sessions are necessary because both commands need to be running at the same time.
Run this command in two 'sessions' (you don't have to press Enter simultaneously): aplay -D hw:0,0 BeeGees.wav -vv
aplay: main:834: audio open error: Resource busy
How'd that go? Not good, huh? Well, it wasn't supposed too (sorry, but it's a nice error message you'll be getting in the future for other stuff, so it's here to get you used to frustration : ) ).
Now try this