-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatatoBand.py
110 lines (89 loc) · 2.84 KB
/
patatoBand.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import os
import pygame
from pygame.locals import *
pygame.init()
piano1 = pygame.mixer.Sound("piano1.wav")
piano2 = pygame.mixer.Sound("piano2.wav")
piano3 = pygame.mixer.Sound("piano3.wav")
battery1 = pygame.mixer.Sound("battery1.wav")
battery2 = pygame.mixer.Sound("battery2.wav")
battery3 = pygame.mixer.Sound("battery3.wav")
fenetre = pygame.display.set_mode((640, 480))
reset = 0
touch = 0
### MODE PIANO ###
def piano():
print("Mode piano active")
while 1:
fichierVar = open("var.txt", "r")
touch = fichierVar.read()
if touch == "1" and reset == 0:
reset = 1
print("Contact 1 doigt")
piano1.play()
if touch == "2" and reset == 0:
reset = 1
print("Contact 2 doigts")
piano2.play()
if touch == "3" and reset == 0:
reset = 1
print("Contact 3 doigts")
piano3.play()
if touch == "0":
reset = 0
for event in pygame.event.get():
if event.type == QUIT:
continuer = 0
if event.type == KEYDOWN and event.key == K_SPACE:
guitar()
### MODE GUITARE ###
def guitar():
print("Mode guitar active")
while 1:
fichierVar = open("var.txt", "r")
touch = fichierVar.read()
if touch == "1" and reset == 0:
reset = 1
print("Contact 1 doigt")
guitar1.play()
if touch == "2" and reset == 0:
reset = 1
print("Contact 2 doigts")
guitar2.play()
if touch == "3" and reset == 0:
reset = 1
print("Contact 3 doigts")
guitar3.play()
if touch == "0":
reset = 0
for event in pygame.event.get():
if event.type == QUIT:
continuer = 0
if event.type == KEYDOWN and event.key == K_SPACE:
batterie()
### MODE BATTERIE ###
def batterie():
print("Mode batterie active")
while 1:
fichierVar = open("var.txt", "r")
touch = fichierVar.read()
if touch == "1" and reset == 0:
reset = 1
print("Contact 1 doigt")
battery1.play()
if touch == "2" and reset == 0:
reset = 1
print("Contact 2 doigts")
battery2.play()
if touch == "3" and reset == 0:
reset = 1
print("Contact 3 doigts")
battery3.play()
if touch == "0":
reset = 0
for event in pygame.event.get():
if event.type == QUIT:
continuer = 0
if event.type == KEYDOWN and event.key == K_SPACE:
piano()
piano()