An open API service indexing awesome lists of open source software.

https://github.com/tahirzia-1/design-to-improve-speech-signal-quality-through-spectrum

Signal Processing design to improve SPEECH signal quality through spectrum by mainly using Filtration Techniques (IEEE Report & MATLAB code).
https://github.com/tahirzia-1/design-to-improve-speech-signal-quality-through-spectrum

filtration ieee matlab mp3 signals-and-systems speech wav

Last synced: 7 months ago
JSON representation

Signal Processing design to improve SPEECH signal quality through spectrum by mainly using Filtration Techniques (IEEE Report & MATLAB code).

Awesome Lists containing this project

README

          

# Advanced Speech Signal Enhancement

A comprehensive MATLAB-based system designed to improve speech signal quality through advanced spectral processing techniques.

## Overview

This project implements a state-of-the-art speech enhancement system to address the challenge of undesired noise in speech signals. Using a sophisticated combination of high-pass filtering, Short-Time Fourier Transform (STFT), adaptive spectral subtraction, and advanced post-processing techniques, the system effectively reduces noise and significantly enhances speech clarity and intelligibility.

## Key Features

- **Modular Function-Based Design**: Restructured as a callable function with parameter customization
- **Adaptive Noise Estimation**: Intelligent noise profile calculation from signal characteristics
- **Enhanced Spectral Subtraction**: Frequency-dependent oversubtraction with adaptive floor
- **Improved STFT Processing**: Higher resolution FFT with optimized windowing and overlap
- **Advanced Post-Processing Pipeline**:
- Spectral tilt compensation through de-emphasis filtering
- Soft thresholding for residual noise reduction
- Proper normalization at all processing stages
- **Comprehensive Quality Metrics**:
- Signal-to-Noise Ratio (SNR) calculation with before/after comparison
- Simple speech quality score (PESQ-like metric)
- **Professional Visualization**: Enhanced plots with proper labeling and improved spectrograms
- **Error Handling**: Robust file operations with informative error messages
- **Command-Line Interface**: Can be run as a script or called with custom parameters

## Requirements

- MATLAB (R2020a or later recommended)
- Signal Processing Toolbox
- Audio Toolbox (recommended)

## Installation

1. Clone this repository:
```
git clone https://github.com/yourusername/speech-enhancement.git
cd speech-enhancement
```

2. Ensure you have the required MATLAB toolboxes installed.

## Usage

### Basic Usage

Run the script in MATLAB with default parameters:

```matlab
enhance_speech();
```

This will process the default file 'Hallelujah.wav' and save the enhanced audio as 'Hallelujah_enhanced.wav'.

### Custom Usage

Process a specific audio file and save to a custom location:

```matlab
enhance_speech('path/to/input.wav', 'path/to/output.wav');
```

### Integration in Other Projects

```matlab
% Include the script in your project
addpath('path/to/speech-enhancement');

% Call the function from your code
enhance_speech(input_file, output_file);
```

## Technical Details

### 1. Pre-processing

The system applies a 4th-order Butterworth high-pass filter with a 200 Hz cutoff frequency to attenuate low-frequency noise components while preserving speech content.

```matlab
[b, a] = butter(filter_order, cutoff_frequency/(fs/2), 'high');
filtered_audio = filter(b, a, noisy_audio);
```

### 2. Spectral Analysis

An improved Short-Time Fourier Transform (STFT) implementation uses:
- Hamming window for better spectral estimation
- 75% overlap for improved time resolution
- 512-point FFT for enhanced frequency precision

```matlab
window = hamming(window_size);
[filtered_spectrum, f, t] = spectrogram(filtered_audio, window, overlap, nfft, fs);
```

### 3. Advanced Noise Reduction

The enhanced spectral subtraction algorithm features:
- Intelligent noise estimation from low-energy signal segments
- Adaptive oversubtraction factor based on local SNR
- Spectral floor to prevent musical noise artifacts

```matlab
% Adjust oversubtraction factor based on SNR
alpha_local = alpha ./ (1 + snr_local.^2);

% Apply spectral subtraction with spectral floor
subtracted_mag = mag_spectrum - alpha_local .* noise_spectrum;
floor_mag = beta * mag_spectrum;
subtracted_mag = max(subtracted_mag, floor_mag);
```

### 4. Post-processing

Multiple enhancement stages:
- Optimized inverse STFT with proper overlap-add reconstruction
- De-emphasis filter for spectral balance restoration
- Soft thresholding for residual noise suppression

## Performance Metrics

The system calculates:

1. **Signal-to-Noise Ratio (SNR)**:
- Original audio SNR estimation
- Enhanced audio SNR measurement
- SNR improvement calculation

2. **Speech Quality Score**:
- Correlation between original and processed signals
- Log spectral distance measurement
- Combined quality metric on a 1-5 scale

## Customization Options

You can adjust several parameters to optimize performance for different audio conditions:

```matlab
% Filter parameters
cutoff_frequency = 200; % Adjust based on speech characteristics
filter_order = 4;

% STFT parameters
window_size = 256; % Time resolution
overlap_percentage = 0.75; % Overlap between frames
nfft = 512; % Frequency resolution

% Noise reduction parameters
alpha = 4.0; % Oversubtraction factor
beta = 0.002; % Spectral floor parameter

% Post-processing parameters
deemphasis_coefficient = 0.95;
threshold = 0.01; % Soft thresholding level
```

## Example Results

| Metric | Original Audio | Enhanced Audio | Improvement |
|--------|----------------|----------------|-------------|
| SNR | 12.34 dB | 18.67 dB | +6.33 dB |
| Quality| 2.45 | 4.12 | +1.67 |

## Applications

This advanced speech enhancement system is ideal for:

- **Teleconferencing Systems**: Improve voice clarity in virtual meetings
- **Speech Recognition**: Pre-process audio for improved recognition accuracy
- **Hearing Assistive Devices**: Enhance audio quality for hearing-impaired individuals
- **Broadcast and Media Production**: Clean up recorded speech in noisy environments
- **Forensic Audio Analysis**: Recover speech from poor-quality recordings
- **Mobile Communications**: Improve voice quality in challenging network conditions