{"id":21264727,"url":"https://github.com/navierula/mood-class","last_synced_at":"2025-10-14T11:44:03.091Z","repository":{"id":89053899,"uuid":"125283826","full_name":"navierula/mood-class","owner":"navierula","description":"software that analyzes speech utterances","archived":false,"fork":false,"pushed_at":"2019-01-01T20:09:39.000Z","size":16013,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-11T07:59:48.845Z","etag":null,"topics":["emotion-analysis","emotional-intelligence","machine-learning","pyaudioanalysis","spoken-language-processing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/navierula.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-14T22:52:32.000Z","updated_at":"2024-02-19T09:47:44.000Z","dependencies_parsed_at":"2023-06-13T17:53:32.415Z","dependency_job_id":null,"html_url":"https://github.com/navierula/mood-class","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/navierula/mood-class","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navierula%2Fmood-class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navierula%2Fmood-class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navierula%2Fmood-class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navierula%2Fmood-class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/navierula","download_url":"https://codeload.github.com/navierula/mood-class/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navierula%2Fmood-class/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019074,"owners_count":26086518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emotion-analysis","emotional-intelligence","machine-learning","pyaudioanalysis","spoken-language-processing"],"created_at":"2024-11-21T05:02:31.631Z","updated_at":"2025-10-14T11:44:03.086Z","avatar_url":"https://github.com/navierula.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mood-class\n\n\u003ci\u003emood-class\u003c/i\u003e is a classification tool that accepts inputs in the form of audio files and returns outputs in the form of text labels, corresponding to one in five emotion classes:\n\u003e anger \n\u003e disgust \n\u003e fear\n\u003e happiness\n\u003e sadness\n\nHave a speech utterance you'd like to know the overall tone of? Read on to learn more about how to use \u003ci\u003emood-class\u003c/i\u003e!\n\n## Getting Started\n\nThese next set of instructions will help you get a copy of \u003ci\u003emood-class\u003c/i\u003e and its corresponding requirements installed on your local machine.\n\n### Prerequisites\n\n#### Python\n\u003ci\u003emood-class\u003c/i\u003e and its various dependencies are all built on top of Python. If you do not have Python installed on your machine, follow this [guide](https://wsvincent.com/install-python3-mac/) on how to do so via Homebrew. \u003ci\u003emood-class\u003c/i\u003e will run on Python versions 3 or higher.\n\n#### Python Libraries\nWe'll be making use of several Python libraries to get our classifier to work. We can use pip to pre-install these. \n```\npip install numpy matplotlib scipy sklearn hmmlearn simplejson eyed3 pydub\n```\nIf you don't have pip installed, you can check out the documentation for how to do so [here](https://pip.pypa.io/en/stable/installing/). The above list of libraries are courtesy of [pyAudioAnalysis](https://github.com/tyiannak/pyAudioAnalysis), which is the framework we will use to perform the classification task. \n\n### Installations and Set Up\n\n#### Clone this repository\n\nNavigate to your preferred directory location and clone this repository.\n\n```\ngit clone https://github.com/navierula/mood-class\n```\n#### Clone pyAudioAnalysis\n\n```\ngit clone https://github.com/tyiannak/pyAudioAnalysis\n```\nMake sure that you place this repository within your \u003ci\u003emood-class\u003c/i\u003e directory, specifically where you will choose to perform the classification task. For reference, my placement looks like this:\n```\nmood-class/\n|_audioClassication/\n|__pyAudioAnalysis/\n```\n\n#### Update path in `bashrc` file\n\nIn order to get pyAudioAnalysis to work, you would need to update the Python path in your `bashrc` file. You can access this hidden file via your terminal by any text editor of your choice. Here's how you might edit the file using emacs:\n\n```\nemacs .bashrc\n```\nOnce you have the file open, set the Python path to where you saved pyAudioAnalysis locally. \n\n```\nexport PYTHONPATH=$PYTHONPATH:\"/Users/navrajnarula/Desktop/audioClassification/pyAudioAnalysis\n```\n\nTo update these specifications, specify the source in your terminal.\n\n```\nsource ~/.bashrc\n```\n#### Download FFmpeg \n\nFFmpeg is a free software that is designed for command-line-based processing of audio files. Since our classifier works with audio files, I would suggest downloading FFmpeg [here](https://www.ffmpeg.org/download.html) to avoid trivial errors when it comes to reading in inputs. \n\n## Running \u003ci\u003emood-class\u003c/i\u003e\n\nNow that everything has been set up on your local machine, we can go ahead and run the classifier!\n\n### Data\n\nYou can use any audio data that you have available for this classifier. Since my focus is on emotional analysis, I utilized [CREMA-D](https://github.com/CheyneyComputerScience/CREMA-D). This dataset contains over 7,000 instances of speech utterances delivered by actors that fall into labeled categories of anger, disgust, fear, happiness, and sadness. To obtain the full dataset, head on over to CREMA-D's repository and download the data using [Git Large File Storage](https://git-lfs.github.com/). \n\nFor testing purposes, I have included a small subset of CREMA-D's files in the `praat_viz` directory of my repository, which are distinguished by male and female voices. This is further broken down by emotion, as stated within each file name.\n\n```\nmood-class/\n|_audioClassification/\n|__trainingdata/\n|___anger/\n|___disgust/\n|___fear/\n|___happiness/\n|___sadness/\n```\nNote that pyAudioAnalysis will work on both `.mp3` and `.wav` files. My training files are in `.wav` format.\n\n### Train Data\n\n\u003ci\u003emood-class\u003c/i\u003e currently uses an [SVM](https://en.wikipedia.org/wiki/Support_vector_machine) model in this example, but if you prefer to use another one, check out [pyAudioAnalysis](https://github.com/tyiannak/pyAudioAnalysis) for varying models it may support. To train \u003ci\u003emood-class\u003c/i\u003e on your training data, simply run this command:\n\n```\npython createClassifierModel.py trainingData\n```\n`trainingData` is the directory I have stored my training files in.\n\nOnce the data is trained, you'll see a contingency table representing the output.\n\n```\ndis  fear  hap  \ndis  16.67  1.67  2.75  \nfear  5.08  11.08  5.67  \nhap  4.00  5.92  13.50  \n```\nThe above displays the matrix for disgust, fear, and happiness.\n\n### Testing Data\n\n\u003ci\u003emood-class\u003c/i\u003e will categorize any audio file into any class of your labeled dataset. \n\n```\npython testClassifierModel.py happiness_test.wav\n```\nPassing in an untrained happy file to \u003ci\u003emood-class\u003c/i\u003e returns the probability for which class the file would fall into:\n\n```\nclassNames is ['disgust', 'fear', 'happiness']\nP is [0.01042657 0.04208108 0.94749235]\nresult is 2.0\n\nFile: happiness_test.wav is in category: happiness, with probability:  0.94749235\n```\n\n## Maintenance\n\nThis project is authored and maintained by Navie Narula. \u003ci\u003emood-class\u003c/i\u003e works in beta, but is still a work in progress. New contributors, pull requests, and issues are always welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavierula%2Fmood-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnavierula%2Fmood-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavierula%2Fmood-class/lists"}