Code2 Wav Stage#

class Code2WavStage : public trt_edgellm::rt::multiStage::IStage#

Vocoding, behind IStage.

Drives Code2WavRunner as a stream: one step vocodes one window of codec frames and publishes it, so audio starts playing before the codec sequence is finished.

Each window carries left context that is vocoded and then dropped, which is what keeps the seam between windows free of boundary artifacts.

Config keys: chunk_frames codec frames published per step; defaults to 25 and may not exceed the engine’s opt_code_len. Together with the vocoder’s left context it must fit max_code_len. stream_depth PCM slots per member behind the audio port; at least 2, and at least as many windows as a reader of that port holds at once checkpoint optional, checkpoint-backed engine weights whole_utterance optional, false by default. True waits for the whole codec sequence and vocodes it in one pass when it fits max_code_len, else in windows of the engine’s chunk size; chunk_frames is then not read. The first PCM slot grows to max_code_len.

Public Functions

explicit Code2WavStage(multiStage::StageInitContext const &init)#
~Code2WavStage() override#
virtual void preallocate() override#

Init-time allocation. Every device buffer this stage will ever use is claimed here, sized by maxBatch x maxSeq. Nothing on the step path may allocate.

virtual bool admit(
multiStage::StageExecContext const &ctx,
std::string &reason
) override#

Per-request admission. Reject here – it costs nothing – rather than failing mid-step.

Returns:

false plus a reason when this stage cannot serve the request.

virtual void prepare(multiStage::StageExecContext &ctx) override#

Per-request setup, once the inputs this stage reads are published. A throw fails only this request, so what prepare() writes must be this member’s own or scratch that the next member’s prepare() rewrites.

virtual multiStage::StageStatus step(
multiStage::StageExecContext &ctx
) override#
void stepCohort(
std::vector<multiStage::StageExecContext*> const &members,
std::vector<multiStage::StageStatus> &statuses
) override#
virtual void finish(
multiStage::StageExecContext &ctx,
multiStage::FinishReason reason
) override#

Called for every member on every active stage when run() ends: success, failure and cancellation alike. Emits the terminating chunk and reports metrics. A stage that only cleans up on success is a leak. take() without run() skips it; see reset().

virtual void reset() override#

Idempotent. Drops per-request state; anything longer-lived survives.

std::unique_ptr<multiStage::IStage> trt_edgellm::rt::qwen3_omni::createCode2WavStage(
multiStage::StageInitContext const &init
)#
multiStage::RunnerDecl trt_edgellm::rt::qwen3_omni::code2WavDeclaration(
)#

What a code2wav stage offers a stage graph.