Skip to content
PetalEdgeDocs

End-to-end projects

Recognise sounds with your microphone

Build a complete Audio project that tells two words apart from background noise, using only your browser's microphone.

Try it in Studio
On this page

What you will build

A model that listens to 1 second of sound and answers yes, no or noise. You will record the data yourself, train the model, test it live and build a deployment package. It takes about 30 minutes.

  1. 1Create projectAudio type
  2. 2Recordyes, no, noise
  3. 3ImpulseMFE + Classification
  4. 4Train30 cycles
  5. 5TestModel testing + live
  6. 6DeployGeneric tf lite
What you will do

What you need

  • A PetalEdge account.
  • A computer with a microphone and a quiet room.
  • Chrome, Edge or Firefox (to allow microphone access).

1. Create the project

  1. Open the menu under your profile picture and choose Create new project.
  2. Name it Yes No Detector, choose Audio: Sound Recognition and select Create Project.

More detail: Create a project.

2. Add the data

You will record three labels. For each one:

  1. On Data acquisition, select the microphone button in Collect data.
  2. Type the Label: yes.
  3. Set Duration (Seconds) to 60 Seconds (1 Min).
  4. Keep 1-Sec Auto-Split on and Automatic Split (80% / 20%) selected.
  5. Select Start Recording and say "yes" about once a second, with a short pause each time. Change your voice a little: louder, softer, closer, further away.
  6. Select Save to Dataset. You now have about 60 one-second yes clips.

Repeat for:

  • no: say "no" about once a second for 60 seconds.
  • noise: record 60 seconds of the room with no words: typing, moving your chair and some complete silence.

Check that every label has clips in both the training and testing sets. See Labels and splits.

3. Design the impulse

  1. Open Create impulse.
  2. Set Window size to 1000 ms, Window increase (stride) to 500 ms and Frequency (Hz) to 16000.
  3. Select Add a processing block and choose Audio (MFE).
  4. Select Add a learning block and choose Classification.
  5. Select Save Impulse. Studio opens the MFE page.
  6. On the Parameters tab, keep the defaults and select Save parameters.
  7. On the Generate features tab, select Generate features. Wait for the job to finish.
  8. Look at the feature explorer: yes, no and noise should form mostly separate groups.

Read more: Audio windows and MFE.

4. Train

  1. In the left menu, select Classification.
  2. Set Number of training cycles to 30. Keep Learning rate at 0.005.
  3. Select Start Training and wait until the job finishes.
  4. Look at the Confusion Matrix (Validation): most numbers should be on the diagonal.

Read more: Classification.

5. Evaluate and test

  1. Open Model testing and select Classify all. Note how many clips were classified correctly.
  2. Click a wrong cell in the Confusion Matrix and play those clips. Are they mislabelled, too quiet or cut off?
  3. Open Live classification, allow the microphone and select Start Live Stream.
  4. Say "yes" and "no", and stay quiet. Watch the Classification Output.

If silence is detected as a word, record more noise and retrain. If words are missed, lower the Silence Gate. See Evaluating an Audio model.

6. Deploy

  1. Open Deployment.
  2. Under Target Device, choose Generic tf lite. This package works with MFE models.
  3. Choose the precision Studio marks Recommended.
  4. Select Build Deployment Package and download the package when it is ready.

Read more: Deploying an Audio model.

What you learned

  • How to record and label audio in Studio with 1-Sec Auto-Split.
  • Why a noise label with silence matters.
  • How windows, MFE features and a Classification model fit together.
  • How to check a model with a confusion matrix and live microphone testing.
  • How to build a deployment package.

Next, try the same project with Spectrogram or Transfer Learning and compare the results.