User-agent: Mediapartners-Google Disallow: User-agent: * Disallow: /search Allow: / Sitemap: http://nano7mobile.blogspot.com/sitemap.xml Nano Mobile: ALSA from chroot -- Audio for the other side topic

ALSA from chroot -- Audio for the other side topic






First, a short story :)



After installing a chroot debian on my s2 I noticed that vlc player isn't working.
Sadly it took me several weeks to notice that sound in general wasn't working at all.
Problem: There was simply nowhere to output the sound.
So I tried to get alsa working from chroot to get some form of audio output.
and here it is.



ALSA ON CHROOT LINUX
The bumpy road to half broken (and therefore other half working) linux audio



Once you have a working chroot (with correct mounts that is), download and install the following packages:

Code:


alsa-base  alsa-oss  alsa-utils

Now run

Code:


alsamixer

to open the alsa sound mixer.
There you should unmute

Code:


DL1 MM_EXT    DL1 Mixer Multimedia    DL1 PDM

Then set

Code:


HS Left

and

Code:


HS Right

to

Code:


HS DAC

This should enable headset output
ALso unmute

Code:


Earphone

to well....use the Earphone speaker.

To enable the Main speaker, unmute

Code:


DL2 Mixer Multimedia    DL2 Mono

And set

Code:


HF Right

and

Code:


HF Left

to

Code:


HF DAC

For other devices, this section will be different. Just look through alsamixer and try to make sense of the countless options there.
Finished more or less.
Now you can play audio from chroot.:victory:

Notice: If you run any sound from android or plug the headset in/out, you need to reapply these settings.
To avoid that I run a script that continously re-enables the mentioned settings. (mainly the headset)
It looks something like this

Code:


#!/bin/bash
while true: do

amixer -c 0 csent numid=74 1
amixer -c 0 csent numid=73 1
amixer -c 0 csent numid=35 1
amixer -c 0 csent numid=52 1
amixer -c 0 csent numid=33 1
sleep 0.5
done


This probably isn't the best way of doing it (it might actually be the worst), but it works.
It might put load on the cpu or it might not, but for me, running this decreases my SoD frequency. (idek why)
Also the best way to run the script is a few seconds after the system started using the "nohup" command. That way you can run it and close the terminal and it will still be active. To kill it, search its pid using

Code:


ps -x

and kill it with

Code:


kill (insert pid here)

If you want you can also run it as a start up script.
Though if you do that, you might see that it runs but doesn't do anything.
Don't panic. Or do if you want to.
But just restart the script anyways.



OPTIONAL: (because I force you to use the stuff above:))




We can play no more than ONE audio source at a time:(
Soloution: PulseAudio
Or so I thought... I can't seem to get it working. If someone can, please tell me how to.

So instead we have

Solution 2: Dmixer
Dmixer is what it name sounds like. It downmixes multiple sources into a single audio stream.
And it works (sometimes).
So here is how to.
Simply copy the content of the file below into a new file called .asoundrc in /home/username


Code:


pcm.!default {
        type plug
        salve.pcm "dmixer"
}

pcm.dmixer {
        type dmix
        ipc_key 1024
        slave {
                pcm "hw:0,0"
        }
        bindings {
                0 0
                1 1
        }
}

ctl.dmixer {
        type hw
        card 0
}


This one is mainly pulled directly from the alsa project site and should work most of the time.
hw:0,0 might need changing on different devices. Same with card 0.
run

Code:


aplay -l

and use that to find the correct card and device.




???




The standard: I am not responsible for anything that happens to you, your phone or anything else.
Also I didn't invent any of this stuff myself. All credit goes to the original developers.
I just wrote this guide (if you can call it that)
Oh...and if you can't understand my english, well.... I'm sorry but i can't do better.







Aucun commentaire:

Enregistrer un commentaire