Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Generating a sound

    General and Desktop
    4
    6
    7101
    Loading More Posts
    • 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.
    • N
      noobiept last edited by

      Hey, is there a tone generator in qt, where you could generate a sound? (the beep kind of sound.. - single frequency tone)

      1 Reply Last reply Reply Quote 0
      • M
        mlong last edited by

        For generating arbitrary tones? No. There is a "beep":http://doc.qt.nokia.com/4.7/qapplication.html#beep function in QApplication that will play your system beep. But not a tone generator in the "play simple tunes" sense.

        There are various multimedia APIs in Qt, but primarily are concerned with playback of media files and that sort of thing.

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply Reply Quote 0
        • N
          noobiept last edited by

          ok, thanks anyway.

          1 Reply Last reply Reply Quote 0
          • J
            Jupiter last edited by

            if you have a sound file you can play it with QSound::play

            1 Reply Last reply Reply Quote 0
            • N
              noobiept last edited by

              No, haven't got any file.

              I've found this "tutorial":http://doc.qt.nokia.com/4.7-snapshot/multimedia-audiooutput.html , it seems to be generating a sound, I'll try to understand the code.

              1 Reply Last reply Reply Quote 0
              • S
                smileeFace last edited by

                Hello,

                I know this post was from a few years ago. Is there still no way to generate a tone if I were to pass volume and frequency?

                Edit: Found that I could just use Windows.h's Beep(..). All I needed was a basic tone of which I could set the frequency. How pretty it sounded didn't matter. Planning on making an abstraction layer so that when I change to another platform, I would only have to change this system specific file.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post