
Raspberry Pi에서 사운드가 작동하도록 도와줄 수 있는 사람이 있는지 궁금합니다.
오류 메시지가 계속 나타납니다.
my_sound = pygame.mixer.my_sound('/home/pi/gpio-music-box/samples/drum_tom_mid_hard.wav') AttributeError: module 'pygame.mixer' has no attribute 'my_sound'
코드나 설정에 문제가 있나요? 내 코드는 아래와 같습니다!
감사해요
import pygame
pygame.init
Sound = pygame.mixer.Sound('/home/pi/gpio-music-box/samples/drum_tom_mid_hard.wav')
Sound.play()
답변1
코드가 표시된 것과 같나요? 오류 메시지는 ".sound(...)" 대신 ".my_sound(...)"를 사용했음을 나타냅니다. 작성된 코드는 해당 오류 메시지를 표시하지 않습니다.
보고pygame.mixer에 대한 API 문서, 대문자 "S"가 포함된 ".Sound(...)"여야 하는 것 같습니다. 생성자이므로 의미가 있습니다.