maemo (N900) 上的 Qt 应用程序中的同步音频流
请问N900手机可以进行语音串流吗?我需要缓冲来自麦克风的语音样本并同时将语音从其他缓冲区发送到扬声器? 你认为这可能吗?如何实现? 现在我正在使用文件来录制和播放音频。但这是不同步的。
录音:
outputFile.setFileName("/tmp/test.raw");
outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate );
QAudioFormat format;
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(16);
format.setSampleType(QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setCodec("audio/pcm");
QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
qDebug() << info.availableDevices(QAudio::AudioInput).at(1).deviceName();
if (!info.isFormatSupported(format)) {
qWarning() << "Default format not supported - trying to use nearest";
format = info.nearestFormat(format);
}
/////////////////////////////
audio = new QAudioInput(info,format, this);
QTimer::singleShot(5000, this, SLOT(stopRecording()));
audio->start(&outputFile);
播放:
inputFile.setFileName("/tmp/test.raw");
inputFile.open( QIODevice::ReadOnly );
QAudioFormat format;
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(16);
format.setSampleType(QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setCodec("audio/pcm");
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
if (!info.isFormatSupported(format)) {
qWarning()<<"raw audio format not supported by backend, cannot play audio.";
format = info.nearestFormat(format);
}
audio2 = new QAudioOutput(format, this);
connect(audio2,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State)));
audio2->start(&inputFile);
我需要缓冲麦克风中的语音样本,并同时将语音从其他缓冲区发送到扬声器。我怎样才能做到这一点?
I wonder if it is possible to perform voice streaming on N900 phone? I need to buffer voice samples from the micrphone and symultanously send voice from other buffer to speaker?
Do you thing it is possible and how?
now i am using files to record and play audio. but this is not synchronized.
recording:
outputFile.setFileName("/tmp/test.raw");
outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate );
QAudioFormat format;
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(16);
format.setSampleType(QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setCodec("audio/pcm");
QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
qDebug() << info.availableDevices(QAudio::AudioInput).at(1).deviceName();
if (!info.isFormatSupported(format)) {
qWarning() << "Default format not supported - trying to use nearest";
format = info.nearestFormat(format);
}
/////////////////////////////
audio = new QAudioInput(info,format, this);
QTimer::singleShot(5000, this, SLOT(stopRecording()));
audio->start(&outputFile);
palying:
inputFile.setFileName("/tmp/test.raw");
inputFile.open( QIODevice::ReadOnly );
QAudioFormat format;
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(16);
format.setSampleType(QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setCodec("audio/pcm");
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
if (!info.isFormatSupported(format)) {
qWarning()<<"raw audio format not supported by backend, cannot play audio.";
format = info.nearestFormat(format);
}
audio2 = new QAudioOutput(format, this);
connect(audio2,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State)));
audio2->start(&inputFile);
I need to buffer voice samples from the micrphone and symultanously send voice from other buffer to speaker. how i can do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论