Created attachment 171274 [details] Tarball of sample file in wav, flac, mp3, and ogg formats *** If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports *** SUMMARY When trying to play a file unsupported by libcanberra, a dialog window pops up which says "Error playing audio file: '/PATH/TO/SPECIFIED/AUDIO/FILE.FORMAT' Unsupported audio format, or corrupt data" STEPS TO REPRODUCE 1. Create a new audio alarm 2. Specify for the audio alarm a file which is encoded in FLAC or MP3 3. Click "Try" and observe the previously mentioned error message which indicates the file is corrupt. 4. Verify the file is not corrupt by playing it with a different media player, such as vlc, mpv, mplayer, or a web browser. 5. Confirm that the command `canberra-gtk-play -f $SAMPLE_FILE_PATH` outputs the second part of the dialog's error message, "Failed to play sound: File or data corrupt"` OBSERVED RESULT Error message about a corrupt file. EXPECTED RESULT That it just works. Linux/KDE Plasma: Fedora Linux 40 (available in About System) KDE Plasma Version: 6.1.1 KDE Frameworks Version: 6.3.0 Qt Version: 6.7.1 ADDITIONAL INFORMATION Using wayland. The sample file is only five seconds long, you can confirm with a media player or audacity or whatever that none are corrupt and produce audio. This is a deficiency of libcanberra, rather than a specific problem with kalarm other than transitively.
I can confirm that when I set KAlarm to play the mp3 or flac file, libcanberra does not recognise them. It has been previously reported that opus files also don't work. Harald: KAlarm changed from Phonon to libcanberra on your recommendation, but it doesn't handle as many audio formats as Phonon. Is there any way to be able to play MP3, FLAC or OPUS audio, perhaps using some other library, bearing in mind that it must be thread safe?
Canberra can use gstreamer as backend at which point it should be able to play anything gstreamer can.
Canberra has a gstreamer backend, but because Canberra hasn't been updated in 12 years, at least one of the gstreamer calls is obsolete: gst_element_factory_make("decodebin2", NULL) GStreamer no longer recognises decodebin2, so this call returns an error and playback fails. (decodebin and decodebin3 are recognised, but substituting them produces different errors.) The conclusion is that Canberra can't be used any longer with GStreamer, so some other library is required. One possibility is to use ffmpeg libraries to convert to .wav first, and then continue to use Canberra, but this doesn't seem ideal. Do you have any other suggestions?
> Do you have any other suggestions? update the gstreamer backend maybe? or write a new one using ffmpeg or libvlc Ultimately I don't think your idea of converting to wav is a bad one, it makes things work with any plugin. Perhaps cache the result of the conversion though?
KAlarm has now been converted to use the VLC library to play sound files, which fixes this bug. The fix will be in KAlarm version 3.9, which will be in the KDE Gear 24.08 release. Commit https://invent.kde.org/pim/kalarm/-/commit/a3ce5043f2074829156f414cc32075579b3bbf94