[mythtv-users] Myth, Jack & resampling

Mark Knecht markknecht at gmail.com
Fri Jul 4 20:02:44 UTC 2008


On Fri, Jul 4, 2008 at 12:30 PM, Alen Edwards
<allen.edwards at oldpaloalto.com> wrote:
>
>
> Mark Greenwood wrote:
>
> On Friday 04 July 2008 15:57:04 Dave Badia wrote:
>
>
> On Fri, Jun 27, 2008 at 2:15 PM, Mark Greenwood <fatgerman at ntlworld.com>
> wrote:
>
>
>
> It would appear from your log that your sound card runs at a native sample
> rate of 48KHz (a lot of them do, especially if they have digital IO). In
> order to get its timing correct, JACK needs to run at the same rate.
>
>
> Ah, so assuming my sound card only supports 48KHz, that would explain why
> the myth code is resampling the output.  Is there some definitive way I can
> see if my sound card (mb audio VT8233) supports output at the 44.1KHz sample
> rate?  Seems like that's the what this is coming down to...
>
> From all of the "bit-perfect audio" articles I've been reading, it seems
> that some sound cards will pass through at 44.1KHz, but others won't.
>
> for reference, lspci shows:
> 00:11.5 Multimedia audio controller: VIA Technologies, Inc.
> VT8233/A/8235/8237 AC97 Audio Controller (rev 60)
>
>
> It's a complicated problem... To the very best of my knowledge, all
> "standard" digital audio I/O is 48KHz. Therefore if the source audio is not
> 48KHz it will have to be resampled somewhere along the line. If the sound
> card supports "pass-through at 44.1KHz" then what's actually happening is
> that the sound card is doing the resampling to 48KHz. In your case, your
> other email implies that myth is doing the resampling. This would tend to
> indicate that myth is running internally at 44.1KHz and is having to
> resample in order to send data at the rate the sound card requires. This in
> turn implies that the sound card driver is running at 48KHz.
>
> So, because you're using jackd we have the opportunity to experiment. What
> sample rate is jackd running at? I like to use qjackctl to start jackd, it's
> a much easier way of playing with the settings. If you start jackd at 48KHz
> then it will require audio to be sent to it at 48KHz. Audio at any other
> rate will play at the wrong speed. If, in this scenario, myth is still doing
> resampling then it implies that myth is running internally at 44.1KHz and is
> resampling in order to pass the data to jack at the rate jack requires. This
> to me doesn't sound like a very good thing but as far as I know there's no
> way to change the sample rate myth uses internally. In this scenario you
> could try starting jackd at 44.1KHz and see what happens. Your sound card
> might then do the resampling for you. Which is usually a good thing.
>
> Note that when you use qjackctrl you are able to patch inputs to outputs on
> the fly and save the settings - this is usually much easier and far more
> flexible than passing command line parameters to jackd to tell it which
> output to use. I start jackd by having qjackctrl start up at boot. I'd
> suggest you give it a try.
>
> It's complicated when you start including jackd in the equation, but at
> least you have full control over it. Like I say though I don't know a lot
> about how it interacts with ALSA because I use it with freebob as the
> driver. Your best bet for now would seem to be to play around with the
> sample rates and see what happens.
>
> Mark
>
>
>
> Thanks for the help
> Dave
>
>
>
>
>
> I don't think it is correct to say all digital I/O is 48KHz.
>
> From Wikipedia:  "S/PDIF is used to transmit digital signals of a number of
> formats, the most common being the 48 kHz sample rate format used in DAT,
> and the 44.1 kHz format used in CD audio."
>
> And from Answers.com:
> "S/PDIF is used to transmit digital signals of a number of formats, the most
> common being the 48 kHz sample rate format used in DAT, and the 44.1 kHz
> format used in CD audio. In order to support both systems, as well as others
> that might be needed, the format has no defined data rate. "
>
> Apparently some old sound cards only output 48KHz.  They clearly don't meet
> the S/PDIF specification.
>
> Allen
>

This sort of technical topic is one that seldom seems to get covered
correctly in things like Wikipedia. To give Mark Greenwood credit, he
did use "standard" whereas you did not. None the less you both have
good points:

1) Digital audio can be managed at any frequency. Think about 8KHz mp3
files. That's 'digital audio', but it's not 'sound'. CD's are 44.1K.
DVD's are 48K (I believe) mp3's are all over the map.

2) Digital *interfaces*, such as coaxial spdif, optical spdif, optical
ADAT, HDMI, etc., can generally run at different frequencies. I use
coaxial spdif and optical ADAT every day at 44.1K through Jack. I use
optical spdif on my home theater receiver at 48K. Both work great, and
it's all completely contemplated in the original hardware interface
specs, but I have hardware to support it. (This hardware also supports
88.2KHz, 96KHz, and external clocking if I want to run at some other
custom frequency.) However those same spdif hardware interface specs
to *not* require that devices support all frequencies. That's left to
the implementation so I don't think the device you speak of is
necessarily 'out of spec'.

3) Many recent PCs have seemingly opted for fixing hardware sample
rates to 48K in favor of DVD playback. There are lots of sound cards
that cannot change frequency and therefore *require* software
resampling of at least one format into the other. Most folks don't
know how to check for that before they purchase, nor would it likely
change their purchase if they did.

4) I personally don't know of any PC sound cards that resample in
hardware as to do that really requires that card has both clock rates
available which adds cost and is of little value to 99.9% of their
owners.

I've been interested in this thread as I've never bothered to try Myth
through Jack, and then beyond that through Jack running with real-time
priorities. Hope this response adds another (hopefully useful)
perspective to the conversation.

Cheers,
Mark


More information about the mythtv-users mailing list