-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdemo_1_simple.py
More file actions
142 lines (123 loc) · 6.66 KB
/
demo_1_simple.py
File metadata and controls
142 lines (123 loc) · 6.66 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
from modtrack import tracker
import pygame
#################################################################
#MAKE A PATTERN BY HAND, WE USE INTERNAL SAMPLES
#################################################################
tracker.songtitle="byhand"
#we can load a external sample, sample numbers are offset by 1
#tracker.wav2sample('samples/sin_c3_u8b_pcm_8287Hz.wav',0x10,1)
#tracker.wav2sample('samples/sin_c3_u8b_pcm_16574Hz.wav',0x10,4)
#tracker.wav2sample('samples/ClassicGuitar_C3.wav',0x10,4)
#tracker.wav2sample('samples/Flute_C2.wav',0x10,4)
#tracker.wav2sample('samples/bowl_c6.wav',0x10,4)
#tracker.wav2sample('samples/HumanVoice_C4_32Flt.wav',0x10,4)
#tracker.wav2sample('samples/HumanVoice_C4_U8Int.wav',0x10,4)
#tracker.wav2sample('samples/HumanVoice_C4_S16Int.wav',0x40,4)
#tracker.wav2sample('samples/HumanVoice_C4_S32Int.wav',0x10,4)
#tracker.wav2sample('samples/HumanVoice_C4_S24Int.wav',0x10,4)
#tracker.wav2sample('samples/Piano_C3_U8B_PCM_8287Hz.wav',0x10,4)
usr_waveform4= [" x xx ",
" x x x ",
" x x x x x ",
"x x x xx x ",
"x x ",
" x x",
" x x ",
" x "]
tracker.custom_waveform(usr_waveform4,0x40,4)
usr_waveform1= [" xxx",
" x ",
" x ",
"xxx "]
tracker.custom_waveform(usr_waveform1,0x10,1)
# a pattern is 64 rows (positions) and 4 cols (tracks/channels)
# format Note(#) Sharp/Flat(#) Octave(#) Instrument(##) Effect(###)
tracker.octave_transpose=1
pop_corn=[
["C-3 04 000", "C-1 01 C05", "--- 00 000", "--- 00 000"],#00
["--- 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#01
["G-2 04 000", "C-2 01 000", "--- 00 000", "--- 00 000"],#02
["--- 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#03
["D#2 04 000", "C-1 01 000", "--- 00 000", "--- 00 000"],#04
["G-2 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#05
["--- 04 000", "C-2 01 000", "--- 00 000", "--- 00 000"],#06
["--- 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#07
["C-2 04 000", "C-1 01 000", "--- 00 000", "--- 00 000"],#08
["--- 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#09
["--- 04 000", "C-2 01 000", "--- 00 000", "--- 00 000"],#10
["--- 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#11
["C-3 04 000", "C-1 01 000", "--- 00 000", "--- 00 000"],#12
["--- 04 000", "D-1 01 000", "--- 00 000", "--- 00 000"],#13
["A#2 04 000", "D#1 01 000", "--- 00 000", "--- 00 000"],#14
["--- 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#15
["C-3 04 000", "C-1 01 000", "--- 00 000", "--- 00 000"],#16
["--- 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#17
["G-2 04 000", "C-2 01 000", "--- 00 000", "--- 00 000"],#18
["--- 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#19
["D#2 04 000", "C-1 01 000", "--- 00 000", "--- 00 000"],#20
["G-2 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#21
["--- 04 000", "C-2 01 000", "--- 00 000", "--- 00 000"],#22
["C-2 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#23
["--- 04 000", "C-1 01 000", "--- 00 000", "--- 00 000"],#24
["--- 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#25
["--- 04 000", "C-2 01 000", "--- 00 000", "--- 00 000"],#26
["--- 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#27
["C-3 04 000", "C-1 01 000", "--- 00 000", "--- 00 000"],#28
["--- 04 000", "D-1 01 000", "--- 00 000", "--- 00 000"],#29
["D-3 04 000", "D#1 01 000", "--- 00 000", "--- 00 000"],#30
["--- 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#31
["D#3 04 000", "D#1 01 000", "--- 00 000", "--- 00 000"],#32
["--- 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#33
["D-3 04 000", "D#2 01 000", "--- 00 000", "--- 00 000"],#34
["D#3 04 000", "A#1 01 000", "--- 00 000", "--- 00 000"],#35
["--- 04 000", "D#1 01 000", "--- 00 000", "--- 00 000"],#36
["D#3 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#37
["C-3 04 000", "D#2 01 000", "--- 00 000", "--- 00 000"],#38
["--- 04 000", "A#1 01 000", "--- 00 000", "--- 00 000"],#39
["D-3 04 000", "A#0 01 000", "--- 00 000", "--- 00 000"],#40
["--- 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#41
["C-3 04 000", "A#1 01 000", "--- 00 000", "--- 00 000"],#42
["D-3 04 000", "F-1 01 000", "--- 00 000", "--- 00 000"],#43
["--- 04 000", "A#0 01 000", "--- 00 000", "--- 00 000"],#44
["D-3 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#45
["A#2 04 000", "A#1 01 000", "--- 00 000", "--- 00 000"],#46
["--- 04 000", "F-1 01 000", "--- 00 000", "--- 00 000"],#47
["C-3 04 000", "G#0 01 000", "--- 00 000", "--- 00 000"],#48
["--- 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#49
["A#2 04 000", "G#1 01 000", "--- 00 000", "--- 00 000"],#50
["C-3 04 000", "D#1 01 000", "--- 00 000", "--- 00 000"],#51
["--- 04 000", "G#0 01 000", "--- 00 000", "--- 00 000"],#52
["C-3 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#53
["G#2 04 000", "G#1 01 000", "--- 00 000", "--- 00 000"],#54
["--- 04 000", "D#1 01 000", "--- 00 000", "--- 00 000"],#55
["C-3 04 000", "C-1 01 000", "--- 00 000", "--- 00 000"],#56
["--- 04 000", "--- 01 000", "--- 00 000", "--- 00 000"],#57
["--- 04 000", "C-2 01 000", "--- 00 000", "--- 00 000"],#58
["--- 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#59
["C-3 04 000", "C-1 01 000", "--- 00 000", "--- 00 000"],#60
["--- 04 000", "D-1 01 000", "--- 00 000", "--- 00 000"],#61
["A#2 04 000", "D#1 01 000", "--- 00 000", "--- 00 000"],#62
["--- 04 000", "G-1 01 000", "--- 00 000", "--- 00 000"],#63
]
pop_corn=pop_corn+pop_corn
#################################################################
#INIT, MAKE AND PLAY
#################################################################
screen=tracker.init(0x10,(100,100))
tracker.make_pattern(True,pop_corn)
tracker.play_pattern()
#################################################################
#PLAY WHILE USER DOES NOT QUIT PROGRAM
#################################################################
while True:#player.isAlive():
for event in pygame.event.get():
#Key event
if event.type == pygame.KEYDOWN:
#Close window
if event.key==pygame.K_ESCAPE:
tracker.abort_play()
quit()
# Window Close Button
if event.type == pygame.QUIT:
tracker.abort_play()
quit()