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 sound
Qt 6.11 is out! See what's new in the release blog

Play sound

Scheduled Pinned Locked Moved General and Desktop
17 Posts 5 Posters 9.6k 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.
  • B Offline
    B Offline
    bagipro
    wrote on last edited by
    #1

    I needed to play short sound (1-3 sec) from url

    I used QSoundEffect

    @QSoundEffect* player = new QSoundEffect;
    player->setSource(QUrl("http://translate.google.ru/translate_tts?ie=UTF-8&tl=en&prev=input&q=" + word));
    player->setVolume(1.0f);
    player->play();@

    File loaded correctly, but was not played and i got QSoundEffect(qaudio): Error decoding source

    I used so QMediaPlayer. There is no loading was performed and was wrote "no service found for org.qt-project.qt.mediaplayer"

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bagipro
      wrote on last edited by
      #2

      No ideas? :'(

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

        Hi,

        Please don't bump your own thread in such a short interval, allow at least 24 to 72 hours.

        That said, are you sure your URL gives you valid audio data ?

        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
        • B Offline
          B Offline
          bagipro
          wrote on last edited by
          #4

          Ok, sorry
          Yes i sure. I tried to use local file, but i got same error

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bagipro
            wrote on last edited by
            #5

            U can check too. Link for example: http://translate.google.com/translate_tts?ie=UTF-8&tl=en&prev=input&q=hello

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bagipro
              wrote on last edited by
              #6

              24h waited
              Up
              I really need dicision. Maybe non-qt libs have those capabilities? I use only windows

              1 Reply Last reply
              0
              • JeroentjehomeJ Offline
                JeroentjehomeJ Offline
                Jeroentjehome
                wrote on last edited by
                #7

                Maybe use the resource file to do this, or to be sure the URL is valid, use a qfiledialog to ask the user what sound to play. In the debugger analyze the given path+name. there might be a difference there. Usually it's not the Qt class that malfunctions, but the information provided

                Greetz, Jeroen

                1 Reply Last reply
                0
                • JeroentjehomeJ Offline
                  JeroentjehomeJ Offline
                  Jeroentjehome
                  wrote on last edited by
                  #8

                  so, first test with a local file (via qfiledialog), then the local file without the dialog, then the URL way?

                  Greetz, Jeroen

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    bagipro
                    wrote on last edited by
                    #9

                    No, i tried it. All time i see this error

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      AlterX
                      wrote on last edited by
                      #10

                      Have you tried QMediaPlayer?

                      Qt Ambassador
                      Real-time cooperative teams: http://www.softairrealfight.net
                      Free Real-time network platform sdk: https://github.com/AlterX76/Solomon

                      https://codereview.qt-project.org/...

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        bagipro
                        wrote on last edited by
                        #11

                        [quote author="AlterX" date="1377879730"]Have you tried QMediaPlayer?[/quote]

                        Yes, I wrote it in first post
                        [quote] I used so QMediaPlayer. There is no loading was performed and was wrote “no service found for org.qt-project.qt.mediaplayer”[/quote]

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

                          What OS/Qt version are you using ?

                          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
                          • B Offline
                            B Offline
                            bagipro
                            wrote on last edited by
                            #13

                            WinXp, qt5.1

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

                              Might be a limitation of the multimedia backend on windows... I tried a wav file on OS X and it's working fine but not using the link you provided.

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

                                Awww, why i got in touch with qt... :D nothing is not working correctly, or i doing something wrong?

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

                                  Well... Just reading a local wav file should not be a problem. Did you check the "bug report system":https://bugreports.qt-project.org/ to see if this is something known ? You might consider creating a bug report (put as much details as you can and a minimal compilable example so it can be reproduced)

                                  You can also start by asking on the interest mailing list, You'll find Qt's developers/maintainers there (this forum is more user oriented)

                                  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
                                  • A Offline
                                    A Offline
                                    AGol
                                    wrote on last edited by
                                    #17

                                    I have the same problem on BeagleboneBlack.
                                    Everything works great in ubuntu on Desktop. but i receive "no service found for org.qt-project.qt.mediaplayer" error on beaglebone board.

                                    how did you solve this problem?

                                    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