
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
A Node.js + TypeScript client for the DVoice TTS API, enabling text-to-speech conversion with support for single audio generation and real-time audio streaming via WebSocket.
mp3
, wav
, ogg
, aac
, flac
).Install the package using npm:
npm install dvoice-tts
import { TTS } from "dvoice-tts";
Initialize the TTS client with your API token:
const tts = new TTS({ token: "YOUR_API_TOKEN" });
Replace 'YOUR_API_TOKEN'
with your actual API token from the DVoice TTS service.
To use the DVoice TTS API, you need a valid API token. Visit the main website at dvoice.uz and navigate to profile.dvoice.uz to create an account or log in. Once logged in, you can generate or retrieve your API token from your profile dashboard.
Use the single()
method to generate an audio file from text:
import * as fs from "fs";
async function generateAudio() {
try {
const audio = await tts.single({
model: "default",
text: "Salom!",
format: "mp3", // Options: 'mp3', 'wav', 'ogg', 'aac', 'flac'
});
fs.writeFileSync("output.mp3", audio);
console.log("Audio file saved as output.mp3");
} catch (error) {
console.error("Error generating audio:", error);
}
}
generateAudio();
Use the stream()
method to receive audio chunks in real-time:
tts.stream(
{
model: "default",
text: "Davomiy nutqni real vaqtda translatsiya qilish!",
format: "mp3", // Options: 'mp3', 'wav', 'ogg', 'aac', 'flac'
},
(err, chunk, close) => {
if (err) {
console.error("Stream error:", err);
close(); // Close the connection on error
} else if (chunk) {
// Process the audio chunk (e.g., feed to an audio player)
console.log("Received audio chunk:", chunk.length, "bytes");
} else {
// Stream has ended
console.log("Stream completed");
close(); // Close the connection
}
}
);
The close()
function can be called to terminate the WebSocket connection manually.
new TTS(options)
Creates a new TTS client instance.
options.token
(string): Your API token for DVoice TTS authentication.tts.single(options)
Generates a single audio file from text.
options.model
(string): The TTS model to use (e.g., 'default'
).options.text
(string): The text to convert to speech.options.format
(string): Audio format ('mp3'
, 'wav'
, 'ogg'
, 'aac'
, 'flac'
).Promise<Buffer>
- A promise resolving to a Buffer containing the audio data.tts.stream(options, callback)
Streams audio chunks in real-time over WebSocket.
options.model
(string): The TTS model to use (e.g., 'default'
).options.text
(string): The text to convert to speech.options.format
(string): Audio format ('mp3'
, 'wav'
, 'ogg'
, 'aac'
, 'flac'
).callback
(function): Called with (err, chunk, close)
:
err
(Error | null): Any error that occurs.chunk
(Buffer | null): Audio data chunk, or null
if the stream ends.close
(function): Function to close the WebSocket connection.void
Both single()
and stream()
methods include error handling:
single()
, errors are thrown and can be caught using try/catch
.stream()
, errors are passed to the callback as the err
parameter.Example:
try {
const audio = await tts.single({
model: "default",
text: "Test",
format: "mp3",
});
} catch (error) {
console.error("Failed to generate audio:", error.message);
}
stream()
method is ideal for applications requiring low-latency audio, such as live voice assistants or interactive systems.This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please submit a pull request or open an issue on the GitHub repository for bug reports, feature requests, or improvements.
FAQs
Node.js & TypeScript client for DVoice TTS API
We found that dvoice-tts 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.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.