AI-powered spoken-language classification for Indian languages using acoustic features and Random Forest.
Live Demo: https://audio-language-detection-bhwha53elusztx56o8yb2v.streamlit.app/
Audio Language Detection is a Streamlit application that analyzes spoken audio and predicts which supported Indian language is being spoken.
The pipeline combines signal preprocessing, handcrafted acoustic feature extraction, feature scaling, and a trained Random Forest classifier. The application supports both uploaded audio files and direct microphone recording, then presents the prediction together with confidence-oriented visualizations.
| Language | Supported |
|---|---|
| 🇮🇳 Bengali | ✅ |
| 🇮🇳 Gujarati | ✅ |
| 🇮🇳 Kannada | ✅ |
| 🇮🇳 Konkani | ✅ |
| 🇮🇳 Malayalam | ✅ |
| 🇮🇳 Marathi | ✅ |
| 🇮🇳 Odia | ✅ |
| 🇮🇳 Tamil | ✅ |
| 🇮🇳 Telugu | ✅ |
Open the deployed application:
https://audio-language-detection-bhwha53elusztx56o8yb2v.streamlit.app/
You can upload a supported audio file or record speech directly from the browser and inspect the model output and visualizations.
- Upload
.wav,.mp3,.m4a,.ogg, or.flacaudio files. - Record speech directly from the browser microphone.
The inference pipeline prepares incoming audio through:
- Resampling to 16 kHz
- Spectral noise reduction with
noisereduce - DC-offset correction
- Silence trimming / VAD-style cleanup
The classifier uses a 78-dimensional acoustic feature representation built from:
- MFCCs
- MFCC deltas
- Chroma features
- Spectral contrast
- Tonnetz
- Spectral centroid
- Zero-crossing rate
- Predicted language
- Probability distribution across supported classes
- Audio waveform
- Mel-spectrogram
- Interactive exploratory visuals
Audio File / Microphone
│
▼
Audio Loading
│
▼
Resampling + Cleanup
│
▼
Noise Reduction + Trimming
│
▼
78-D Feature Extraction
│
▼
Scaling
│
▼
Random Forest Classifier
│
▼
Language Prediction
│
├──────────────► Confidence Distribution
├──────────────► Waveform
└──────────────► Mel-Spectrogram
.
├── page.py
├── inference.py
├── train_and_save_model.py
├── model_bundle.joblib
├── requirements.txt
├── sample_audios/
├── colab_notebook.ipynb
└── work/
| File | Purpose |
|---|---|
page.py |
Streamlit interface for upload, recording, prediction, and visualization |
inference.py |
Audio preprocessing and 78-D feature extraction used during inference |
train_and_save_model.py |
Model training and bundle generation |
model_bundle.joblib |
Serialized model artifacts used for inference |
requirements.txt |
Python dependency list |
sample_audios/ |
Sample/benchmark audio clips |
colab_notebook.ipynb |
Experimental and research workflow |
work/ |
Benchmark/evaluation artifacts |
git clone https://github.com/RICK2814/audio-language-detection.git
cd audio-language-detectionpip install -r requirements.txtpython -m streamlit run page.pyThen open:
http://localhost:8501
The application follows the same general path for uploaded audio and microphone recordings:
- Load the audio signal.
- Normalize the sampling rate to 16 kHz.
- Reduce unwanted spectral noise.
- Correct DC offset and trim silence.
- Compute the 78-D acoustic representation.
- Apply the trained preprocessing/scaling pipeline.
- Run the Random Forest classifier.
- Decode the predicted class label.
- Visualize prediction confidence and audio characteristics.
The repository stores a pre-trained inference bundle containing the artifacts needed to transform extracted features into the final language prediction.
Conceptually:
Raw Audio
↓
Acoustic Feature Engineering
↓
Feature Scaling
↓
Random Forest
↓
Label Decoding
↓
Predicted Indian Language
This design keeps feature extraction and model inference separated from the Streamlit presentation layer, making the system easier to test and extend.
The application is designed not only to return a class label but also to expose interpretable audio-side information through visualizations such as:
- Waveform — amplitude variation over time
- Mel-spectrogram — time-frequency representation on a mel scale
- Class probability chart — relative model confidence across supported languages
The repository includes a Colab notebook and working artifacts for experimentation and benchmark analysis. These materials can be used to inspect the feature pipeline, training workflow, and evaluation process before deploying changes to the Streamlit interface.
The application is deployed on Streamlit Community Cloud.
For a local deployment:
python -m streamlit run page.pyFor Streamlit Community Cloud, connect the GitHub repository and configure the application entry point as:
page.py
Install dependencies from:
requirements.txt
# Install dependencies
pip install -r requirements.txt
# Run locally
python -m streamlit run page.py
# Train / rebuild the model bundle
python train_and_save_model.pyThe training command should only be run when you intentionally want to regenerate the model artifacts used by the application.
Before publishing a new version, verify:
- App launches locally
-
.wavupload works -
.mp3upload works - Microphone recording works
- Preprocessing completes without errors
- All supported language labels decode correctly
- Probability visualization renders
- Waveform renders
- Mel-spectrogram renders
-
model_bundle.joblibis available in the deployment environment - Streamlit deployment starts successfully
Prediction quality depends on recording conditions, speaker characteristics, pronunciation, background noise, sample duration, and how representative the training data is of real-world speech.
A model confidence score should be interpreted as the classifier's estimated class probability distribution, not as a guarantee of correctness.
The application performs local preprocessing of the supplied audio before inference. The repository includes the serialized model bundle used for prediction. Avoid committing private or sensitive recordings to the repository.
Source: https://github.com/RICK2814/audio-language-detection
Live Demo: https://audio-language-detection-bhwha53elusztx56o8yb2v.streamlit.app/
Potential next improvements:
- Add more Indian languages
- Add stronger calibration and evaluation reporting
- Improve robustness to noisy and short recordings
- Add richer model benchmarking
- Add confusion-matrix and per-class evaluation views
- Introduce automated testing for preprocessing and inference
- Add model version metadata to the UI
This project is released under the MIT License.
If this project is useful for speech-processing, machine-learning, or Indian-language research, consider starring the repository and sharing feedback.