Overview
VoicevoxResponse is the response object returned by synthesis methods such as talk()->generate() and song()->generate(). The same VoicevoxResponse is used in both client and native modes.
Internally it holds the WAV binary data and provides helpers for saving, converting, and stringifying.
content()
content() returns the raw WAV binary. Use it when you want to return it as an HTTP response directly.
storeAs()
storeAs() saves the WAV to Laravel’s Storage. Its arguments follow the same convention as Storage::put().
string). It returns false on failure.
toBase64()
toBase64() converts the WAV binary into a Base64 string. Handy for JSON responses or embedding in HTML.
__toString()
Casting a VoicevoxResponse to a string returns the same WAV binary as content().