# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
require 'oci'
# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config
# Initialize service client with default config file
ai_speech_client = OCI::AiSpeech::AIServiceSpeechClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
synthesize_speech_response =
ai_speech_client.synthesize_speech(
OCI::AiSpeech::Models::SynthesizeSpeechDetails.new(
text: 'EXAMPLE-text-Value',
is_stream_enabled: false,
compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
configuration:
OCI::AiSpeech::Models::TtsOracleConfiguration.new(
model_family: 'ORACLE',
model_details:
OCI::AiSpeech::Models::TtsOracleTts1StandardModelDetails.new(
model_name: 'TTS_1_STANDARD',
voice_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-voiceId-Value'
),
speech_settings:
OCI::AiSpeech::Models::TtsOracleSpeechSettings.new(
text_type: 'SSML',
sample_rate_in_hz: 36_460,
output_format: 'JSON',
speech_mark_types: %w[WORD]
)
),
audio_config:
OCI::AiSpeech::Models::TtsBaseAudioConfig.new(
config_type: 'BASE_AUDIO_CONFIG', save_path: 'EXAMPLE-savePath-Value'
)
)
)
# Get the data from response
puts "#{synthesize_speech_response.data}"