Gender Model Recipes
Overview
The gender model can be used to classify the speech in an audio snippet into female or male speech. If the confidence in the classification is too low, the result would be unknown
. The examples below cover the use cases:
- streaming from a microphone and reporting gender in real-time - toy app 1
- streaming from a microphone and reporting long monologues in real-time - toy app 2
If you are interested in file-processing code examples, rather than real-time, check out the speech or arousal recipes.
Recipes
Real-time analysis of male/female speech
Pre-requisites
- Deeptone
- pyaudio
- a microphone
pyaudio
Installing pyaudio in a python3.7 env may require some extra steps unless you are using Anaconda to manage your environment.
We still feel it's the easiest way to get your mic input in python though.
Installing pyaudio
If you already have pyaudio installed in your environment or an alternative package to stream audio from a microphone, go straight to the code.
- Mac
- Windows
On mac, you may have to install or overwrite portaudio, before installing pyaudio
then inside your virtualenv
Reference: https://medium.com/@koji_kanao/when-cant-install-pyaudio-with-pip-190973840dbf
Toy app 1 - report gender in real-time
Toy example to determine the gender characteristics of the speaker every ~1s in real-time. Other non-speech sounds are also detected (silence, background noise, music) and classified as no_speech
. Here we are using the gender model as an example, but any other model can be used in the same way.
Remember to add a valid license key before running the example.
Toy app 2 - analyse monologues in real-time
Toy example to analyse a stream in real-time and warn if there are long monologues (people from the same gender speaking) or long silences. Here we are using the gender model as an example, but any other model can be used in the same way.
Remember to add a valid license key before running the example.