Resampling problem 44.1 kHz 48 kHz?

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

Hi,

I recently had a (unsolved) problem with distorted sounds while playing youtube videos via ALSA -> LOOP -> Jack

The thread can be found here: viewtopic.php?f=47&t=16537 if someone is interested.

I have KXStudio running and my interface is a ZOOM R8 which is set to 48 kHz, cause with 44.1 kHz I get crackling sounds with all Jack settings I tested. At least now I could limit the problem a bit more:

1. Here you hear frequency sweep played via youtube (see below) and recorded via audacity with a jack setting of 48 kHz (interface also set to 48 kHz)

http://vocaroo.com/i/s1XX3GNhW5Vg (please open in new window)

It's not a pure sine tone as there are overtones overlayed. Here's the frequency distribution:

Image

2. The same done with a Jack setting of 44.1 kHz (interface still set to 48 kHz)


http://vocaroo.com/i/s1h6xUw0jvyZ

The sound now seems ok, but I here sporadic crackling. The freq distribution also looks ok. As I wrote setting the interface to 44.1 kHz is not a solution as I was not able to get rid of the crackling at all.

Image

The freq sweep can be found here: https://www.youtube.com/watch?v=qNf9nzvnd1k
I recorded second 20 - ~35.

I really would appreciate if someone can help to solve this annoying issue or at least understands what's going on here. :D

btw: The two audio files played through firefox now have both distortions. Played via clementine the 44.1 kHz version has crackles and the 48 kHz has distortion.
Attachments
441khz.png
441khz.png (32.29 KiB) Viewed 2098 times
48khz.png
48khz.png (32.52 KiB) Viewed 2098 times
Last edited by lilith on Mon Dec 25, 2017 12:03 am, edited 1 time in total.
User avatar
sadko4u
Established Member
Posts: 986
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 359 times

Re: Resampling problem 44.1 kHz 48 kHz?

Post by sadko4u »

Do you have speech-dispatcher running/installed?
If yes, please try to disable it.
LSP (Linux Studio Plugins) Developer and Maintainer.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

I don't have it installed.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

Question. Don't understand the grafic.
All are under minus 50 db. Beneath about minus 10db no one can hear it? Ain't it?
The frequency I recorded is quite low (~ 30 Hz), that's why it looks a bit strange. But when you listen to the audio files with headphones you can hear it.

I just made some more tests:
I booted from the KXStudio ISO file and get the same issues. Then I switched to a laptop and booted from the ISO and again -> same issues. Then I played around and sometimes it's not really reproducible, i.e. changing the sampling rate makes no difference. Something seems to stuck at the old parameters. Sometimes it works, sometimes I get extreme distortion, etc. What I found out: It makes a difference if in jack the interface is set to duplex mode or not. With duplex mode off I get no distortions but crackling at 48 kHz and distortion at 44.1 kHz. With duplex mode it's the other way around (as written above). But this works only if I switch from duplex to non-duplex after booting. Changing it a second time makes no difference.
I also tested a ESI DAC nano with the laptop and had similar problems. Changing USB ports makes also no difference.
It only happens when playing music through the browser. Is it possible that it is due to some values in .asoundrc or would it help to use pulseaudio instead? Sorry for not being more clear, it's just not reproducible always.
What also strange: When I set my interface in jack to "hw:HDMI,7 [HDMI 1]" for example I still get sound from the Zoom R8, so it seems that still the R8 is taken although it's disabled.
Attachments
jack.png
jack.png (147.45 KiB) Viewed 2056 times
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

I just recorded the stream to show what the problem is. When I (only) listen to music in youtube I get crackles or distortion.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

The problem has to do with the alsa -> jack bridge I guess, because it only happens when using firefox. When I download the file and play it through clementine or smplayer it sounds fine at 48kHz, i.e. without distortion. While in Firefox I get distortion. At 44.1 kHz however I get crackings in youtube and in smplayer, but no distortion. I think these two problems are not related. The crackles seem to be interface related, however I get them also with the ESI DAC nano. The distortion has clearly something to to with this alsa bridge or firefox.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

The problem is present when listening to youtube videos / music with audible frequencies. Everything sounds metallic and slightly distorted. I have it with 2 PCs and with the KXStudio ISO image. Also appears with Chromium as browser. I'll try the AVLinux image now if it's also present there.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

I am online with an ISO image of AVLinux and .... tataaaaaaa... the same. :mrgreen: Either I get distortion while playing youtube videos or I get crackling depending on the sampling rate I choose in Jack. I just downloaded the a youtube file and when paying it through a media player there is no crackling and no distortion. What I did not get, what is the difference between playing directly via youtube and downloading the file and playing it with a media player?

So, is the problem my interface or is it youtube and resampling? I mean the latter should basically affect everyone ..


@falkTX could you give me a hint how do get zita running and how to install it?
rghvdberg
Established Member
Posts: 1067
Joined: Mon May 12, 2014 7:11 am
Has thanked: 15 times
Been thanked: 36 times

Re: Resampling problem 44.1 kHz 48 kHz?

Post by rghvdberg »

My guess is that the media player uses jack directly and Firefox goes via alsa and then to jack.

Btw, I've never understood the alsa - > loop-> jack thing and use alsa - > jack (always on) thing. but that's another topic ;)
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

It also happens with the internal onboard sound card, so it's not related to the interface.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

I reproduced it with Audacity. Generated a sine signal and when choosing ALSA as output, I get crackling. When choosing Jack Audio Connection Kit everything is fine. When stopping Jack and the Alsa Jack Bridge and choosing Alsa in Audacity and the Zoom R8 as Output device everything sounds fine.

Alsa -> Zoom R8 : works
Alsa -> AloopPlayback : crackles
Jack -> System : works

So, the problem lies somewhere in the setting of bridge and is not related to the interface.
User avatar
lilith
Established Member
Posts: 1698
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 117 times
Been thanked: 57 times
Contact:

Re: Resampling problem 44.1 kHz 48 kHz?

Post by lilith »

falkTX wrote:there's an option to use zita-a2j/j2a instead of alsa_in/out, which in theory provides better resampling.
also note that resampling quality for the cadence aloop bridge is the almost minimum quality, in order to reduce cpu load (because it will likely be running all the time).
I should add an option there to configure quality...
This basically solved my problem 8)

All I did was:

Code: Select all

sudo apt-get install zita-ajbridge
After rebooting I got the zita bridge in Cadence and the crackling in youtube is gone.
It's seems a bit buggy as sometimes I have to restart my interface / kill cadence to get it running but it's doing the job.

Thanks!
Post Reply