File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -2807,11 +2807,11 @@ write_to_wav_file('test.wav', samples_f)
2807
2807
#### Plays a WAV file:
2808
2808
``` python
2809
2809
# $ pip3 install simpleaudio
2810
- import simpleaudio
2810
+ from simpleaudio import play_buffer
2811
2811
with wave.open(' test.wav' , ' rb' ) as file :
2812
2812
p = file .getparams()
2813
2813
frames = file .readframes(p.nframes)
2814
- simpleaudio. play_buffer(frames, p.nchannels, p.sampwidth, p.framerate)
2814
+ play_buffer(frames, p.nchannels, p.sampwidth, p.framerate)
2815
2815
```
2816
2816
2817
2817
### Text to Speech
Original file line number Diff line number Diff line change 2387
2387
</ code > </ pre > </ div >
2388
2388
2389
2389
< div > < h4 id ="playsawavfile "> Plays a WAV file:</ h4 > < pre > < code class ="python language-python hljs "> < span class ="hljs-comment "> # $ pip3 install simpleaudio</ span >
2390
- < span class ="hljs-keyword "> import </ span > simpleaudio
2390
+ < span class ="hljs-keyword "> from </ span > simpleaudio < span class =" hljs-keyword " > import </ span > play_buffer
2391
2391
< 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:
2392
2392
p = file.getparams()
2393
2393
frames = file.readframes(p.nframes)
2394
- simpleaudio. play_buffer(frames, p.nchannels, p.sampwidth, p.framerate)
2394
+ play_buffer(frames, p.nchannels, p.sampwidth, p.framerate)
2395
2395
</ code > </ pre > </ div >
2396
2396
2397
2397
< div > < h3 id ="texttospeech "> Text to Speech</ h3 > < pre > < code class ="python language-python hljs "> < span class ="hljs-comment "> # $ pip3 install pyttsx3</ span >
You can’t perform that action at this time.
0 commit comments