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. How to get QAudioBuffer from QAudioProbe in Pyqt5 ?
Forum Updated to NodeBB v4.3 + New Features

How to get QAudioBuffer from QAudioProbe in Pyqt5 ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 517 Views 1 Watching
  • 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.
  • H Offline
    H Offline
    HandsomeLeonard
    wrote on last edited by
    #1

    It's my first question here.

    I want to get the audio volume level when I use the QAudioRecorder, I looked it up in all websites, they told me to use audioBufferProbed signal from QAudioProbe, but what should I do after connecting the signal with the slot function to process the buffer, and I don't even know where the QAudioBuffer data is from

    a part of my code is below, what should I add to get access to processing the audio recoded by the recorder?
    Thank you!

            self.m_audioRecorder = QAudioRecorder()
            self.m_probe = QAudioProbe()
            self.m_probe.setSource(self.m_audioRecorder)
            self.m_probe.audioBufferProbed.connect(self.processBuffer)
            def processBuffer(self)
                    pass
    
    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by Bonnie
      #2

      The processBuffer function should have a QAudioBuffer as parameter.
      So when the function is called, you get a QAudioBuffer object, from the parameter.
      Sorry I don't use Py, but your processBuffer definition seems to need another parameter.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        HandsomeLeonard
        wrote on last edited by
        #3

        thank you ,so in C++ version where is the AudioBuffer object from?

        I saw code like this in C++ QT tutorial, I don't understand where the parameter buffer for processBuffer function is from

        connect(m_probe, &QAudioProbe::audioBufferProbed,
                    this, &AudioRecorder::processBuffer);
        
        void AudioRecorder::processBuffer(const QAudioBuffer& buffer);
        
        jsulmJ 1 Reply Last reply
        0
        • H HandsomeLeonard

          thank you ,so in C++ version where is the AudioBuffer object from?

          I saw code like this in C++ QT tutorial, I don't understand where the parameter buffer for processBuffer function is from

          connect(m_probe, &QAudioProbe::audioBufferProbed,
                      this, &AudioRecorder::processBuffer);
          
          void AudioRecorder::processBuffer(const QAudioBuffer& buffer);
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @HandsomeLeonard said in How to get QAudioBuffer from QAudioProbe in Pyqt5 ?:

          I don't understand where the parameter buffer for processBuffer function is from

          Here: https://doc.qt.io/qt-5/qaudioprobe.html#audioBufferProbed
          The signal parameter is passed from the signal emitter (m_probe in your case).

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • eyllanescE Offline
            eyllanescE Offline
            eyllanesc
            wrote on last edited by
            #5

            @HandsomeLeonard change to def processBuffer(self, buffer):

            If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

            1 Reply Last reply
            1

            • Login

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