The lengths a coder goes to skip classes. (How I wrote code to make it sound like my voice is buffering in class so I can binge watch stuff in peace)

Tathagata Roy
3 min readSep 3, 2021

So it was a normal day. I was either watching Rick and Morty’s Season 5 Episode 8 or I was trying to read a blog. Oh and there was a class going on, and the tab was muted obviously. Suddenly I hear my phone vibrate vigorously.

Generally not a lot of people text me, but I see that I got tonnes of texts telling me that sir was calling my name to answer a question. I quickly unmuted myself and thankfully, it was a very basic question so I could answer. That brought up a conundrum. For most of my life, my “breakthrough inventions” were always something I made to cheat the system. My first big code was in 8th Grade where I made a chat program which utilized the internal servers so that my peers and I could chat while our teacher was teaching useless stuff. For that time, it was a masterpiece in my eyes. The code was 800lines and I could not be any happier. A few years later when I saw the code, I could not be more disgusted. Like though it was indented(I was surprised) it was still very badly structured.

Anyways lemme progress before I get carried away. Later I made viruses and spywares and stuff, but nothing to destructive. You get the gist, nothing motivates me more than breaking the rules.

So I started ruminating the best way to watch my stuff in peace while class was on. I realized that muting the tab worked as long as teachers did not call your name, and in the first year I made the mistake of being very active so everyone knew my name. After some deliberation I got to the conclusion that if I could somehow make it seem that my connection was bad then I could easily get out since, when someone with a bad connection turns their mic on, the teachers just skip them so as not to waste time.

I was ready to exploit this.

But the problem was I had no idea where to start. I asked a senior of mine, and from the things he said, I got a keyword —

pulseaudio

I searched it up, and turns out that it is the software which handles audio input and interacts directly with the hardware in linux. So I researched a bit into it. I found two main manipulators of audio — ffmpeg and sox.

The former was soon put out of consideration because it does not work on real -time input(as far as I understood).

sox seemed very promising as I got it to work on real time input pretty easily by routing audio to a null output, and then changing the input mode of google meet/discord to “Monitor of Null Output” which appears once I enable Null Output as mentioned in the linked article. Now all I had to do was find a way to buffer my voice.

The first basic way that came to mind to do that was cut off parts of my speech, as that is what I understood buffering to be in all its simplicity. So I started a wild goose chase of trying out all viable commands in sox and check which parameter does the trick. It took me three days to find it out — trim.

The only thing that kept me motivated is that what I was doing was wrong :p.

So I checked it out, and got its argument syntax. I wrote a simple bash script to generate random intervals at which to silence my audio.

Done. Now I can binge watch in peace, but the only human interaction required here was that someone has to notify me if someone calls my name, and I have reliable more dedicated friends than me to do that. Thanks guy :-*.

I did not include code here because, medium is a very bad place to share code, instead you can check out my repo at —

The code is extremely short, and I did all the explaining.

Anyway, I hope this helps someone. Thenk for reading.

--

--