One work-around is to use the base pygame.mixer, which is happy to load uncompressed WAV. And while I don't have an 'CABLE Input (VB-Audio Virtual Cable)' device, I do get a nice file of silence, which I validated with the sound-editing program Audacity, and this seems to play OK.import sounddevice as sdfrom scipy.io.wavfile import writeimport pygameimport timeimport randompygame.init()pygame.mixer.init(devicename='CABLE Input (VB-Audio Virtual Cable)')fs = 44100 # Sample rateseconds = 00.1 # Duration of recordingdef main(): for x in range(10000): number = random.randint(1,9999999) myrecording = sd.rec(int(seconds * fs), samplerate=fs, channels=2) sd.wait() # Wait until recording is finished filename = f'output/output{str(number)}.wav' write(filename, fs, myrecording) # Save as uncompressed WAV file # PLAY MIC SOUND HERE print( "Playing [" + filename + "]" ) #pygame.mixer.music.load(filename) #Load the wav #pygame.mixer.music.play() #Play it #while ( pygame.mixer.music.get_busy() ): # wait for the sound to end # time.sleep(00.1) sound = pygame.mixer.Sound(filename) #Load the wav sound.play() #Play it while ( pygame.mixer.get_busy() ): # wait for the sound to end time.sleep(00.1)main() 这篇关于发生异常:错误 mpg123_seek:RVA 模式无效.(代码 12)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-01 16:33