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 StudioOn 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.
- 1Create projectAudio type
- 2Recordyes, no, noise
- 3ImpulseMFE + Classification
- 4Train30 cycles
- 5TestModel testing + live
- 6DeployGeneric tf lite
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
- Open the menu under your profile picture and choose Create new project.
- 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:
- On Data acquisition, select the microphone button in Collect data.
- Type the Label: yes.
- Set Duration (Seconds) to 60 Seconds (1 Min).
- Keep 1-Sec Auto-Split on and Automatic Split (80% / 20%) selected.
- 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.
- 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
- Open Create impulse.
- Set Window size to 1000 ms, Window increase (stride) to 500 ms and Frequency (Hz) to 16000.
- Select Add a processing block and choose Audio (MFE).
- Select Add a learning block and choose Classification.
- Select Save Impulse. Studio opens the MFE page.
- On the Parameters tab, keep the defaults and select Save parameters.
- On the Generate features tab, select Generate features. Wait for the job to finish.
- Look at the feature explorer: yes, no and noise should form mostly separate groups.
Read more: Audio windows and MFE.
4. Train
- In the left menu, select Classification.
- Set Number of training cycles to 30. Keep Learning rate at 0.005.
- Select Start Training and wait until the job finishes.
- Look at the Confusion Matrix (Validation): most numbers should be on the diagonal.
Read more: Classification.
5. Evaluate and test
- Open Model testing and select Classify all. Note how many clips were classified correctly.
- Click a wrong cell in the Confusion Matrix and play those clips. Are they mislabelled, too quiet or cut off?
- Open Live classification, allow the microphone and select Start Live Stream.
- 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
- Open Deployment.
- Under Target Device, choose Generic tf lite. This package works with MFE models.
- Choose the precision Studio marks Recommended.
- 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.