Repository for Signal Processing
Go to file
Charles STELANDRE e9887b5e45 adjusted README file. 2025-05-04 16:39:49 +02:00
pictures Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
praat_data Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
sound Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
.DS_Store Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
README.md adjusted README file. 2025-05-04 16:39:49 +02:00
chanvocoder.m Added all starting files. Developped speech_analysis until signal selection of phonemes. 2025-04-14 10:03:38 +02:00
computeFormants.m Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
computePitch.m Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
frequencySpectrum.m Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
record_vocoder.m Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
spectrogram.m Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
speech_analysis.m Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
vocoder.m Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00
zeroPole.m Updated all scripts. Added complete README file. 2025-05-04 16:18:30 +02:00

README.md

Speech Analysis and Vocoder Repository

This repository contains MATLAB scripts for various speech analysis and synthesis tasks, including a channel vocoder implementation.

Repository Contents

  • pictures/
  • praat_data/
  • sound/
  • README.md
  • chanvocoder.m
  • computeFormants.m
  • computePitch.m
  • frequencySpectrum.m
  • record_vocoder.m
  • spectrogram.m
  • speech_analysis.m
  • vocoder.m
  • zeroPole.m
  • pictures/: This folder contains images or figures generated by the scripts or used in documentation.
  • praat_data/: This folder contains data files in .txt extracted from Praat, a software for speech analysis. These files are used by scripts like for computeFormants.m and computePitch.m.
  • sound/: This folder contains audio files in .wav used as input for the analysis and vocoder scripts like modulator22.wav used for speech_analysis.m and white_periodic.wav used as a carrier signal in the vocoder. It also contains all expected results from the decimation, downsampling, and vocoding processes.
  • README.md: This file, providing an overview of the repository.
  • chanvocoder.m: This function implements a channel vocoder, which modulates a carrier signal with the spectral envelope of a modulator signal. Copied directly from : https://sethares.engr.wisc.edu/vocoders/channelvocoder.html
    function y = chanvocoder(carrier, modul, chan, numband, overlap)
    % y = chanvocoder(carrier, modul, chan, numband, overlap)
    % The Channel Vocoder modulates the carrier signal with the modulation signal
    % chan = number of channels         (e.g., 512)
    % numband = number of bands (<chan) (e.g., 32)
    % overlap = window overlap          (e.g., 1/4)
    
  • computeFormants.m: This script computes the average formant frequencies from a data file generated by Praat's formant listing tool.
    function computeFormants(filename)
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % function computeFormants(filename)
    % ex.: computeFormants("./praat_data/infoFormants.txt")
    %
    % Task: To compute the average formants from a data set extracted from the formant
    % listing tool of the Praat software.
    %
    % Inputs:
    %	-filename : String containing the directory of the file to read (.txt).
    %
    % Outputs:
    %
    %
    % Author: Charles Stelandre - charles.stelandre@ecam.fr
    % Date: 01/05/2025
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
  • computePitch.m: This script calculates the average pitch from .txt data file generated by Praat's pitch listing tool.
    function computePitch(filename)
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % function computePitch(filename)
    % ex.: computeFormants("./praat_data/infoPitch.txt")
    %
    % Task: To compute the average pitch from a data set extracted from the formant
    % listing tool of the Praat software.
    %
    % Inputs:
    %	-filename : String containing the directory of the file to read (.txt).
    %
    % Outputs: -
    %
    %
    % Author: Charles Stelandre - charles.stelandre@ecam.fr
    % Date: 01/05/2025
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
  • frequencySpectrum.m: This function computes and displays the power spectrum (linear and logarithmic scales) of an input signal.
    function [power, duration] = frequencySpectrum(signal, fs, pad)
    %%%%%%%%%%%%%%%%%%
    %function power = frequencySpectrum(signal, fs, pad)
    %
    % Task: Display the power spectrum (lin and log scale) of a given signal
    %
    % Input:
    %	- signal: the input signal to process
    %	- fs: the sampling rate
    %	-pad: boolean if true, signal is padded with 0 to the next power of 2 -> FFT instead of DFT
    %
    % Output:
    %	- power: the power spectrum
    %
    % Author:   Guillaume Gibert  - guillaume.gibert@ecam.fr
    %   - Minor adjustments:
    %           Charles Stelandre - charles.stelandre@ecam.fr
    %
    % Date: 25/04/2022
    %   - Revised: 01/05/2025
    %%%%%%%%%%%%%%%%%%
    
  • record_vocoder.m: This script records audio for a specified duration and then applies the channel vocoder to the recorded signal.
    function record_vocoder()
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % Task: To apply a vocoder on a recorded signal.
    %
    % Inputs: -
    %
    % Outputs: -
    %
    %
    % Author: Improved using
    %         vocoder.m
    %         code by :         Guillaume Gibert  - guillaume.gibert@ecam.fr
    %
    %         Modified by :     Charles Stelandre - charles.stelandre@ecam.fr
    %
    % Date: 04/05/2025
    %
    % Notes : This code records an audio and applies a vocoder on this
    % recording. Also plots the temporal plots and spectrograms. Problems
    % occured to use the record() functions. An alternative involved using the
    % recorder object.
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
  • spectrogram.m: This function calculates and plots the spectrogram of a given time-domain signal.
    function spectrogram(signal, samplingFreq, step_size, window_size)
    %%%%%%%%%%%%%%%%%%%%%%%
    %function spectrogram(signal, samplingFreq, step_size, window_size)
    % ex.:  spectrogram(signal, samplingFreq, step_size, window_size)
    %
    % Task: Plot the spectrogram of a given signal
    %
    % Inputs:
    %	-signal: temporal signal to analyse
    %	-samplingFreq: sampling frequency of the temporal signal
    % 	-step_size: how often the power spectrum will be computed in ms
    %	-window_size: size of the analysing window in ms
    %
    % Ouput: None
    %
    % author: Guillaume Gibert (guillaume.gibert@ecam.fr)
    % date: 14/03/2023
    %%%%%%%%%%%%%%%%%%%%%%%
    
  • speech_analysis.m: This is the main script for analyzing a speech signal (modulator22.wav). It likely performs various analyses, including temporal plots and potentially frequency domain analysis.
    function speech_analysis()
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % Task: To analyse the temporal and frequency plots of a signal.
    %
    % Inputs: -
    %
    % Outputs: -
    %
    %
    % Author: Charles Stelandre - charles.stelandre@ecam.fr
    %
    % Date: 09/04/2025
    %
    % Notes : This is the main file for the analysis of a signal. The main
    % signal is modulator22.wav, which is present in the "sound" folder. Sound
    % functions "sound()" are commented at then of the script.
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
  • vocoder.m: This script likely serves as a high-level function or entry point for applying different types of vocoding techniques (though based on the presence of chanvocoder.m, it might specifically call the channel vocoder).
    function vocoder()
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % Task: To create a vocoded version
    %
    % Inputs: -
    %
    % Outputs: -
    %
    %
    % Author: Charles Stelandre - charles.stelandre@ecam.fr
    %
    % Date: 01/05/2025
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
  • zeroPole.m: This function visualizes the zeros and poles of a given filter (defined by its coefficients a and b) in the complex z-plane.
    function [Z, P] = zeroPole(a, b, plt)
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % function [Z, P] = zeroPole(a, b, plt)
    % ex.: [Z, P] = zeroPole( [1 0 0.81], [1 0.5 -1], 1)
    % ex.: [Z, P] = zeroPole( [1 -1.2 0.3], [0.1 0.0 0.0], 1)
    %
    % Task: To experiment with zeros and poles of filters
    %
    % Inputs:
    %	-a: vector of ak weights applied to previous outputs
    %	-b: vector of bm weights applied to previous inputs
    %	-plt: if different from 0, plot the zeros/poles
    %
    % Outputs:
    %
    %
    % Author: Guillaume Gibert  - guillaume.gibert@ecam.fr,
    %
    %   - Minor adjustments :
    %         Charles Stelandre - charles.stelandre@ecam.fr
    %
    % Date: 09/04/2025
    %   - Revised: 01/05/2025
    %
    % Notes : A small adjustment was made to detect whenever the FIR or the IIR
    % is used. Additionally, the poles and zeros labels were adjusted to be
    % displayed correctly in the complex z-plane.
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    

Usage

To use these scripts, ensure you have MATLAB installed. You will need to navigate to the repository directory within the MATLAB environment.

  1. Data Preparation: Ensure the necessary audio files (.wav) are present in the sound/ folder and the Praat data files (.txt) are in the praat_data/ folder if you intend to run the analysis scripts.
  2. Running Scripts: Open the desired .m file in the MATLAB editor and run it by pressing the "Run" button or by typing its name in the MATLAB command window (without the .m extension).

Specific Instructions for Some Scripts:

  • computeFormants.m: Run this script with the path to your Praat formant data file as input, e.g., computeFormants('./praat_data/infoFormants.txt').
  • computePitch.m: Similarly, run this with the path to your Praat pitch data file, e.g., computePitch('./praat_data/infoPitch.txt').
  • frequencySpectrum.m: This is a function and needs to be called by another script or from the command line with a signal and sampling rate as inputs, e.g., [power, duration] = frequencySpectrum(yourSignal, yourSamplingRate, true).
  • record_vocoder.m: Run this script directly. It will prompt you to press a key to start recording audio, apply the vocoder, and play the result.
  • spectrogram.m: This is a function that needs to be called with a signal, sampling frequency, step size (in ms), and window size (in ms), e.g., spectrogram(yourSignal, Fs, 10, 30).
  • speech_analysis.m: Run this script directly to perform analysis on the modulator22.wav file.
  • chanvocoder.m : This is a function called, such as record_vocoder.m or vocoder.m
  • zeroPole.m: This function can be called with the filter coefficients and a flag to plot (1) or not (0), e.g., [Z, P] = zeroPole([1 -0.9], [1 0], 1).

Relevant Information

  • Authors: The scripts in this repository are primarily authored by Guillaume Gibert (guillaume.gibert@ecam.fr) and Charles Stelandre (charles.stelandre@ecam.fr).
  • Date: The scripts have been created and revised on various dates, with the latest revisions in May 2025.
  • Software: These scripts are written for MATLAB. Ensure you have a compatible version installed.
  • Dependencies: Some scripts might depend on specific toolboxes in MATLAB, such as the Signal Processing Toolbox and the Audio System Toolbox.
  • Praat: Scripts like computeFormants.m and computePitch.m rely on data exported from Praat (http://www.fon.hum.uva.nl/praat/), a free software for phonetic analysis.

This repository provides a set of tools for analyzing speech signals and experimenting with speech synthesis techniques like channel vocoding. Explore the individual scripts to understand their specific functionalities and how they can be used for your speech processing tasks.