Distorted / Crackling Sound via ALSA -> Loop -> Jack

Unofficial support for the KXStudio Linux distribution and applications.
More info at http://kxstudio.linuxaudio.org/

Moderators: MattKingUSA, khz

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

Distorted / Crackling Sound via ALSA -> Loop -> Jack

Post by lilith »

Hi,

I don't know if this might be related to some software update. From time to time I get a distorted / crackling sound when listening to youtube videos via ALSA-> loop-> Jack. With just Jack everything is fine. Anyone else observed this recently?
User avatar
lilith
Established Member
Posts: 1706
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 122 times
Been thanked: 57 times
Contact:

Re: Distorted / Crackling Sound via ALSA -> Loop -> Jack

Post by lilith »

It happens also with 512 or 1024. When listening to a sinusoidal tone and the problem is present it sounds as there are some higher harmonics overlaying the root tone.
progwolff
Established Member
Posts: 44
Joined: Tue Sep 27, 2016 9:08 am
Location: Lübeck, Germany

Re: Distorted / Crackling Sound via ALSA -> Loop -> Jack

Post by progwolff »

This sounds similar to the issues I had with my old Tascam US 122 mkII.
Every 10 minutes or so there were ugly noises and harmonics on top of the audio signal which were persistent until I unplugged the interface.

It was a hardware issue though. Both on Windows and Linux the drivers / firmware seemed to be a little buggy.
User avatar
lilith
Established Member
Posts: 1706
Joined: Fri May 27, 2016 11:41 pm
Location: bLACK fOREST
Has thanked: 122 times
Been thanked: 57 times
Contact:

Re: Distorted / Crackling Sound via ALSA -> Loop -> Jack

Post by lilith »

I tried a different interface and I also get the crackling in firefox via youtube. It seems only to happen with the alsa -> loop -> jack bridge. Is there anything that I can test to localize the reason for this? Are the values in alsa config file relevant? My interface works best with 48kHz (which is also set in cadence).

Code: Select all

cat ~/.asoundrc                  
# ------------------------------------------------------
# Custom asoundrc file for use with snd-aloop and JACK
#
# use it like this:
# env JACK_SAMPLE_RATE=44100 JACK_PERIOD_SIZE=1024 alsa_in (...)
#

# ------------------------------------------------------
# playback device
pcm.aloopPlayback {
  type dmix
  ipc_key 1
  ipc_key_add_uid true
  slave {
    pcm "hw:Loopback,0,0"
    format S32_LE
    rate {
      @func igetenv
      vars [ JACK_SAMPLE_RATE ]
      default 44100
    }
    period_size {
      @func igetenv
      vars [ JACK_PERIOD_SIZE ]
      default 1024
    }
    buffer_size 4096
  }
}

# capture device
pcm.aloopCapture {
  type dsnoop
  ipc_key 2
  ipc_key_add_uid true
  slave {
    pcm "hw:Loopback,0,1"
    format S32_LE
    rate {
      @func igetenv                                                                                                         
      vars [ JACK_SAMPLE_RATE ]                                                                                             
      default 44100                                                                                                         
    }                                                                                                                       
    period_size {
      @func igetenv
      vars [ JACK_PERIOD_SIZE ]
      default 1024
    }
    buffer_size 4096
  }
}

# duplex device
pcm.aloopDuplex {
  type asym
  playback.pcm "aloopPlayback"
  capture.pcm "aloopCapture"
}

# ------------------------------------------------------
# default device
pcm.!default {
  type plug
  slave.pcm "aloopDuplex"
}

# ------------------------------------------------------
# alsa_in -j alsa_in -dcloop -q 1
pcm.cloop {
  type dsnoop
  ipc_key 3
  ipc_key_add_uid true
  slave {
    pcm "hw:Loopback,1,0"
    channels 2
    format S32_LE
    rate {
      @func igetenv
      vars [ JACK_SAMPLE_RATE ]
      default 44100
    }
    period_size {
      @func igetenv
      vars [ JACK_PERIOD_SIZE ]
      default 1024
    }
    buffer_size 32768
  }
}

# ------------------------------------------------------
# alsa_out -j alsa_out -dploop -q 1
pcm.ploop {
  type plug
  slave.pcm "hw:Loopback,1,1"
}
Post Reply