Follow Marin Events


SOX in TERMUX on ANDROID The Manual                The ubuntu manual    

SOX plays and records audio in a Terminal Emulator ( like TERMUX which you can download as an AP from the PLAY STORE)

ecasound    Ecasound Manual  Ecasound Examples

 

   

The scripting module is a plug-in that allows Audacity to be driven from an external Python or Perl script. Commands are sent to Audacity over a 'named pipe'.

TEXT TO SPEACH: Dont forget the hyphen for the SOX "play" command that you are piping the espeak output as input to "play"
espeak -w /proc/self/fd/1  "Speaking this throo andoid speakers" | play - 

- SoX can be used in simple pipeline operations by using the special filename `-'
which, if used as an input filename, will cause SoX will read audio data from
`standard input' (stdin), and which, if used as the output filename, will cause SoX
will send audio data to `standard output' (stdout). Note that when using this
option for the output file, and sometimes when using it for an input file, the
file-type (see -t below) must also be given.

APP INVENTOR EXTENSION -- How to execute statements in the Jackpal Terminal Emulator       Launching Terminal Emulator for Android from another App

but you need to do this before pulseaudio --start  cos for some reason it gets stopped but its just an intermittent problem not necessarily fixed by pulseaudio --start

play /sdcard/temp001/myvoice.aiff rarely plays thru the speaker so Try pulseaudio --start --exit-idle-time=-1   source  fixes intermittent use of speaker

note that it won't use the speaker if a mic is plugged in !!! its probably expecting a headset( with a mic included and has switched output to the mic/headset from the speaker) -- not just a mic AND THIS IS WHY:-

The “Micro-USB” headphone used by LG GS155 is not really an USB device — it just uses the USB connector for the same analog audio signals as in usual 3.5 or 2.5 mm round connectors. Look at the MicroUSB to 3.5 or 2.5 jack headset pinout.

In order to work with such headsets, the phone needs to have the appropriate hardware to detect the type of connected device and switch functions of USB port pins from USB to analog audio. It is highly unlikely that the phone will have such hardware if it also has a standard 3.5 or 2.5 mm audio connector. Even older HTC phones using the proprietary “ExtUSB” connector compatible with Mini-USB did not switch pin functions when a headset is connected — they used separate pins for audio.

The only way to connect this headphone to your new phone is to build an adapter with a 3.5 mm plug and a Micro-USB Type B receptacle connector, so that the headphone will be connected to the audio circuit through the 3.5 mm audio connector on the phone. source

  TRS TRRS
So  I need  ENVEL 3.5mm Jack Cable Headset Adapter Kit Mutual Convertors for Laptop,Mac,PS4,Smartphone,Xbox One,Tablet Earphone with Headphone/Microphone Simultaneously Y Splitter Audio 2 Female  to 1 Male ( 3.5 TRS plugs into the females and the male out is 3.5 TRRS giving both audio in thru a mic and audio out thru the females ) for ANDROID jack.
That way I can plug in my old mic with 3.5 TRS and my old PC Speakers with 3.5 TRS. So now when I play from SOX it outputs to my PC Speakers

records half an hour of stereo audio, rec −c 2 radio.aiff trim 0 30:00  -- mono rec −c 1 radio.aiff trim 0 30:00

  Active Noise Canceling, Anti-phase Destructive Interference or  Wave Inversion

vol gain [type [limitergain]]  a negative gain inverts the audio signal in addition to adjusting its volume.
play vol -1 /sdcard/temp001/myvoice.aiff   /sdcard/temp001/inverted.aiff   
unchanged gain but inverted volume

When in AUDACITY you create 2 tracks and put myvoice.aiff  in one track and inverted.aiff in the other you hear absolute silence !!! Delay one of the tracks a fraction and the silence is gone so ....... gotta be accurately delayed in sync with distance between mic and speakers
( Speed of sound 340 meters / sec so if distance is 20 feet it takes 17 MILLISECONDS to travel thru air 20 feet from mic to speakers so delay needs  to be 17ms)

delay {position(=)}
Delay one or more audio channels such that they start at the given position. For example, delay 1.5 +1 3000s delays the first channel by 1.5 seconds, the second channel by 2.5 seconds (one second more than the previous channel), the third channel by 3000 samples, and leaves any other channels that may be present un-delayed

 rec −c 2 -r 44100 | play vol -1 delay 0.017 - Pipe ( | ) the recording into the play -- play thinks the recording is an input file.

ecasound -f:16,3,44100  -ea:-100  -i test.wav     INVERT

MORE

oops Out Of Phase Stereo effect. Mixes stereo to twin-mono where each mono channel contains the difference between the left and right stereo channels. This is sometimes known as the ‘karaoke’ effect as it often has the effect of removing most or all of the vocals from a recording. It is equivalent to remix 1,2i 1,2i.

Install SOX pkg install sox

TERMUX

The Termux:Tasker add-on provides an easy way to call Termux executables from Tasker and compatible apps. https://play.google.com/store/apps/details?id=com.termux.tasker&hl=en_US

Similar Apps on the Play Store

The Termux:Widget add-on provides a widget with shortcuts to run scripts placed in the $HOME/.shortcuts/ folder, allowing quick access to frequently used commands without typing.

Termux-microphone-record Record using microphone on your device.
Usage termux-microphone-record [args]
Options

-d Start recording w/ defaults
-f <file> Start recording to specific file
-l <limit> Start recording w/ specified limit (in seconds, unlimited for 0)
-e <encoder> Start recording w/ specified encoder (aac, amr_wb, amr_nb)
-b <bitrate> Start recording w/ specified bitrate (in kbps)
-r <rate> Start recording w/ specified sampling rate (in Hz)
-c <count> Start recording w/ specified channel count (1, 2, ...)
-i Get info about current recording
-q Quits recording
Termux:API - Termux addon that exposes device functionality as API to command line programs.

cd $HOME

CANNOT RECORD WITH rec −c 1  -r 44100 rec.aiff trim 0 30:06  it creates the file but it has nothing in it. Same: rec −d /sdcard/temp001/rec.wav trim 0 00:05

this doesnt work:-

First, kill pulseaudio if you have it running.
pulseaudio -k
Then, restart pulseaudio and load the “module-sles-source” module.
The -D flag will daemonise/background pulseaudio.
pulseaudio -L "module-sles-source" -D
That’s it, now you can record sound using sox.

 is it possible to communicate with pulseaudio for Termux also by using linux sockets

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/FirstSteps/

pulseaudio -nF pulseaudio.pa doesn't work --error in startup command  --- no command parec found (How do I record stuff?)

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Daemon/ pulseaudio  -D

pacmd list-modules

PulseAudio Wikipedia

tsu A su wrapper for Termux. Termux relies on LD_LIBRARY_PATH enviroment variables to find it's libraries. For security reasons some environent variables seem to be reset by su, unless an --preserve-environent flag is passed. tsu handles this for you and also launches your preferred shell.  pkg install tsu Then when u run it   get PERMISSION DENIED !
/data/data/com.termux/files/usr/bin/tsu: 144: exec: : Permission denied  -- so in /data/data I ran chmod +rwx com.termux
cd /data/data/com.termux gives -- cannot open directory Permission denied
In /data/data/com.termux/files/usr/bin chmod g+rwx tsu , chmod o+rwx tsu made no difference
whoami gives u0_a146  and ls -al in /data/data/com.termux/files/usr/bin shows
[[-rwx------ 1 u0_a146 u0_a146 3962 Dec 1 2019 tsu ]]

sudo apt-get install sox   --- but neither sudo nor su is available on termux

LINUX on ANDROID

ROOT Android    banking apps will often stop working due to the perceived security risk.

How to Install Linux on Android -- WITHOUT ROOTING
To run Ubuntu on an Android device with UserLAnd:
Download and install UserLAnd from the Google Play Store.

sudo apt-get install sox ran successfully but sox wasn't found  -- same for ecasound

===================================

Willing to pay $'s for audio editor that

1.  takes input from microphone

2. Applies effect INVERT ( as is done in Audacity)

3. Outputs to speaker

4. Adds a variable delay to the output

   
Questions or problems regarding this web site should be directed to Info@marincounty.info  
Last modified: Thursday February 22, 2024.