Opened 14 years ago
Closed 14 years ago
#10081 closed Bug Report - General (fixed)
ALSA: Distorted 24bit playback
Reported by: | Owned by: | JYA | |
---|---|---|---|
Priority: | minor | Milestone: | 0.25 |
Component: | MythTV - Audio Output | Version: | 0.24.1 |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
If the decoded audio-data is stored in upper 24bits of 4 bytes alsa output is distorted.
see http://lkml.indiana.edu/hypermail/linux/kernel/0806.3/0134.html
Changing audiooutputalsa.cpp fixed it at least for flac and wave files on my system.
bool AudioOutputALSA::OpenDevice?() {
...
switch (output_format) {
case FORMAT_U8: format = SND_PCM_FORMAT_U8; break; case FORMAT_S16: format = SND_PCM_FORMAT_S16; break; The data is stored in upper 24bits of 4 bytes case FORMAT_S24: format = SND_PCM_FORMAT_S32; break; case FORMAT_S32: format = SND_PCM_FORMAT_S32; break; case FORMAT_FLT: format = SND_PCM_FORMAT_FLOAT; break; default:
Error(QString("Unknown sample format: %1").arg(output_format)); return false;
}
...
}
If all audio-decoders use the upper 24bits of 4 bytes for their data everything should work
Attachments (2)
Change History (9)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Status: | new → infoneeded_new |
---|
comment:3 follow-up: 4 Changed 14 years ago by
To me its not a problem of byte conversation but a problem of bit location. When using SND_PCM_FORMAT_S24 alsa fetches data from bits 0-24, when using SND_PCM_FORMAT_S32 from bits 8-31.
For testing create a 24bit wave file: sox input.flac -3 24bit.wav This should play fine with aplay Turn volume to zero, start playback in mythmusic and then slowly increase volume.
On my system I only hear very loud white noise without the changes I suggested.
comment:4 Changed 14 years ago by
Different point of view:
If the audio-decoder gets 24bit data and stores it in bits 8-31 of an integer then he's doing an on-the-fly s24_(3)le to s32_le conversation. Input format is still s24_(3)le but what alsa gets is s32_le.
comment:5 follow-up: 6 Changed 14 years ago by
still waiting for a log (with -v audio) and a sample exhibiting the problem
Changed 14 years ago by
Attachment: | mythtv.log---original added |
---|
Changed 14 years ago by
Attachment: | mythtv.log---patched added |
---|
comment:6 Changed 14 years ago by
Replying to jyavenard:
still waiting for a log (with -v audio) and a sample exhibiting the problem
Sorry, got a call from work
mythtv.log---original: everything distorted except the 32bit thing
mythtv.log---patched: everything works for me
Where should I upload the samples (8 and 11Mb)
comment:7 Changed 14 years ago by
Milestone: | unknown → 0.25 |
---|---|
Resolution: | → fixed |
Status: | infoneeded_new → closed |
Add ALSA playback support for 24 bits LSB audio.
Fixes #10081
Branch: master Changeset: 3dd7439c498a372718b6d8e449cc75340a724324
Either provide a path, or a sample to reproduce the problem..
Fwiw, 24bits LSB/MSB conversion is done well before it ever reach alsa and should there be any problems, it's not to be done in the alsa code.