May 27, 2025
Before: My name is Maximus Decimus Meridius. Father to a murdered son, husband to a murdered wife. And I will have my vengeance, in this life or the next.
After: My name is Maximus Decimus Mamacita. Inheritor of my dad's company, nephew to a rare fish collector. And I will kick you from this group chat, permanently, after brunch.
TLDR:
- We're open-sourcing our newest inpainter model, PlayDiffusion.
- Try it here: Play Studio · Hugging Face
- Explore the code on GitHub
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:
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.
Introducing PlayDiffusion 1.0
Source code & model weights → https://huggingface.co/PlayHT/PlayDiffusion
At PlayAI, we’ve addressed this problem with a novel diffusion-based approach for audio speech editing. Here’s how it works:
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.
When a segment needs to be modified, we mask that portion of the audio.
A diffusion model, conditioned on the updated text is used to denoise the masked region.
The surrounding context is preserved seamlessly, ensuring smooth transitions and consistent speaker characteristics.
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.

Figure 1. PlayAI Diffusion 1.0 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 Discrete Diffusion 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.
Discrete Diffusion as TTS
In the extreme case where the entire audio waveform is masked, a diffusion model can function as a highly efficient Text-to-Speech (TTS) system.
While Autoregressive Transformer models have shown impressive results in speech synthesis, their sequential, token-by-token generation introduces inherent inefficiencies. Each token must be generated based on the previous ones, leading to significant computational overhead.
In contrast, diffusion models adopt a non-autoregressive approach—generating all tokens simultaneously and refining them through a fixed number of denoising steps. This fundamental architectural difference offers a major performance advantage.

To illustrate: with an audio codec running at 50 Hz, generating 20 seconds of speech would require 1,000 steps in an autoregressive setup. A diffusion model, on the other hand, can produce all 1,000 tokens at once and refine them in just 20 iterative steps—making it up to 50 times more efficient in terms of generation steps, without compromising the quality or intelligibility of the output.
Training
We started with a pre-trained decoder-only text-transformer architecture and introduced crucial modifications tailored specifically for audio generation:
Non-Causal Masking:
Unlike standard decoder-only LLMs, like GPT, which employ causal masking (allowing tokens only to attend to previous ones), our modified LLM implementation uses non-causal attention heads. This allows the model to simultaneously leverage past, present, and future tokens.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.Speaker Conditioning:
Our model incorporates speaker conditioning derived from a pre-trained embedding model e(w): ℝᵗ → ℝᵏ, 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 [1], 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ₜ, and C as the text condition, we model the loss as:

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:
Preliminary Prediction: At each iteration, the model generates an initial prediction, X̂₀, conditioned on the current masked audio and textual input.
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.
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 [1] 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.
—
References:
[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 https://arxiv.org/pdf/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: https://arxiv.org/pdf/2409.00750.
Try PlayDiffusion Now
To effortlessly experience PlayDiffusion, we've introduced Speech Editor to our Studio. This is the quickest, easiest way to experiment and create with our new PlayDiffusion model. Have fun, and please tag us on X with any of your creations. We look forward to seeing what you make.