Skip to main content

Overview

VoicevoxResponse is the response object returned by synthesis execution methods such as talk()->generate() and song()->generate(). It wraps WAV binary data and provides helper methods for saving, converting, and casting.

content()

content() returns the raw WAV binary. Use it when you want to return audio directly in an HTTP response.

storeAs()

storeAs() saves the WAV data through Laravel Storage. Its arguments follow the same idea as Storage::put().
The return value is the stored path (string), or false if saving fails.

toBase64()

toBase64() returns the WAV data as a Base64 string. This is useful for JSON responses and inline HTML audio playback.

__toString()

When you cast VoicevoxResponse to a string, it returns the same WAV binary as content().
Last modified on May 23, 2026