LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-13-2007, 03:15 PM   #1
Xvium
LQ Newbie
 
Registered: Apr 2005
Posts: 23

Rep: Reputation: 15
Choppy sound Recording


Hey all I'm using PClinuxOS and a program called ardour to record. I start the qtjackctl then run ardour and i have my guitar plugged into my line in. which is enabled in alsa mixer. the sound records but sounds really bad and choppy. I'm set to 44100khz and the latency is set to 1024. what can i do to fix this?
 
Old 08-14-2007, 12:32 PM   #2
studioj
Member
 
Registered: Oct 2006
Posts: 460

Rep: Reputation: 31
there are a couple or many ways to aproach this.
first the easy stuff.
don't use qjackcnl i have seen with some setups it causes too much resources to divert to updating the gui readout.
just start jack with the line you find in ~/.jackdrc from the command line.
next is to make x a little more nice. xorg really sucks resources. try a line like.
renice +2 -p `ps -C Xorg -o pid=`
use less or more "+2" as you can get away with and still have x resond ok.
next and this is the most important thing is the buffer settings. generally the slower your sound hardware the larger buffers you need. this is the line i use to start jackd.
jackd -R -P70 -dalsa -dhw:0 -r44100 -p512 -n2
you can try the 1024 setting you had above for -p or greater. i think don't change other settings or add other flags.
next is you ~/.asoundrc where you can change the period and buffer settings for the soundcard itself. i give you mine as an example to start with or look at. it has alternate settings commented out you can play with. if you don't understand just post back.
Code:
pcm.jackplug {
	        type plug
	        slave { pcm "jack" }
	}

	pcm.jack {
	        type jack
	        playback_ports {
 	               0 alsa_pcm:playback_1
 	               1 alsa_pcm:playback_2
 	       }
 	       	capture_ports {
 	               0 alsa_pcm:capture_1
                	1 alsa_pcm:capture_2
        	}

	}

pcm.dsp {
    type plug
   # slave.pcm "dmixer"
    slave.pcm "duplex"
}

pcm.dsp0 {
    type plug
   # slave.pcm "dmixer"
    slave.pcm "duplex"
}



# this makes native ALSA apps default to using dmix
pcm.!default {
    type plug
   # slave.pcm "dmixer"
    slave.pcm "duplex"
   
}

ctl.!default {
	type hw           
	card 0
        }

pcm.dmixer  {
	type dmix
	ipc_key 1024
	slave {
	    pcm "hw:0,0"
	 #   period_time 0 # set to 0 lets period size and buffer size do everything
             period_time 2 # this is the general standard even though often is set to 0
         #   period_time 84000
         #   period_size 512
             period_size 1024 # oss period frames this is the one shown as hardware
         #    period_size 128
	 #   period_size 2048
         #   period_size 4096 # not great to go over this 
         #   buffer_time 340000
	 #   buffer_size 16384 # this is the one shown as hardware but causes huge mess
         #   buffer_size 8192
         #   buffer_size 4096
             buffer_size 2052 # this is the one i use
             rate 44100 # can let card decide this on it's own this one is what hardware says
	 #   rate 48000

	}
	bindings {
	    0 0
	    1 1
	}
    }
 
    ctl.dmixer {
	type hw
	card 0
    }

    ctl.mixin {
        type hw
        card 0
     }

    pcm.duplex{
         type asym
         playback.pcm "dmixer"
         capture.pcm "mixin"
      }

pcm.mixin {
        type dsnoop
        ipc_key 5978293	# must be unique for all dmix plugins!!!!
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
		channels 2
		period_size 1024
        #       period_size 1026
	#	buffer_size 4096
                buffer_size 2052
		rate 44100
      #		periods 0 
		period_time 2
        }
        bindings {
                0 0
                0 1
        }
    }

pcm.ladspadelay {
type ladspa
slave.pcm "plughw:0,0";
path "/usr/lib/ladspa";
plugins [
{
label delay_5s
input {
controls [ 0.8 0.3 ]
}
}
]
}

pcm.delay {

type plug

slave.pcm "ladspadelay";
}


pcm.ladspacompress {
type ladspa
slave.pcm "plughw:0,0";

path "/usr/lib/ladspa";

plugins [
{
label dysonCompress
input {
#peak limit, release time, fast ratio, ratio
controls [1.0 0.1 0.1 0.9]
}
}
]
} 

pcm.compress {

type plug

slave.pcm "ladspacompress";
}
next is to mess with rt irq priority settings.
look at
cat /proc/interrupts
pick out the one for rtc and your sound card then set them like this.
chrt -f -p 82 `pidof "IRQ 11"`
chrt -f -p 98 `pidof "IRQ 8"`
where 8 for me is rtc and 11 is my soundcard so adjust as needed.
last is to mess with harware latency settings
look at
lspci -v
find your soundcard
my soundcard is 04:08.0
you can try settings like
setpci -v -s '04:08.0' latency_timer=48
setpci -v -s '04:08.0' latency_timer=78
setpci -v -s '04:08.0' latency_timer=ff
and see what works the best.
generally larger latency settings give larger bursts and better throughput.
you might also be able to turn down video driver latency or even increase latency across the pci bus itself and see if it helps.
post back if you can't get it going. there is kernel junk to do if you have to.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound problem - choppy sound - skype and gizmo robertpolson Linux - Hardware 0 01-29-2007 09:53 AM
choppy sound koby *BSD 1 03-06-2005 04:32 AM
choppy Sound in RH 8 lostcity Linux - Laptop and Netbook 0 05-17-2004 10:03 PM
Sound is Choppy nrunge Linux - Hardware 0 10-08-2003 08:06 PM
choppy sound withdraw Linux - Newbie 7 01-05-2003 12:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration