Simplify WAV example.
This commit is contained in:
parent
0f12bb890f
commit
7d688f005f
3 changed files with 3 additions and 27 deletions
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
CircuitPython I2S MP3 playback example.
|
||||
Plays a single MP3 once.
|
||||
Plays an MP3 once.
|
||||
|
||||
Remove this line and all of the following docstring content before submitting to the Learn repo.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"""
|
||||
CircuitPython I2S WAV file playback.
|
||||
Plays a WAV file for six seconds, pauses
|
||||
for two seconds, then resumes and plays
|
||||
the file to the end.
|
||||
Plays a WAV file once.
|
||||
|
||||
Remove this line and all of the following docstring content before submitting to the Learn repo.
|
||||
|
||||
|
|
@ -15,7 +13,6 @@ Update the following pin names to a viable pin combination:
|
|||
* WORD_SELECT_PIN
|
||||
* DATA_PIN
|
||||
"""
|
||||
import time
|
||||
import audiocore
|
||||
import board
|
||||
import audiobusio
|
||||
|
|
@ -27,15 +24,6 @@ wav = audiocore.WaveFile(wave_file)
|
|||
|
||||
print("Playing wav file!")
|
||||
audio.play(wav)
|
||||
t = time.monotonic()
|
||||
while time.monotonic() - t < 6:
|
||||
pass
|
||||
|
||||
print("Pausing!")
|
||||
audio.pause()
|
||||
time.sleep(2)
|
||||
print("Resuming!")
|
||||
audio.resume()
|
||||
while audio.playing:
|
||||
pass
|
||||
print("Done!")
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
"""
|
||||
CircuitPython I2S WAV file playback.
|
||||
Plays a WAV file for six seconds, pauses
|
||||
for two seconds, then resumes and plays
|
||||
the file to the end.
|
||||
Plays a WAV file once.
|
||||
"""
|
||||
import time
|
||||
import audiocore
|
||||
import board
|
||||
import audiobusio
|
||||
|
|
@ -16,15 +13,6 @@ wav = audiocore.WaveFile(wave_file)
|
|||
|
||||
print("Playing wav file!")
|
||||
audio.play(wav)
|
||||
t = time.monotonic()
|
||||
while time.monotonic() - t < 6:
|
||||
pass
|
||||
|
||||
print("Pausing!")
|
||||
audio.pause()
|
||||
time.sleep(2)
|
||||
print("Resuming!")
|
||||
audio.resume()
|
||||
while audio.playing:
|
||||
pass
|
||||
print("Done!")
|
||||
|
|
|
|||
Loading…
Reference in a new issue