File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -2370,19 +2370,19 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
2370
2370
write_to_wav_file(< span class ="hljs-string "> 'test.wav'</ span > , samples_f)
2371
2371
</ code > </ pre > </ div >
2372
2372
2373
- < div > < h4 id ="playsawavfile "> Plays a WAV file:</ h4 > < pre > < code class ="python language-python hljs "> < span class ="hljs-comment "> # $ sudo apt install libasound2-dev</ span >
2374
- < span class ="hljs-comment "> # $ pip3 install simpleaudio</ span >
2373
+ < div > < h4 id ="playsawavfile "> Plays a WAV file:</ h4 > < pre > < code class ="python language-python hljs "> < span class ="hljs-comment "> # $ pip3 install simpleaudio</ span >
2375
2374
< span class ="hljs-keyword "> from</ span > simpleaudio < span class ="hljs-keyword "> import</ span > play_buffer
2376
2375
< span class ="hljs-keyword "> with</ span > wave.open(< span class ="hljs-string "> 'test.wav'</ span > , < span class ="hljs-string "> 'rb'</ span > ) < span class ="hljs-keyword "> as</ span > file:
2377
2376
p = file.getparams()
2378
2377
frames = file.readframes(< span class ="hljs-number "> -1</ span > )
2379
2378
play_buffer(frames, p.nchannels, p.sampwidth, p.framerate)
2380
2379
</ code > </ pre > </ div >
2381
2380
2382
- < div > < h3 id ="texttospeech "> Text to Speech</ h3 > < pre > < code class ="python language-python hljs "> < span class ="hljs-comment "> # $ sudo apt install espeak ffmpeg libespeak1</ span >
2383
- < span class ="hljs-comment "> # $ pip3 install pyttsx3</ span >
2381
+ < div > < h3 id ="texttospeech "> Text to Speech</ h3 > < pre > < code class ="python language-python hljs "> < span class ="hljs-comment "> # $ pip3 install pyttsx3</ span >
2384
2382
< span class ="hljs-keyword "> import</ span > pyttsx3
2385
- pyttsx3.speak(<str>) < span class ="hljs-comment "> # Reads the string while blocking.</ span >
2383
+ engine = pyttsx3.init()
2384
+ engine.say(< span class ="hljs-string "> 'Sally sells seashells by the seashore.'</ span > )
2385
+ engine.runAndWait()
2386
2386
</ code > </ pre > </ div >
2387
2387
2388
2388
< div > < h2 id ="synthesizer "> < a href ="#synthesizer " name ="synthesizer "> #</ a > Synthesizer</ h2 > < div > < h4 id ="playspopcornbygershonkingsley "> Plays Popcorn by Gershon Kingsley:</ h4 > < pre > < code class ="python language-python hljs "> < span class ="hljs-comment "> # $ pip3 install simpleaudio</ span >
You can’t perform that action at this time.
0 commit comments