![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
unrealspeech
Advanced tools
Unreal Speech JavaScript SDK allows you to easily integrate the Unreal Speech API into your JavaScript applications for text-to-speech (TTS) synthesis. This package provides convenient methods for working with the Unreal Speech API, including generating s
Unreal Speech JavaScript SDK allows you to easily integrate the Unreal Speech API into your JavaScript applications for text-to-speech (TTS) synthesis. This package provides convenient methods for working with the Unreal Speech API, including generating speech, managing synthesis tasks, and streaming audio.
To use the play
utility, you should have FFmpeg installed on your system
Download FFmpeg: Go to the FFmpeg official website (https://ffmpeg.org/download.html) and download the latest build for Windows.
Install Homebrew: If not already installed, open Terminal and run /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
.
npm i unrealspeech
Endpoint | Description |
---|---|
/stream | Stream audio for short, time-sensitive cases |
/speech | Generate speech with options (MP3 format) |
/synthesisTasks | Manage synthesis tasks for longer text |
/synthesisTasks/TaskId | Check the status of a synthesis task |
Property | Type | Required? | Default Value | Allowed Values |
---|---|---|---|---|
VoiceId | string | Required | N/A | Scarlett, Liv, Dan, Will, Amy |
Bitrate | string | Optional | 192k | 16k, 32k, 48k, 64k, 128k, 192k, 256k, 320k |
Speed | float | Optional | 0 | -1.0 to 1.0 |
Pitch | float | Optional | 1.0 | 0.5 to 1.5 |
VoiceId:
Bitrate: Defaults to 192k. Use lower values for low bandwidth or to reduce the transferred file size. Use higher values for higher fidelity.
Speed: Defaults to 0. Examples:
Pitch: Defaults to 1. However, on the landing page, we default male voices to 0.92 as people tend to prefer lower/deeper male voices.
Plan | Requests per second |
---|---|
Free | 1 |
Basic | 2 |
Pro | 8 |
Get your API Key To use the Unreal Speech API, you'll need to obtain an API key by signing up for an account on the Unreal Speech website. Once you have an API key, you can use it to initialize the UnrealSpeechAPI class.
To use the SDK, you need to initialize it with your API key and other required configurations. Initialization
import { UnrealSpeechAPI, play, save } from "unrealspeech";
const unrealSpeech = new UnrealSpeechAPI("your_api_key");
stream(text, voiceId, bitrate, speed, pitch, codec, temperature)
This method streams the synthesized speech based on the provided parameters.
text
: The text to be synthesized.voiceId
: The ID of the voice to be used.bitrate
: The bitrate of the audio.speed
: The speed of speech.pitch
: The pitch of speech.codec
: The audio codec to be used.temperature
: The temperature of speech.Returns: A promise that resolves to the synthesized speech buffer.
createSynthesisTask(text, voiceId, bitrate, timestampType)
This method creates a synthesis task for the provided text and voice.
text
: The text to be synthesized.voiceId
: The ID of the voice to be used.bitrate
: The bitrate of the audio.timestampType
: The type of timestamp to be used.Returns: A promise that resolves to the ID of the created synthesis task.
getSynthesisTaskStatus(taskId)
This method retrieves the status of a synthesis task based on the provided task ID.
taskId
: The ID of the synthesis task.Returns: A promise that resolves to the status of the synthesis task.
speech(text, voiceId, bitrate, timestampType)
This method synthesizes speech based on the provided text and voice.
text
: The text to be synthesized.voiceId
: The ID of the voice to be used.bitrate
: The bitrate of the audio.timestampType
: The type of timestamp to be used.Returns: A promise that resolves to the synthesized speech data.
apiKey
: Your API key for authentication.This method streams the synthesized speech based on the provided parameters.
import { UnrealSpeechAPI, play, save } from "unrealspeech";
const unrealSpeech = new UnrealSpeechAPI("your_api_key");
const speechBuffer = await unrealSpeech.stream({
text: "Hello, world!",
voiceId: "Scarlett",
bitrate: "192k",
timestampType: "word",
speed:0,
pitch: 1.0
});
// play audio
play(speechBuffer);
// save audio
save(speechBuffer, "filename.mp3");
const taskId = await unrealSpeech.createSynthesisTask({
text: "Hello, world!",
voiceId: "Scarlett",
bitrate: "192k",
timestampType: "word",
speed: 0,
pitch: 1.0
});
console.log(taskId); // Use the ID of the created synthesis task as needed
const taskId = "task123"; // Replace with the actual task ID
const status = await unrealSpeech.getSynthesisTaskStatus(taskId);
console.log(status); // Use the status of the synthesis task as needed
const speechData = await unrealSpeech.speech({
text: "Hello, world!",
voiceId: "Scarlett",
bitrate: "192k",
timestampType: "word",
speed: 0,
pitch: 1.0
});
console.log(speechData); // Use the synthesized speech data as needed
You can find a code example here: code
Include common issues and their solutions.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Unreal Speech JavaScript SDK allows you to easily integrate the Unreal Speech API into your JavaScript applications for text-to-speech (TTS) synthesis. This package provides convenient methods for working with the Unreal Speech API, including generating s
We found that unrealspeech demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.