Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAudioProbe tutorial

QAudioProbe tutorial

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pajczur
    wrote on last edited by
    #1

    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;
    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();
    // 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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What platform are you running that code ?

      Did you check that setSource is indeed successful ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pajczur
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Pajczur
            wrote on last edited by
            #5

            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 QAudioBuffer.data(), it gives me array of some values, but I'm not sure if they are values which I'm looking for?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

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

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved