@andresaya/edge-tts 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # Edge TTS
2
+
3
+ ## Overview
4
+
5
+ **Edge TTS** is a powerful Text-to-Speech (TTS) package that leverages Microsoft's Edge capabilities. This package allows you to synthesize speech from text and manage voice options easily through a command-line interface (CLI).
6
+
7
+ ## Features
8
+
9
+ - **Text-to-Speech**: Convert text into natural-sounding speech using Microsoft Edge's TTS capabilities.
10
+ - **Multiple Voices**: Access a variety of voices to suit your project's needs.
11
+ - **Audio Export Options**: Export synthesized audio in different formats (raw, base64, or directly to a file).
12
+ - **Command-Line Interface**: Use a simple CLI for easy access to functionality.
13
+ - **Easy Integration**: Modular structure allows for easy inclusion in existing projects.
14
+
15
+ ## Installation
16
+
17
+ You can install Edge TTS via npm. Run the following command in your terminal:
18
+
19
+ ```bash
20
+ bun add @andresaya/edge-tts
21
+ ```
22
+ ```bash
23
+ npm install @andresaya/edge-tts
24
+ ```
25
+
26
+
27
+ ## Usage
28
+ Command-Line Interface
29
+
30
+ You can install Edge TTS via npm. bun Run the following command in your terminal:
31
+
32
+ ```bash
33
+ npm install -g @andresaya/edge-tts
34
+ ```
35
+
36
+ ```bash
37
+ bun install --global edge-tts
38
+ ```
39
+
40
+ To synthesize speech from text, use the following command:
41
+ ```bash
42
+ edge-tts synthesize -t "Hello, world!" -o output
43
+ ```
44
+
45
+ To list available voices, run:
46
+
47
+ ```bash
48
+ edge-tts voice-list
49
+ ```
50
+
51
+ Integration into Your Project
52
+ To use Edge TTS in your Bun project, you can import it like this:
53
+
54
+ ```js
55
+ import { EdgeTTS } from '@andresaya/edge-tt';
56
+
57
+ // Initialize the EdgeTTS service
58
+ const tts = new EdgeTTS();
59
+
60
+ // Get voices
61
+ const voices = await tts.getVoices();
62
+ console.log(voices); // Display available voices
63
+
64
+ // Synthesize text with options for voice, rate, volume, and pitch
65
+ await tts.synthesize("Hello, world!", 'en-US-AriaNeural', {
66
+ rate: '0%', // Speech rate (range: -100% to 100%)
67
+ volume: '0%', // Speech volume (range: -100% to 100%)
68
+ pitch: '0Hz' // Voice pitch (range: -100Hz to 100Hz)
69
+ });
70
+
71
+ // Export synthesized audio in different formats
72
+ const base64Audio = tts.toBase64(); // Get audio as base64
73
+ await tts.toFile("output.wav"); // Save audio to file
74
+ const rawAudio = tts.toRaw(); // Get raw audio stream
75
+ ```
76
+
77
+ ## Export Options
78
+ After synthesizing speech, you can export the audio in various formats:
79
+
80
+ - `toBase64`: Returns the audio as a Base64 string.
81
+ - `toFile`: Saves the audio to a specified file (e.g., "output.wav").
82
+ - `toRaw`: Returns the raw audio stream.
83
+
84
+ ## Contributing
85
+ We welcome contributions! Please read our CONTRIBUTING.md for guidelines on how to contribute to this project.
86
+
87
+ ## License
88
+ This project is licensed under the GNU General Public License v3 (GPLv3).
89
+
90
+ ## Acknowledgments
91
+
92
+ We would like to extend our gratitude to the developers and contributors of the following projects for their inspiration and groundwork:
93
+
94
+ * https://github.com/rany2/edge-tts/tree/master/examples
95
+ * https://github.com/rany2/edge-tts/blob/master/src/edge_tts/util.py
96
+ * https://github.com/hasscc/hass-edge-tts/blob/main/custom_components/edge_tts/tts.py