Follow

Follow

Introducing ToneFinder: A Game Designer's Attempt to help people with disabilities ๐ŸŽง

Mr. Bud's photo
Mr. Bud
ยทApr 12, 2022ยท

8 min read

Introducing ToneFinder: A Game Designer's Attempt to help people with disabilities ๐ŸŽง
Play this article

Table of contents

๐Ÿ‘‹ Hello, World! Recently, DEV and Deepgram introduced a new type of hackathon, Deepgram x DEV Hackathon. Of course, I was excited but never thought about participating in the "Build" challenge except for the "Innovative Ideas" challenge. But sooner, I realized that building an application myself will be more awarding and I will learn a lot, I mean a lot of things! And the best thing, I have never participated in a hackathon so this is my first one too.

Before starting, let me get something straight. I'm a GAME DEVELOPER, not a Software developer or a Python developer. And this is my almost first finished Python GUI application, which is a result of huge hard work. You get what I want to say; This might not be perfect, but it does the job! โœŒ

And one more record: For the first time, I wrote 800+ lines of code in Python! ๐Ÿฅด

View Repository

ToneFinder is Licensed Under MIT. ๐Ÿ›ก

Download Executable Application on Sync.com

What is ToneFinder?

Image description

ToneFinder is a software application that can be used to find the tone/emotion of any audio file. That's the best simple definition I can use for that.

I know, you may be wondering what the hell is the use of it. But you might not get it in a sec. What if I told, you some people are employed but have hearing disabilities?

Let's imagine an entrepreneur who wants to collect feedback from people through phone calls. He has a disability of hearing but he also needs feedback from customers. What are the most useful applications he would have? A Speech-to-text application and an application that helps him to find the emotion or the tone of an audio file. A huge number of speech-to-text applications, a very few Tone Finders (I don't know whether there are, either). So yes, that's my purpose for creating ToneFinder.

Even if you don't have such kind of scenario, don't hesitate to play with it! (it has a built-in Audio Recorder as well as some Games ๐ŸŽฎ)

Licensed under MIT ๐Ÿ›ก

The Plan

I'm kind of Old-School. Before doing any project, even a Game, I like to plan and draw it in an A4 with a pencil or something. It gives me the idea straight into my mind. A Digital preview of my idea was like below ๐Ÿ‘‡ [Zoom It to view carefully]

Untitled design (3).png

As you see, it's not the same one I built. But anyway, I have developed all the features I got on my mind!

Tech stack

ToneFinder's Tech stack is pretty simple.

  • Deepgram for Transcribing
  • Python 3.10 as the main language
  • Tkinter for Frontend
  • Text to Emotion API form Komprehend.io to find the tone of the text
  • Figma for design
  • StackOverflow for debugging! ๐Ÿคฃ

Process

Image description

As you see in the Tech stack, the process of ToneFinder is also simple. If we take a rough sketch of the process:

  • Step 1: Get the Input
  • Step 2: Convert Audio to Text using Deepgram
  • Step 3: Find the Tone of the converted Text
  • Step 4: Display the Output

Preview

You can view the preview video below (Use your Headphones ๐ŸŽง)

How-to Guide

Possible Bugs ๐Ÿ›

Weird Fonts: If you're seeing something wrong with words, the fonts used in ToneFinder may not be installed in your PC. To fix that, download Barlow Condensed font family and add it to FONTS Folder

Take Time to show Output: The speed of the process may vary on your Internet connection and the size of the file. If it takes an unusual amount of time, try restarting.

Note: Tested on Windows Only

What will be there in the future?

You may have already seen, there's a lot to be in the future!

Live Audio Tone + Speech to text transcription

This is an essential feature, especially for my target group. My idea is to create a simple Live Audio Tone and Text displayer, which is always updating. Thereafter, ToneFinder will be an all-in-one software!

One barrier to that, I'm still finding a solution inside Deepgram docs!

ASL language converter

Though most people who have difficulty hearing can read, some can't. Therefore, Text to ASL language converter is the best gift for them.

I hope to research the process they use in WeCapable English to Sign Language (ASL) Translator and use it here.

Improved GUI and Performance

You see, I had no more than 14 days to develop it so ToneFinder kinda looks like a mess. For sure, I have to develop this into a better mess by improving the GUI as well as the performance.

Videos + Games

Image description

If you tried ToneFinder once, you may have noticed it consists of 3 simple python GUI games, which lets you play them when the file is being processed.

I have a lot of experience in being bored when a file is being processed or something, so I just made sure users who use ToneFinder won't get bored.

There're 3 games in there: Snake Game, Dots-and-Boxes, and the famous Tic-Tac-Toe!

I especially thank Aqeel Anwar, Senior ML Engineer @NVIDIA for creating those amazing games and sharing them with us in this article.

Playing games is cool when waiting for a file to finish the process but random funny videos are gonna be super cool. So sooner, you may see random ShotOniPhone videos in the app too!

Unforgettable Bugs and Problems

This part is for programmers!

Among the hundreds of bugs and problems I faced, there are some unforgettable ones that took me days to debug as a Game designer with no prior experience in app development in Python.

Running a script by Tkinter button command

Even though my GUI and the Main script were one script together, I had to write different scripts for the Audio recorder and the games.

At first, running a script by a command seemed easier for me and I tried this one:

import Recorder

button_3 = Button(
    image=button_image_3,
    borderwidth=0,
    highlightthickness=0,
    command=exec(Record),
    relief="flat"
)

Yay, let's run the script.

Since I import the module first, the script runs without a command even. But I had another solution! Put the whole script inside of if __name__ == "__main__"

Again, it doesn't run the script or even function inside of it! After hours of searching, I found a beautiful module, runpy. So the solution was pretty simple:

def runRecorder():
    runpy.run_path("Record.py")


button_3 = Button(
    image=button_image_3,
    borderwidth=0,
    highlightthickness=0,
    command=runRecorder,
    relief="flat"
)

It worked!

Calling Async function from a Button

In here too, I thought it won't be that hard but again, I'm wrong.

Transcribing from Deppgram SDK was done by an Async function. So I need it to run when the Process button is clicked.

So I just used this code:

  button_10 = Button(
        image=button_image_1,
        borderwidth=0,
        highlightthickness=0,
        command=asyncio.run(transcribe()),
        relief="flat"
    )

It also runs without the command. I just removed the brackets in transcribe and it returned an error.

Error: a coroutine was expected, got <function transcribe at 0x0000014F4F823D90>

Hmm.. now what? I tried almost everything, event loops, threads, and blah blah blah. Nothing worked. But... why the hell did I forget about a function that calls it!!

def runTranscribe():
    asyncio.run(transcribe())

button_10 = Button(
        image=button_image_1,
        borderwidth=0,
        highlightthickness=0,
        command=runTranscribe,
        relief="flat"
    )

Phew!

Can't Import Script

The solution I found for this is not really applicable but is OK.

Simple, importing script is done in this way (when it is the same directory)

import script

print(script.x)

But it didn't work. So I tried everything below

import Main  # it just runs the Main.py files, doesn't import variables
import Main.py  # same as above
from .Main import *  # error occurred: attempted relative import with no known parent package
from . import Main  # same as above

I used different modules and tried to import it manually but nothing worked. I was about to give up this thing (It was the very beginning, otherwise I'd never thought about giving up)

Even though I thought about writing both GUI and Main Script together in one file, I thought that would be a spaghetti code. But I, lucky bud was able to do it right and it was totally OK than I thought!

As I said before, even I didn't accept this as an acceptable solution. But in that instance, I had no choice either.

Summing Up

Damn it, this one is longer than expected! Lemme finish this article.

Things I learned

As my almost first finished application (I hope it's OK to use that word even though there's a lot to come) I learned a lot of things.

  • Developing Software is not that easy. It required a very similar effort to making games, but a short time period.

  • Designing a GUI may make you mad, it's not easy as creating the frontend part of a website.

  • Documenting and Commenting are important for people who forget immediately, like me.
  • You should respect software because it's a result of a lot of hard work.

ToneFinder - Brief Summary

ToneFinder is for everyone but is specially made for the purpose of helping people with disabilities of hearing. It helps you to find the Emotion/Tone of audio files, even MP4s (To be thanks to Deepgram, a powerful Speech-to-Text API).

That's all, thanks for reading so far! ๐Ÿ˜‰

Oh, before you go, make sure to give me some inspiration by commenting on your thoughts on ToneFinder.

Image description

ย 
Share this