willy17 commited on
Commit
589d428
·
verified ·
1 Parent(s): 1e84a65

Delete 2 previous changes

Browse files
Files changed (1) hide show
  1. main.py +3 -29
main.py CHANGED
@@ -141,16 +141,7 @@ async def websocket_vibe(websocket: WebSocket):
141
  while is_playing:
142
  beat = 60.0 / current_bpm
143
 
144
- # --- SỬA TẠI ĐÂY: Tạo sự khác biệt nhịp điệu rõ rệt ---
145
- if current_bpm < 75:
146
- step = beat # BPM thấp: Đánh nốt chậm (nốt đen)
147
- elif current_bpm < 100:
148
- step = beat / 2 # BPM trung bình: Nốt móc đơn
149
- else:
150
- step = beat / 4 # BPM cao: Nốt móc kép (Dồn dập)
151
- # ---------------------------------------------------
152
-
153
- # step = beat / 2
154
 
155
  batch = []
156
 
@@ -176,33 +167,16 @@ async def websocket_vibe(websocket: WebSocket):
176
 
177
  notes = []
178
 
179
- # chord
180
- # Chỉ đổi hợp âm tại đầu mỗi batch hoặc sau mỗi 8 nốt
181
- if (note_count + i) % 8 == 0:
182
- chord = random.choice(CHORDS) # Chọn ngẫu nhiên 1 trong 4 hợp âm
183
- # -------------------------------------------------------------
184
-
185
- notes = []
186
- # Tạo nốt Hợp âm (Chord)
187
  if (note_count + i) % 8 == 0:
188
  for c in chord:
189
  notes.append({
190
  "note": c,
191
- "velocity": 35, # Giảm xuống 35 cho êm
192
  "duration": beat * 4,
193
  "type": "chord",
194
  "time": i * step
195
  })
196
-
197
- # if (note_count + i) % 8 == 0:
198
- # for c in chord:
199
- # notes.append({
200
- # "note": c,
201
- # "velocity": 40,
202
- # "duration": beat * 4,
203
- # "type": "chord",
204
- # "time": i * step
205
- # })
206
 
207
  # melody
208
  if midi:
 
141
  while is_playing:
142
  beat = 60.0 / current_bpm
143
 
144
+ step = beat / 2
 
 
 
 
 
 
 
 
 
145
 
146
  batch = []
147
 
 
167
 
168
  notes = []
169
 
170
+ # chord
 
 
 
 
 
 
 
171
  if (note_count + i) % 8 == 0:
172
  for c in chord:
173
  notes.append({
174
  "note": c,
175
+ "velocity": 40,
176
  "duration": beat * 4,
177
  "type": "chord",
178
  "time": i * step
179
  })
 
 
 
 
 
 
 
 
 
 
180
 
181
  # melody
182
  if midi: