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. ALSA: QSoundEffect heavily distorted after migration from Qt5 to Qt6
Qt 6.11 is out! See what's new in the release blog

ALSA: QSoundEffect heavily distorted after migration from Qt5 to Qt6

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 587 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.
  • E Offline
    E Offline
    edelmanjm
    wrote on last edited by edelmanjm
    #1

    After migrating from Qt 5.9 to Qt 6.4.3, playing sounds with QSoundEffect and the ALSA backend results in a heavily distorted audio output on my embedded system. While the correct sound effect does play, it's both far too loud and badly distorted. The command line aplay utility is able to play the same WAV files just fine, without any distortion. Reducing the volume below 1% does help, but the distortion remains.

    System configuration:

    • Raspberry Pi CM4
    • Yocto Kirkstone
    • MAX98357A I2S amplifier on a carrier board

    Here's some captures from an oscilloscope showing the difference between the expect signal (aplay), and the signal produced by QSoundEffect at 60% and .392156862% (1/255) volume respectively. Apologies for the quality of the captures, I'm no electrical engineer.
    PXL_20230809_175107712.jpg
    PXL_20230809_175530255_exported_1691605010843.jpg
    PXL_20230809_181709899.jpg

    I've verified that the correct audio device is being selected, that I'm playing WAV files with a supported audio encoding (PCM s16le), and that the issue does not reproduce on a desktop development station (Ubuntu 20.04) running Qt6 (prebuilt binaries for Linux with pulseaudio/ALSA.)

    Here's the multimedia configuration for my Qt build:

    Qt Multimedia:
      Spatial Audio .......................... no
      Spatial Audio (Quick3D) ................ no
      Low level Audio Backend:
        ALSA (experimental) .................. yes
        PulseAudio ........................... no
        MMRenderer ........................... no
        CoreAudio ............................ no
        Windows Media SDK .................... no
        Open SLES (Android) .................. no
        Web Assembly ......................... no
      Plugin:
        GStreamer 1.0 ........................ yes
        FFmpeg ............................... no
        MMRenderer ........................... no
        AVFoundation ......................... no
        Windows Media Foundation ............. no
      Hardware acceleration and features:
        Video for Linux ...................... yes
        VAAPI support ........................ no
        Linux DMA buffer support ............. yes
        VideoToolbox ......................... no
    

    I also tried a Yocto build with pulseaudio, and a corresponding Qt build with PulseAudio enabled:

    Qt Multimedia:
      Spatial Audio .......................... no
      Spatial Audio (Quick3D) ................ no
      Low level Audio Backend:
        ALSA (experimental) .................. no
        PulseAudio ........................... yes
        MMRenderer ........................... no
        CoreAudio ............................ no
        Windows Media SDK .................... no
        Open SLES (Android) .................. no
        Web Assembly ......................... no
      Plugin:
        GStreamer 1.0 ........................ yes
        FFmpeg ............................... no
        MMRenderer ........................... no
        AVFoundation ......................... no
        Windows Media Foundation ............. no
      Hardware acceleration and features:
        Video for Linux ...................... yes
        VAAPI support ........................ no
        Linux DMA buffer support ............. yes
        VideoToolbox ......................... no
    

    While I was able to play sounds via paplay when using pulseaudio, QSoundEffect didn't play anything (including distorted audio), nor were any errors logged. I did verify that Qt was attempting to use the pulseaudio backend though, as stopping the pulseaudio server caused errors to be logged in the Qt application.

    Does anyone know what might be going on? Given that this broke after the migration from Qt5 to Qt6, I'm guessing it has something to do with the QtMultimedia rewrite, but I can't figure out what's happening; as far as I can tell, it's not an ALSA issue.

    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