Opened 9 years ago

Closed 9 years ago

#9081 closed defect (Invalid)

Audio choppy when bitrate not converted

Reported by: paul<at>planar.id.au Owned by: JYA
Priority: minor Milestone: unknown
Component: MythTV - Audio Output Version: Unspecified
Severity: medium Keywords:
Cc: Ticket locked: yes

Description

I have an external dac - a v-dac, which is a usb audio device with burr-brown chipset. It appears on my machine as ALSA:hw:3,0.

Since upgrading to trunk 0.24, I'm having some issues with bitrate.

When I set to ALSA:default, myth is choosing to resample my tracks from 44.1KHz to 48KHz. This sounds OK, but perhaps with a bit of audio quality loss. If I use VLC to play the same track to ALSA:hw:3,0, the report from /proc/asound/card3/stream0 is: Burr-Brown from TI USB Audio DAC at usb-0000:00:1d.1-2, full s : USB Audio

Playback:

Status: Running

Interface = 1 Altset = 1 URBs = 3 [ 8 8 8 ] Packet Size = 192 Momentary freq = 44100 Hz (0x2c.199a)

Interface 1

Altset 1 Format: S16_LE Channels: 2 Endpoint: 2 OUT (ADAPTIVE) Rates: 32000, 44100, 48000

Interface 1

Altset 2 Format: S16_LE Channels: 1 Endpoint: 2 OUT (ADAPTIVE) Rates: 32000, 44100, 48000

If I set myth to play to ALSA:hw:3,0, it reports also that it is playing 44.1KHz, but the sound is quite choppy. It is still recognisable, but definitely giving that "fluffy" sort of noise. The report from /proc is: Burr-Brown from TI USB Audio DAC at usb-0000:00:1d.1-2, full s : USB Audio

Playback:

Status: Running

Interface = 1 Altset = 1 URBs = 3 [ 8 8 8 ] Packet Size = 192 Momentary freq = 44100 Hz (0x2c.199a)

Interface 1

Altset 1 Format: S16_LE Channels: 2 Endpoint: 2 OUT (ADAPTIVE) Rates: 32000, 44100, 48000

Interface 1

Altset 2 Format: S16_LE Channels: 1 Endpoint: 2 OUT (ADAPTIVE) Rates: 32000, 44100, 48000

I can get acceptable output by using default and allowing resampling. The problem I have is that the DAC runs internally at 192KHz, so what I'm doing is resampling 44.1->48->192. It seems to me that must involve some quality loss, which I'd prefer to avoid.

I'm not sure what logs would be useful in diagnosing this. I tried mythfrontend -v audio, and I get a log something like this. Unfortunately, I don't think that is going to tell anyone much of anything.

2010-10-10 14:06:58.560 Update not found (ALSA:hw:3,0) 2010-10-10 14:06:59.297 Update not found (ALSA:hw:3,0) 2010-10-10 14:07:11.606 SendReceiveStringList?(REFRESH_BACKEND) called from UI thread 2010-10-10 14:07:11.653 SendReceiveStringList?(MESSAGE,CLEAR_SETTINGS_CACHE) called from UI thread 2010-10-10 14:07:11.654 Received a remote 'Clear Cache' request 2010-10-10 14:07:19.114 MythVideo::ScanVideoDirectory? Scanning (/usr/share/mythtv/server/mythvideo) 2010-10-10 14:07:27.144 XMLParse: LoadTheme? using '/usr/share/mythtv/themes/blue-abstract-wide/music-ui.xml' 2010-10-10 14:07:27.790 XMLParse, Warning: Unknown: area in repeated image 2010-10-10 14:07:27.790 XMLParse, Warning: Unknown: area in repeated image 2010-10-10 14:07:28.662 Launching: ps -ae | grep pulseaudio > /dev/null 2010-10-10 14:07:28.668 PID 16161: launched 2010-10-10 14:07:28.747 PID 16161: exited: status=256, result=1 2010-10-10 14:07:28.763 AO: SRC quality = high 2010-10-10 14:07:28.764 AO: Sample rate 32000 is supported 2010-10-10 14:07:28.764 AO: Sample rate 44100 is supported 2010-10-10 14:07:28.764 AO: Sample rate 48000 is supported 2010-10-10 14:07:28.764 AO: 1 channel(s) are supported 2010-10-10 14:07:28.764 AO: 2 channel(s) are supported 2010-10-10 14:07:28.794 AO: AC3 or DTS capable 2010-10-10 14:07:28.794 AO: 6 channel(s) are supported 2010-10-10 14:07:28.798 AO: Killing AudioOutputDSP 2010-10-10 14:07:28.798 AO: Original codec was NONE, signed 16 bit, 44 kHz, 2 channels 2010-10-10 14:07:28.798 AO: enc(0), passthru(0), canAC3(0), canDTS(0), canLPCM(0), configured_channels(2), 2 channels supported(1) 2010-10-10 14:07:28.800 AO: Opening audio device 'hw:3,0' ch 2(2) sr 44100 sf signed 16 bit reenc 0 2010-10-10 14:07:28.800 Opening ALSA audio device 'hw:3,0'. 2010-10-10 14:07:28.800 ALSA: SetParameters?(format=2, channels=2, rate=44100, buffer_time=200000, period_time=50000) 2010-10-10 14:07:28.800 ALSA: Buffer time = 200000 us 2010-10-10 14:07:28.800 ALSA: Period time = 50000 us 2010-10-10 14:07:28.806 ALSA: Buffer size = 8820 | Period size = 2205 2010-10-10 14:07:28.810 AO: Audio fragment size: 4410 2010-10-10 14:07:28.810 AO: Audio Stretch Factor: 1 2010-10-10 14:07:28.810 AO: Ending Reconfigure() 2010-10-10 14:07:28.812 AO: kickoffOutputAudioLoop: pid = 15982 2010-10-10 14:07:28.812 AO: OutputAudioLoop?: Play Event 2010-10-10 14:07:28.814 AO: Pause 1 2010-10-10 14:07:28.823 AO: OutputAudioLoop?: audio paused 2010-10-10 14:07:28.875 AO: Reconfigure(): No change -> exiting 2010-10-10 14:07:28.877 avfdecoder.o: seek time 29 2010-10-10 14:07:29.029 Error seeking 2010-10-10 14:07:29.030 AO: Pause 0 2010-10-10 14:07:29.030 Read frame failed 2010-10-10 14:07:29.075 AO: OutputAudioLoop?: Play Event 2010-10-10 14:07:29.246 AO: Pause 1 2010-10-10 14:07:29.275 AO: OutputAudioLoop?: audio paused 2010-10-10 14:07:29.460 AO: Reconfigure(): No change -> exiting 2010-10-10 14:07:29.465 AO: Pause 0 2010-10-10 14:07:29.475 AO: OutputAudioLoop?: Play Event 2010-10-10 14:07:36.596 AO: Pause 1 2010-10-10 14:07:36.625 AO: OutputAudioLoop?: audio paused 2010-10-10 14:07:36.630 AO: Reconfigure(): No change -> exiting 2010-10-10 14:07:36.641 AO: Pause 0 2010-10-10 14:07:36.675 AO: OutputAudioLoop?: Play Event

Change History (5)

comment:1 Changed 9 years ago by JYA

Resolution: Invalid
Status: newclosed

Use the device found by myth. Do not set the ALSA device yourself. That's what the device scanning is for.

If your device reports 44.1kHz as being supported, and you are trying to play 44.1kHz this is what myth will use.

If you device only reports 48kHz, then audio will be resampled. You can override the quality of the resampler used in the advanced settings.

If myth converts everything to 48kHz despite what you are playing or what the device support, it's because you have configured myth to override the resampler and to resample everything to 48kHz.

The log show that 32k, 44.1k and 48kHz are available. And myth doesn't try to resample and play the audio at 44.1kHz. Not sure what made you believe it was resampling at 48kHz.

It plays fine using default ; so leave it at that. it will only resample based on what ALSA reports

Do not try to configure the audio like you used to do with myth <= 0.23 . Let myth do its job

comment:2 Changed 9 years ago by paul<at>planar.id.au

Sorry, I left that part out of the log. When I set it to play using default, the log looks as follows:

2010-10-10 20:07:41.600 Launching: ps -ae | grep pulseaudio > /dev/null 2010-10-10 20:07:41.616 PID 18483: launched 2010-10-10 20:07:41.728 PID 18483: exited: status=256, result=1 2010-10-10 20:07:41.775 AO: Resampling from 44 kHz to 48 kHz with quality high 2010-10-10 20:07:41.776 AO: Opening audio device 'default:CARD=default' ch 2(2) sr 48000 sf signed 16 bit reenc 0 2010-10-10 20:07:41.777 Opening ALSA audio device 'default:CARD=default'. 2010-10-10 20:07:41.821 avfdecoder.o: seek time 17 2010-10-10 20:07:42.047 Error seeking 2010-10-10 20:07:42.366 Read frame failed

The /proc dump says: Burr-Brown from TI USB Audio DAC at usb-0000:00:1d.1-2, full s : USB Audio

Playback:

Status: Running

Interface = 1 Altset = 1 URBs = 3 [ 7 7 8 ] Packet Size = 192 Momentary freq = 48000 Hz (0x30.0000)

Interface 1

Altset 1 Format: S16_LE Channels: 2 Endpoint: 2 OUT (ADAPTIVE) Rates: 32000, 44100, 48000

Interface 1

Altset 2 Format: S16_LE Channels: 1 Endpoint: 2 OUT (ADAPTIVE) Rates: 32000, 44100, 48000

So I believe myth is resampling it, but I'm not clear why. It seems to me that myth probably believes the card cannot support 44100, although VLC seems OK with it. When I force it to 44.1 by using hw:3,0, it does sound funny, so perhaps myth is correct. But I'm still at a loss as to why vlc works fine.

comment:3 Changed 9 years ago by paul<at>planar.id.au

I've also checked the settings in myth, I haven't set the flag for "Force audio device output to 48K", I have set the "override SRC quality" to "best". If I set this to "none", which should force it to use native rate, I get the following log:

2010-10-10 20:18:13.252 PID 18514: launched 2010-10-10 20:18:13.319 PID 18514: exited: status=256, result=1 2010-10-10 20:18:13.370 AO: Opening audio device 'default:CARD=default' ch 2(2) sr 44100 sf signed 16 bit reenc 0 2010-10-10 20:18:13.370 Opening ALSA audio device 'default:CARD=default'. 2010-10-10 20:18:13.377 ALSA, Error: Rate doesn't match (requested 44100Hz, got 0Hz) 2010-10-10 20:18:13.723 avfdecoder.o: seek time 10 2010-10-10 20:18:13.801 Error seeking

This indicates that myth is correct in not using 44100, since it doesn't work when it tries to. Which leaves me with the mystery of why vlc works fine, and I think why myth worked fine with 0.23.

I'm a little reluctant to reopen, but I'm not sure how else to flag these comments for your attention - so I'll reopen so that you can relook.

comment:4 Changed 9 years ago by paul<at>planar.id.au

Resolution: Invalid
Status: closednew

comment:5 Changed 9 years ago by JYA

Resolution: Invalid
Status: newclosed
Ticket locked: set

I told you what to do. Use the myth scanning to find out what audio device you can use.

Everything is behaving normally here.

Note: See TracTickets for help on using tickets.