Speech-to-Speech Translation › Analysis: Latency, Speaker, and Prosody

Michael BrenndoerferNovember 25, 20264 min read
Language AI HandbookAll chapters
Part 27 of 67Machine Translation and Speech Translation
Chapter 196Speech-to-Speech Translation › Analysis: Latency, Speaker, and Prosody
Reading section 11 of 14 · Analysis: Latency, Speaker, and Prosody · 4 minSection 11 of 14 · 4 min

Section 11 of 14 · 4 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

These analyses cover different aspects of the cascade. Latency asks how long a request waits. Timbre and pitch ask what the audio output preserves or changes. A match on the recovered words leaves these other questions open.

Latency Breakdown

To reason about full-utterance latency, add the sequential stage times. The bars below use an illustrative timing budget. Timing the tiny tone functions would describe this code and machine rather than a realistic S2ST system.

PythonIn [25]
CollapseExpand
stage_ms = {"ASR": 120, "MT": 80, "TTS": 180}
total_latency_ms = sum(stage_ms.values())
rtf = (total_latency_ms / 1_000) / (source_audio.size / source_rate)
ConsoleOut [26]
CollapseExpand
Sequential processing budget: 380 ms
Processing time / source duration: 0.38×
VisualizationOut [27]
CollapseExpand
Horizontal bars show assumed ASR, MT, and TTS times of 120, 80, and 180 milliseconds.
Illustrative processing budget for a sequential speech translation cascade. Synthesis receives the largest share in this example. The budget excludes audio collection, buffering, and playback.

A streaming system can overlap the stages as soon as partial results are stable enough to use. User-facing delay then also depends on buffering, commitment policy, and time to the first playable audio. A sequential processing sum cannot answer those questions.

Speaker Similarity Measurement

For real speech, compare embeddings from a speaker encoder validated for the languages and channels in use. Simple acoustic features also respond to content and recording conditions. In the tone fixture, we can measure a simpler feature with a known meaning: the relative amplitude of the first three harmonics in the first segment. Resample both signals to a shared analysis rate using each signal's own original rate.

PythonIn [28]
CollapseExpand
def harmonic_profile(waveform, original_rate, analysis_rate):
    audio = resample_waveform(waveform, original_rate, analysis_rate)
    frequencies, spectrum = frame_spectra(audio, analysis_rate)
    first_frame = spectrum[0]
    fundamental = frequencies[first_frame.argmax()]
    harmonics = fundamental * np.arange(1, 4)
    return np.interp(harmonics, frequencies, first_frame) / first_frame.max()


source_profile = harmonic_profile(source_audio, source_rate, recognizer_rate)
target_profile = harmonic_profile(target_speech, target_rate, recognizer_rate)
profile_cosine = np.dot(source_profile, target_profile) / (
    np.linalg.norm(source_profile) * np.linalg.norm(target_profile)
)
ConsoleOut [29]
CollapseExpand
Source harmonics: [1.   0.35 0.12]
Target harmonics: [1.   0.1  0.42]
Tone profile cosine: 0.934

The source and target profiles differ because synthesis used a new set of harmonic weights. They can still have a high cosine because the fundamental is the largest component of both profiles. This calculation describes synthetic timbre. A speaker-identity comparison requires a speaker encoder and a separate validation protocol.

Prosody Similarity

Use the dominant frequency in each quarter-second segment as the fundamental of our test signal. Compute it using the correct rate for each signal and plot the result against elapsed time. Real speech has variable voicing, duration, and spectral structure, which calls for a pitch tracker and an alignment procedure when comparing across languages.

PythonIn [30]
CollapseExpand
source_hz, source_spectrum = frame_spectra(source_audio, source_rate)
target_hz, target_spectrum = frame_spectra(target_speech, target_rate)
f0_src = source_hz[source_spectrum.argmax(axis=1)]
f0_tgt = target_hz[target_spectrum.argmax(axis=1)]
segment_centers = (np.arange(len(f0_src)) + 0.5) * word_seconds
VisualizationOut [31]
CollapseExpand
Two rising traces on a shared time axis. The four source frequencies span 120 to 168 Hz, and the four target frequencies span 196 to 232 Hz.
Estimated fundamental frequency at the center of each tone segment. The source and target use separate tone inventories, so the synthesized target sits higher on the shared frequency axis.
ConsoleOut [32]
CollapseExpand
Source mean fundamental: 144.0 Hz
Target mean fundamental: 214.0 Hz

The target fundamental frequencies come from the German tone inventory. In this fixture the transcript IDs also identify the original English fundamentals, because each ID has one fixed source frequency. The synthesis stage uses the target inventory and its own harmonic weights. It receives neither the original waveform nor the source harmonic weights.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy