> ## Documentation Index
> Fetch the complete documentation index at: https://docs.m-star.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Fish Audio S2-Pro

> Synthesize 44.1 kHz speech with a reference voice and inline prosody control.

Fish Audio S2-Pro generates 44.1 kHz speech. Supply a clip and its transcript to clone the voice, or send text alone to generate speech without a reference.

## Install and start

The default runs on one GPU. The [Fish Audio Research License](https://huggingface.co/fishaudio/s2-pro) limits the weights to research and non-commercial use.

### `fish_s2_pro`

Text, audio → audio. The default `fish_s2_pro.yaml` uses 1 GPU. The [weights](https://huggingface.co/fishaudio/s2-pro) use Fish Audio Research License (non-commercial).

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[fish_s2_pro]"
mstar serve fish_s2_pro
```

[Send the request](#synthesize).

## Send a request

Run either client example in a second terminal after `/health` returns 200.

### Synthesize a sentence

Record “Welcome aboard.” in `speaker.wav`, or substitute a clip of a few seconds and its exact transcript. The SDK writes a WAV. curl saves the PCM samples.

**Python SDK**

```python theme={null}
from mstar import MStarClient

client = MStarClient("http://localhost:8000")
reply = client.tts(
    'The next stop is Central.',
    reference_audio="speaker.wav",
    ref_text='Welcome aboard.',
)
reply.to_wav("reply.wav")
```

**curl**

```bash theme={null}
curl -fsS http://localhost:8000/generate \
  --form-string 'text=The next stop is Central.' \
  -F files=@speaker.wav \
  --form-string input_modalities=audio,text \
  --form-string output_modalities=audio \
  --form-string streaming=false \
  --form-string 'model_kwargs={"ref_text":"Welcome aboard."}' \
  | python3 -c '
import base64, json, sys

outputs = json.load(sys.stdin)["outputs"]
with open("reply.pcm", "wb") as file:
    for chunk in outputs["audio"]:
        file.write(base64.b64decode(chunk["data"]))
'
```

## Deployment configs

| File | GPUs | Layout | Use |
| - | - | - | - |
| `fish_s2_pro.yaml` | 1 | RefEncoder and AR on one worker, codec beside them, cap 64, warmup requests | Default |

## Settings and defaults

Request fields (on `/v1/audio/speech`, all but `temperature`, `top_p` and `seed` go in `extra_body`):

| Field | Default | Effect |
| - | - | - |
| `ref_audio`, `ref_text` | none | A clip to clone (data URL or bare base64; an http(s) URL only with `MSTAR_ALLOW_REMOTE=1`) and its transcript. |
| `temperature`, `top_p`, `top_k` | 0.8, 0.8, 30 | The reference's sampling defaults. |
| `do_sample` | `true` | `false` decodes greedily. |
| `repetition_penalty` | 1.0 (off) | M\*'s penalty counts the whole generation, not the reference's 16-token window. |
| `max_new_tokens` | 2048 | Codec frames of 2048 samples at 44.1 kHz. |
| `ignore_eos` | `false` | Decode all `max_new_tokens`, for fixed-length benchmarks. |
| `sentence_chunking` | on from 600 characters | Ordered sentence chunks of about 400 characters. |

Deployment settings:

| Knob | Default | Effect |
| - | - | - |
| `model_kwargs.codec_exact_fp32` | `false` | The codec decodes with TF32. `true` runs it in fp32 with TF32 off, so streamed audio matches the whole-utterance decode to within one int16 step. |
| `resources.codec_state.max_slots` | 65 (64 streams and a sink slot) | A request holds a codec stream until it ends; startup refuses a `max_concurrent_requests` above the streams. |
| `resources.slow_ar_attn.flashinfer_backend` | `fa2` in the config | The attention backend for the Slow AR. |

## Limits

* `voice` and `speed` are not S2-Pro controls and are logged as ignored.
* At the same sampling values, M\*'s sampler keeps a slightly different token set per step than the reference: it applies the temperature before top-k and top-p, and keeps the token that carries the running total past top-p.
* `max_new_tokens` is at most 4096 frames.
* A reference clip must be 0.5 to 30 s long.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.