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

mNo edit summary
Line 1: Line 1:
READ THIS FIRST: [[ALSA Basics|ALSA Basics - Wiki.TerraBase.info]]
First of all, good to be back.  Issues with MediaWiki, along with time constraints on fixing it, have prevented new articles from being created.
First of all, good to be back.  Issues with MediaWiki, along with time constraints on fixing it, have prevented new articles from being created.


Line 89: Line 91:


===ALSA Related Commands===
===ALSA Related Commands===
==== Starting and Stopping ALSA ====
Good luck!  Ain't no ALSA service.  Oh, wait, try the following (it's the only solution besides restarting that seems to work, because modpropbe seems to be 'neutered' on OpenWRT with no additional 'modprobe package' available);
* "Stop ALSA Service": echo '1-1' > /sys/bus/usb/drivers/usb/unbind
* "Start ALSA Service": echo '1-1' > /sys/bus/usb/drivers/usb/bind
* ...followed by: alsactl restore
* ...and just as a note, stopping and starting pulseaudio has the net effect of re-reading the /etc/asound.conf file.
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.
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.


Line 97: Line 108:
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 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".


/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
/var/lib/alsa/asound.state<span> </span>: 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


alsactl store
alsactl store
Line 119: Line 130:
amixer scontents<span> </span>: Shows a detailed list of devices
amixer scontents<span> </span>: Shows a detailed list of devices


alsactl info : Shows information about sound device
alsactl info<span> </span>: Shows information about sound device


amixer -c 0 controls : Shows detailed information about the controls_count variable from alsactl info
amixer -c 0 controls<span> </span>: 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 cget numid=1<span> </span>: 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)
amixer -c 0 get 'WhatEverNameOfDevice'<span> </span>: 'Gets' the 'capabilities' of an 'item' / device ( WhatEverNameOfDevice can be obtained with the amixer scontents command above)
Line 213: Line 224:
The error will be: pa_context_connect() failed: Connection refused
The error will be: pa_context_connect() failed: Connection refused


=== Web / HTML GUIs ===
===Web / HTML GUIs===


==== amixer-webui ====
====amixer-webui====
opkg install git git-http python3 python3-pip (assumes ALSA is installed already)
opkg install git git-http python3 python3-pip (assumes ALSA is installed already)


Line 224: Line 235:
./alsamixer_webui.py -p 8080 -l W.X.Y.Z (where W.X.Y.Z is the IP Address of the router)
./alsamixer_webui.py -p 8080 -l W.X.Y.Z (where W.X.Y.Z is the IP Address of the router)


==== amixer-web ====
====amixer-web====
...won't work as OpenWRT doesn't have the ALSA Mixer "library.so" files or packages
...won't work as OpenWRT doesn't have the ALSA Mixer "library.so" files or packages


==== viacast - alsamixer ====
====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???)
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) ====
====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
sox CominUnderFire.mp3 --show-progress -t wav CominUnderFire_6ch.wav remix 1v0.8 2v0.8 1v0.5 2v0.5 1v0.3 2v0.3


Line 239: Line 250:
Channels       : 2
Channels       : 2


Sample Rate    : 44100
Sample Rate   <span> </span>: 44100


Precision      : 16-bit
Precision     <span> </span>: 16-bit


Duration       : 00:04:14.49 = 11223097 samples = 19086.9 CDDA sectors
Duration       : 00:04:14.49 = 11223097 samples = 19086.9 CDDA sectors


File Size      : 10.2M
File Size     <span> </span>: 10.2M


Bit Rate       : 320k
Bit Rate       : 320k
Line 444: Line 455:


<nowiki>###</nowiki> Configuration Services and Scripts (by me): /etc/init.d/bt-reconnect, /etc/bluetooth.sh, /etc/pulse/pulseaudio.sh
<nowiki>###</nowiki> Configuration Services and Scripts (by me): /etc/init.d/bt-reconnect, /etc/bluetooth.sh, /etc/pulse/pulseaudio.sh
<br />
=== Rough Notes; ===
The below two items are functionally equivalent;
----pcm.LINE {
    type plug
    slave.pcm {
        type route
        slave.pcm "hw:0,0"
        slave.channels 2
        ttable.0.0 1
        ttable.1.1 1
    }
}
----
pcm.line {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
        channels 2
    }
}
<nowiki>#</nowiki> Line Test
pcm.LINE {
    type plug
    slave.pcm {
        type route
        slave.pcm "line"
        slave.channels 2
        ttable.0.0 1
        ttable.1.1 1
    }
}
----<br />