Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Microphone Support Without Termux-API #2871

Closed
zairullahdev opened this issue Jul 7, 2022 · 6 comments
Closed

[Feature]: Microphone Support Without Termux-API #2871

zairullahdev opened this issue Jul 7, 2022 · 6 comments

Comments

@zairullahdev
Copy link

Feature description

I know this ridiculous, but it's will help to make some program (packages) record from termux

Additional information

Maybe

@yingshaoxo
Copy link

Why even after I installed termux-api by using pkg install termux-api

Then I run termux-microphone-record -l 3

It will do nothing?

It did not ask my microphone permission

I tested both android 13 and android 9, no success.

@sylirre
Copy link
Member

sylirre commented Sep 14, 2023

@yingshaoxo termux-api is a command line frontend which doesn't work without https://f-droid.org/packages/com.termux.api/ application.

@sylirre
Copy link
Member

sylirre commented Sep 14, 2023

As for the this ticket itself,

it's will help to make some program (packages) record from termux

the microphone recording is already supported by PulseAudio. Just need to grant microphone permission via Termux:API app and then load module-sles-source PulseAudio module. So basically everything that was possible to be done is done.

I'm closing this issue.

@zavocc
Copy link

zavocc commented Sep 14, 2023

As for the this ticket itself,

it's will help to make some program (packages) record from termux

the microphone recording is already supported by PulseAudio. Just need to grant microphone permission via Termux:API app and then load module-sles-source PulseAudio module. So basically everything that was possible to be done is done.

I'm closing this issue.

@sylirre So PulseAudio recording is already supported as long Termux:API apps and packages installed?

@sylirre
Copy link
Member

sylirre commented Sep 14, 2023

Yes, PulseAudio supports recording, just by default it uses only module-sles-sink which does output. The module module-sles-source processes input (microphone) and it needs to be manually loaded via pactl (after granting microphone permission for api app).

Termux:API is needed only to propagate the microphone permission to Termux application.

However the everything above is applicable only to PulseAudio and pulseaudio-based programs.

ALSA was never supported and won't be as it is kernel-based audio interface, is not necessarily available on Android devices and requires root for use.


If you have problems with getting PulseAudio microphone recording to work, open issue at https://github.com/termux/termux-packages.


Here an example which shows two possible states of source module. The first command was run without microphone permission and another one after granting permission to the Termux:API.

Screenshot_20230914-115039

@yingshaoxo
Copy link

yingshaoxo commented Sep 14, 2023

I solved this problem by doing:

  1. Install LinuxDeploy apk; Install busybox apk, install busybox payloads, reboot your phone

  2. Select Ubuntu, bionic, File, image size 60GB, set username and password, enable ssh, enable vnc gui, select xfce. Hit the install button, hit the configure button, hit the start button.

  3. Install "termux" apk, install "com.termux.api" apk

  4. In termux

    
    pkg update
    
    pkg install pulseaudio
    
    pkg install termux-api
    
    
    
    termux-microphone-record -l 3
    
    
    
    pulseaudio --start --exit-idle-time=-1
    
    pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
    
    pacmd load-module module-sles-source
    
    pactl load-module module-sles-source
    
    ```
    
    
  5. In LinuxDeploy system, add "export PULSE_SERVER=127.0.0.1" to the end of "/etc/profile", do a reboot

  6. Use fakestandby apk to make sure the network is always on:

  7. Now when you use vnc enter your linux system, you should be able to use microphone and speaker without any problems.

https://yingshaoxo.blogspot.com/2023/09/how-to-let-linuxdeploy-desktop-audio.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants