How sreosham/wake-up-word- works
Main Components
• Data Collection Module:
• Represented by the prepare.py script.
• Uses the sounddevice framework to capture audio samples.
• Collects both wakeup words and noise to form a binary classification dataset.
• Preprocessing Module:
• Though not explicitly represented by a file named preprocess.py in the file tree, the README suggests that a preprocessing step exists.
• Uses the Librosa library to extract MFCC features from the collected audio data.
• This module prepares data for model training.
• Model Training Module:
• Represented by train.py.
• The neural network training process feeds on the preprocessed features to learn to distinguish the wakeup word from noise.
• The trained model is saved in the saved_model directory (specifically WWD.h5), along with additional data such as CSV files (audio_data.csv) stored under saved_model/final_audio_wakeup.
• Model Inference Module:
• Represented by inference.py.
• In real-time prediction, a temporary audio file (predict.wav) is generated from user input.
• This audio file is then sent through the trained model to determine if it is the wakeup word.
• Auxiliary/Supporting Files:
• requirements.txt: Lists the project’s dependencies.
• prediction.wav: Likely a sample or generated file used during confirmation or debugging of the prediction process.
Relationships and Data Flow
• The data flow begins with data collection (prepare.py) that captures raw audio.
• The raw audio data then moves to the preprocessing module (using Librosa) to extract MFCC features.
• Preprocessed data feeds into the training module (train.py), where a neural network is trained.
• The trained model is stored (saved_model/WWD.h5), and logged data (e.g., CSV in final_audio_wakeup) may be used for evaluation or debugging.
• At runtime, the inference module (inference.py) takes a real-time audio sample (stored as predict.wav) and uses the saved model to classify whether the wakeup word is present.
Architectural Patterns and Design Principles
• Separation of Concerns:
• Each step (collection, preprocessing, training, inference) is encapsulated in its own script, clarifying the responsibilities.
• Modular Pipeline:
• The architecture follows a data pipeline with distinct stages which can be diagrammed as separate modules with clear interconnections.
• Real-Time Processing:
• Emphasis on real-time prediction which requires minimal delay between capturing audio (via microphone) and inference.
• Extensibility:
• The saved model and supporting data structure suggest that future updates (e.g., enhanced preprocessing or additional wakeup words) can be integrated without overhauling the system.