It also provides an interface for calling from other languages. Still under testing
#include <iostream>
int main(
int argc,
char** argv)
{
std::string text = "こんにちは";
if (argc > 1)
{
text = argv[1];
}
std::cout << "input: " << text << std::endl;
.
Request<voicevox_client_cpp::Client::OptionalString>(req_synthesis);
std::cout << "saved audio file path: " << string.value() << std::endl;
return EXIT_SUCCESS;
}
pplx::task< void > Request(const web::http::http_request &req, const CallbackType< OptionalJson > callback_json)
An interface for sending supplies to the server and receiving responses asynchronously.
std::optional< web::json::value > OptionalJson
Responses from the client (in JSON format).
Definition: client.hpp:29
static Client & GetInstance(const std::string &uri)
The only interface for obtaining the client.
web::http::http_request get() noexcept
Create and provide a request based on the settings provided so far.
Definition: request.hpp:42
Builder & speaker(const int speaker)
Set the speaker ID to be used for the query to synthesize Japanese speech.
Definition: post.hpp:52
Builder & text(const utility::string_t &text)
Set the text to be used for the query to synthesize Japanese speech.
Definition: post.hpp:39
A builder for creating requests to obtain audio_query.
Definition: post.hpp:22
Builder & speaker(const int speaker)
Set the speaker ID to be used for the query to synthesize Japanese speech.
Definition: post.hpp:152
Builder & accent_phrases(const web::json::value &accent_phrases)
Set the query for speech synthesis included in the response body of the audio_query request.
Definition: post.hpp:185
Builder & enable_interrogative_upspeak(const bool enable_interrogative_upspeak)
Set a flag to control whether to raise the intonation at the end when it's a question.
Definition: post.hpp:165
A builder for creating requests to obtain audio_query.
Definition: post.hpp:132
voicevox_client_cpp::request::post::synthesis::Builder ReqSynthesisBuilder
Definition: post_audio_query_then_synthesis.cpp:6
int main(int argc, char **argv)
Definition: post_audio_query_then_synthesis.cpp:40
voicevox_client_cpp::request::post::audio_query::Builder ReqAudioQueryBuilder
Definition: post_audio_query_then_synthesis.cpp:5
# Please run the voicevox server before execution of following commands.
docker run \
-it \
--rm \
--net host \
--volume /tmp:/tmp:rw \
vvccpp:24.04 voicevox_client_cpp_sample_post_audio_query_then_synthesis
> input: こんにちは
> received audio size: 50732
> audio file size: 50732
# Please see /tmp then you can find wav files named like yyyymmddhhMMss-koNnichiwa.wav
# 2 files are output because the sample requests 2 queries using sync method and async method.