This project is a small end-to-end audio classification system that distinguishes reading-style speech from natural conversational speech using short audio clips.
⚡ Implemented from scratch: This model does not use TensorFlow or PyTorch. All neural network operations—including forward/backward passes and weight updates—are coded manually to demonstrate a deep understanding of audio features and learning dynamics.
The goal is not to build a production-grade model, but to demonstrate:
- Audio feature extraction (MFCCs)
- Basic neural network implementation from scratch
- Model training and evaluation
- A simple web interface with Flask
- Clean separation between data, features, model, and interface
This project was developed as part of a technical portfolio.
The pipeline is:
- Load short mono WAV files (16kHz, 16-bit)
- Extract MFCC features (13 coefficients per clip)
- Normalize features using training statistics
- Train a small neural network (1 hidden layer, ReLU + Sigmoid)
- Evaluate classification accuracy
- Save model weights and feature scaler
- Serve the model via a Flask web interface for online predictions
The dataset consists of 23 short audio clips:
- 12 reading-style recordings
- 11 natural speech recordings
Note: Due to the small dataset size, overfitting is expected.
Accuracy may vary across runs, but the focus is on demonstrating a complete ML workflow.
reading-vs-natural-online/
├── app.py # Flask application
├── requirements.txt # Python dependencies
├── README.md
├── src/
│ ├── init.py
│ ├── features.py # MFCC extraction
│ ├── model.py # Tiny neural network implementation
│ ├── train.py # Training script
│ └── predict.py # Inference helper
├── data/
│ ├── reading/ # Reading-style audio clips
│ └── natural/ # Natural speech clips
├── uploads/ # Uploaded audio files via Flask
└── models/
├── model.npz # Saved NN weights
└── scaler.npz # Saved StandardScaler statistics
-
Clone the repository:
git clone https://github.com/yourusername/reading-vs-natural-online.git cd reading-vs-natural-online -
Create a virtual environment and activate it:
python3 -m venv .venv source .venv/bin/activate # Mac/Linux .venv\Scripts\activate # Windows
-
Install dependencies:
python3 -m pip install -r requirements.txt
-
Place your audio clips in data/reading and data/natural.
-
Run the training script:
python3 -m src.train
-
This will:
- Extract MFCC features
- Train the TinyNN model
- Save model weights (models/model.npz)
- Save scaler statistics (models/scaler.npz)
- Start the Flask app:
python3 app.py
- Open your browser at http://127.0.0.1:5000
- Upload an audio file (mono WAV, 16kHz recommended)
- Click Upload and Predict to see the classification
- The uploaded file name and prediction will remain displayed until a new file is uploaded.
Tip: Only short clips were used during training. Very long files may yield unreliable predictions.
- Sampling rate: 16 kHz
- Bit depth: 16-bit PCM
- Mono audio
For best results, match these settings when recording or preprocessing your audio.
I used these settings to keep this prototype at a manageable size.
src/features.py: MFCC extraction logicsrc/model.py: Tiny neural network with forward, backward, training, and predict functionssrc/train.py: Training pipeline including model/scaler savingsrc/predict.py: Loading saved model and scaler, making predictionsapp.py: Flask app exposing a web interface