Skip to content

Commit c6622fc

Browse files
committed
Readme formatting and code formatting
1 parent a192d96 commit c6622fc

File tree

3 files changed

+66
-79
lines changed

3 files changed

+66
-79
lines changed

README.md

Lines changed: 43 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ npm install -g @humeai/cli
3131

3232
## Usage
3333

34+
```
3435
Text to speech
3536
3637
━━━ Usage ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -39,26 +40,26 @@ $ hume tts <text>
3940
4041
━━━ Options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4142
42-
-d,--description #0 Description of the desired voice
43-
-c,--continue,--context-generation-id #0 Previous generation ID for continuation
44-
-l,--last,--continue-from-last Use a generation from a previous synthesis as context. If the last synthesis was created with --num-generations > 1, you must also provide --last-index
45-
--last-index #0 Index of the generation to use from the previous synthesis.
46-
-o,--output-dir #0 Output directory for generated audio files
47-
-n,--num-generations #0 Number of variations to generate
48-
-p,--prefix #0 Filename prefix for generated audio
49-
--play #0 Play audio after generation: all variations, just the first, or none
50-
--play-command #0 Command to play audio files (uses $AUDIO_FILE as placeholder for file path)
51-
--api-key #0 Override the default API key
52-
--format #0 Output audio format
53-
-v,--voice-name #0 Name of a previously saved voice
54-
--voice-id #0 Direct voice ID to use
55-
--json Output in JSON format
56-
--pretty Output in human-readable format
57-
--base-url #0 Override the default API base URL (for testing purposes)
58-
--provider #0 Voice provider type (CUSTOM_VOICE or HUME_AI)
59-
--speed #0 Speaking speed multiplier (0.25-3.0, default is 1.0)
60-
--trailing-silence #0 Seconds of silence to add at the end (0.0-5.0, default is 0.35)
61-
--streaming Use streaming mode for TTS generation (default: true)
43+
-d,--description #0 Description of the desired voice
44+
-c,--continue,--context-generation-id #0 Previous generation ID for continuation
45+
-l,--last,--continue-from-last Use a generation from a previous synthesis as context. If the last synthesis was created with --num-generations > 1, you must also provide --last-index
46+
--last-index #0 Index of the generation to use from the previous synthesis.
47+
-o,--output-dir #0 Output directory for generated audio files
48+
-n,--num-generations #0 Number of variations to generate
49+
-p,--prefix #0 Filename prefix for generated audio
50+
--play #0 Play audio after generation: all variations, just the first, or none
51+
--play-command #0 Command to play audio files (uses $AUDIO_FILE as placeholder for file path)
52+
--api-key #0 Override the default API key
53+
--format #0 Output audio format
54+
-v,--voice-name #0 Name of a previously saved voice
55+
--voice-id #0 Direct voice ID to use
56+
--json Output in JSON format
57+
--pretty Output in human-readable format
58+
--base-url #0 Override the default API base URL (for testing purposes)
59+
--provider #0 Voice provider type (CUSTOM_VOICE or HUME_AI)
60+
--speed #0 Speaking speed multiplier (0.25-3.0, default is 1.0)
61+
--trailing-silence #0 Seconds of silence to add at the end (0.0-5.0, default is 0.35)
62+
--streaming Use streaming mode for TTS generation (default: true)
6263
6364
━━━ Details ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6465
@@ -69,74 +70,59 @@ saved voices.
6970
━━━ Examples ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
7071
7172
Basic usage
72-
$ hume tts "Make sure to like and subscribe!" --description "The speaker is a charismatic, enthusiastic, male YouTuber in his 20s with a American accent, a slightly breathy voice, and a fast speaking rate."
73+
$ hume tts "Make sure to like and subscribe!" --description "The speaker is a charismatic, enthusiastic, male YouTuber in his 20s with a American accent, a slightly breathy voice, and a fast speaking rate."
7374
7475
Saving a voice you like (see `hume voices create --help`)
75-
$ hume voices create --name influencer_1 --last
76+
$ hume voices create --name influencer_1 --last
7677
7778
Using a previously-saved voice
78-
$ hume tts "Thanks for the 100,000,000,000 likes guys!" -v influencer_1
79+
$ hume tts "Thanks for the 100,000,000,000 likes guys!" -v influencer_1
7980
8081
Using a voice from the Hume Voice Library
81-
$ hume tts "Hello there" -v narrator --provider HUME_AI
82+
$ hume tts "Hello there" -v narrator --provider HUME_AI
8283
8384
Reading from stdin
84-
$ echo "I wouldn't be here without you" | hume tts - -v influencer_1
85+
$ echo "I wouldn't be here without you" | hume tts - -v influencer_1
8586
8687
Continuing previous text
87-
$ hume tts "Take some arrows from the quiver" -v influencer_1
88-
$ hume tts "Take a bow, too" -v influencer_1 --last # should rhyme with 'toe' not 'cow'
88+
$ hume tts "Take some arrows from the quiver" -v influencer_1
89+
$ hume tts "Take a bow, too" -v influencer_1 --last # should rhyme with 'toe' not 'cow'
8990
9091
Using custom audio player (macOS/Linux)
91-
$ hume tts "Hello world" -v narrator --play-command "mpv $AUDIO_FILE --no-video"
92+
$ hume tts "Hello world" -v narrator --play-command "mpv $AUDIO_FILE --no-video"
9293
9394
Using custom audio player (Windows)
94-
$ hume tts "Hello world" -v narrator --play-command "powershell -c \"[System.Media.SoundPlayer]::new('$AUDIO_FILE').PlaySync()\""
95+
$ hume tts "Hello world" -v narrator --play-command "powershell -c \"[System.Media.SoundPlayer]::new('$AUDIO_FILE').PlaySync()\""
9596
9697
Setting a custom audio player for the session
97-
$ hume session set tts.playCommand "vlc $AUDIO_FILE --play-and-exit"
98+
$ hume session set tts.playCommand "vlc $AUDIO_FILE --play-and-exit"
9899
99100
Adjusting speech speed
100-
$ hume tts "I am speaking very slowly" -v narrator --speed 0.75
101+
$ hume tts "I am speaking very slowly" -v narrator --speed 0.75
101102
102103
Adding trailing silence
103-
$ hume tts "Wait for it..." -v narrator --trailing-silence 3.5
104+
$ hume tts "Wait for it..." -v narrator --trailing-silence 3.5
104105
105106
## Voice Management
106107
107-
The CLI provides commands to manage your custom voices:
108-
109-
### Creating Voices
108+
Save a voice from a previous generation
109+
$ hume voices create --name my-narrator --last
110110
111-
Save a voice from a previous generation:
112-
113-
```shell
114-
# Create a voice from the last generation
115-
hume voices create --name my-narrator --last
116-
117-
# Create a voice from a specific generation ID
118-
hume voices create --name my-narrator --generation-id abc123
119-
````
111+
Create a voice from a specific generation ID
112+
$ hume voices create --name my-narrator --generation-id abc123
120113
121114
### Listing Voices
122115
123-
List your custom voices:
124-
125-
```shell
126-
# List your custom voices
127-
hume voices list
116+
List your custom voices
117+
$ hume voices list
128118
129-
# List voices from the Hume Voice Library
130-
hume voices list --provider HUME_AI
131-
```
119+
List voices from the Hume Voice Library
120+
$ hume voices list --provider HUME_AI
132121
133122
### Deleting Voices
134123
135-
Delete a voice by name:
136-
137-
```shell
138-
hume voices delete --name my-narrator
139-
```
124+
Delete a voice by name
125+
$ hume voices delete --name my-narrator
140126
141127
━━━ See also ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
142128
@@ -145,7 +131,4 @@ hume voices delete --name my-narrator
145131
- `hume voices delete --help` - Delete a saved voice
146132
- `hume session --help` - Save settings temporarily so you don't have to repeat yourself
147133
- `hume config --help` - Save settings more permanently
148-
149-
```
150-
151134
```

src/voices.test.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ describe('Voices', () => {
88
tts: {
99
voices: {
1010
create: mock(() => Promise.resolve({ name: 'test-voice', id: 'voice123' })),
11-
list: mock((): Promise<Partial<Page<unknown>>> =>
12-
Promise.resolve({
13-
hasNextPage: () => true,
14-
data: [
15-
{ name: 'voice1', id: 'id1' },
16-
{ name: 'voice2', id: 'id2' },
17-
],
18-
})
11+
list: mock(
12+
(): Promise<Partial<Page<unknown>>> =>
13+
Promise.resolve({
14+
hasNextPage: () => true,
15+
data: [
16+
{ name: 'voice1', id: 'id1' },
17+
{ name: 'voice2', id: 'id2' },
18+
],
19+
})
1920
),
2021
delete: mock(() => Promise.resolve({ success: true })),
2122
},
@@ -25,9 +26,9 @@ describe('Voices', () => {
2526
// Mock reporter
2627
const mockReporter = {
2728
mode: 'pretty',
28-
json: mock((_: unknown) => { }),
29-
info: mock((_: string) => { }),
30-
warn: mock((_: string) => { }),
29+
json: mock((_: unknown) => {}),
30+
info: mock((_: string) => {}),
31+
warn: mock((_: string) => {}),
3132
withSpinner: mock(async (_, callback) => await callback()),
3233
};
3334

src/voices.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class Voices {
8686
* Default provider is CUSTOM_VOICE (user-created voices)
8787
*/
8888
public list = async (opts: RawListVoicesOpts) => {
89-
const {pageSize, pageNumber} = opts;
89+
const { pageSize, pageNumber } = opts;
9090
const { reporter, hume } = await this.getSettings(opts);
9191
if (!hume) {
9292
throw new ApiKeyNotSetError();
@@ -99,21 +99,24 @@ export class Voices {
9999
const result = await reporter.withSpinner(
100100
`Listing ${provider === 'HUME_AI' ? 'Hume Voice Library' : 'your custom'} voices...`,
101101
async () => {
102-
return await hume.tts.voices.list({ provider, pageSize, pageNumber});
102+
return await hume.tts.voices.list({ provider, pageSize, pageNumber });
103103
}
104104
);
105105

106-
107-
reporter.json(result.data.map((voice: ReturnVoice) => ({
108-
id: voice.id,
109-
name: voice.name,
110-
})));
106+
reporter.json(
107+
result.data.map((voice: ReturnVoice) => ({
108+
id: voice.id,
109+
name: voice.name,
110+
}))
111+
);
111112
for (const voice of result.data) {
112113
reporter.info(`${voice.name} (${voice.id})`);
113114
}
114115

115116
if (result.hasNextPage()) {
116-
reporter.info(`There are more voices available. Use --page-number ${(pageNumber ?? 0) + 1} to retrieve them.`)
117+
reporter.info(
118+
`There are more voices available. Use --page-number ${(pageNumber ?? 0) + 1} to retrieve them.`
119+
);
117120
}
118121
};
119122

0 commit comments

Comments
 (0)