Inspiration
When we are frustrated and saying angry/curse words while doing our work, it is good to have something to calm down our anger. In real life, if we cannot control our anger, we cannot maintain peace with one another. The best way is to practice to control our anger at home. I followed Mayo Clinic steps how a person can control their anger. To control their anger, a person needs to calm down first and express their anger. Secondly, the person needs to do physical exercises to reduce stress and distract their minds, not thinking what made them angry. Thirdly, practice relaxation skills such as listening to music, write a journal or do yoga poses.
What it does
When a person says angry/curse words such as, "shut up", "a******", "I'm mad", "I hate you", there will be alert pop up and telling the person to take calm down by taking a deep breath. It will then ask the person to write down what makes them upset to express their anger. The alert will ask if the journaling help to calm them down. If no, the extension will direct the person to a yoga exercise to calm their mind. Next, if the person is still angry, the extension will direct them to listen to relaxing musics to distract their minds. If The extension will keep prompting the user to listen to more music until the user is no longer angry. If the person is no longer angry, the alert will give motivation and congratulate them
How we built it
I use HTML/JavaScript to build Chrome extension. I also use SpeechRecognition to receive the audio from the user and use JavaScript to check if the user's speech contain any angry/curse words.
Challenges we ran into
- This is my first time using Speech Recognition API (SRA). When SRA returns the result of speech recognition array, I didn't know how to extract specific phrase that is spoken by the person.
- Originally I wanted to play audio as a background music while the user do the journaling, but couldn't. Therefore, I used window.open() to direct user to to YouTube to listen to music and do yoga
- At the last minute, my Google Chrome had a console problem saying the window.prompt() is suppressed because the current tab is not active (since I direct the user to YouTube website so it is the YouTube website that is active). So I fixed the problem by adding window.focus() before the window.open().
Accomplishments that we're proud of
I was able to implement SpeechRecognition API and fix the problem that allows the alert to pop up even when directing the user to another Website (fix the Window.prompt() suppression problem which this problem took place at the last minute and I was so stressed out. That's why you can see I'm actually stressed out when recording the demo video)
What we learned
- Learnt how to implement Speech Recognition API. The user speaks as a phrase but the results contain an array of words. I learnt how to map and join the words to form a phrase and check if the phrase contain any angry/curse words.
- Learnt that you can't play any audio while the Speech Recognition API is on
- Learnt how to set up and build Chrome Extension (create a manifest.json file to setup extension and create html/javascript file as extension popup)
- Learnt JavaScript functions such as includes(), random
- Learnt to implement content_secrutiy_policy to allow unsafe-inline
- Learnt how to help someone control their anger
What's next for RefrainFromAnger
- Add more bad/curse words -Add more yoga/music videos

Log in or sign up for Devpost to join the conversation.