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 generate audio sample by sample in real time?
Qt 6.11 is out! See what's new in the release blog

How to generate audio sample by sample in real time?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 367 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.
  • S Offline
    S Offline
    Simmania
    wrote on last edited by
    #1

    Hi,
    I Need to generate audio output sample by sample. For instance to generate a sinewave on left and or right channel of the headphone.
    Is that possible?
    Is there an example available for this?
    When searching for audio, I can find how to play a sound file. But i need to be able to generate the samples my self. In real time.

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

      Hi,

      If using Qt 5, use QAudioOutput::start and write the audio samples you generate in the device.

      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
      • S Offline
        S Offline
        Simmania
        wrote on last edited by
        #3

        But how do I know how much samples to write? So how is are the samples synchronized?
        Can I read somehow how many samples still in the buffer?
        Or can I get connect a signal to generate the next N samples?

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

          You know the audio format you use, so adapt to that one.

          I don't think you can ge that I formation.

          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