Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Problems to get sound working with Yocto on the Raspberry Pi
Forum Updated to NodeBB v4.3 + New Features

Problems to get sound working with Yocto on the Raspberry Pi

Scheduled Pinned Locked Moved Solved Mobile and Embedded
14 Posts 3 Posters 1.5k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    Might be a silly question but are you sure your application is finding the file ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    C 1 Reply Last reply
    0
    • SGaistS SGaist

      Hi,

      Might be a silly question but are you sure your application is finding the file ?

      C Offline
      C Offline
      coldspark29
      wrote on last edited by coldspark29
      #3

      @SGaist I actually tried setting some non-existant file and QtMediaPlayer did not complain. So I am not sure. It does find all the other assets like images, so I am assuming that it finds the file as well. What is weird though it that I don't really need to have the other assets in the working directory as I used to when I was manually building the app for Raspian. Seems like they are somehow being compiled into the binary, which wasn't the case before. Confusing!

      Any ideas how to debug this?

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

        Did you put them in Qt's resources system ?

        One thing you can do is start your application with the QT_DEBUG_PLUGINS environment variable set to 1 to see what is happening on the backend side.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        C 1 Reply Last reply
        1
        • SGaistS SGaist

          Did you put them in Qt's resources system ?

          One thing you can do is start your application with the QT_DEBUG_PLUGINS environment variable set to 1 to see what is happening on the backend side.

          C Offline
          C Offline
          coldspark29
          wrote on last edited by
          #5

          @SGaist Yes, I just realized that the images are listed close to the .qml file, because I added them as assets. The sounds were not listed there, so I tried adding them as well. Unfortunately this did not work. I assume that those assets are only needed for QML and not for the C++ code.

          I tried setting QT_DEBUG_PLUGINS and I don't see anything suspicious

          https://pastebin.com/m06ydd2A

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

            Everything seems to load fine indeed.

            Did you try to play that file with GStreamer directly like you did with aplay ?

            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
            • C Offline
              C Offline
              coldspark29
              wrote on last edited by
              #7

              I tried googling for a command, but I am always getting errors. Can you help me out here?

              Also: when I check player->availability() or player->isAudioAvailable(), both are false. Does this mean Qt can't find the file?

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

                What errors are you getting ?

                The command should look like gst-play.

                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
                • C Offline
                  C Offline
                  coldspark29
                  wrote on last edited by coldspark29
                  #9

                  I am trying

                  root@pi:~# gst-launch-1.0 filesrc location=/home/root/sounds/test.wav ! wavparse ! audioconvert ! audioresample ! alsasink
                  WARNING: erroneous pipeline: no element "wavparse"
                  

                  as documented here https://gstreamer.freedesktop.org/documentation/tools/gst-launch.html?gi-language=c

                  There is no gst-play on my system

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

                    Did you install all the GStreamer related package ? There might be one dedicated to these tools.

                    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
                    • C Offline
                      C Offline
                      coldspark29
                      wrote on last edited by
                      #11

                      No, the qtmultimedia package installs only the bad

                      https://github.com/meta-qt5/meta-qt5/blob/master/recipes-qt/qt5/qtmultimedia_git.bb

                      Will manually install the good and the ugly as well...

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        coldspark29
                        wrote on last edited by
                        #12

                        Yes! I installed the good, bad, ugly and base plugins. Now I can not only play the files using the above command, but the Qt application can also play sound. Actually Yocto should take care of this. Weird.

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

                          I am guessing that the plugin may have changed from one package to another because it was deemed stable but was not when first introduced.

                          Can you check if installing only the good plugins is enough ?

                          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
                          • C coldspark29

                            I previously had the sound working on the Raspbian installation where I compiled Qt manually. Now in the Yocto installation I can't get it to work, although I can play .wav file with aplay. So asound.conf and asound.state should be configured right. I think that Qt uses gstreamer usually, but I also installed pulseaudio to make sure. None of it works.

                            Here are the packages I have installed

                            IMAGE_INSTALL:append = " \
                              alsa-state \
                              alsa-utils \
                              gstreamer1.0 \
                              gstreamer1.0-libav \
                              gstreamer1.0-plugins-good \
                              gstreamer1.0-plugins-bad \
                              gstreamer1.0-plugins-ugly \
                              dbus \
                              pulseaudio-server \
                              pulseaudio-misc \
                              pulseaudio-module-dbus-protocol \
                              healthpi \
                              module-init-tools \
                              qtbase \
                              qtbase-examples \
                              qtbase-plugins \
                              qtbase-tools \
                              qtdeclarative \
                              qtdeclarative-plugins \
                              qtdeclarative-qmlplugins \
                              qtdeclarative-tools \
                              qtimageformats-plugins \
                              qtmultimedia \
                              qtmultimedia-plugins \
                              qtmultimedia-qmlplugins \
                              qtquickcontrols2 \
                              qtquicktimeline \
                              qtscript \
                              qtsvg \
                              qtsvg-plugins \
                              qtsystems \
                              qtsystems-qmlplugins \
                              qtsystems-tools \
                              pulseaudio \
                              "
                            
                            PACKAGECONFIG:append:pn-qtbase = " \
                              eglfs \
                              fontconfig \
                              kms  \
                            "
                            PACKAGECONFIG:append:pn-qtmultimedia = "\
                              pulseaudio \
                              gstreamer \
                              alsa \
                            "
                                                                      
                            DISTRO_FEATURES:append = " \
                              eglfs \
                              linuxfb \
                              pulseaudio \
                              dbus \
                            "
                            

                            The code I am using is as like this:

                            
                                player = new QMediaPlayer{};
                                player->setMedia(QUrl::fromLocalFile("sounds/test.wav"));
                                player->setVolume(100);
                                player->play();
                            

                            I am not sure what is missing here.

                            H Offline
                            H Offline
                            HaiHoang
                            wrote on last edited by HaiHoang
                            #14

                            @coldspark29 Make sure all related plugins are installed:

                            gstreamer1.0-plugins-base 
                            gstreamer1.0-plugins-good 
                            gstreamer1.0-plugins-bad 
                            gstreamer1.0-plugins-ugly
                            

                            and enable qt multimedia:

                            PACKAGECONFIG_append_pn-qtmultimedia = " gstreamer alsa"
                            
                            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