QT creator monitor audio input
-
Hello,
thanks for your reply.
By "monitor" I mean something like on that video: https://www.youtube.com/watch?v=JYqQCP0yo2oI know how to make it easly when I use QAudioRecorder as a source for QAudioProbe, something like that:
QAudioProbe->setSource(QAudioRecorder); // It works greatbut that:
QAudioProbe->setSource(QAudioInput); // That doesn't workI know QAudioProbe accepts as a source QAudioRecorder or QMediaObject. So the goal is how to convert QAudioInput to be QMediaObject?
-
Then there's no real need for QAudioProbe in your case, you can process the audio data you get from QAudioInput.
-
Hello,
great thanks for your reply, but could you give any advaice (not asking for solution but any advice) how to do that?And I still think I need QAudioProbe also because later I want also check and display the musical tone frequency of recorded audio. So don't you think it's good idea to use QAudioProbe? Or maybe for that case I don't need it also?
-
You likely going to get stereo data most of the time then check the buffer size and you'll known how many audio frame you have in one sample, then convert its content in DB so you can then paint your scale based on that.
As for audio probe, just keep the common code in one place so you can re-use it with your probe.
-
Hello,
great thanks for your reply. I trained a little bit with QAudioProbe and now I think I understand it a little bit more.But I am not sure what you mean, and how to understand your answer.
To be clear my code is:QAudioRecorder * audioRecorder = new QAudioRecorder(this); probe = new QAudioProbe; connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer))); probka->setSource(audioRecorder);
And slot looks like that:
void MainWindow::processBuffer(const QAudioBuffer& buffer) { qDebug() << buffer.byteCount(); qDebug() << sizeof(buffer); qDebug() << buffer.frameCount(); }
And my doubts to your answer are:
-
"You likely going to get stereo data most of the time..." - actually I am going to record only mono microphone signal, so why you suppose I going to get stereo?
-
What do you mean "check buffer size"? If I use just regular C++ sizeof(QAudioBuffer) I get just a lot of eights, like that: 888888888888....
But when I use QAudioBuffer.byteCount(); I get a lot of 4096.
When I use buffer.frameCount(); I get a lot of 2048. -
What do you mean DB? Are you talking about decibels? So then we are not talking about frequency but about loudness/volume? Actually now I know how to get and set audio volume. As you told: I don't even need QAudioProbe. QAudioRecorder::Volume, and setVolume do the job. But now my issue is to get frequency of recorded audio. Something like in guitar tuner. And I have no idea how to get that. Even don't know if QAudioProbe can provide me that solution? Maybe I should focus on something totally differen?
-
-
-
Most of the times people listen in stereo
-
frameCount/byteCount
-
Decibel indeed. The video you showed is a VU-meter so it's not showing the volume you set but the loudness of the sound at the volume you set. So in fact you'd like to make a Spectrogram ?
-
-
-
Frame count is the number of audio frames available in the buffer. Its value will depend on the format of the audio input. The bye count is the number of bytes of data in the buffer.
-
Hello, thanks for your repy,
yes I think I understand what is frames count and byte count. But I have no idea how to use those valu to my issue. As you told they depend on the format of the audio input, and ones you set it they are always the same valu, so how I can take the advantage of it?For any help thanks in advance.
Best Regards -
You then know how the data are arranged in your array as well as there range and the number of millisecond worth of them.