Predicting Emotional Indicators in Speech

Speech Emotion Recognition

Predicting emotional indicators in speech from features such as prosody, energy, and spectrum, as probabilistic classification and not a reading of psychological state.

Educational content in the form of a scientific draft that needs expert review before being adopted as an academic reference. No experimental result that was not actually run is shown here.

Overview

Understand the acoustic features associated with emotion and the classification methods, recognizing that voice alone does not determine psychological state and that acted data only partially represents reality.

Learning Objectives

  • Extract pitch, energy, and MFCC and relate them to emotion
  • Build and evaluate a simple emotion classifier
  • Read per-class F1 and the confusion matrix
  • Explain the limits of acted datasets
  • Express results as probabilistic indicators, not diagnosis

Scientific and Ethical Notes

  • Voice alone does not determine psychological state and is not suitable for medical or psychological diagnosis.
  • The phrasing "predicting emotional indicators" is used, not "detecting true feelings".
  • Most datasets are acted, so their results should not be generalized to spontaneous speech.
  • Its use in hiring, exams, surveillance, or making decisions about individuals is prohibited.

Topics

Predicting Emotional Indicators in Speech Speech Emotion Recognition

The system classifies a speech segment into emotion categories such as anger, joy, or neutral based on its acoustic features. The output is the probability of a class within a defined labeling scheme, not a judgment of the speaker's real feeling, since vocal expression is affected by culture, context, and acting. Conclusions are always phrased as probabilistic indicators that can be wrong.

Pitch Pitch

The fundamental frequency (F0) is the rate of vocal fold vibration and is perceived as the pitch of the voice. It is estimated with algorithms such as YIN or autocorrelation. Its mean, range, and variation are used as emotional features, but they differ between men, women, and individuals, so per-speaker normalization is needed. The F0 distribution of the same speaker across emotions is compared rather than making absolute comparisons between individuals.

Energy Energy

Frame energy is the sum of the squares of its samples, and reflects relative loudness. Its mean and variation over time are derived as auxiliary features. It is affected by microphone distance and recording level, so it must be normalized before comparing different recordings. It is often expressed in decibels or as the root mean square (RMS) to bring it closer to auditory perception.

Prosody and Rhythm Prosody

Prosody combines pitch, duration, energy, pauses, and speaking rate. It carries emotional information and linguistic emphasis at the same time, so the two effects overlap. Segment-level statistics are extracted from it, or a deep network is left to learn it implicitly. It is advisable to analyze the effect of each component separately to understand what the classifier depends on.

MFCC Coefficients MFCC

MFCC coefficients summarize the shape of the spectral envelope using a mel scale followed by a discrete cosine transform. Typically a number of the first coefficients are used along with their derivatives. They reflect articulation and the vocal tract, and are affected by the channel and the speaker, so they need mean normalization to mitigate this. They are computed for short frames and then summarized statistically across the whole segment before classification.

Spectral Features Spectral Features

They include the spectral centroid, spread, flatness, roll-off, zero-crossing rate, and spectral flux. They describe the brightness and sharpness of the sound. They are computed from the STFT for each frame and then summarized statistically, and they complement MFCC in hand-designed feature sets. Plotting them over time helps to observe changes in the loudness and sharpness of the voice during a sentence.

Emotion Classification Emotion Classification

Classifiers such as SVM or random forests are trained on feature statistics, and evaluated according to how speakers are distributed between training and test. Speaker-independent evaluation is recommended, because overlapping evaluation inflates the results. Per-class F1 and the confusion matrix are reported. Comparison with a simple baseline is performed to verify that the extra complexity is worth its cost.

Deep Learning for Emotion Deep Learning for Emotion Recognition

CNN, LSTM, and transformer networks learn representations directly from the spectrogram or from self-supervised models such as wav2vec 2.0. They need more data and tend to overfit on small datasets. The problem of differences among speakers, languages, and ways of expression remains. It is recommended to evaluate the model on speakers and languages that did not appear in training.

Experiments

Pitch and Energy

Pitch & Energy

Extracts the pitch contour F0 with the YIN algorithm and the energy contour (RMS) from your recording and displays the statistics (mean, range, deviation). These are aco…

Runs in the Browser

MFCC Explorer

MFCC Explorer

Visualizes all the MFCC extraction steps: frames, windowing, FFT, Mel filterbank, logarithm, DCT, and then the coefficients.

Runs in the Browser

Local User Classifier

Local Sound Classifier

Train a real classifier on your own recordings: you add samples for classes you define, statistical MFCCs are extracted for each sample, and kNN is applied with Leave-On…

Runs in the Browser

Audio Recorder

Audio Recorder

An in-browser recorder that uses the MediaRecorder API to capture audio and the Web Audio API to display the audio waveform live during recording.

Runs in the Browser

Audio Spectrum Explorer

Spectrogram Explorer

Computes a real STFT with control over window size, hop length, and window type (Hann/Hamming), and shows the Spectrogram and Mel Spectrogram side by side.

Runs in the Browser

Classifying Emotion Categories in Labeled Data

Emotion Categories Classification

Train or run a classifier on a dataset such as RAVDESS (under its license terms) to predict emotional indicators. The results concern the dataset's categories and do not…

Requires an External Model

Effect of Recording Duration on Indicators

Duration Effect on Features

You can observe how the pitch and energy statistics change by changing the analysis segment in "Pitch and Energy"; there is no standalone prediction experiment.

Educational Reference Only

Algorithms

Mel-Frequency Cepstral Coefficients

Mel-Frequency Cepstral Coefficients

Compact audio features extracted from the log energies of mel filters by applying the discrete cosine transform (DCT) and keeping the first few coefficients (often 13).

IntermediateSignal Processing

YIN Algorithm for Fundamental Frequency Estimation

YIN Pitch Estimation

A time-domain method for estimating the fundamental frequency f_0 that relies on the difference function and its cumulative normalization to choose the smallest lag givi…

AdvancedSignal Processing

Support Vector Machine

Support Vector Machine

A classifier that searches for a separating hyperplane with the largest margin between two classes. It can be extended to nonlinear cases with kernels and to multiple cl…

IntermediateMachine Learning

Random Forest

Random Forest

An ensemble of decision trees, each trained on a bootstrap sample of the data and with a random subset of features at each split, whose predictions are then aggregated b…

IntermediateMachine Learning

k-Nearest Neighbors

k-Nearest Neighbors

An example-based classifier: a new input is classified by a vote among the k training examples closest to it under a distance measure, with no actual training phase.

BeginnerMachine Learning

Convolutional Neural Network

Convolutional Neural Network

A neural network that uses convolutional filters with shared weights that slide over the input to extract local patterns. In audio, it is often applied to the spectrogra…

IntermediateDeep Learning

Long Short-Term Memory

Long Short-Term Memory

A type of recurrent network that adds a cell state and gates that control what is forgotten, what is written, and what is read, which mitigates the vanishing gradient pr…

IntermediateDeep Learning

Bidirectional LSTM

Bidirectional LSTM

A network that passes the sequence in two directions, forward and backward, and then merges the two states at each step. Each frame gets the context of both the past and…

IntermediateDeep Learning

wav2vec 2.0

wav2vec 2.0

A self-supervised model on the raw waveform: a convolutional encoder produces latent representations, parts of them are masked, and then the Transformer learns to predic…

AdvancedAcoustic Models

HuBERT

HuBERT

A self-supervised model that predicts hidden unit labels generated by unsupervised clustering (k-means) for masked segments, turning the representation problem into clas…

AdvancedAcoustic Models

WavLM

WavLM

A self-supervised speech model that predicts hidden units in the style of HuBERT, and adds prediction under noise or overlapping speech and a gated relative position bia…

AdvancedAcoustic Models

Lessons

Datasets

RAVDESS

RAVDESS

Acted recordings of labeled emotions, with audio and video of actors, for studying emotional cues (not real emotions).

Non-Commercial

CREMA-D

CREMA-D

Acted emotional clips from multiple actors for studying emotional cues.

Open

Models

Wav2Vec 2.0

Wav2Vec 2.0

Self-supervised learning: a CNN encoder then a Transformer with a contrastive objective over discrete units.

Educational Reference Only

HuBERT

HuBERT

Self-supervised learning by predicting k-means cluster labels for masked segments.

Educational Reference Only

WavLM

WavLM

Self-supervised model for full speech tasks, trained with noise and overlapped speech.

Educational Reference Only

CLAP

CLAP

Contrastive training on audio and text-caption pairs for a joint representation (zero-shot).

Educational Reference Only

Evaluation Metrics

AccuracyThe proportion of correctly classified clips; misleading when emotion classes are imbalanced.
Per-class F1F1 computed separately for each emotion class, then aggregated by macro average to balance between classes.
Confusion matrixA table that matches the true emotion against the predicted one, showing the similar classes that get confused, such as anger and joy.

References

  1. Livingstone et al.. The Ryerson Audio-Visual Database of Emotional Speech and Song (RAVDESS): A dynamic, multimodal set of facial and vocal expressions in North American English (2018). DOI
  2. Cao, Cooper, Keutmann, Gur, Nenkova, Verma. CREMA-D: Crowd-Sourced Emotional Multimodal Actors Dataset. IEEE Transactions on Affective Computing (2014). DOI
  3. Davis, Mermelstein. Comparison of parametric representations for monosyllabic word recognition in continuously spoken sentences. IEEE Trans. ASSP 28(4):357-366 (1980). DOI
  4. Baevski et al.. wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations. arXiv (2020). DOI
  5. McFee, Raffel, Liang, Ellis, McVicar, Battenberg, et al.. librosa: Audio and Music Signal Analysis in Python. Proceedings of the 14th Python in Science Conference (2015). DOI

Audio processing in the experiments takes place inside your browser. Audio, texts, and conversations are not saved on the server. Privacy Policy