Speech recognition

Automatic Speech Recognition

Converting the spoken audio signal into written text through feature extraction and acoustic and language modeling, or through end-to-end audio-to-text models.

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 stages of a speech recognition system, the difference between traditional and end-to-end models, and measuring their quality with standard metrics, while recognizing the challenges of Arabic and its dialects.

Learning Objectives

  • Explain the stages of an ASR system from signal to text
  • Distinguish between CTC, RNN-T, and attention-based models
  • Compute the word error rate (WER) and character error rate (CER) manually and programmatically
  • Analyze the effect of the language model and tokenization on the results
  • Assess the limits of recognition for Arabic and its dialects without unsupported claims

Scientific and Ethical Notes

  • WER results are compared only after unifying the text normalization and using the same test set.
  • The platform does not provide a neural ASR model; the available experiment relies on the Web Speech interface in the browser or an external model.
  • Support for an Arabic dialect is not claimed without a model and documented test data for it.
  • Voice recordings are personal data; the speakers' consent and a license for the data must be obtained.

Topics

Introduction to Speech Recognition Introduction to ASR

Automatic speech recognition (ASR) is the task of converting an audio sequence into a sequence of words. The difficulty is that the signal varies with the speaker, noise, and speaking rate, and that the boundaries between words are unclear in the audio. The problem is formulated probabilistically: finding the most probable text given the input audio. The system's success is measured by comparing its output with a manually written reference text.

The Speech Recognition Pipeline Speech Recognition Pipeline

In the traditional system, audio passes through stages: signal capture, framing, feature extraction, the acoustic model, the pronunciation lexicon, the language model, and then decoding to obtain the text. In end-to-end models, several stages are merged into a single neural network, with the features remaining as input. Understanding each stage separately makes it easier to locate the source of an error when analyzing performance.

Acoustic Features Acoustic Features

The waveform is converted into a smaller and clearer representation before modeling, such as a spectrogram on the Mel scale or MFCC coefficients. Framing with short overlapping frames and a window is applied, followed by the short-time Fourier transform (STFT). The choice of features affects robustness to noise and the size of the input.

Acoustic Units and Tokens Phonemes and Tokens

The phoneme is the smallest sound unit that distinguishes meaning. Traditional models rely on phonemes and a pronunciation lexicon, whereas end-to-end models use tokens such as characters or subwords (Subword). The choice of unit balances vocabulary size, sequence length, and the model's ability to handle new words. Different vocabulary sizes are tried to select the most suitable for the domain data.

Connectionist Temporal Classification CTC

CTC solves the problem of not knowing the alignment between audio and text by adding a blank symbol (blank) and summing the probabilities of all valid alignments with dynamic programming. It produces an output for each frame, then repeats are merged and blanks are removed. It assumes conditional independence between outputs, so it benefits from an external language model.

The RNN-T Transducer RNN-T

RNN-T adds to the acoustic encoder network a prediction network that depends on previous tokens, and a joint function that produces a distribution over tokens including a blank symbol. It thereby removes the independence assumption of CTC, and suits streaming recognition (Streaming) because it processes audio incrementally without waiting for the end of the sentence.

Transformer-Based Recognition Transformer-based ASR

Transformer and Conformer models replace recurrent layers with a self-attention mechanism that captures long-range dependencies and allows parallel training. The cost of attention grows with input length, so chunking or local attention is used for long audio and streaming recognition. The choice between performance and latency remains an engineering decision that depends on the application.

End-to-End Speech Recognition End-to-End Speech Recognition

End-to-end models train a single network that maps audio directly to text, either in an encoder-decoder style with attention, or with a CTC or RNN-T function. They simplify the pipeline but need a lot of labeled data, and may be weak on rare words and unseen domains. It is therefore advisable to verify performance on speech from the application's own domain before adopting the model.

Language Models in Recognition Language Models in ASR

The language model estimates the probability of a word sequence and so favors plausible sentences when the audio is ambiguous. It is integrated during search (Beam Search) with an adjustable weight, or used to rescore hypotheses. A language model from a different domain may harm the results, and it must be tuned on texts from the application's domain. Its effect is measured by comparing WER with and without the language model on the same test set.

Arabic Speech Recognition Arabic ASR

Arabic requires special handling: the absence of diacritics in ordinary writing, the richness of morphology that increases the number of word forms, and the multiplicity of dialects relative to Modern Standard Arabic. Practical decisions arise in unifying hamzas and alif maqsura and in handling diacritics when computing WER. Performance quality depends on the data available under an appropriate license.

Dialect Recognition Dialect Recognition

Arabic dialects differ in phonetics, vocabulary, and grammar, and often have no unified writing system. Dialect identification is a classification of the speaker or the sentence, and is separate from speech transcription. Support for a dialect must not be claimed without a model, documented data covering it, and a suitable evaluation metric. It is recommended to disclose the dialects actually covered in any report.

Experiments

Speech to Text

Speech-to-Text

A unified interface with a swappable Adapter: (1) the Web Speech API in the browser, if available, (2) a hosted inference endpoint configured by the administrators; both…

Runs via Browser / Optional Provider

WER and CER Calculator

WER / CER Calculator

Computes the word and character error rates between a reference text and the output text of any system using Levenshtein alignment, and shows substitutions, deletions, i…

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

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

Model Comparison

Model Benchmark

A table in which you enter the results of your actual experiments (WER, CER, Accuracy, F1, Latency, model size, and memory) for different models and compare them. They a…

Runs in the Browser

ASR Model Comparison

ASR Model Comparison

Run several models (such as Whisper and Wav2Vec 2.0) on the same sample, then compute the WER of each with the WER calculator.

Requires an External Model

Arabic and English Recognition Comparison

Arabic vs English ASR

Compare WER/CER between Arabic and English on balanced samples; requires an ASR system that supports both languages and documented reference data.

Requires an External Model

Effect of Noise on Recognition Accuracy

Noise Effect on ASR

Add noise at different SNR levels (using the noise reduction experiment), then measure the change in an ASR system's WER. The noise part works locally, while recognition…

Requires an External Model

Algorithms

Connectionist Temporal Classification

Connectionist Temporal Classification

A loss function and decoding method that trains a network to convert a long feature sequence into a shorter token sequence without prior alignment, using a special blank…

AdvancedDeep Learning

Recurrent Neural Network Transducer

RNN Transducer

A sequence model that comprises an acoustic encoder, a text prediction network, and a joint network, so it learns the distribution over tokens plus the blank for each po…

AdvancedDeep Learning

Transformer

Transformer

An architecture based on self-attention instead of recurrence, so it processes all positions of the sequence in parallel and links any two positions directly. It has bec…

AdvancedDeep Learning

Conformer

Conformer

An encoder that combines self-attention to capture global context with depthwise convolution to capture local patterns within a single block, and it was designed primari…

AdvancedDeep Learning

Attention

Attention

A mechanism that computes, for each output, a weighted average of a set of values, where the weights are computed from the degree of match between a query and the keys.…

IntermediateDeep Learning

Hidden Markov Model

Hidden Markov Model

A probabilistic model for sequences generated from hidden states that transition according to a Markov chain, where each state emits observations with a probability dist…

AdvancedMachine Learning

Gaussian Mixture Model

Gaussian Mixture Model

A probabilistic model that represents the feature distribution as a weighted sum of several Gaussian distributions. It is estimated with the expectation-maximization (EM…

IntermediateMachine Learning

SpecAugment

SpecAugment

A data augmentation technique applied directly to the spectrogram during training, by masking random frequency bands and time bands (and optionally time warping). It red…

IntermediateDeep Learning

Word and Character Error Rate

Word / Character Error Rate

Two metrics of speech recognition quality that compute the edit distance (Levenshtein) between the reference text and the predicted text, divided by the reference length…

BeginnerSignal Processing

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

Mel Spectrogram

Mel Spectrogram

A spectrogram in which frequency bins are grouped by triangular filters spaced on the perceptual mel scale. It reduces dimensionality and emphasizes detail at low freque…

IntermediateSignal Processing

Lessons

Datasets

LibriSpeech

LibriSpeech

An English read-speech corpus from public-domain audiobooks, used as a common ASR benchmark.

Open

Mozilla Common Voice

Mozilla Common Voice

A multilingual crowd-sourced speech corpus contributed by volunteers reading written sentences; distributed in numbered releases.

Unverified

FLEURS

FLEURS

A parallel speech corpus in 102 languages built on FLoRes-101 for evaluating speech recognition and language identification.

Open

AISHELL-1

AISHELL-1

A Chinese (Mandarin) read-speech corpus for training ASR.

Open

Models

Whisper

Whisper

An encoder-decoder Transformer model trained with weak supervision on a large amount of multilingual audio.

Educational Reference Only

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

XLS-R

XLS-R

wav2vec 2.0 model trained on multilingual data at several model sizes.

Educational Reference Only

Conformer

Conformer

Combines self-attention with convolution to capture global and local context in audio.

Educational Reference Only

Evaluation Metrics

WERWord error rate: (substitutions + deletions + insertions) divided by the number of reference words, after text normalization.
CERCharacter error rate: the same metric at the character level, useful for morphologically rich languages and for non-standardized texts.
AccuracyThe ratio of correct predictions to the total; in ASR it is usually used for classification tasks such as short voice commands and not for sentence transcription.
Real-Time FactorProcessing time divided by audio duration; a value below one means processing faster than real time on the measured hardware.
LatencyThe delay between uttering speech and the appearance of the text, measured in seconds or milliseconds, and especially important for streaming recognition.

References

  1. Graves, Fernandez, Gomez, Schmidhuber. Connectionist temporal classification: labelling unsegmented sequence data with recurrent neural networks. ICML '06 (23rd Int. Conf. on Machine Learning), pp. 369-376 (2006). DOI
  2. Graves. Sequence Transduction with Recurrent Neural Networks. arXiv preprint (ICML 2012 representation learning workshop, not confirmed on page) (2012). DOI
  3. Chan, Jaitly, Le, Vinyals. Listen, Attend and Spell (2015). DOI
  4. Amodei et al. (Baidu Research, 34 authors). Deep Speech 2: End-to-End Speech Recognition in English and Mandarin. arXiv preprint (ICML 2016 not shown on page) (2015). DOI
  5. Gulati et al.. Conformer: Convolution-augmented Transformer for Speech Recognition. arXiv preprint (2020). DOI
  6. Radford et al.. Robust Speech Recognition via Large-Scale Weak Supervision. arXiv (2022). DOI
  7. Baevski et al.. wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations. arXiv (2020). DOI
  8. Park, Chan, Zhang, Chiu, Zoph, Cubuk, Le. SpecAugment: A Simple Data Augmentation Method for Automatic Speech Recognition. Interspeech 2019 (inferred from DOI prefix) (2019). DOI

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