Code Monkey home page Code Monkey logo

mosquito-js's Introduction

Mosquito JS

A JavaScript Mosquito. This proved too painful to continue and quickly eroded my sanity levels. Wrapped it up as fast as possible. You an see it here. I shall not return to it. My descent into madness is logged below, as well as in the code comments.

How it went down

The 0th minute:
Created the repo and a readme plotting out my ideas. They included creating the noise a mosquito makes as it flies around with the web audio API, and then elaborate plans to tie it in with user interaction, and have an API for multiple mosquitos or mosquito breeds.

The 20th minute:
Success! After getting an oscillator connected up I had created life. I played around with oscillator types and found the sawtooth best represented a mosquito to me. Some research told me that mosquito noises were in the 17.4 kHz range, but that didn't really match what I was hearing.

The 30th minute:
Signs of insanity starting to click in. I needed to code an off button, and it's unclear why I didn't start with one. For some reason you can call oscillator.start() then oscillator.stop() but they will not then allow you to call oscillator.start() again. I can't really understand why, but I've taken to disconnect and reconnect the oscillator to stop and start it. Now whenever I stop the mosquito noise, I have a deep feeling in the pit of my stomach that it continues somewhere in the distance, unheard. I must persevere.

The 35th minute:
I've added a clap noise when I disconnect the oscillator to give me comfort that the mosquito has been squished. It helps.

The 45th minute:
The mosquito is becoming real. I've created a function that detunes the frequency slightly at 60 times a second in a smooth sine wave. Now it buzzes closer and further away from my ears. I have twice closed all my tabs to make sure I've stopped the noise. I'm now acutely aware of every fan in the house.

The 55th minute:
Is it possible to awaken a sleeping case of tinnitus? I think I have.

The 60th minute:
I've added another variable to randomly modulate and detune the volume and frequencies along with the sine wave. I don't think there are any rhyme and reason to this devilish sound. Every now and when I stop it, I fear that something has landed on me, and check my exposed legs.

The 75th minute:
As I start to extract the mosquito code into a function, so I can create multiple of them, I decide I've had enough and shouldn't do this anymore. It's completely pointless. I keep blocking my ears to see if the noise is inside my head or not. I cross out any other plans. And will end this project in the morning.

The middle minutes:
It's insane, but this is the FitBit recording of my sleep this night. The heartbeat goes DOWN when I wake up. No lies.

The morning after:
I dreamed of mosquitos. I can't bear to run the mosquito for more than 1 second intervals, just to ensure that it's running. I've built a quick and simple page for it and have annotated the javascript lest some braver soul wishes to pick up this burden. I have called it quits.

When times are bad, I can look at this graph and at least know that we have come a long way since the 1900's.

graph of mosquito word usage over time

Licenses

Clap MP3 - Licenced /w (CC BY 4.0) (via https://www.freesoundslibrary.com/)
Code - Licensed /w (MIT)

mosquito-js's People

Contributors

tholman avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.