Spyder(Python 35)音频

时间:2016-07-15 16:20:34

标签: python-3.x audio spyder

我在Windows 64位上使用python 3.5,我一直试图在我的代码中加入一些声音。

我在spyder中尝试了两个程序,但我仍然无法让它工作。这两个程序都运行没有错误,但我听不到任何声音。我认为问题可能出在spyder本身?我不确定。我尝试重置spyder设置,但它仍然无法正常工作。有人可以帮忙吗?

两个代码:

import pygame
#import os
pygame.init()
pygame.mixer.init()
sounda= pygame.mixer.Sound("b001c012.wav")
#os.system

sounda.play()





import os
from datetime import datetime

debug = True

def playASound(x):
    if debug == True:
        print(x,end = ' - ')
        print(daysound[x])

    todaysound = 'aplay' + sayDayDirectory + daysound[x] + '.wav -R 1'
    os.system(todaysound)

sayDayDirectory = '/home/pi/exercise\ files/dayOfWeekSounds/'
daysound = ['monday','tuesday','wednesday','thursday','friday','saturday','sunday']
todaysDate = datetime.now()
todaysDay = datetime.weekday(todaysDate)

playASound(todaysDay)

if debug == True:
    print('other sounds are ')
    for n in range(0,7):
        playASound(n)

0 个答案:

没有答案