Playing audio in termux

I have tried all kinds of apt install software, using Python library to write code to run (all kinds of libraries are not available), using java to write code to run (using Android’s own API), all failed. The reasons all point to one point: there is no default audio.

Analysis: because the execution environment is termux, there is no default setting in termux. Android is the real system of the outer system of termux. As long as the sound card, driver, default device and so on are set in termux, they can also be executed after setting.

Here’s a simpler way:

Premise: tinyalsa, root identity, a 44.1KHz audio, turn on the volume

Play command:

./tinyalsa play ~/test.wav

View command:

/tinyalsa tinymix

./tinyalsa tinypcminfo -D /proc/asound/cards

cat /proc/asound/cards

Set the output device to speaker:

/tinyalsa tinymix 0 SPK

Write the play command into a script, give him permission, you can play and use it freely!

After a variety of searches, a better solution was found:

Better and simpler solutions

Read More: