English

PlayDiffusion

Introduction

Autoregressive transformer models have proven highly effective for synthesizing speech from text. However, they face a significant limitation: modifying portions of the generated audio —known as inpainting— or removing them without leaving discontinuity artifacts is beyond their standard capabilities. Thus different approaches are needed for more general speech editing tools. Consider the sentence:

“The answer is out there, Neo. Go grab it!”

Now suppose you want to change 🔴 "Neo" to 🟢 "Trinity" after generation. With traditional AR models, your options are limited.

  • Regenerate the entire sentence, which is computationally expensive and often leads to variations in prosody or speech rhythm.
  • Replace just the word “Neo”, which results in noticeable artifacts or mismatches at word boundaries.
  • Regenerate from a midway point, e.g., from “Trinity. Go grab it!”, but this has the potential of changing the prosody of the unedited part ("Go grab it"), creating unwanted variations in the speech rhythm.

All of these approaches compromise both the coherence and naturalness of the audio. Instead, for these type of speech editing tools, non-autoregressive approaches are favorable [1, 2].

PlayDiffusion Model

At Play.AI, we’ve addressed this problem with a novel diffusion-based approach for audio speech editing. Here’s how it works:

  1. First, we encode an audio sequence into a discrete space, converting the waveform into a more compact representation. Each unit in this representation is called a token. This process works with both real speech and audio generated by Text-to-Speech models.
  2. When a segment needs to be modified, we mask that portion of the audio.
  3. A diffusion model, conditioned on the updated text is used to denoise the masked region.
    1. The surrounding context is preserved seamlessly, ensuring smooth transitions and consistent speaker characteristics.
  4. The resulting output token sequence is then transformed back to a speech waveform using our BigVGAN decoder model.

By using a non-autoregressive diffusion model, we can better maintain context at the edit boundaries—resulting in high-quality, coherent audio edits. This marks a significant step forward in audio editing capabilities and paves the way for dynamic, fine-grained speech modification.

The full process is outlined in Figure 1.

Image

Figure 1. PlayDiffusion Model. 1) The input audio containing the speech “The answer is out there Neo. Go grab it!” is encoded to discrete audio tokens. 2) The tokens that corresponds to the speech targeted for editing is masked. Here we mask the tokens for “Neo”. 3) Given the updated text and the full input token sequence (i.e., masked and unmasked) the PlayDiffusion model generates the edited output sequence. 4) The sequence is transformed to a waveform by our BigVGAN, conditioned on the speaker embedding extracted from the original clip.

Training

We started with a pre-trained decoder-only text-transformer architecture and introduced crucial modifications tailored specifically for audio generation:

  1. Non-Causal Masking: Unlike standard decoder-only LLMs, like GPT, which employ causal attention (allowing tokens only to attend to previous ones), our modified Llama implementation uses non-causal attention heads. This allows the model to simultaneously leverage past, present, and future tokens.
  2. Custom Tokenizer and Embedding Reduction: To optimize efficiency, particularly for English speech synthesis, we used a custom Byte Pair Encoding (BPE) tokenizer consisting of only 10,000 text tokens. This drastically decreases the size of the embedding table, significantly boosting computational speed without compromising audio quality.
  3. Speaker Conditioning: Our model incorporates speaker conditioning derived from a pre-trained embedding model $e(w):\R^t \to \R^k$, which maps waveforms of varying length $t$ to fixed-size vectors of dimension $k$. This captures essential speaker characteristics, ensuring consistent voice identity across synthesized or edited audio segments.

During training, like MaskGCT [3], we randomly mask a percentage of audio tokens. The model learns to accurately predict these masked tokens based on context provided by the speaker embeddings, textual input, and remaining unmasked audio tokens. This method effectively trains the model to handle partial or complete audio masking scenarios. Given text samples at different time-steps as $x_t$ and text condition $\mathbf{C}$, we model the loss as:

Lmask=XD,t\[0,T]i=1Nmt,ilogpθ(xiXt,C). \mathcal{L}_{\text{mask}} = - \sum _{\mathcal{X} \in \mathcal{D}, t \in \[0,T]} \sum _{i=1}^{N} m _{t,i} \cdot \log p{\theta}(x_i | \mathbf{X}_t, \mathbf{C}).

where the mask $m_{t,i}$ is defined as:

mt,i={1,if token i is masked0,otherwise m_{t,i} = \begin{cases} 1, & \text{if token } i \text{ is masked} \\ 0, & \text{otherwise} \end{cases}

During inference, decoding occurs iteratively, starting with a fully masked token sequence. The decoding process is conducted over multiple steps, designated as T:

  • Step-wise Decoding Process:
    1. Preliminary Prediction: At each iteration, the model generates an initial prediction, X̂₀, conditioned on the current masked audio and textual input.
    2. Confidence Scoring: Tokens receive a confidence score based on the model’s prediction. Newly predicted (previously masked) tokens are assigned a confidence equivalent to their predicted probabilities, while tokens previously determined remain unaltered with a confidence score of 1.
    3. Adaptive Remasking: Utilizing a progressively decreasing schedule, $\gamma$, we select a specific number of lowest-confidence tokens for remasking in subsequent iterations. The number of tokens to remask reduces progressively with each iteration, focusing the model’s refinement efforts on areas of highest uncertainty. See MaskGCT [3] for further details.

This iterative decoding process continues until all steps are complete, gradually refining token predictions and resulting in coherent, high-quality audio outputs.

Reference:

[1] Alon Ziv, Itai Gat, Gael Le Lan, Tal Remez, Felix Kreuk, Alexandre Défossez, Jade Copet, Gabriel Synnaeve, and Yossi Adi. 2024. Masked audio generation using a single non-autoregressive transformer. arXiv preprint arXiv:2401.04577.

[2] Zalán Borsos, Matt Sharifi, Damien Vincent, Eugene Kharitonov, Neil Zeghidour, and Marco Tagliasacchi. 2023. SoundStorm: Efficient parallel audio generation. arXiv preprint arXiv:2305.09636.

[3] Yuancheng Wang, Haoyue Zhan, Liwei Liu, Ruihong Zeng, Haotian Guo, Jiachen Zheng, Qiang Zhang, Xueyao Zhang, Shunsi Zhang, and Zhizheng Wu. 2025. Maskgct: Zero-shot text-to-speech with masked generative codec transformer. In ICLR. Arxiv link.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 1 Ask for provider support