# Understanding the total_step Denoising Parameter in Supertonic

> Master the total_step denoising parameter in Supertonic to enhance audio fidelity and optimize inference speed in speech synthesis. Learn how this key setting impacts your results.

- Repository: [Supertone Inc./supertonic](https://github.com/supertone-inc/supertonic)
- Tags: deep-dive
- Published: 2026-05-14

---

**The `total_step` parameter in Supertonic controls the number of iterative denoising iterations in the diffusion-based speech synthesis pipeline, where higher values improve audio fidelity at the cost of linearly increased inference latency.**

Supertonic is an open-source neural speech synthesis engine developed by Supertone that employs a diffusion model to generate high-quality audio waveforms. According to the supertone-inc/supertonic source code, the `total_step` parameter serves as the primary control for the trade-off between generation quality and inference speed. Understanding how this hyperparameter interacts with the underlying denoising loop is essential for optimizing the library for both real-time and offline applications.

## How total_step Governs the Diffusion Denoising Process

In Supertonic's architecture, audio generation follows a diffusion pattern where Gaussian noise is progressively refined into a coherent speech signal. Each step in the `total_step` count represents one complete forward pass through the neural network, gradually reducing noise and enhancing articulation.

The relationship is linear: doubling the step count approximately doubles the inference time while incrementally improving timbral clarity and reducing artifacts. According to the documentation across all language bindings, the parameter accepts integer values, with practical deployments ranging from **4 steps** (low-latency mode) to **10 or more** (high-fidelity mode).

## Default Configuration and Cross-Platform Consistency

Supertonic maintains semantic consistency across its multi-language SDKs. The default value is **8 steps**, which provides a balanced baseline for most use cases.

According to the source documentation in the repository:
- In [`swift/README.md`](https://github.com/supertone-inc/supertonic/blob/main/swift/README.md), the flag is documented as `--total-step` with default 8
- In [`py/README.md`](https://github.com/supertone-inc/supertonic/blob/main/py/README.md), identical semantics are preserved
- In [`rust/README.md`](https://github.com/supertone-inc/supertonic/blob/main/rust/README.md), [`nodejs/README.md`](https://github.com/supertone-inc/supertonic/blob/main/nodejs/README.md), [`go/README.md`](https://github.com/supertone-inc/supertonic/blob/main/go/README.md), [`csharp/README.md`](https://github.com/supertone-inc/supertonic/blob/main/csharp/README.md), and [`cpp/README.md`](https://github.com/supertone-inc/supertonic/blob/main/cpp/README.md), the parameter maintains the same default and type

This uniformity ensures that voice applications behave predictably regardless of whether you are implementing in Swift, Python, or C++.

## Language-Specific Implementation Details

While the core logic resides in the C++ backend, each language wrapper exposes `total_step` through idiomatic interfaces.

### Swift CLI Usage

The Swift implementation exposes the parameter via command-line interface as documented in [`swift/README.md`](https://github.com/supertone-inc/supertonic/blob/main/swift/README.md):

```swift
// Default 8 steps
swift run Supertonic --text "Hello world" --voice-style voice.json

// High quality mode with 10 steps
swift run Supertonic --text "Hello world" --voice-style voice.json --total-step 10

```

### Python Integration

In the Python bindings ([`py/README.md`](https://github.com/supertone-inc/supertonic/blob/main/py/README.md)), the parameter is passed through the helper module:

```python
import supertonic.helper as st

# Standard quality (8 steps)

st.run("--text 'Hello world!' --voice-style voice.json")

// Enhanced quality configuration
st.run("--text 'Hello world!' --voice-style voice.json --total-step 10")

```

### Rust, Node.js, Go, C#, and C++ Bindings

The remaining language implementations follow the same pattern. For example, in Go ([`go/README.md`](https://github.com/supertone-inc/supertonic/blob/main/go/README.md)), the flag is defined as:

```go
flag.IntVar(&args.totalStep, "total-step", 8, "Number of denoising steps")

```

In Node.js ([`nodejs/README.md`](https://github.com/supertone-inc/supertonic/blob/main/nodejs/README.md)), invocation follows the CLI convention:

```bash
node example_onnx.js --text "Hello world" --voice-style ./voice_styles/M1.json --total-step 10

```

The C# ([`csharp/README.md`](https://github.com/supertone-inc/supertonic/blob/main/csharp/README.md)) and C++ ([`cpp/README.md`](https://github.com/supertone-inc/supertonic/blob/main/cpp/README.md)) implementations similarly expose this as an integer flag with default value 8.

## Core Implementation in the C++ Backend

The actual iterative logic resides in [`cpp/helper.cpp`](https://github.com/supertone-inc/supertonic/blob/main/cpp/helper.cpp), where the `total_step` value determines the iteration count of the denoising loop. During each step, the ONNX runtime processes the latent representation, progressively refining the waveform from noise toward the final speech signal. This iterative denoising mechanism is the computational bottleneck that scales directly with your chosen step count.

## Optimizing total_step for Production Workflows

Selecting the appropriate step count depends on your latency constraints and quality requirements.

- **Real-time interactive applications**: Use **4–6 steps** to minimize latency, accepting modest degradation in naturalness.
- **Standard offline processing**: Retain the default **8 steps** for balanced output.
- **High-fidelity archival generation**: Increase to **10 or more** steps to minimize residual noise and maximize articulation clarity.

## Summary

- The `total_step` parameter controls the number of diffusion denoising iterations in Supertonic's speech synthesis pipeline.
- Default value is **8** across all language bindings including Swift, Python, Rust, Node.js, Go, C#, and C++.
- Higher values improve audio quality linearly while proportionally increasing inference latency.
- The core implementation resides in [`cpp/helper.cpp`](https://github.com/supertone-inc/supertonic/blob/main/cpp/helper.cpp) within the iterative denoising loop.
- Tune values between **4** (fast) and **10+** (high quality) based on application requirements.

## Frequently Asked Questions

### What is the default total_step value in Supertonic?

The default value is **8** denoising steps. This default is consistent across all language implementations as documented in the respective README files (e.g., [`swift/README.md`](https://github.com/supertone-inc/supertonic/blob/main/swift/README.md), [`py/README.md`](https://github.com/supertone-inc/supertonic/blob/main/py/README.md), [`cpp/README.md`](https://github.com/supertone-inc/supertonic/blob/main/cpp/README.md)), providing a balanced trade-off between generation speed and audio quality for most use cases.

### How does total_step affect inference speed?

Inference time scales approximately linearly with the `total_step` count. Because each step requires a complete forward pass through the neural network, doubling the step count from 8 to 16 will roughly double the latency. For real-time applications, reducing steps to 4–6 significantly accelerates generation, while offline processing can utilize 10 or more steps without latency constraints.

### Can I set total_step below 4 for faster generation?

While technically possible in some implementations, values below **4** are not recommended as they produce noticeable audio artifacts and degraded speech intelligibility. The diffusion process requires sufficient iterations to transform noise into coherent speech; fewer than 4 steps typically results in incomplete denoising and metallic or garbled output.

### Where is the total_step parameter implemented in the source code?

The parameter is implemented at multiple levels: it is declared in the CLI argument parsers of each language binding (e.g., [`go/README.md`](https://github.com/supertone-inc/supertonic/blob/main/go/README.md) for the Go flag definition) and ultimately consumed in the core C++ implementation within [`cpp/helper.cpp`](https://github.com/supertone-inc/supertonic/blob/main/cpp/helper.cpp). This file contains the iterative denoising loop that executes the diffusion process for the specified number of steps.