PulseAudio on OpenWRT with MPD and other Stuff: Difference between revisions

mNo edit summary
mNo edit summary
Line 89: Line 89:


===ALSA Related Commands===
===ALSA Related Commands===
alsactl : Good for testing basic sound device settings (Top Tip: By default, for whatever reason, the "state" (AKA stored configuration) Directory (/var/lib/alsa) does not exist, so create it.
alsactl<span> </span>: Good for testing basic sound device settings (Top Tip: By default, for whatever reason, the "state" (AKA stored configuration) Directory (/var/lib/alsa) does not exist, so create it.


aplay -D stereoB BeeGees.wav
aplay -D stereoB BeeGees.wav


aplay -D hw:0,0 -c 6 BeeGees.wav -vv : Will show information and a 'meter', along with playing the song.
aplay -D hw:0,0 -c 6 BeeGees.wav -vv<span> </span>: Will show information and a 'meter', along with playing the song.


speaker-test -D hw:0,0 -c 4 --chmap=FL,FR,FC,LFE -t wav : Tests the speaker output (make sure alsa-utils-tests is installed), --chmap "allows for putting things in a different order".
speaker-test -D hw:0,0 -c 4 --chmap=FL,FR,FC,LFE -t wav<span> </span>: Tests the speaker output (make sure alsa-utils-tests is installed), --chmap "allows for putting things in a different order".


speaker-test -D hw:0,0 -c 8 --chmap=FL,FR,FC,LFE,SL,SR,SL,SR -t wav : For testing 7.1 surround sound, with a catch: Ain't no RL (Rear Left) or RR (Rear Right), there are two SL (Side Left(s)) and two SR (Side Right(s)).  Hey, it is what it is.  Now you know.
/var/lib/alsa/asound.state : Filie in a Directory (gonna have to create the 'alsa' sub-directory manually as it isn't created during ALSA installation) that preserves settings in ALSA Mixer


amixer -c 0 sset 'PCM Capture Source' 'Line' : A handy command to change the input of a USB Audio Device that support more than one input / source.  Keep in mind the two items in the quotes ( 'PCM Capture Source' and 'Line' ) are potentially unique to every USB Audio Device.  How can one get that information?  A couple commands (some noted below with details, but for now, just the commands): amixer scontrols (that's two words / commands typed together) and then: amixer -c 0 get 'PCM Capture Source' ( again, modify the item in ' ' (quotes) to the name obtained in the previous command)
alsactl store
 
speaker-test -D hw:0,0 -c 8 --chmap=FL,FR,FC,LFE,SL,SR,SL,SR -t wav<span> </span>: For testing 7.1 surround sound, with a catch: Ain't no RL (Rear Left) or RR (Rear Right), there are two SL (Side Left(s)) and two SR (Side Right(s)).  Hey, it is what it is.  Now you know.
 
amixer -c 0 sset 'PCM Capture Source' 'Line'<span> </span>: A handy command to change the input of a USB Audio Device that support more than one input / source.  Keep in mind the two items in the quotes ( 'PCM Capture Source' and 'Line' ) are potentially unique to every USB Audio Device.  How can one get that information?  A couple commands (some noted below with details, but for now, just the commands): amixer scontrols (that's two words / commands typed together) and then: amixer -c 0 get 'PCM Capture Source' ( again, modify the item in ' ' (quotes) to the name obtained in the previous command)


alsamixer: shows a text GUI of controls
alsamixer: shows a text GUI of controls
Line 115: Line 119:
amixer scontents<span> </span>: Shows a detailed list of devices
amixer scontents<span> </span>: Shows a detailed list of devices


amixer -c 0 get 'WhatEverNameOfDevice' : 'Gets' the 'capabilities' of an 'item' / device ( WhatEverNameOfDevice can be obtained with the amixer scontents command above)
alsactl info : Shows information about sound device
 
amixer -c 0 controls : Shows detailed information about the controls_count variable from alsactl info
 
amixer -c 0 cget numid=1 : Shows even more detailed information about the 'control' from amixer command above
 
amixer -c 0 get 'WhatEverNameOfDevice'<span> </span>: 'Gets' the 'capabilities' of an 'item' / device ( WhatEverNameOfDevice can be obtained with the amixer scontents command above)


Example below;<syntaxhighlight lang="text">
Example below;<syntaxhighlight lang="text">
Line 202: Line 212:


The error will be: pa_context_connect() failed: Connection refused
The error will be: pa_context_connect() failed: Connection refused
=== Web / HTML GUIs ===
==== amixer-webui ====
opkg install git git-http python3 python3-pip (assumes ALSA is installed already)
pip3 install flask
git clone <nowiki>https://github.com/JiriSko/amixer-webui.git</nowiki>
./alsamixer_webui.py -p 8080 -l W.X.Y.Z (where W.X.Y.Z is the IP Address of the router)
==== amixer-web ====
...won't work as OpenWRT doesn't have the ALSA Mixer "library.so" files or packages
==== viacast - alsamixer ====
Looks great.  Doesn't work (even though it shows the correct USB realtek chip).  On a side note, REACT installs and works on OpenWRT (Hmmm, a good thing???)


===Useful Commands for Testing (from a live file, hence the # Comment Tags)===
===Useful Commands for Testing (from a live file, hence the # Comment Tags)===
==== Multi-Channel Testing (first need a multi-channel file) ====
sox CominUnderFire.mp3 --show-progress -t wav CominUnderFire_6ch.wav remix 1v0.8 2v0.8 1v0.5 2v0.5 1v0.3 2v0.3
Input File     : 'CominUnderFire.mp3'
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:04:14.49 = 11223097 samples = 19086.9 CDDA sectors
File Size      : 10.2M
Bit Rate       : 320k
Sample Encoding: MPEG audio (layer I, II or III)
Comments       :
Title=08 - Comin' Under Fire
Artist=Def Leppard
Album=Pyromania
Tracknumber=8
Genre=Power Metal
In:100%  00:04:14.48 [00:00:00.01] Out:11.2M [      |      ] Hd:2.6 Clip:0   
Done.
<nowiki>###</nowiki> Useful Commands for testing stuff;
<nowiki>###</nowiki> Useful Commands for testing stuff;