Skip to content

Latest commit

 

History

History
1422 lines (957 loc) · 21 KB

File metadata and controls

1422 lines (957 loc) · 21 KB

Reference

Auth

client.auth.generate_token()

📝 Description

Generates an auth token for authenticating your requests

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.auth.generate_token()

⚙️ Parameters

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

TextToSpeech

client.text_to_speech.generate(...)

📝 Description

Returns a url to the generated audio file along with other associated properties.

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.text_to_speech.generate(
    format="MP3",
    locale="en-US",
    sample_rate=44100.0,
    text="Hi, How are you doing today?",
    voice_id="Natalie",
)

⚙️ Parameters

text: str — The text that is to be synthesised. e.g. 'Hello there [pause 1s] friend'

voice_id: str — Use the GET /v1/speech/voices API to find supported voiceIds. You can use either the voiceId (e.g. en-US-natalie) or just the voice actor's name (e.g. natalie).

audio_duration: typing.Optional[float] — This parameter allows specifying the duration (in seconds) for the generated audio. If the value is 0, this parameter will be ignored. Only available for Gen2 model.

channel_type: typing.Optional[str] — Valid values: STEREO, MONO

encode_as_base_64: typing.Optional[bool] — Set to true to receive audio in response as a Base64 encoded string instead of a url. This enables zero retention of audio data on Murf's servers.

format: typing.Optional[str] — Format of the generated audio file. Valid values: MP3, WAV, FLAC, ALAW, ULAW, PCM, OGG

model_version: typing.Optional[typing.Literal["GEN2"]] — Valid values: GEN2. Audio will be generated using the new and advanced GEN2 model. Outputs from GEN2 sound more natural and high-quality compared to earlier models.

multi_native_locale: typing.Optional[str]

This field is superseded by locale field. Please migrate to locale field to ensure compatibility with future API versions.

Specifies the language for the generated audio, enabling a voice to speak in multiple languages natively. Only available in the Gen2 model. Valid values: "en-US", "en-UK", "es-ES", etc. Use the GET /v1/speech/voices endpoint to retrieve the list of available voices and languages.

locale: typing.Optional[str]

Specifies the language for the generated audio, enabling a voice to speak in multiple languages natively. Only available in the Gen2 model. Valid values: "en-US", "en-UK", "es-ES", etc. Use the GET /v1/speech/voices endpoint to retrieve the list of available voices and languages.

pitch: typing.Optional[int] — Pitch of the voiceover

pronunciation_dictionary: typing.Optional[typing.Dict[str, PronunciationDetail]]

An object used to define custom pronunciations.

Example 1: {"live":{"type": "IPA", "pronunciation": "laɪv"}}.

Example 2: {"2022":{"type": "SAY_AS", "pronunciation": "twenty twenty two"}}

rate: typing.Optional[int] — Speed of the voiceover

sample_rate: typing.Optional[float] — Valid values are 8000, 24000, 44100, 48000

style: typing.Optional[str] — The voice style to be used for voiceover generation.

variation: typing.Optional[int] — Higher values will add more variation in terms of Pause, Pitch, and Speed to the voice. Only available for Gen2 model.

word_durations_as_original_text: typing.Optional[bool] — If set to true, the word durations in response will return words as the original input text. (English only)

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.text_to_speech.stream(...)

📝 Description

Synthesize speech with ultra-low latency over a streaming connection. Choose the Base URL from the URL dropdown (Global URL or a pinned Region)

Note: Global URL auto-routes to the nearest region.

Region URL Default Concurrency
Global (Routes to the nearest server) https://global.api.murf.ai/v1/speech/stream Region specific concurrency
US-East https://us-east.api.murf.ai/v1/speech/stream 15
US-West https://us-west.api.murf.ai/v1/speech/stream 2
India https://in.api.murf.ai/v1/speech/stream 2
Canada https://ca.api.murf.ai/v1/speech/stream 2
South Korea https://kr.api.murf.ai/v1/speech/stream 2
UAE https://me.api.murf.ai/v1/speech/stream 2
Japan https://jp.api.murf.ai/v1/speech/stream 2
Australia https://au.api.murf.ai/v1/speech/stream 2
EU (Central) https://eu-central.api.murf.ai/v1/speech/stream 2
UK https://uk.api.murf.ai/v1/speech/stream 2
South America (São Paulo) https://sa-east.api.murf.ai/v1/speech/stream 2

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.text_to_speech.stream()

⚙️ Parameters

text: str — The text that is to be synthesised. e.g. 'Hello there [pause 1s] friend'

voice_id: str — Use the GET /v1/speech/voices API to find supported voiceIds. You can use either the voiceId (e.g. en-US-natalie) or just the voice actor's name (e.g. natalie).

model: typing.Optional[str] — The model to use for audio output. Defaults to FALCON for all the regions except US-East. Valid values: FALCON, GEN2

channel_type: typing.Optional[str] — Valid values: STEREO, MONO

format: typing.Optional[str] — Format of the generated audio file.Valid values: MP3, FLAC, WAV, ALAW, ULAW, OGG, PCM

multi_native_locale: typing.Optional[str]

This field is superseded by locale field. Please migrate to locale field to ensure compatibility with future API versions.

Specifies the language for the generated audio, enabling a voice to speak in multiple languages natively. Valid values: "en-US", "en-UK", "es-ES", etc. Use the GET /v1/speech/voices endpoint to retrieve the list of available voices and languages.

locale: typing.Optional[str]

Specifies the language for the generated audio, enabling a voice to speak in multiple languages natively. Valid values: "en-US", "en-UK", "es-ES", etc. Use the GET /v1/speech/voices endpoint to retrieve the list of available voices and languages.

pitch: typing.Optional[int] — Pitch of the voiceover

pronunciation_dictionary: typing.Optional[typing.Dict[str, PronunciationDetail]]

An object used to define custom pronunciations.

Example 1: {"live":{"type": "IPA", "pronunciation": "laɪv"}}.

Example 2: {"2022":{"type": "SAY_AS", "pronunciation": "twenty twenty two"}}

rate: typing.Optional[int] — Speed of the voiceover

sample_rate: typing.Optional[float] — Valid values are 8000, 16000, 24000, 44100, 48000. Defaults to 24000 for Falcon model and 44100 for Gen2 model.

style: typing.Optional[str] — The voice style to be used for voiceover generation.

variation: typing.Optional[int] — Higher values will add more variation in terms of Pause, Pitch, and Speed to the voice. Only available for Gen2 model.

request_options: typing.Optional[RequestOptions] — Request-specific configuration. You can pass in configuration such as chunk_size, and more to customize the request and response.

client.text_to_speech.get_voices(...)

📝 Description

Returns a list of available voices for speech synthesis

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.text_to_speech.get_voices(
    token="token",
    model="FALCON",
)

⚙️ Parameters

model: typing.Optional[str] — Valid values: FALCON, GEN2

token: typing.Optional[str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Text

client.text.translate(...)

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.text.translate(
    target_language="es-ES",
    texts=["Hello, world.", "How are you?"],
)

⚙️ Parameters

target_language: str — The language code for the target translation

texts: typing.Sequence[str] — List of texts to translate

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

VoiceChanger

client.voice_changer.convert(...)

📝 Description

Returns a url to the generated audio file along with other associated properties.

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.voice_changer.convert(
    voice_id="voice_id",
)

⚙️ Parameters

voice_id: str — Use the GET /v1/speech/voices API to find supported voiceIds. You can use either the voiceId (e.g. en-US-natalie) or just the voice actor's name (e.g. natalie).

audio_duration: typing.Optional[float] — This parameter allows specifying the duration (in seconds) for the generated audio. If the value is 0, this parameter will be ignored. Only available for Gen2 model.

channel_type: typing.Optional[str] — Valid values: STEREO, MONO

encode_output_as_base_64: typing.Optional[bool] — Set to true to receive audio in response as a Base64 encoded string along with a url.

file: `from future import annotations

typing.Optional[core.File]` — See core.File for more documentation

file_url: typing.Optional[str]

format: typing.Optional[str] — Format of the generated audio file. Valid values: MP3, WAV, FLAC, ALAW, ULAW

multi_native_locale: typing.Optional[str]

Specifies the language for the generated audio, enabling a voice to speak in multiple languages natively. Only available in the Gen2 model. Valid values: "en-US", "en-UK", "es-ES", etc.

Use the GET /v1/speech/voices endpoint to retrieve the list of available voices and languages.

pitch: typing.Optional[int] — Pitch of the voiceover

pronunciation_dictionary: typing.Optional[str]

A JSON string that defines custom pronunciations for specific words or phrases. Each key is a word or phrase, and its value is an object with type and pronunciation.

Example 1: '{"live": {"type": "IPA", "pronunciation": "laɪv"}}'

Example 2: '{"2022": {"type": "SAY_AS", "pronunciation": "twenty twenty two"}}'

rate: typing.Optional[int] — Speed of the voiceover

retain_accent: typing.Optional[bool] — Set to true to retain the original accent of the speaker during voice generation.

retain_prosody: typing.Optional[bool] — Indicates whether to retain the original prosody (intonation, rhythm, and stress) of the input voice in the generated output.

return_transcription: typing.Optional[bool] — Set to true to include a textual transcription of the generated audio in the response.

sample_rate: typing.Optional[float] — Valid values are 8000, 24000, 44100, 48000

style: typing.Optional[str] — The voice style to be used for voiceover generation.

transcription: typing.Optional[str] — This parameter allows specifying a transcription of the audio clip, which will then be used as input for the voice changer

variation: typing.Optional[int] — Higher values will add more variation in terms of Pause, Pitch, and Speed to the voice. Only available for Gen2 model.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Dubbing Languages

client.dubbing.languages.list_destination_languages()

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.dubbing.languages.list_destination_languages()

⚙️ Parameters

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.dubbing.languages.list_source_languages()

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.dubbing.languages.list_source_languages()

⚙️ Parameters

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Dubbing Jobs

client.dubbing.jobs.create(...)

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.dubbing.jobs.create(
    target_locales=["target_locales"],
)

⚙️ Parameters

target_locales: typing.List[str] — List of target locales

file: `from future import annotations

typing.Optional[core.File]` — See core.File for more documentation

file_url: typing.Optional[str]

source_locale: typing.Optional[str] — Source locale

webhook_url: typing.Optional[str]

file_name: typing.Optional[str]

priority: typing.Optional[JobsCreateRequestPriority] — Priority of the job. Allowed values: LOW, NORMAL, HIGH

webhook_secret: typing.Optional[str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.dubbing.jobs.create_with_project_id(...)

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.dubbing.jobs.create_with_project_id(
    project_id="project_id",
)

⚙️ Parameters

project_id: str — Your Project Id

file: `from future import annotations

typing.Optional[core.File]` — See core.File for more documentation

file_url: typing.Optional[str]

webhook_url: typing.Optional[str]

file_name: typing.Optional[str]

priority: typing.Optional[JobsCreateWithProjectIdRequestPriority] — Priority of the job. Allowed values: LOW, NORMAL, HIGH

webhook_secret: typing.Optional[str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.dubbing.jobs.get_status(...)

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.dubbing.jobs.get_status(
    job_id="job_id",
)

⚙️ Parameters

job_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Dubbing Projects

client.dubbing.projects.create(...)

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.dubbing.projects.create(
    name="name",
    dubbing_type="AUTOMATED",
    target_locales=["target_locales"],
)

⚙️ Parameters

name: str — Your Project Name

dubbing_type: ApiCreateProjectRequestDubbingType

target_locales: typing.Sequence[str] — List of target locales

source_locale: typing.Optional[str] — Source Locale

description: typing.Optional[str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.dubbing.projects.list(...)

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.dubbing.projects.list(
    limit=1,
    next="next",
)

⚙️ Parameters

limit: typing.Optional[int] — Number of Projects in response

next: typing.Optional[str] — Next Page Iterator

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.dubbing.projects.update(...)

🔌 Usage

from murf import Murf

client = Murf(
    api_key="YOUR_API_KEY",
)
client.dubbing.projects.update(
    project_id="project_id",
    target_locales=["target_locales"],
)

⚙️ Parameters

project_id: str

target_locales: typing.Sequence[str] — List of target locales

request_options: typing.Optional[RequestOptions] — Request-specific configuration.