【发布时间】:2018-07-08 13:28:32
【问题描述】:
我正在尝试制作节拍垫。我以这样的方式对此进行了编程,即在按下 a 时踢球并在按下 s 时进行圈套。如果我通过按 a-s-a-s 来制作基本节拍,有什么方法可以保存正在发出的声音吗?
import pygame
pygame.init()
screen = pygame.display.set_mode((800,800))
while True:
screen.fill((255,255,255))
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_a:
pygame.mixer.music.load('Kick1.mp3')
pygame.mixer.music.play()
if event.key == pygame.K_s:
pygame.mixer.music.load('Snare1.mp3')
pygame.mixer.music.play()
if event.key == pygame.K_w:
pygame.quit()
quit()
pygame.display.update()
pygame.display.set_caption('Beat pad')
【问题讨论】:
-
您想组合声音并将它们保存为单个声音文件吗?
-
是的,我刚刚想通了。我现在发布答案
标签: python python-3.x audio pygame pyaudio