Skip to content

Instantly share code, notes, and snippets.

@HuangJiaLian
Created March 29, 2022 12:32
Show Gist options
  • Save HuangJiaLian/5899ad2f26e4ca3d1e48fcea8f1d515e to your computer and use it in GitHub Desktop.
Save HuangJiaLian/5899ad2f26e4ca3d1e48fcea8f1d515e to your computer and use it in GitHub Desktop.
Play 6/8 time signature
import simpleaudio, time
strong_beat = simpleaudio.WaveObject.from_wave_file('strong_beat.wav')
weak_beat = simpleaudio.WaveObject.from_wave_file('weak_beat.wav')
sub_strong_beat = simpleaudio.WaveObject.from_wave_file('sub_strong_beat.wav')
count = 0
while True:
count = count + 1
if count == 1:
strong_beat.play()
elif count == 4:
sub_strong_beat.play()
else:
weak_beat.play()
if count == 6:
count = 0
time.sleep(0.5/2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment