2017-02-15 408 views
0

我的代码是:sounddevice.PortAudioError:错误打开的OutputStream:渠道数量无效

import scipy.io as sio 
import sounddevice as sd 
xx= sio.loadmat('C:\\Users\\dell\\Desktop\\Rabia Ahmad spring 2016\\FYP\\1. Matlab Work\\record work\\aa.mat')['aa'] 
sd.play(xx,64000) 

我得到了错误sounddevice.PortAudioError:错误打开的OutputStream:无效的通道数

+0

什么是'xx.shape'? –

+0

@WarrenWeckesser其(1,4999) –

回答

2

在评论,你说xx已形成(1, 4999)sounddevice.play正在将此解释为带有4999个通道的单个样本!

transposing the array尝试,所以play看到阵列作为信号4999个样品用1个通道:

sd.play(xx.T, 64000)