Skip to content

Instantly share code, notes, and snippets.

@HuangJiaLian
Created March 29, 2022 11:56
Show Gist options
  • Save HuangJiaLian/f483b8baddacc40772df265701be3d4a to your computer and use it in GitHub Desktop.
Save HuangJiaLian/f483b8baddacc40772df265701be3d4a to your computer and use it in GitHub Desktop.
Play strong and weak beats
import simpleaudio, time
strong_beat = simpleaudio.WaveObject.from_wave_file('strong_beat.wav')
weak_beat = simpleaudio.WaveObject.from_wave_file('weak_beat.wav')
count = 0
while True:
count = count + 1
if count == 1:
strong_beat.play()
else:
weak_beat.play()
if count == 4:
count = 0
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment