Skip to main content
Open in Google Colab

Local Software Requirements

Set up Google TTS API

First off you will need to set up and Edge Impulse account and create your first project. You will also need a Google Cloud account with the Text to Speech API enabled: https://cloud.google.com/text-to-speech, the first million characters generated each month are free (WaveNet voices), this should be plenty for most cases as you’ll only need to generate your dataset once. From google you will need to download a credentials JSON file and set it to the correct environment variable on your system to allow the python API to work: (https://developers.google.com/workspace/guides/create-credentials#service-account)

Generate the desired samples

First off we need to set our desired keywords and labels:
Then we need to set up the parameters for our speech dataset, all possible combinations will be iterated through:
Then provide some other key parameters:
  • out_length - How long each output sample should be
  • count - Maximum number of samples to output (if all combinations of languages, pitches etc are higher then this restricts output)
  • voice-dir - Where to store the clean samples before noise is added
  • noise-url - Which noise file to download and apply to your samples
  • output-folder - The final output location of the noised samples
  • num-copies - How many different noisy versions of each sample to create
  • max-noise-level - in Db,
Then we need to check all the output folders are ready
And download the background noise file
Then we can generate a list of all possible parameter combinations based on the input earlier. If you have set num_copies to be smaller than the number of combinations then these options will be reduced:
Finally we iterate though all the options generated, call the Google TTS API to generate the desired sample, and apply noise to it, saving locally with metadata:
The files in ./out-noisy can be uploaded easily using the Edge Impulse CLI tool:

What next?

Now you can use your keywords to create a robust keyword detection model in Edge Impulse Studio! Make use of our pre-built keyword dataset to add noise and ‘unknown’ words to your model: Keyword Spotting Dataset Try out both classification models and the transfer learning keyword spotting model to see which works best for your case