Skip to content
Snippets Groups Projects
Commit f006f6f5 authored by LAKHAL MAYSSA p2308653's avatar LAKHAL MAYSSA p2308653
Browse files

added upper octave C

parent f2c98e3c
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ import pygame
# tests avec pygame
root_folder = os.path.dirname(os.path.relpath(__file__))
print(f"Root folder: {root_folder}")
# print(f"Root folder: {root_folder}")
# variables
# default octave : 4 (right hand), 3 (left hand)
......@@ -14,23 +14,28 @@ print(f"Root folder: {root_folder}")
right_octave = 4
left_octave = 3
left_hand = ["w", "s", "x", "d", "c", "v", "g", "b", "h", "n", "j", ","]
right_hand = ["r", "(", "t", "-", "y", "u", "_", "i", "ç", "o", "à", "p"]
left_hand = ["w", "s", "x", "d", "c", "v", "g", "b", "h", "n", "j", ",", ";"]
right_hand = ["r", "(", "t", "-", "y", "u", "_", "i", "ç", "o", "à", "p", "^"]
notes = ["C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B"]
notes = ["C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B", "C"]
right_notes = [notes[i] + str(right_octave) for i in range(12)]
left_notes = [notes[i] + str(left_octave) for i in range(12)]
right_notes = [notes[i] + str(right_octave) for i in range(12)]+ [notes[0] + str(right_octave + 1)]
print(right_notes)
left_notes = [notes[i] + str(left_octave) for i in range(12)] + [notes[0] + str(left_octave + 1)]
# functions
pygame.mixer.init()
def play_sound(note):
print(f"Playing sound: {note}")
sound = pygame.mixer.Sound(f"./assets/notes/{note}.wav")
sound.play()
audio_file = os.path.join(root_folder, f"./assets/notes/{note}.wav")
if os.path.isfile(audio_file):
print(f"Playing sound: {audio_file}")
sound = pygame.mixer.Sound(audio_file)
sound.play()
threading.Timer(2.0, sound.stop).start()
else:
print(f"File not found: {audio_file}")
def press(key):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment