1
Guidelines for The MAIN Assignment
Vehicle Noise and Vibration (MIET2580)
Professor Mohammad Fard
Parin Sanpetchnarong
2
MAIN ASSIGNMENT (VEHICLE NVH MIET2580)
In this assignment, the student will develop a machine learning
model for sound classification in real-world scenario
1. Decide what sound you want to classify (e.g., vehicle sound in 3 locations:
front, cabin, back).
2. Collect sound samples for each class (e.g., front, cabin, back).
3. Use the code provided (MATLAB or Python program) to train and
test machine learning model.
4. Write a report and make a presentation for submission
Features Train/Test Testing Data
Extraction Split
Raw Sound
Signal Acoustic
Features Training
Data
ML Models ML Models
Training Testing
Initial Model Trained Model Evaluation
(Untrained) Results
3
HOW TO DO THIS?
STEP 1: Planning
• Think what sound should I classify (e.g., vehicle sound in 3 locations: front, cabin, back)?
• There should be at least 3 different classes of audio data and at least 20
samples per class for machine learning models training.
• The sound should be differentiable by your ears for each class
• Check your plan with the lecturer/tutor before collecting the data. Submit the
data collection plan.
STEP 2: Data collection and pre-processing
• Record sound using your mobile phone sound recorder
• Convert sound into .wav format in mono with 44,100 Hz sampling rate (use
Audacity free software for this).
• Trim each sound sample to exactly 5-second length (do all samples).
• Create one folder for each sound class and put the samples in the related folder
(see details in STEP 2).
STEP 3: Adjust the given ML (machine learning) program for your project
• Use the code provided (MATLAB or Python program). It is similar to Machine
Learning homework.
• Read FAQ file carefully if you have error or questions
• Show and discuss classification results
4
4
STEP 1: Planning
5
PLAN YOUR SOUND PATTERN RECOGNITION PROJECT
Ask yourself
• What sound to classify?: Should be creative and innovative.
• What are classes? How to collect them?: Should be challenging but
achievable
Audio Database
(At least 3 classes)
Class A Class B Class C
(20 samples) (20 samples) (20 samples)
Requirements
• At least 3 classes
• At least 20 samples per class. The more sample, the better
classification performance
• Check your plan with supervisors before you collect data.
Prof. Mohammad FARD and Mr Asith Abeysinghe 5
6
DATA COLLECTION PLAN
You need to submit the data collection plan to your supervisors via email
before collecting data. Send email to both:
• Professor Mohammad Fard ([Link]@[Link])
• Parin Sanpetchnarong (s3918509@[Link])
Your data collection plan should answer the following questions:
1. What sound do you want to classify? (e.g., classify engine model based on its
sound)
2. How many classes are there, and how many samples per class?
• Number of Classes: At least 3 classes
• Samples per each Class: At least 10 samples per class
3. What will be the duration of each sample?
• 5 seconds (each sample) recommended but can be longer or shorter.
4. How will you collect the sounds?
• Smartphone recordings are fine, but ensure that final files are in mono,
44.1 kHz, and WAV format as per the assignment guidelines.
7
EXAMPLE PROJECT: CLASSIFYING LOCATIONS
Detecting the recording position around the car
Vehicle Engine Sound
(At least 3 classes)
Inside Cabin In Front Near Exhaust
(20 samples) (20 samples) (20 samples)
8
EXAMPLE PROJECT: CLASSIFYING LOCATIONS
Note: Each sample within a class should be unique!
Sample Class Engine RPM Car A/C Car Audio
1 C 800 OFF OFF
2 C 1200 OFF OFF
3 C 1600 OFF OFF
4 C 2000 OFF OFF
5 C 2200 OFF OFF
6 C 800 ON OFF
7 C 1200 ON OFF
8 C 1600 ON OFF
You can induce some variation among 9
10
C
C
2000
2200
ON
ON
OFF
OFF
them. For example: 11 C 800 OFF ON
12 C 1200 OFF ON
Vary engine RPM 13 C 1600 OFF ON
Turn A/C on or off 14
15
C
C
2000
2200
OFF
OFF
ON
ON
Turn car audio on or off 16 C 800 ON ON
17 C 1200 ON ON
Change the music 18 C 1600 ON ON
Etc. 19
20
C
C
2000
2200
ON
ON
ON
ON
9
9
STEP 2: Data collection
and pre-processing
10
RECORD SOUND
1. Use your smartphone to record sound
iOS: Voice Memos app Android: Voice Recorder
2. Record the sound for each class for each scenario (20 different
samples)
3. Save audio file
It is highly recommended to name file corresponding to that class and
scenarios
4. Send the audio files to your computer for processing
Upload to one of following recommended ways and then download in your
computer
OneDrive Google Drive Gmail Outlook Teams
11
PROCESS SOUND FILE USING AUDACITY
All audio files must be mono .wav files, normalised, 44.1 kHz sampling
rate, and equal duration (e.g. 5 s).
This can be done by following steps
1. Install Audacity.
2. Import audio files.
Audacity
3. Trim each file to equal duration. Free software
Recommended for audio
4. Set sampling rate.
processing.
5. Convert to mono.
6. Normalise the signal. Note:
• Install the FFmpeg package if Audacity
7. Convert file to .wav format.
can’t open certain formats (.mp3, .m4a).
• Otherwise, convert the file to .wav using
8. Once all audio files are
any online converter before importing
processed, create a dataset folder. into Audacity.
Official Audacity manual: [Link]
12
1. INSTALLING AUDACITY
Software Installation
Through Microsoft Store Download from Internet
Open Microsoft Store, search for Go to download site
Audacity, and click install Download and run the installer
Download 64-bit installer
13
1. INSTALLING AUDACITY: FFmpeg
Ffmpeg package enables Audacity to work with various audio file formats
(.m4a, .mp3, etc)
1. Download the FFmpeg installer from this link.
Select the 64-bit Windows version.
2. Run the installer. Accept License Agreement
3. Ensure that FFmpeg is installed into
C:\Program Files\FFmpeg for Audacity
4. Restart Audacity
To check if FFmpeg is installed properly
1. Open Audacity.
2. On the top menu bar, go to Edit >
Preferences
3. Select Libraries in the left pane menu
4. It should show the version of installed
FFmpeg
14
ONLINE AUDIO FORMAT CONVERTER
1. Search Google: “mp3 to wav” or
“m4a to wav”
2. Try sites like:
1. Cloudconvert
2. Freeconvert
3. Upload your audio file
4. Choose .wav as the output format
Drag & Drop
5. Download the converted .wav file
(should be automatic)
15
STEP 2.2.1: IMPORT AUDIO FILES
1. Open Audacity
2. Go to File > Import >
Audio…
3. Select a file you want
to import (can be multiple
files)
Alternatively, Drag & Drop the files
Drag and Drop on Audacity
window
16
STEP 2.2.2: TRIMING AUDIO SIGNAL
All audio files in the dataset need to have a consistent length (e.g., 2
seconds, 5 seconds)
1. Hover on the recording to be
trimmed
3. Right click on the
highlighted area, and click
copy
2. Specify the trimming
duration
4. Paste the copied
duration (Ctrl + V), it will
show up on another track
17
STEP 2.2.3: CHANGE SAMPLING RATE
Sample Rate should be 44,100 Hz in all audio files to make it compatible
with the provided code
Warning:
Changing rate will change the
audio duration and affect
audio quality
1. Right click in this
area of the a recording 2. Go to rate, and select the
rate (44100 Hz)
What is Sample Rate?: [Link]
18
STEP 2.2.4: CONVERT TO MONO
All audio signals need to be in Mono format (single signal) to make it
compatible with the provided code
This can be done by mixing down two signals in stereo format
2. On the top menu bar, go to Tracks >
Mix > Mix Stereo Down to Mono
Stereo (2 channels)
1. Select all recordings to be processed
(Ctrl + A to select all recordings or Ctrl +
click manually select one by one) Mono (1 channel)
Further Info: [Link]
19
STEP 2.2.5: NORMALISE AUDIO SIGNAL
Normalise the audio signals so that all have the same amplitude
This will reduce model bias related to sound volume and recording distance
2. On the top menu bar, go to Effects > Volume
and Compression > Normalize…
3. Click Apply
1. Select all recordings to be processed
(Ctrl + A to select all recordings or Ctrl
+ click manually select one by one)
20
STEP 2.2.6: EXPORT AS .WAV FORMAT
Export each audio sample file as .wav format to make it compatible with the
provided code
3. Select file format
4. Select Multiple Files
if you want to export as
many files
2. Go to File >
Export Audio…
1. Select all recordings to be 5. Click Export
processed (Ctrl + A to select all
recordings or Ctrl + click manually
select one by one)
21
STEP 2.3: CREATE DATASET FOLDER
Dataset folder: create a folder similar to RattleDB in Homework 2
EngineDB
1. Create a main folder (e.g., EngineDB)
FR FR1
FR2 2. Create a folder for each class (e.g., FR for Front,
BC
BC for back, IN for inside)
IN
3. Put audio files in each folder, corresponding to class
FR20
File/Folder Naming rules Unequal Name length (Cat, Horse, Ox, Fox)
Class Cat Class Horse Class Ox Class Fox
Each class must have the same name Bad Example
[Link] [Link] [Link] [Link]
[Link] [Link] [Link] [Link]
length, for example 1 character Will cause error [Link] [Link] [Link] [Link]
(A,B,C,…) or 3 characters (AAA, BBB, …
[Link]
…
[Link]
…
[Link]
…
[Link]
CCC, …) Duplicate filename in each class ([Link], [Link], … in all classes)
Filename must not be replicated in each Class A Class B Class C Class D
class [Link] [Link] [Link] [Link]
Good [Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
Example … … … …
[Link] [Link] [Link] [Link]
22
22
STEP 3: Adjust the program
for your project
23
RUN YOUR DATASET: MATLAB
1. Put your dataset in the current MALAB working directory
2. Change the code to your dataset folder name
Example:
Your dataset is
Change this to your dataset
MisfireDB folder name
Your dataset folder should be in
the MATLAB directory
3. Run the code
• If not working
• Carefully check if you follow every step correctly
• Contact Parin for help
24
24
Submission
25
SUBMISION
Submit the following items separately via CANVAS
1. Report %50 of the Total Assignment Mark
• Submit in PDF format (Maximum 15 A4 pages)
• Follow the provided template.
2. Presentation %50 of the Total Assignment Mark
• Prepare PowerPoint slides for a maximum 7-minute
presentation.
• Each student must deliver an online presentation (7
minutes presentation + 3 minutes Q&A).
• Presentation time slots will be scheduled and shared via
email.
3. A .zip file containing your code and audio dataset
• No marks, but compulsory