QAudioProbe tutorial

  • Hello,
    sorry if not appropriate question, but I'm beginner in QT creator, and have a lot of problems with understanding some classes and functions.

    In the documentation of QT - Audio overview, I found that piece of code:

    audioRecorder = new QAudioRecorder;
    QAudioEncoderSettings audioSettings;
    audioProbe = new QAudioProbe(this);
    if (audioProbe->setSource(audioRecorder)) {
        // Probing succeeded, audioProbe->isValid() should be true.
        connect(audioProbe, SIGNAL(audioBufferProbed(QAudioBuffer)),
                this, SLOT(calculateLevel(QAudioBuffer)));
    // Now audio buffers being recorded should be signaled
    // by the probe, so we can do things like calculating the
    // audio power level, or performing a frequency transform

    And the last sentence in comment sounds great for me, I mean "we can do things like calculating the audio power level, or performing a frequency transform". But the problem is, how to do thosÄ™ frequency transform performing or calculating audio power level?
    I searched the answer in exact documentation for QAudioProbe class, but there I also didn't find the answer. I tried QT example project "Audio Recorder", there is QAudioProbe in use, but though I'm not totally begginer in C++, it is very difficult to understand for me. Maybe that is because I have too less QT experience. Fortunately I can manage QAudioRecorder class, I understand it a little bit. But still have big problems with other classes like QAudioInput, QAudioDeviceInfo etc.

    Please could you help me in any way? Maybe you know some tutorials (step by step) with using of QAudio classes. How to start working with it?

    For any help thanks in advance.

  • Lifetime Qt Champion


    What platform are you running that code ?

    Did you check that setSource is indeed successful ?

  • Hey,
    thanks for reply.

    I use OS X.
    And yes setSource is succesful. The problem is for me how to get frequency value of recorded audio?

  • Lifetime Qt Champion

    You have to do the math yourself using a Fourier Transform.

  • Hello, thanks for reply.
    Yes I know math issue (fft) but first I need to get audio waveform as array of values, and then I know how to make fourier transformation, but how to get that waveform.
    I found something like, it gives me array of some values, but I'm not sure if they are values which I'm looking for?

  • Lifetime Qt Champion

    A QAudioBuffer contains a sample of audio data following the format used by the input usually interleaved.

Log in to reply