feat(tool/minimax_tts): add MiniMax text-to-speech tool - #582
Open
octo-patch wants to merge 1 commit into
Open
Conversation
Register a MiniMax text-to-speech tool in the Music & Audio toolkit. The tool synthesizes speech from text through the regional text-to-audio endpoints and writes the generated audio to a file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason: The Music & Audio toolkit had no MiniMax text-to-speech tool, so speech could not be synthesized with the MiniMax speech models.
Changes
tools/music_audio/minimax_tts/withtool.json,settings.sample.json, a Node.js tool and a Python tool that implement the same logic.minimax_ttsintools/music_audio/toolkit.jsonso the toolkit registry picks it up.Tool behaviour
synthesizeToFile(text, outputPath, options)(synthesize_to_filein Python) posts to the text-to-audio endpoint and writes the generated audio tooutputPath:global_encallshttps://api.minimax.io/v1/t2a_v2andcn_zhcallshttps://api.minimaxi.com/v1/t2a_v2. The region comes from the settings and can be overridden per call.speech-2.8-hd,speech-2.8-turbo,speech-2.6-hd,speech-2.6-turbo,speech-02-hd,speech-02-turbo,speech-01-hdandspeech-01-turbo, defaulting tospeech-2.8-hd.Bearertoken and never logged.modelandtextare always sent,streamis forced tofalsebecause the whole audio is needed to write a file, andoutput_format,language_boost,voice_setting,pronunciation_dict,audio_setting,voice_modifyandsubtitle_enableare forwarded only when provided.audio_setting.formatacceptsmp3,wav,flacandpcm.data.audiois decoded to bytes, and whenoutput_formatisurlthe audio is downloaded instead.base_resp.status_codeis reported with the returned message, a nulldataobject and a malformed payload raise an explicit error instead of writing a truncated file, and the model, region, audio format and output path are validated before any request is sent.Settings
MINIMAX_TTS_API_KEYis required, so the tool is reported as unavailable until it is filled.MINIMAX_TTS_MODELandMINIMAX_TTS_REGIONdefault tospeech-2.8-hdandglobal_en.Checks
tsc --noEmit -p tools/tsconfig.jsonreports no error in the added files.python3 -m py_compileon the added Python files.Bearerheader, the exact request body for a full and a minimal call, every supported model, the hex decoding and the url download, and each validation and error path. The manifest was also checked against the registry expectations: the tool is discovered throughtoolkit.json, the runtime resolvessrc/nodejs/index.ts,MINIMAX_TTS_API_KEYis the only required setting, and the declared parameters map onto the method signature with the optional argument trailing.