sounddevice.PortAudioError:打开OutputStream时出错:通道数无效

时间:2017-02-15 16:39:21

标签: python-3.x numpy scipy python-sounddevice

我的代码是:

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时出错:频道数无效

1 个答案:

答案 0 :(得分:2)

在评论中,您说xx的形状为(1, 4999)sounddevice.play将此解释为具有4999个频道的单个示例!

尝试transposing the array,因此play将数组视为4999个信道样本,包含1个频道:

sd.play(xx.T, 64000)