Opened 14 years ago

Closed 10 years ago

Last modified 10 years ago

#7047 closed bug (fixed)

Noisy AIFF audio files

Reported by: humdinger Owned by: stippi
Priority: normal Milestone: R1
Component: Audio & Video/Codecs Version: R1/Development
Keywords: Cc: degea@…, bga@…
Blocked By: #7900 Blocking: #7677, #7679, #9939
Platform: All

Description

This is hrev39962.

AIFF audio files play extremly noisy in MediaPlayer. VLC plays without noise, but with major stutters. I think sample files are too big to be attached to a ticket, you'll find many examples at the site SimpyTheBest.

Attachments (2)

MediaPlayer-847-debug-04-03-2013-17-06-13.report (4.5 KB ) - added by ttcoder 12 years ago.
MP crashes on the sample AIFF file from ffmpeg ticket 204
RisingSunIntroL.aiff (1.1 MB ) - added by Pete 11 years ago.
AIFF with (non-standard) little-endian data that plays in Haiku

Download all attachments as: .zip

Change History (20)

comment:1 by stargatefan, 14 years ago

Humdinger I don't know alot about code, but for sure thats digital distortion in mediaplayer. The gain is to high on the AIFF format. I know that sound clear as day. I didn't try with vlc but likely vlc has a better noise floor and is likely just digitally clipping. the other thing I am clearly hearing in VLC, I'd have to test these files on a known good media player under windows to confirm this, is that the compression/decompression algorythm was rather poor, encoding artifact present everywhere.

I will make some high quality files and see if the problem persists, I also got kicked into gdb and here is the error and backtrace I recieved playing these files.

I tested on a 40033 gcc2 hybrid clean install

GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-pc-haiku"...(no debugging symbols found)

[tcsetpgrp failed in terminal_inferior: Invalid Argument]
Thread 497 caused an exception: Segment violation
Reading symbols from /boot/system/runtime_loader...done.
Loaded symbols for /boot/system/runtime_loader
Reading symbols from /boot/apps/VLC/vlc-0.8.6d/lib/libintl.so...done.
Loaded symbols for /boot/apps/VLC/vlc-0.8.6d/lib/libintl.so
Reading symbols from /boot/apps/VLC/vlc-0.8.6d/lib/libiconv.so...done.
Loaded symbols for /boot/apps/VLC/vlc-0.8.6d/lib/libiconv.so
Reading symbols from /boot/apps/VLC/vlc-0.8.6d/lib/libogg.so...done.
Loaded symbols for /boot/apps/VLC/vlc-0.8.6d/lib/libogg.so
Reading symbols from /boot/system/lib/libnetwork.so...done.
Loaded symbols for /boot/system/lib/libnetwork.so
Reading symbols from /boot/system/lib/libbe.so...done.
Loaded symbols for /boot/system/lib/libbe.so
Reading symbols from /boot/system/lib/libmedia.so...done.
Loaded symbols for /boot/system/lib/libmedia.so
Reading symbols from /boot/system/lib/libtranslation.so...done.
Loaded symbols for /boot/system/lib/libtranslation.so
Reading symbols from /boot/system/lib/libtracker.so...done.
Loaded symbols for /boot/system/lib/libtracker.so
Reading symbols from /boot/system/lib/libgame.so...done.
Loaded symbols for /boot/system/lib/libgame.so
Reading symbols from /boot/system/lib/libstdc++.r4.so...done.
Loaded symbols for /boot/system/lib/libstdc++.r4.so
Reading symbols from /boot/system/lib/libroot.so...done.
Loaded symbols for /boot/system/lib/libroot.so
Reading symbols from /boot/system/lib/libtextencoding.so...done.
Loaded symbols for /boot/system/lib/libtextencoding.so
Reading symbols from /boot/system/lib/liblocale.so...done.
Loaded symbols for /boot/system/lib/liblocale.so
Reading symbols from /boot/system/lib/libicudata.so.44...
warning: Lowest section in /boot/system/lib/libicudata.so.44 is .hash at 00000094
done.
Loaded symbols for /boot/system/lib/libicudata.so.44
Reading symbols from /boot/system/lib/libicui18n.so.44...done.
Loaded symbols for /boot/system/lib/libicui18n.so.44
Reading symbols from /boot/system/lib/libicuio.so.44...done.
Loaded symbols for /boot/system/lib/libicuio.so.44
Reading symbols from /boot/system/lib/libicule.so.44...done.
Loaded symbols for /boot/system/lib/libicule.so.44
Reading symbols from /boot/system/lib/libiculx.so.44...done.
Loaded symbols for /boot/system/lib/libiculx.so.44
Reading symbols from /boot/system/lib/libicutu.so.44...done.
Loaded symbols for /boot/system/lib/libicutu.so.44
Reading symbols from /boot/system/lib/libicuuc.so.44...done.
Loaded symbols for /boot/system/lib/libicuuc.so.44
Reading symbols from /boot/system/lib/libroot-addon-icu.so...done.
Loaded symbols for /boot/system/lib/libroot-addon-icu.so
Reading symbols from /boot/apps/VLC/vlc-0.8.6d/lib/libdvdcss.so...done.
Loaded symbols for /boot/apps/VLC/vlc-0.8.6d/lib/libdvdcss.so
[tcsetpgrp failed in terminal_inferior: Invalid Argument]
[Switching to team /boot/apps/VLC/vlc-0.8.6d/VLC media player (497) thread VLC media player (497)]
0x001048d3 in topological_sort () from /boot/system/runtime_loader
(gdb) bt
#0  0x001048d3 in topological_sort () from /boot/system/runtime_loader
#1  0x00105620 in get_sorted_image_list () from /boot/system/runtime_loader
#2  0x001018cc in terminate_program () from /boot/system/runtime_loader
#3  0x00f4bf20 in exit () from /boot/system/lib/libroot.so
#4  0x002633e2 in _start ()
#5  0x00105fb2 in runtime_loader () from /boot/system/runtime_loader
#6  0x7ffeefec in ?? ()
(gdb) 






Version 1, edited 14 years ago by stargatefan (previous) (next) (diff)

comment:2 by stargatefan, 14 years ago

Ok after a bit mor einvestigation on my end. I did check these files in a few DAW's I use, these are very poorly encoded files, very high noise floor, loads of gain. I think something in ffmpeg is attempting to normalize the gain leve or add gain and its making a bad sound file horrific.

Not really sure what to suggest here. Haiku should be able to play very lossy sounding files. But on the other hand, lossy files are really obnixous. But mediaplayer is not handling these files correctly.

comment:3 by humdinger, 14 years ago

I converted a hi-quality file with Audacity under Ubuntu to AIFF(16bit PCM), 44.1kHz, stereo. Where the low-quality examples (11kHz, mono) produce noise, these new ones call the gdb right from the start:

[tcsetpgrp failed in terminal_inferior: Invalid Argument]
Thread 306 called debugger(): Decoder didn't set raw audio output buffer size
[...]
[Switching to team /boot/system/apps/MediaPlayer (301) thread playback manager (306)]
0xffff0114 in ?? ()
(gdb) bt
#0  0xffff0114 in ?? ()
#1  0x00959d3b in debugger () from /boot/system/lib/libroot.so
#2  0x0058b560 in BMediaTrack::DecodedFormat ()
   from /boot/system/lib/libmedia.so
#3  0x0026263c in MediaTrackAudioSupplier::_InitFromTrack ()
#4  0x00262a31 in MediaTrackAudioSupplier::MediaTrackAudioSupplier ()
#5  0x00260c89 in MediaFileTrackSupplier::CreateAudioTrackForIndex ()
#6  0x0026d68e in Controller::SelectAudioTrack ()
#7  0x0026e962 in Controller::SetTo ()
#8  0x0026e9f8 in Controller::MessageReceived ()
#9  0x0034f5b8 in BLooper::DispatchMessage () from /boot/system/lib/libbe.so
#10 0x003510f4 in BLooper::task_looper () from /boot/system/lib/libbe.so
#11 0x00350e1a in BLooper::_task0_ () from /boot/system/lib/libbe.so
#12 0x0095dbd0 in thread_entry () from /boot/system/lib/libroot.so
#13 0x70080fec in ?? ()

comment:4 by humdinger, 13 years ago

Blocking: 7677 added

(In #7677) Duplicate of #7047.

comment:5 by humdinger, 13 years ago

Blocking: 7679 added

(In #7679) Still a duplicate of #7047, just as #7677...

comment:6 by ttcoder, 13 years ago

Cc: degea@… added

I asked dsuden about the "gain" thing but apparently high-quality AIFF files play just static too, so it's not a case of ffmpeg being half-wrong or picky, the bug seems much more heavy in consequences..

comment:7 by bga, 13 years ago

Checking the encoding quality is all fine but, if you check the bug I created (#7900) you will see a sample file that used to play fine in haiku and now does not. So the problem does seem to be some change in the media codecs and not a problem with specific files.

comment:8 by bga, 13 years ago

Cc: bga@… added

in reply to:  7 comment:9 by ttcoder, 13 years ago

Replying to bga:

if you check the bug I created (#7900) you will see a sample file that used to play fine in haiku and now does not

Bruno any idea (even very rough) when was the last year/month that this worked in Haiku?

Update: just checked the change history in addons/media/plugins/aiff_reader and apparently it has had almost zero change in the last 6 years..!

So I suspect the answer to my question is "when we switched over to ffmpeg" or something eh :-) ?

Could the devs make the Media Kit use the 'old' decoder/reader, while the ffmpeg guys fix their code (I assume this latter one is an external project outside of the control of Haiku devs) ?

comment:10 by bga, 13 years ago

Cc: bga@… added; bga@… removed

Sorry, I have no idea. I did not run Haiku at all for a long time and just now resumed playing with it.

There is probably a way to change the priority for a specific media type. stippi would know how to do that.

comment:11 by ttcoder, 13 years ago

Investigated some more and now I'm back with good steps toward resolving this ticket (I think).

Didn't find prioritizing of plugins, but -- Found two possibles fixes, one of which I've successfully tested: I'm now successfully playing AIFF files on R1A3 again, thanks to the 'native' (pre-ffmpeg) reader. So there are two ways to fix this I guess:

Option 1:

Upgrade ffmpeg to a more recent build, as it might fix AIFF support (and maybe the WAV and mp3 problems reported in other tickets too, who knows). Indeed, there are 2 tickets in the ffmpeg "trac" that are related to AIFF files:

http://ffmpeg.org/trac/ffmpeg/ticket/62 (closed as fixed) http://ffmpeg.org/trac/ffmpeg/ticket/204 (open enhancement)

Option 2:

(A more immediate, easy fix, successfully tested here) -- restore the original Haiku AIFF reader:

  • make it part of the build, presumably by appending "aiff_reader" to HaikuImage:146
  • make ffmpeg decline support of AIFF files, presumably by commenting out CodecTable.cpp:23 and maybe another line down this file; maybe this step can be ommited as I've noticed that ffmpeg sometimes gets "pre-empted" by aiff_reader even without doing this step, when BFS does return plugins in lexical order -- but this is not reliable, to say the least. It would be best to outright disable AIFF support in ffmpeg to make sure the aiff_reader is the one that handles this format no matter what.

So basically, AIFF support can be back in Haiku with one (or two) one-liner modifications.. Hopefully this ticket can be closed soon ;-) in the meantime I can send the compiled aiff_reader to dsuden to unblock him.

comment:12 by mmadia, 13 years ago

Owner: changed from nobody to stippi
Status: newassigned

comment:13 by ttcoder, 13 years ago

dsuden just tried the recent hrev43888 [which includes an earlier] upgrade of the ffmpeg package but no change for him... His media_server is a bit shaky so I should test on my own too just to be safe.

Last edited 13 years ago by ttcoder (previous) (diff)

by ttcoder, 12 years ago

MP crashes on the sample AIFF file from ffmpeg ticket 204

comment:14 by ttcoder, 12 years ago

Still there in hrev45325 . Tried the file from the ffmpeg ticket and now it crashes (see attached). I don't think it did before (?). Would try a gcc4 build of Haiku, but I guess it wouldn't help since this is not a compilation problem or stack alignment problem but something else at play here..

by Pete, 11 years ago

Attachment: RisingSunIntroL.aiff added

AIFF with (non-standard) little-endian data that plays in Haiku

comment:15 by Pete, 11 years ago

Is anybody looking at this? I've found out exactly why AIFF files sound like white noise, anyway. The endianness of the samples is not recognized! AIFF data is always big-endian, but ffmpeg seems to be assuming they are little-endian. (AIFC files can be little-endian, and somewhere I read that these can sound like noise in a standard AIFF player, which led me to this realization.)

After a bit of fiddling with sox, I generated an "AIFF" file with little-endian samples (attached), and MediaPlayer handles it just fine!

Not sure where the fix now lies, but Ihope that's helpful.

comment:16 by pulkomandy, 10 years ago

Blocked By: 7900 added

comment:17 by pulkomandy, 10 years ago

Resolution: fixed
Status: assignedclosed

Fixed in hrev48071.

comment:18 by pulkomandy, 10 years ago

Blocking: 9939 added

(In #9939) In hrev48071 the ffmpeg decoder was fixed for AIFF files. This makes part of the patch now unneeded.

Note: See TracTickets for help on using tickets.