Record Audio with Mic using Termux-API 🔥🎤

Hey Guys, It's me SaadMaqsood 🙋🏻‍♂️. So we all have seen hacker movies where hackers just use some kind of gadget to record audio in certain rooms and after a few hours they collect it and get the information that they want. well, in this post I am going to tell you how you can convert your phone into that spy gadget. Of course, we will use Termux-api to do that. This Is a fairly simple method but it can save you big time and give you abilities that are really powerful if used correctly. Read properly and you will become a hacker spy today🔥.

Basics information about Termux Microphone Record 🎤📲:

Termux-microphone-record is a termux:API command that allows us to record voice using our termux terminal. This command will access your microphone and record voice using a few internal commands, these recordings will be saved inside your internal storage and you can listen to them any time you want. We all know, we have voice recorder apps for that, we can simply use them to record audio but the advantages that termux gives are far better. if you are using termux as your voice recorder, no one will know if you are recording audio or just trying to do something in the settings. you can record secretly and you can even hide termux from your notification panel and then leave your phone anywhere, and no one will ever know that your phone is recording audio.  

Now since we can record voice in one single command we can use other Linux commands to use this in any way we want. we can create a script that will record voice and save it after a set time interval. we can create a shortcut to record audio with just a click of a button. You can even install termux on any phone you want and write a script so that termux will send recordings to you in your email. The use is endless and it all depends upon our imagination and skill to make something really awesome out of it. In this post, I will tell a few ways I use the termux-record feature.

Install Termux-API:

Since you cannot use termux-microphone-record command without termux-api, if you don't have it on your phone, you need to install it. The installation process is simple but can look lengthy so I have written a separate post on it. just follow the below post (It's gonna take less than 1 min).

Make sure to install the Termux-api properly and come back here to follow this post.

Record Audio using Termux-API 🔥💬:

There are different ways we can use the termux sms commands and I am adding different Linux-based commands to enhance the workings of the termux-microphone-record so read the below methods carefully to understand them well.

1) Record Audio using Termux (simple method):

To record audio in termux using termux-api, you have to use termux-microphone-record command and you can see in the below example how you are going to use it. The green part is the number of seconds you wanna record and -l means limit so if you write"-l 20" that means we are setting a 20 second recording limit.
termux-microphone-record -l 10

Just once termux will ask permission to use your microphone, just allow and after that, it will always work fine.

2) Record Audio in a specific folder using Termux :

Now that we know the basics of how you can record the audio for any amount of time you want, you should also know how you can save those files with a specific name in a specific folder. Here in the below command I am saving my recordings in my internal storage in a folder name termux. my file will be saved as saad.mp3. make sure you first make a folder name termux in your internal storage before copy-pasting this command.
 termux-microphone-record -l 3 -f ~/storage/shared/termux/saad.mp3

3) Record Audio in termux for an infinite amount of time:

So you want to record audio till you come and stop it, you can use the below command and it will start recording the audio for an infinite amount of time.
termux-microphone-record -l 0

To stop the recording you just have to type the below command and the recording will be stopped.
termux-microphone-record -q

To check status of the recording you just have to use -i argument. While recording audio for infinite length, if you need to check if your phone is actually recording the audio or not just type the below command (because the termux API records everything silently).
termux-microphone-record -i

4) Record Audio Using a shortcut key :

So since we can send Record audio with a single command like you have seen above, you can write it in a simple alias command so that you can just press a single key and termux will start recording audio silently and we will also set an alias so that we can stop the recording too. below is a simple alias command example where if you will press "r" button on your keyboard and press enter, Termux will start recording through your microphone and it will not stop until you press "q" and enter. copy and paste all of these commands in your termux and restart your termux, and the shortcuts will be added. 

This command is for Start Recording (shortcut r):
echo "alias r='termux-microphone-record -l 0'" >> /data/data/com.termux/files/usr/etc/bash.bashrc 

This command is for Stop Recording (shortcut q):
echo "alias q='termux-microphone-record -q'" >> /data/data/com.termux/files/usr/etc/bash.bashrc 

 This command is for Checking the Recording Status (shortcut i):

echo "alias i='termux-microphone-record -i'" >> /data/data/com.termux/files/usr/etc/bash.bashrc 

Make sure to keep in mind that the shortcut keys are r,q, and i. 


Recording voice using termux is a truly amazing thing that we can do, and this detailed post will guide you toward the journey of creative use of termux commands in general. I have tried to show a few ways you can use termux to record audio silently through your phone but there are so many things that you can do like making your own tool to record audio with termux and manage the recorded files. if you make anything like that, make sure to comment and I will add that tool to my posts. This was just one command of Termux-api and if you like it, make sure to check out my other posts on Termux API. If you want to know more about termux then make sure to check out my other posts too. If you have any comments or suggestions then use the comment section. thanks for reading guys, and as always, Stay Ethical 👾.

Post a Comment