Unsolved Qt audio loudness level
-
Hi.
How can I meter loudness level of a streaming voice from microphone by qt? Is it that what I want?audioRecorder = new QAudioRecorder; QAudioEncoderSettings audioSettings; audioSettings.setCodec("audio/amr"); audioSettings.setQuality(QMultimedia::HighQuality); audioRecorder->setEncodingSettings(audioSettings); audioRecorder->setOutputLocation(QUrl::fromLocalFile("test.amr")); audioProbe = new QAudioProbe(this); if (audioProbe->setSource(audioRecorder)) { // Probing succeeded, audioProbe->isValid() should be true. connect(audioProbe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(calculateLevel(QAudioBuffer))); } audioRecorder->record();
And whats the output of this code? What audio standard(decibel or others) is its output?
calculateLevel(QAudioBuffer)
-
Hi and welcome to devnet,
AFAIK, there's only one standard to measure audio loudness it's decibel but you have to calculate that yourself.
You have all the information available through the QAudioBuffer class in order to calculate that.
-
Tnx but could you tell me how can I calculate it(stream audio) as decibel by this class?
I'm an absolute beginner.tnx -
Hi
You have access to the raw buffer
http://doc.qt.io/qt-5/qaudiobuffer.html#constData
that has a given volume/loudness so its not exact science but you can google
around for various ways ( sorry, not sound expert so cant give any concrete solution)
https://stackoverflow.com/questions/2445756/how-can-i-calculate-audio-db-level -
@addr3ss
Hi ,
There is a standard defined for audio loudness including five meters and four of them are in dB.
You can find them by search easily.
Also you can use this link: https://www.mathworks.com/help/audio/ref/loudnessmeter-system-object.html
Good luck.