gpt4 book ai didi

javascript - 我可以使用Java音频通过ALAudioDevice(setClientPreferences,然后进行订阅)从Pepper的麦克风流式传输音频吗?

转载 作者:行者123 更新时间:2023-12-03 01:16:41 24 4
gpt4 key购买 nike

我已使用python成功将Pepper麦克风的音频流传输到笔记本:

 class SoundReceiverModule(naoqi.ALModule):
.......
def start( self ):
audio = naoqi.ALProxy( "ALAudioDevice", self.strNaoIp, 9559 );
nNbrChannelFlag = 3;
nDeinterleave = 0;
nSampleRate = 48000;
audio.setClientPreferences( self.getName(), nSampleRate, nNbrChannelFlag, nDeinterleave );
audio.subscribe( self.getName() );

def processRemote( self, nbOfChannels, nbrOfSamplesByChannel, aTimeStamp, buffer ):
aSoundDataInterlaced = np.fromstring( str(buffer), dtype=np.int16 );
aSoundData = np.reshape( aSoundDataInterlaced, (nbOfChannels, nbrOfSamplesByChannel), 'F' );
.......

但是,当我使用Javascript进行操作时,订阅ALAudioDevice后没有产生信号。谁能帮我解决这个问题?谢谢!

最佳答案

目前,我无法对此进行测试,但是我希望这可以作为起点。请让我知道是否可行,否则您会遇到任何错误。

class SoundReceiverModule {
constructor(){
}
processRemote(nbOfChannels, nbrOfSamplesByChannel, buffer, timeStamp){
console.log(buffer)
}
}

const channels = 3;
const deinterleaved = 0;
const sampleRate = 48000;
const moduleName = SoundReceiverModule.name;

// with /libs/qimessaging/2/qimessaging.js included
QiSession.connect(function (session) {
session.service("ALAudioDevice").then(function (ALAudioDevice) {
ALAudioDevice.setClientPreferences(moduleName, sampleRate, channels, deinterleaved);
ALAudioDevice.subscribe(moduleName);
});
});

关于javascript - 我可以使用Java音频通过ALAudioDevice(setClientPreferences,然后进行订阅)从Pepper的麦克风流式传输音频吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62305013/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com