亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Python MusicalBeeps 導致錯誤

Python MusicalBeeps 導致錯誤

楊__羊羊 2022-12-14 20:55:22
我開始使用模塊MusicalBeeps嘗試在 Python 中播放音樂,但是,每當我嘗試讓播放器播放噪音時,我都會遇到一個巨大的錯誤。我的代碼現在看起來像這樣:import musicalbeeps as musicglobal TempPlayerdef PlayNote(Note, Octive, Accidental, Duration, Volume):  #Accidental is either # (sharp) or b (flat) or '' (none)  global TempPlayer  TempPlayer = music.Player(volume = float(Volume), mute_output = False)  TempPlayer.play_note("{}{}{}".format(Note, Octive, Accidental), Duration)  TempPlayer = Noneprint("Running...")PlayNote("B", 4, "#", 5, 1)print("Done!")這是他們在網站上展示的示例,但是每當我嘗試運行它時,我都會收到這個奇怪的錯誤:ALSA lib confmisc.c:767:(parse_card) cannot find card '0'ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directoryALSA lib confmisc.c:392:(snd_func_concat) error evaluating stringsALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directoryALSA lib confmisc.c:1246:(snd_func_refer) error evaluating nameALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directoryALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directoryALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM defaultTraceback (most recent call last):  File "main.py", line 13, in <module>    PlayNote("B", 4, "#", 5, 1)  File "main.py", line 9, in PlayNote順便說一句,我正在使用repl.it來制作它,并且我已經將 musicbeeps 模塊下載到文件中。請幫忙,我只是想做一個簡單的項目??
查看完整描述

1 回答

?
慕田峪9158850

TA貢獻1794條經驗 獲得超7個贊

感謝您提供已安裝包的鏈接 - 它可以更輕松地找到解決方案。MusicalBeeps 依賴于 simpleaudio,它需要(至少在 linux 上——當你發布 ALSA 錯誤時,我假設這是 Linux)安裝 libasound2-dev 開發庫。請參閱https://simpleaudio.readthedocs.io/en/latest/installation.html#linux-dependencies


查看完整回答
反對 回復 2022-12-14
  • 1 回答
  • 0 關注
  • 101 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號