# Voice Signal Processing, Denoising and Segmentation in MATLAB
This project was originally developed jointly by **Miguel Martín Domínguez** and **Adriana Moreno Naranjo** as an academic assignment in Biomedical Engineering.
## Overview
This project implements a MATLAB workflow for processing and analysing sustained-vowel voice recordings.
The pipeline includes:
- Time-domain voice visualisation
- Synthetic sinusoidal interference generation
- Frequency-domain analysis using the Fast Fourier Transform
- FIR band-stop filtering
- Energy-based sustained-vowel segmentation
- Automatic export of detected vowel segments
- Narrowband and wideband spectrogram comparison
- Analysis of a normal voice recording and a simulated hoarse voice recording
The repository is intended for educational biomedical signal-processing purposes. It is **not a clinically validated voice-assessment tool**.
## Biomedical Context
Voice signals contain information related to phonation, vocal-fold vibration and vocal-tract resonance.
Digital signal-processing techniques can be used to:
- Reduce unwanted interference
- Identify active voice regions
- Segment sustained phonemes
- Study harmonic structure
- Analyse formant-related spectral patterns
- Compare different voice-production conditions
In this project, the vowels **a–e–i–o–u** are processed using conventional signal-processing methods implemented in MATLAB.
## Methodology
### 1. Voice recordings
The original experiment used two 10-second recordings sampled at **8000 Hz**:
- A normal sustained-vowel recording
- A recording of the same vowels using a simulated hoarse voice
Both recordings were produced by Miguel Martín Domínguez.
The personal audio files are not included in the public repository.
### 2. Synthetic sinusoidal interference
The original academic assignment used an interference recording provided by the course instructor.
In the refactored version, a **1000 Hz sinusoidal interference** is generated directly in MATLAB. This removes the dependency on a restricted external audio file and makes the experiment reproducible.
### 3. Frequency-domain analysis
The Fast Fourier Transform is used to obtain the single-sided magnitude spectrum of:
- The original voice
- The contaminated voice
- The filtered voice
This allows the interference component to be identified and its attenuation to be measured.
### 4. FIR band-stop filtering
A finite impulse response band-stop filter is designed to attenuate frequencies between:
800 Hz and 1200 Hz
The filter is applied using zero-phase filtering to avoid introducing phase distortion.
### 5. Sustained-vowel segmentation
The filtered signal is squared to estimate its short-term energy.
A low-pass filter smooths the energy envelope, which is then normalised and compared with a configurable threshold.
The binary activity sequence is used to detect the start and end of each sustained-vowel segment.
### 6. Spectrogram analysis
Two spectrogram configurations are used:
- **Narrowband spectrogram:** higher frequency resolution for visualising harmonic structure
- **Wideband spectrogram:** higher temporal resolution for visualising formant-related patterns
The normal recording is compared with the simulated hoarse recording.
This comparison is educational and must not be interpreted as a diagnosis of dysphonia or any other voice disorder.
## Repository Structure
voice-signal-processing-matlab/
├── .gitattributes
├── .gitignore
├── AUTHORS.md
├── README.md
├── data/
│ └── README.md
├── results/
│ └── README.md
└── src/
  ├── README.md
  └── run\_voice\_analysis.m
The analysis script creates additional files locally inside results/.
## Data Privacy
The following files are intentionally excluded from the public repository:
- Personal voice recordings
- The sinusoidal interference originally provided by the course instructor
- Automatically generated audio segments
- Figures and CSV files generated from the private recordings
The refactored project generates the interference internally and allows users to analyse their own authorised recordings.
## Requirements
- MATLAB
- Signal Processing Toolbox
Main MATLAB functions used include:
- audioread
- audiowrite
- fft
- fir1
- filtfilt
- butter
- freqz
- spectrogram
## How to Run
1. Clone or download this repository.
2. Add two authorised mono WAV recordings to the data/ directory:
data/voz1.wav
data/vozRonca1.wav
3. Both recordings should use a sampling frequency of **8000 Hz**.
4. Open MATLAB.
5. Open:
src/run\_voice\_analysis.m
6. Run the script.
The script automatically creates:
results/
├── analysis\_summary.csv
├── detected\_segments.csv
├── audio/
└── figures/
## Local Validation Results
A successful local execution using the original private recordings produced:
- Sampling frequency: **8000 Hz**
- Recording duration: **10 seconds per recording**
- Synthetic interference frequency: **1000 Hz**
- Band-stop range: **800–1200 Hz**
- Estimated interference reduction: **86.07 dB**
- Detected sustained-vowel segments: **5**
The five detected segments correspond to the intended vowel sequence:
a – e – i – o – u
The numerical summary demonstrates that the refactored segmentation workflow detected all five sustained vowels. In the original academic version, one vowel was not detected with the selected threshold.
Raw audio, detailed figures and generated segments are not published because they derive from personal voice recordings.
## Generated Outputs
The script may generate:
- Original and contaminated voice plots
- Frequency spectra
- FIR filter magnitude and phase responses
- Before-and-after denoising comparisons
- Energy-envelope and vowel-segmentation plots
- Narrowband and wideband spectrograms
- Filtered audio
- Individual detected vowel segments
- CSV summaries
## Limitations
- The segmentation threshold may require adjustment for other speakers or recording conditions.
- The filter removes a frequency band that may also contain useful voice information.
- The original recordings were produced in an academic environment rather than under controlled clinical conditions.
- The simulated hoarse voice is not equivalent to a recording from a patient with dysphonia.
- The spectrogram comparison is qualitative and has not been clinically validated.
- The project does not perform automatic vowel classification.
- The project does not diagnose voice disorders.
## Future Improvements
Possible extensions include:
- Adaptive threshold selection
- Automatic vowel classification
- Formant-frequency estimation
- Fundamental-frequency tracking
- Jitter and shimmer estimation
- Signal-to-noise ratio analysis
- Validation using a public voice dataset
- Comparison of different denoising filters
- Unit tests for the processing functions
- An interactive MATLAB application or graphical user interface
## Authors
The original academic project was jointly developed by:
- **Miguel Martín Domínguez**
- **Adriana Moreno Naranjo**
Both authors contributed to the original design, implementation, signal analysis and documentation.
See [AUTHORS.md](AUTHORS.md) for additional information.
## Academic Context
Biomedical Engineering
University of Las Palmas de Gran Canaria
## Disclaimer
This repository is provided for educational and portfolio purposes only. It is not intended for clinical diagnosis, treatment decisions or medical use.