做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

python使用PyGame播放Midi和Mp3文件的方法

來源:懂視網 責編:小采 時間:2020-11-27 14:32:59
文檔

python使用PyGame播放Midi和Mp3文件的方法

python使用PyGame播放Midi和Mp3文件的方法:本文實例講述了python使用PyGame播放Midi和Mp3文件的方法。分享給大家供大家參考。具體實現方法如下: ''' pg_midi_sound101.py play midi music files (also mp3 files) using pygame tested with Python273/331
推薦度:
導讀python使用PyGame播放Midi和Mp3文件的方法:本文實例講述了python使用PyGame播放Midi和Mp3文件的方法。分享給大家供大家參考。具體實現方法如下: ''' pg_midi_sound101.py play midi music files (also mp3 files) using pygame tested with Python273/331

本文實例講述了python使用PyGame播放Midi和Mp3文件的方法。分享給大家供大家參考。具體實現方法如下:

''' pg_midi_sound101.py
play midi music files (also mp3 files) using pygame
tested with Python273/331 and pygame192 by vegaseat
'''
import pygame as pg
def play_music(music_file):
 '''
 stream music with mixer.music module in blocking manner
 this will stream the sound from disk while playing
 '''
 clock = pg.time.Clock()
 try:
 pg.mixer.music.load(music_file)
 print("Music file {} loaded!".format(music_file))
 except pygame.error:
 print("File {} not found! {}".format(music_file, pg.get_error()))
 return
 pg.mixer.music.play()
 # check if playback has finished
 while pg.mixer.music.get_busy():
 clock.tick(30)
# pick a midi or MP3 music file you have in the working folder
# or give full pathname
music_file = "Latin.mid"
#music_file = "Drumtrack.mp3"
freq = 44100 # audio CD quality
bitsize = -16 # unsigned 16 bit
channels = 2 # 1 is mono, 2 is stereo
buffer = 2048 # number of samples (experiment to get right sound)
pg.mixer.init(freq, bitsize, channels, buffer)
# optional volume 0 to 1.0
pg.mixer.music.set_volume(0.8)
try:
 play_music(music_file)
except KeyboardInterrupt:
 # if user hits Ctrl/C then exit
 # (works only in console mode)
 pg.mixer.music.fadeout(1000)
 pg.mixer.music.stop()
 raise SystemExit

希望本文所述對大家的Python程序設計有所幫助。

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

python使用PyGame播放Midi和Mp3文件的方法

python使用PyGame播放Midi和Mp3文件的方法:本文實例講述了python使用PyGame播放Midi和Mp3文件的方法。分享給大家供大家參考。具體實現方法如下: ''' pg_midi_sound101.py play midi music files (also mp3 files) using pygame tested with Python273/331
推薦度:
標簽: MP3音頻 python pygame
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 威宁| 肇州县| 阳东县| 潞城市| 福安市| 固阳县| 东乡族自治县| 湖南省| 广德县| 柳江县| 芷江| 乌鲁木齐市| 上饶县| 沐川县| 镇安县| 镇江市| 博客| 资阳市| 阿拉善左旗| 小金县| 宝鸡市| 阿勒泰市| 梁山县| 台南市| 中江县| 武胜县| 弋阳县| 渝北区| 九龙城区| 黄龙县| 德保县| 乳山市| 新竹市| 拉萨市| 德保县| 读书| 陆丰市| 彰化市| 铜鼓县| 开封县| 习水县|