Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to store Audio Input in array?
Qt 6.12 LTS is out! See what's new in the release blog

How to store Audio Input in array?

Scheduled Pinned Locked Moved Solved General and Desktop
10 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.
  • K Offline
    K Offline
    kayakaan02
    wrote on last edited by
    #1
    This post is deleted!
    jsulmJ 1 Reply Last reply
    0
    • K kayakaan02

      This post is deleted!

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @kayakaan02 https://doc.qt.io/qt-5/qaudiooutput.html#start-1 returns QIODevice* which you can use to read the data (see https://doc.qt.io/qt-5/qiodevice.html#readyRead and https://doc.qt.io/qt-5/qiodevice.html#readAll

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

      K 2 Replies Last reply
      2
      • jsulmJ jsulm

        @kayakaan02 https://doc.qt.io/qt-5/qaudiooutput.html#start-1 returns QIODevice* which you can use to read the data (see https://doc.qt.io/qt-5/qiodevice.html#readyRead and https://doc.qt.io/qt-5/qiodevice.html#readAll

        K Offline
        K Offline
        kayakaan02
        wrote on last edited by
        #3

        @jsulm Thank you! I didnt see this. So as I read the data real-time it can also append data to the file?

        jsulmJ 1 Reply Last reply
        0
        • K kayakaan02

          @jsulm Thank you! I didnt see this. So as I read the data real-time it can also append data to the file?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @kayakaan02 Yes, you can also write the data you get from the QIODevice into a file.

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

          1 Reply Last reply
          1
          • jsulmJ jsulm

            @kayakaan02 https://doc.qt.io/qt-5/qaudiooutput.html#start-1 returns QIODevice* which you can use to read the data (see https://doc.qt.io/qt-5/qiodevice.html#readyRead and https://doc.qt.io/qt-5/qiodevice.html#readAll

            K Offline
            K Offline
            kayakaan02
            wrote on last edited by
            #5

            @jsulm I've got an another question, this can read the data but how can I access it? where does it store what it just read? seems like It doesn't return anything.

            JonBJ 1 Reply Last reply
            0
            • K kayakaan02

              @jsulm I've got an another question, this can read the data but how can I access it? where does it store what it just read? seems like It doesn't return anything.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @kayakaan02 said in How to store Audio Input in array?:

              seems like It doesn't return anything.

              What do you mean? When you call QByteArray QIODevice::readAll() it returns a QByteArray of the bytes read. If you have your own char buffer you would prefer it read into there is also qint64 QIODevice::read(char *data, qint64 maxSize).

              K 2 Replies Last reply
              3
              • JonBJ JonB

                @kayakaan02 said in How to store Audio Input in array?:

                seems like It doesn't return anything.

                What do you mean? When you call QByteArray QIODevice::readAll() it returns a QByteArray of the bytes read. If you have your own char buffer you would prefer it read into there is also qint64 QIODevice::read(char *data, qint64 maxSize).

                K Offline
                K Offline
                kayakaan02
                wrote on last edited by
                #7

                @JonB @jsulm thanks, I solved the problem.

                1 Reply Last reply
                0
                • JonBJ JonB

                  @kayakaan02 said in How to store Audio Input in array?:

                  seems like It doesn't return anything.

                  What do you mean? When you call QByteArray QIODevice::readAll() it returns a QByteArray of the bytes read. If you have your own char buffer you would prefer it read into there is also qint64 QIODevice::read(char *data, qint64 maxSize).

                  K Offline
                  K Offline
                  kayakaan02
                  wrote on last edited by
                  #8

                  @JonB So I have another problem, The QByteArray that readAll() returns is empty, and also I compared two .raw files that QAudioInput generated, one of them is recorded while my mic is muted and the other is normal, they have no difference. As I said, It's the same code as shown as example at QT Doc(here)

                  JonBJ 1 Reply Last reply
                  0
                  • K kayakaan02

                    @JonB So I have another problem, The QByteArray that readAll() returns is empty, and also I compared two .raw files that QAudioInput generated, one of them is recorded while my mic is muted and the other is normal, they have no difference. As I said, It's the same code as shown as example at QT Doc(here)

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @kayakaan02 said in How to store Audio Input in array?:

                    The QByteArray that readAll() returns is empty

                    That is not possible provided you call readAll() in the slot for readyRead(), just as I see you have marked as the correct answer from @jsulm above..... If you call readAll() anywhere else it could be empty. Your code cannot be the same as the example you quote since that does not use readAll().

                    K 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @kayakaan02 said in How to store Audio Input in array?:

                      The QByteArray that readAll() returns is empty

                      That is not possible provided you call readAll() in the slot for readyRead(), just as I see you have marked as the correct answer from @jsulm above..... If you call readAll() anywhere else it could be empty. Your code cannot be the same as the example you quote since that does not use readAll().

                      K Offline
                      K Offline
                      kayakaan02
                      wrote on last edited by
                      #10
                      This post is deleted!
                      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
                      • Unsolved