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. Render/Play Audio buffer data
Forum Updated to NodeBB v4.3 + New Features

Render/Play Audio buffer data

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.9k 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.
  • S Offline
    S Offline
    sankar-110
    wrote on 11 Jun 2018, 06:48 last edited by
    #1

    Hi all,
    I have an Audio buffer (PCM samples) and I need to render/play the buffer using the system speaker. How can I achieve this?
    Any help would be appreciated.

    J 1 Reply Last reply 11 Jun 2018, 06:51
    0
    • S sankar-110
      11 Jun 2018, 06:48

      Hi all,
      I have an Audio buffer (PCM samples) and I need to render/play the buffer using the system speaker. How can I achieve this?
      Any help would be appreciated.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 11 Jun 2018, 06:51 last edited by
      #2

      @sankar-110 What about http://doc.qt.io/qt-5/qaudiooutput.html ?

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

      1 Reply Last reply
      1
      • S Offline
        S Offline
        sankar-110
        wrote on 12 Jun 2018, 05:12 last edited by
        #3

        @jsulm ,
        I have checked Qaudiooutput.
        In the example mentioned they have given the source file as a "filepath".
        But my buffer is not a file, rather it is continuous data given by the PCI device.
        how do I render/play this?

        J 1 Reply Last reply 12 Jun 2018, 05:25
        0
        • S sankar-110
          12 Jun 2018, 05:12

          @jsulm ,
          I have checked Qaudiooutput.
          In the example mentioned they have given the source file as a "filepath".
          But my buffer is not a file, rather it is continuous data given by the PCI device.
          how do I render/play this?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 12 Jun 2018, 05:25 last edited by
          #4

          @sankar-110 How exactly do you get your audio data? In which format? It does not have to be a file - it is QIODevice: http://doc.qt.io/qt-5/qaudiooutput.html#start

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

          1 Reply Last reply
          1
          • K Offline
            K Offline
            KillerSmath
            wrote on 12 Jun 2018, 05:55 last edited by KillerSmath 6 Dec 2018, 06:00
            #5

            @sankar-110
            You can create a object of type buffer and set the data given by the PCI device (probably a char array)

            Simple example:

               char *bufferArray;
            
               QBuffer buffer;
            
               buffer.setData(bufferArray, <replace by size of bufferarray>);
            
               // format has been declared before this line
               QAudioOutput* audio = new QAudioOutput(format);
               audio.start(&buffer);
            

            References:

            http://doc.qt.io/qt-5/qbuffer.html#setData-1
            http://doc.qt.io/qt-5/qbuffer.html#QBuffer-1

            @Computer Science Student - Brazil
            Web Developer and Researcher
            “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

            1 Reply Last reply
            2

            3/5

            12 Jun 2018, 05:12

            • Login

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