Sneha Farkya

Jun 13, 2025 • 3 min read

Mic On, Emotions Out – A Browser That Understands You

Decoding Sentiment.js using example

Mic On, Emotions Out – A Browser That Understands You

It’s okay if humans cannot understand your mood, I’ve got you something crazy! Remember the last time you were upset about something and had to pretend you weren’t? Well, with this little experiment of mine, you don’t really have to pretend! Say hello to Voice Mood Detector, my fun experiment where emotion meets code. 🤖💖

You say something and boom, it will understand your mood.

Hi, I am Sneha and this is a new episode of “Learning while Building”! If you haven’t read my blogs yet, go check them out here. Coming back to the topic, this article is all about “Sentiment” . Just like human sentiments, JavaScript has this very interesting module that lets a computer understand your mood.

Discovering Sentiment

Yesterday, while I was studying, I started wondering, what if I could build something that guesses my mood? After researching about this, I came across Sentiment. Sentiment is a Node. js module that uses the AFINN-165 wordlist and Emoji Sentiment Ranking to perform sentiment analysis on arbitrary blocks of input text.

It has like a list of pre-defined words and when someone speaks a sentence it will check the score in it’s “diary” and sum them up. This way it will tell you if the emotion is negative, positive or neutral.

For example:

  • "Love" = +3

  • "Hate" = -3

  • "Okay" = 0

You don’t need to press a bunch of buttons or type anything. Just talk naturally, and let the app do the magic. 🎩✨

Unveiling the Technologies

  • Vite for a super-fast and smooth setup ⚡

  • TypeScript to keep things neat and error-free 💻

  • Tailwind CSS for that clean, modern vibe 🎨

  • Sentiment.js, a cool JavaScript library that understands positive and negative words 🧠

…I stitched this idea together. It’s like giving the browser a tiny brain that listens and interprets how you feel.

How to use it?

I would really like you to use the initial yet basic version of this website. All you have to do is read the instructions below in order to get your hands on it:

  • You click the mic button and start talking.

  • The app turns your speech into text.

  • That text goes through something like a mini emotion filter (thanks to Sentiment.js).

  • Based on the words you use — like happy, awesome, bad, or angry — the app guesses your mood.

  • It then shows you an emoji and a message matching how you sound.

  • There’s something interesting here, if you sound shocked, your phone will actually vibrate!

Try out the website here: Voice Mood Detector

You can also find the code here

While I know you’re eager to use this but here are a couple of things to keep in mind. It will work well in Android devices and on Chrome. Apple devices and laptop/desktop don’t support the vibration API.

This is just the beginning. In the future, I might blend in emotion from tone, face, or even gesture recognition. For now, this is a small step toward emotionally aware web experiences.

If you want to try it out, just open the site, click the mic, and talk. That’s it. Simple, fun, and a little mind-blowing.

If you're looking to get frontend development or content writing done, I’d love to collaborate with you. Feel free to reach out for gigs, freelance work, or any exciting opportunities at:

🖤 Made with code, chai, and curiosity.

Until next time…

Join Sneha on Peerlist!

Join amazing folks like Sneha and thousands of other people in tech.

Create Profile

Join with Sneha’s personal invite link.

0

2

0