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. Play and record audio at the same time
QtWS25 Last Chance

Play and record audio at the same time

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 4 Posters 1.2k 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.
  • QtAndrewQ Offline
    QtAndrewQ Offline
    QtAndrew
    wrote on last edited by QtAndrew
    #3

    The project is now on GitHub: https://github.com/Christoph-Lauer/Impulse-Response-Extractor

    mrjjM 1 Reply Last reply
    0
    • QtAndrewQ QtAndrew

      The project is now on GitHub: https://github.com/Christoph-Lauer/Impulse-Response-Extractor

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @QtAndrew

      Hi
      please hook up recorder's error signal to see if something is raised when you try to record.

      QtAndrewQ 1 Reply Last reply
      0
      • mrjjM mrjj

        @QtAndrew

        Hi
        please hook up recorder's error signal to see if something is raised when you try to record.

        QtAndrewQ Offline
        QtAndrewQ Offline
        QtAndrew
        wrote on last edited by
        #5

        @mrjj There is the other problem that the whole sound processing should be "Synthetic Sound Processing". This means that no files should be played but signal array should be generated, PLAYED and RECORDED simulaneously. And i have cannot find any examples....

        mrjjM 1 Reply Last reply
        0
        • QtAndrewQ QtAndrew

          @mrjj There is the other problem that the whole sound processing should be "Synthetic Sound Processing". This means that no files should be played but signal array should be generated, PLAYED and RECORDED simulaneously. And i have cannot find any examples....

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #6

          @QtAndrew

          Hi
          You mean an example of tone generation ?
          https://doc.qt.io/qt-5.12/qtmultimedia-multimedia-spectrum-app-tonegenerator-cpp.html

          1 Reply Last reply
          0
          • QtAndrewQ Offline
            QtAndrewQ Offline
            QtAndrew
            wrote on last edited by
            #7

            No the generation and the signal processing is clear for me. I mean the technical handling of the SIMULTANEOUS PLAY and RECORD.

            mrjjM 1 Reply Last reply
            0
            • QtAndrewQ QtAndrew

              No the generation and the signal processing is clear for me. I mean the technical handling of the SIMULTANEOUS PLAY and RECORD.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @QtAndrew
              Hi
              Well, it sounds like recording works if used alone.
              but if you play and record its not. ?

              But we don't know what error() says in this case so not much to guess on.

              It can be it's simply not supported for the same hardware sound device, I mean
              play and record at the same time on the same hardware.

              QtAndrewQ 1 Reply Last reply
              0
              • mrjjM mrjj

                @QtAndrew
                Hi
                Well, it sounds like recording works if used alone.
                but if you play and record its not. ?

                But we don't know what error() says in this case so not much to guess on.

                It can be it's simply not supported for the same hardware sound device, I mean
                play and record at the same time on the same hardware.

                QtAndrewQ Offline
                QtAndrewQ Offline
                QtAndrew
                wrote on last edited by
                #9

                @mrjj I got it running for PLAY alone and RECORDING alone, both from File. 20 years ago this simultaneous play/record was a problem, bit got it running if set up a system command for plaing in background and recording. But that's not all what i want, It must run without the files, and i didnt find any examples for that, i spend so much time.

                mrjjM 1 Reply Last reply
                0
                • QtAndrewQ QtAndrew

                  @mrjj I got it running for PLAY alone and RECORDING alone, both from File. 20 years ago this simultaneous play/record was a problem, bit got it running if set up a system command for plaing in background and recording. But that's not all what i want, It must run without the files, and i didnt find any examples for that, i spend so much time.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  @QtAndrew

                  Hi
                  Here they used a custom QIODevice
                  https://stackoverflow.com/questions/7776022/qt-how-to-record-and-play-sound-simultaneously
                  (last example)

                  What does QMediaRecorder error() says when you are playing and try to record?

                  QtAndrewQ 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @QtAndrew

                    Hi
                    Here they used a custom QIODevice
                    https://stackoverflow.com/questions/7776022/qt-how-to-record-and-play-sound-simultaneously
                    (last example)

                    What does QMediaRecorder error() says when you are playing and try to record?

                    QtAndrewQ Offline
                    QtAndrewQ Offline
                    QtAndrew
                    wrote on last edited by QtAndrew
                    #11

                    @mrjj Hello, i know this stackoverflow entry, but they have no solution. There is no error, plaing and recording is always in series and never parallel. Could it be that it has something to with the cucrent loop thread? Because when I try to run the PLAY or RECORD code in a separate the Thread it stops working.

                    mrjjM 1 Reply Last reply
                    0
                    • QtAndrewQ QtAndrew

                      @mrjj Hello, i know this stackoverflow entry, but they have no solution. There is no error, plaing and recording is always in series and never parallel. Could it be that it has something to with the cucrent loop thread? Because when I try to run the PLAY or RECORD code in a separate the Thread it stops working.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      @QtAndrew
                      Hi
                      It sounds like it won't do both at the same time.
                      I'm not aware they shared a worker thread between the classes and hence only one can be active.

                      So the way using a custom QIODevice does not work anymore?
                      (the way the SO link shows)

                      QtAndrewQ 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @QtAndrew
                        Hi
                        It sounds like it won't do both at the same time.
                        I'm not aware they shared a worker thread between the classes and hence only one can be active.

                        So the way using a custom QIODevice does not work anymore?
                        (the way the SO link shows)

                        QtAndrewQ Offline
                        QtAndrewQ Offline
                        QtAndrew
                        wrote on last edited by
                        #13

                        @mrjj i have currently no time to try it out.

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

                          There are several issues with your code:

                          • Why are you using a static QAudioRecorder ?
                          • You are blocking your main thread with your sleep call and thus prevent the event loop from running.
                          • You are talking about synthetic sound yet you use an external application through "system" to play some sound file.

                          What it is exactly that you want to do ?
                          From the looks of it, you should check the new QMediaCaptureSession class.

                          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
                          • QtAndrewQ Offline
                            QtAndrewQ Offline
                            QtAndrew
                            wrote on last edited by
                            #15

                            changed to Matlab --> https://github.com/Christoph-Lauer/Transfer-Function-Extractor-Matlab

                            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