Skip to content

Commit ec7298c

Browse files
authored
Merge pull request #1828 from kattni/wav-update
Simplify WAV example.
2 parents 0f12bb8 + 7d688f0 commit ec7298c

3 files changed

Lines changed: 3 additions & 27 deletions

File tree

  • CircuitPython_Templates
  • MP3_Playback_RP2040/Pico_I2S_WAV

CircuitPython_Templates/i2s_mp3_playback/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
CircuitPython I2S MP3 playback example.
3-
Plays a single MP3 once.
3+
Plays an MP3 once.
44
55
Remove this line and all of the following docstring content before submitting to the Learn repo.
66
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""
22
CircuitPython I2S WAV file playback.
3-
Plays a WAV file for six seconds, pauses
4-
for two seconds, then resumes and plays
5-
the file to the end.
3+
Plays a WAV file once.
64
75
Remove this line and all of the following docstring content before submitting to the Learn repo.
86
@@ -15,7 +13,6 @@
1513
* WORD_SELECT_PIN
1614
* DATA_PIN
1715
"""
18-
import time
1916
import audiocore
2017
import board
2118
import audiobusio
@@ -27,15 +24,6 @@
2724

2825
print("Playing wav file!")
2926
audio.play(wav)
30-
t = time.monotonic()
31-
while time.monotonic() - t < 6:
32-
pass
33-
34-
print("Pausing!")
35-
audio.pause()
36-
time.sleep(2)
37-
print("Resuming!")
38-
audio.resume()
3927
while audio.playing:
4028
pass
4129
print("Done!")
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
"""
22
CircuitPython I2S WAV file playback.
3-
Plays a WAV file for six seconds, pauses
4-
for two seconds, then resumes and plays
5-
the file to the end.
3+
Plays a WAV file once.
64
"""
7-
import time
85
import audiocore
96
import board
107
import audiobusio
@@ -16,15 +13,6 @@
1613

1714
print("Playing wav file!")
1815
audio.play(wav)
19-
t = time.monotonic()
20-
while time.monotonic() - t < 6:
21-
pass
22-
23-
print("Pausing!")
24-
audio.pause()
25-
time.sleep(2)
26-
print("Resuming!")
27-
audio.resume()
2816
while audio.playing:
2917
pass
3018
print("Done!")

0 commit comments

Comments
 (0)