Class: Revox::Resources::Voices

Inherits:
Object
  • Object
show all
Defined in:
lib/revox/resources/voices.rb,
sig/revox/resources/voices.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Voices

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Voices.

Parameters:



88
89
90
# File 'lib/revox/resources/voices.rb', line 88

def initialize(client:)
  @client = client
end

Instance Method Details

#list(request_options: {}) ⇒ Revox::Models::VoiceListResponse

Retrieve all voices available for AI calls, including preset voices from Cartesia/ElevenLabs and your organization's cloned voices.

Parameters:

Returns:

See Also:



41
42
43
44
45
46
47
48
# File 'lib/revox/resources/voices.rb', line 41

def list(params = {})
  @client.request(
    method: :get,
    path: "voices",
    model: Revox::Models::VoiceListResponse,
    options: params[:request_options]
  )
end

#preview(provider:, voice_id:, model: nil, speed: nil, text: nil, volume: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::VoicePreviewParams for more details.

Generate a short audio preview for a given voice.

Parameters:

  • provider (Symbol, Revox::Models::VoicePreviewParams::Provider)

    The provider to use for the preview.

  • voice_id (String)

    The voice ID to generate a preview for.

  • model (Symbol, Revox::Models::VoicePreviewParams::Model)

    Cartesia model for the preview. Defaults to sonic-3. Ignored for other providers

  • speed (Float)

    Speed for preview. Cartesia 0.6–1.5, ElevenLabs 0.7–1.2. Default 1.0.

  • text (String)

    Custom text for the preview. If omitted, a short default is used.

  • volume (Float)

    Volume for Cartesia preview (0.5–2.0). Ignored for other providers.

  • request_options (Revox::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



74
75
76
77
78
79
80
81
82
83
# File 'lib/revox/resources/voices.rb', line 74

def preview(params)
  parsed, options = Revox::VoicePreviewParams.dump_request(params)
  @client.request(
    method: :post,
    path: "voices/preview",
    body: parsed,
    model: NilClass,
    options: options
  )
end

#retrieve(id, provider:, request_options: {}) ⇒ Revox::Models::VoiceRetrieveResponse

Retrieve details for a single voice by its unique ID and provider.

Parameters:

Returns:

See Also:



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/revox/resources/voices.rb', line 19

def retrieve(id, params)
  parsed, options = Revox::VoiceRetrieveParams.dump_request(params)
  query = Revox::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["voices/%1$s", id],
    query: query,
    model: Revox::Models::VoiceRetrieveResponse,
    options: options
  )
end