<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ca">
	<id>http://wiki.joanillo.org/index.php?action=history&amp;feed=atom&amp;title=Aprofundint_en_el_JACK</id>
	<title>Aprofundint en el JACK - Historial de revisió</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.joanillo.org/index.php?action=history&amp;feed=atom&amp;title=Aprofundint_en_el_JACK"/>
	<link rel="alternate" type="text/html" href="http://wiki.joanillo.org/index.php?title=Aprofundint_en_el_JACK&amp;action=history"/>
	<updated>2026-08-30T11:12:02Z</updated>
	<subtitle>Historial de revisió per a aquesta pàgina del wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>http://wiki.joanillo.org/index.php?title=Aprofundint_en_el_JACK&amp;diff=248945&amp;oldid=prev</id>
		<title>Joan: /* Utilitat: jack_lsp */</title>
		<link rel="alternate" type="text/html" href="http://wiki.joanillo.org/index.php?title=Aprofundint_en_el_JACK&amp;diff=248945&amp;oldid=prev"/>
		<updated>2012-02-24T00:54:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Utilitat: jack_lsp&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Pàgina nova&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Introducció=&lt;br /&gt;
[[Imatge:QJackCTL.png|thumbnail]]&lt;br /&gt;
*http://www.ubustu.com/globe/2007/05/29/how-to-configure-jack-in-ubuntu-studio/&lt;br /&gt;
*http://wiki.jacklab.net/index.php/JACK_first_steps&lt;br /&gt;
&lt;br /&gt;
JACK és un servidor d'audio, i que serveix per configurar les opcions d'audio i així obtenir la performance òptima de tot el conjunt.&lt;br /&gt;
&lt;br /&gt;
JACK (Jack Audio Connection Kit) és el servidor de so amb ''latència baixa'' que corre en un sistema Linux. Permet que qualsevol software compatible es pugui interconnectar utilitzant ''patch cords'' virtuals, d'una manera increïblement flexible. Per exemple, pots connectar les teves guitarres i els teus micròfons a les entrades de la teva targeta de so; el teclat es pot connectar al port USB per a grabació MIDI; l'audio es pot enregistrar en una aplicació DAW mentre que el MIDI es pot enregistrar en un seqüenciador MIDI separat. La sortida de totes les aplicacions es pot enregistrar de forma simultània a un fitxer WAV estereo d'una tercera aplicació. Totes les aplicacions estan sincronitzades de forma conjunta i perfecta. Aquest és un exemple de la potència de JACK.&lt;br /&gt;
&lt;br /&gt;
El servidor de JACK ha de ser ''tunejat'' per tal de treure de la targeta de so la màxima ''performance'', sense Xruns (més avall està explicat què són els Xruns).&lt;br /&gt;
&lt;br /&gt;
==JackControl (QJackCTL)==&lt;br /&gt;
&lt;br /&gt;
El QJackCTL és la interfície gràfica d'usuari (GUI) del servidor JACK. Permet modificar la configuració de les targetes de so i fer patches utilitzant el virtual patchbay.&lt;br /&gt;
&lt;br /&gt;
=JACK en mode comanda=&lt;br /&gt;
[[Imatge:400px-QJackCTLsetup.png|thumbnail]]&lt;br /&gt;
Engeguem el JACK amb la configuració per defecte, i mirem la finestra de missatges. Podem veure amb quines opcions es crida al dimoni de JACK (jackd). Aquestes opcions són les que puc configurar en el Setup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/bin/jackd -R -dalsa -dhw:0 -r44100 -p1024 -n2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*-R: tinc marcada la casella RealTime&lt;br /&gt;
*-d és el driver que utilitzem: alsa. JACK treballa per defecte sobre ALSA. Altres possibilitats portaudio, oss, freebob, firewire&lt;br /&gt;
*-dhw:0 és el dispositiu que utilitzem hw:0 representa la targeta interna del portàtil (ICH6). Si tinc connectat el EDIROL UA-25EX, posaré -dhw:1&lt;br /&gt;
*-r44100 és la freqüencia de mostreig. Si escullo una freqüència més gran, per exemple 48000 o 96000, la latència es redueix. La sample rate significa que, quan es graba, cada segon es prenen 44100 mostres. En el Edirol el Sample Rate es pot seleccionar amb un botó. Influeix en la latència.&lt;br /&gt;
*-p1024 és el Frames/Period. Pot anar de 16 a 4096. Com més petita és el valor, més petita és la latència. És el factor que més influeix en la latència.&lt;br /&gt;
*-n2 és el Periods/Buffer (no significa periodes dividit per buffer, sinó que ho podem anomenar periode o buffer). També influeix en la latència.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A frame of audio means 1 sample per channel.. E.g. if you have a 6-channel&lt;br /&gt;
signal and you process one frame of it you have processed one sample per&lt;br /&gt;
channel, 6 samples in total..&lt;br /&gt;
&lt;br /&gt;
frames/period means frames per processing cycle (e.g. if you have 64&lt;br /&gt;
frames/period, then the buffersize per channel is 64 samples)&lt;br /&gt;
&lt;br /&gt;
periods/buffer means how many periods are there [on windows a period is more&lt;br /&gt;
often called a &amp;quot;buffer&amp;quot;]. But in a typical double buffer scheme you have e.g.&lt;br /&gt;
two buffers combined into a single chunk of memory.. And in alsa speak, this&lt;br /&gt;
combined buffer is the &amp;quot;buffer&amp;quot; and the individual chunks in the buffers are&lt;br /&gt;
called periods [kinda, the terminology is a little squishy] So one period is&lt;br /&gt;
the first half of the buffer and the other period is the second half of the&lt;br /&gt;
buffer..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Per exemple, canvio els paràmetres, escullo la UA-25EX com a interfície, i ara en la sortida de missatges obtinc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
11:04:38.987 JACK is starting...&lt;br /&gt;
11:04:38.988 /usr/bin/jackd -R -dalsa -dhw:1 -r44100 -p256 -n2&lt;br /&gt;
11:04:39.009 JACK was started with PID=4659.&lt;br /&gt;
no message buffer overruns&lt;br /&gt;
jackd 0.116.1&lt;br /&gt;
Copyright 2001-2005 Paul Davis and others.&lt;br /&gt;
jackd comes with ABSOLUTELY NO WARRANTY&lt;br /&gt;
This is free software, and you are welcome to redistribute it&lt;br /&gt;
under certain conditions; see the file COPYING for details&lt;br /&gt;
JACK compiled with System V SHM support.&lt;br /&gt;
cannot lock down memory for jackd (Cannot allocate memory)&lt;br /&gt;
loading driver ..&lt;br /&gt;
apparent rate = 44100&lt;br /&gt;
creating alsa driver ... hw:1|hw:1|256|2|44100|0|0|nomon|swmeter|-|32bit&lt;br /&gt;
control device hw:1&lt;br /&gt;
configuring for 44100Hz, period = 256 frames (5.8 ms), buffer = 2 periods&lt;br /&gt;
ALSA: final selected sample format for capture: 24bit little-endian&lt;br /&gt;
ALSA: use 2 periods for capture&lt;br /&gt;
ALSA: final selected sample format for playback: 24bit little-endian&lt;br /&gt;
ALSA: use 2 periods for playback&lt;br /&gt;
JACK: unable to mlock() port buffers: Cannot allocate memory&lt;br /&gt;
JACK: unable to mlock() port buffers: Cannot allocate memory&lt;br /&gt;
11:04:41.110 Server configuration saved to &amp;quot;/home/joan/.jackdrc&amp;quot;.&lt;br /&gt;
11:04:41.113 Statistics reset.&lt;br /&gt;
11:04:41.117 Client activated.. M'explico: per a un periode de 256 frames (256 frames/period), sempre surt el valor de 5,8 ms, però aquest no és el valor que surt com a latència en el setup del JACK. Per calcular-lo, he de multiplicar el 5,8 ms pels periods/buffer. Per exemple, amb frames/period=256 i periods/buffer=4 obtinc una latència de:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*frames/period=256 (5,8 ms)&lt;br /&gt;
*periods/buffer=4&lt;br /&gt;
*latencia=5,8 ms * 4 = 23,2 ms&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
11:04:41.123 JACK connection change.&lt;br /&gt;
11:04:41.162 JACK connection graph change.&lt;br /&gt;
cannot lock down memory for RT thread (Cannot allocate memory)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Fixem-nos que en el missatge ens surt el valor de 5.8ms, que és un valor relacionat amb la latència, però no és exactament el valor de la latència que em diu el QjackCtl. Veure més avall el càlcul de la latència&lt;br /&gt;
&lt;br /&gt;
Fixem-nos també que a partir de les dades de configuració del JACK. es crea el driver ALSA amb aquestes dades de configuració. És a dir, el setup del JACK és al cap i a la fi el setup del ALSA:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
creating alsa driver ... hw:1|hw:1|256|2|44100|0|0|nomon|swmeter|-|32bit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
El Input Device (gravació) i el Output Device (playback) podrien ser diferents. Anem a veure com es tradueix si escullo com a Input Device el hw:1 i com a Output Device el hw:0. Primer de tot s'ha de constatar que la combo box de la interfície es deshabilita (això passa sempre que edito Input Device i Output Device).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
11:16:34.599 Startup script...&lt;br /&gt;
11:16:34.600 artsshell -q terminate&lt;br /&gt;
sh: artsshell: not found&lt;br /&gt;
11:16:35.002 Startup script terminated with exit status=32512.&lt;br /&gt;
11:16:35.003 JACK is starting...&lt;br /&gt;
11:16:35.003 /usr/bin/jackd -R -dalsa -r44100 -p256 -n5 -D -Chw:0 -Phw:1&lt;br /&gt;
11:16:35.026 JACK was started with PID=4971.&lt;br /&gt;
no message buffer overruns&lt;br /&gt;
jackd 0.116.1&lt;br /&gt;
Copyright 2001-2005 Paul Davis and others.&lt;br /&gt;
jackd comes with ABSOLUTELY NO WARRANTY&lt;br /&gt;
This is free software, and you are welcome to redistribute it&lt;br /&gt;
under certain conditions; see the file COPYING for details&lt;br /&gt;
JACK compiled with System V SHM support.&lt;br /&gt;
cannot lock down memory for jackd (Cannot allocate memory)&lt;br /&gt;
loading driver ..&lt;br /&gt;
apparent rate = 44100&lt;br /&gt;
creating alsa driver ... hw:1|hw:0|256|5|44100|0|0|nomon|swmeter|-|32bit&lt;br /&gt;
control device hw:1&lt;br /&gt;
configuring for 44100Hz, period = 256 frames (5.8 ms), buffer = 5 periods&lt;br /&gt;
ALSA: final selected sample format for capture: 16bit little-endian&lt;br /&gt;
ALSA: use 5 periods for capture&lt;br /&gt;
ALSA: final selected sample format for playback: 24bit little-endian&lt;br /&gt;
ALSA: use 5 periods for playback&lt;br /&gt;
JACK: unable to mlock() port buffers: Cannot allocate memory&lt;br /&gt;
JACK: unable to mlock() port buffers: Cannot allocate memory&lt;br /&gt;
11:16:37.070 Server configuration saved to &amp;quot;/home/joan/.jackdrc&amp;quot;.&lt;br /&gt;
11:16:37.073 Statistics reset.&lt;br /&gt;
11:16:37.077 Client activated.&lt;br /&gt;
11:16:37.084 JACK connection change.&lt;br /&gt;
11:16:37.119 JACK connection graph change.&lt;br /&gt;
cannot lock down memory for RT thread (Cannot allocate memory)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ara tenim:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/bin/jackd -R -dalsa -r44100 -p256 -n5 -D -Chw:0 -Phw:1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
he ficat -n5 (5 buffers per periode, per provar), ara no tinc l'opció -d de interfície per defecte, i en canvi tinc -C (dispositiu d'entrada, record, Capture) i -P (dispositiu de sortida, Playback). Aix`en el alsa driver es tradueix com a:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
creating alsa driver ... hw:1|hw:0|256|5|44100|0|0|nomon|swmeter|-|32bit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
és a dir, seguint l'ordre: Playback (hw:1), Record (hw:0), frames/period (256), periods/buffer (5), 44100 (sample rate) i la resta no sé a què fa referència.&lt;br /&gt;
&lt;br /&gt;
=JackControl-QJackCTL: altres opcions=&lt;br /&gt;
*Execute script on startup: és el script que s'executa quan engeguem el dimoni:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
artsshell -q terminate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
No trobo on està aquest script.&lt;br /&gt;
&lt;br /&gt;
*Execute script after shutdown: killall jackd. És a dir, ens assegurem de que no quedi cap dimoni de jackd executant-se&lt;br /&gt;
&lt;br /&gt;
*Save Audio Jack Configuration to: senzillament guardem la configuració de com arrenguem el JACK&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/home/joan/.jackdrc&lt;br /&gt;
&lt;br /&gt;
$ cat .jackdrc &lt;br /&gt;
/usr/bin/jackd -R -dalsa -dhw:0 -r44100 -p256 -n4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Messages log file: qjackctl.log (per defecte no es guarda el log). El que es guarda és senzillament la sortida dels missatges.&lt;br /&gt;
&lt;br /&gt;
És important, doncs, adonar-se que per executar el dimoni ho puc fer tot sense la interfície gràfica: executo el dimoni jackd amb les opcions adients, puc mirar el log, puc establir les connexions (aconnect),...&lt;br /&gt;
&lt;br /&gt;
=XRUNS=&lt;br /&gt;
http://wiki.jacklab.net/index.php/JACK_first_steps&lt;br /&gt;
&lt;br /&gt;
The JACK server needs to be 'tuned' to your soundcard to get the best possible performance without any Xruns. What are Xruns?&lt;br /&gt;
&lt;br /&gt;
Simply speaking, Xruns are either sound buffer overruns or sound buffer underruns.&lt;br /&gt;
&lt;br /&gt;
*A buffer overrun happens during recording, when your sound card tries to write data to buffer, but your software has not yet emptied it.&lt;br /&gt;
*A buffer underrun happens during playback, when your sound card tries to read data from the buffer, but your software has not yet filled it.&lt;br /&gt;
&lt;br /&gt;
It is okay to get a couple of Xruns when you start or close an application. However, any Xruns during recording and you will probably get a very horrible click sound in your audio file. Therefore, it is very important to reduce the possibility of Xruns to an absolute minimum level.&lt;br /&gt;
&lt;br /&gt;
A la captura de pantalla del penell del QJackCTL es pot observar el número que apareix en vermell: 1(1). Són els Xruns. Els Xruns s'han de mantenir el més baixos possibles. Per aconseguir-ho hem de tunejar la configuració del JACK. &lt;br /&gt;
&lt;br /&gt;
Tailoring the settings for best performance is really and trial and error process as there so many variables involved. Your system speed, soundcard and driver and kernel configuration all effect the performance of the JACK server. The settings you need to concentrate on are: Sample Rate, Frames/Period and Periods/Buffer.&lt;br /&gt;
&lt;br /&gt;
We suggest you start with the Sample Rate of 44100Hz for greater compatibility with other digital equipment and especially if you are going to master to CD. Some sound cards don't work very well at 44.1KHz, especially Soundblaster cards. In this case use 48KHz.&lt;br /&gt;
&lt;br /&gt;
As you can see from the screenshot above, with the sample rate at 44100Hz, 64 Frames/Period and 2 Periods/Buffer, we get a latency of 2.9 milliseconds. This is perfectly adequate for realtime effects and software synthesizers. It is perfectly normal operating practice to change the settings of JACK as you progress through a project. For example, for initial track laying and recording of softsynths you will need a very low latency - this is okay as long as minimal live effects and processing are needed. Further into the project when you start mixing, you will need to increase the latency to cope with (fer front a) more processing and effects without encountering any Xruns - this should be okay as live recording isn't needed.&lt;br /&gt;
&lt;br /&gt;
After you have made your settings, click 'save' to exit the configuration. Then press the 'start' button as is shown below: &lt;br /&gt;
&lt;br /&gt;
If everything is okay, then the JACK server will start. If there are problems you will see error messages shown in a pop-up dialogue box.&lt;br /&gt;
&lt;br /&gt;
QJackCTL is the heart of a linux-based professional audio system, the more you get to know it and what it can and can't do - the more productive your linux music session will be.&lt;br /&gt;
&lt;br /&gt;
Després de llegir això, sembla ser que hi ha un compromís entre la latència i els Xruns, i depenent de la situació és més important l'un o l'altre. Si estic executant i fent sonar amb el fluidsynth, m'interessa tenir la latència baixa. En fase de postproducció, quan mesclo, etc., m'interessa no tenir Xruns (i puc augmentar la latència).&lt;br /&gt;
&lt;br /&gt;
Aquí va el mail d'un que té un bon equip destinat per a audio, i que canvia la configuració de la latència en funció de si està grabant o està mesclant:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
On Wednesday 13 May 2009 22.50.08 Brent Busby wrote:&lt;br /&gt;
...&lt;br /&gt;
&amp;gt; Wow...just for reference, what kind of motherboard/cpu was this?  There&lt;br /&gt;
&amp;gt; are probably a lot of people (like me) that would like to know the&lt;br /&gt;
&amp;gt; hardware when a success story is achieved.  Also, what audio card and&lt;br /&gt;
&amp;gt; distro?&lt;br /&gt;
&amp;gt;&lt;br /&gt;
&amp;gt; (Less than a millisecond??)  :-O&lt;br /&gt;
&lt;br /&gt;
Yes, less than a millisecond. :-) ..but I still have to send &amp;quot;nosmp&amp;quot; to the&lt;br /&gt;
kernel in Grub's menu.lst-file - or the system freezes; I wasn't aware of that&lt;br /&gt;
when I wrote to this list yesterday - so it's still a lot of potential for&lt;br /&gt;
improvements; just as with the proprietary nvidia driver for  my previos GPU, &lt;br /&gt;
the proprietary ATI driver don't play nice with the rt-kernel, but I have a&lt;br /&gt;
much quicker and stable sustem with the ST GPU. So I guess that it's a problem&lt;br /&gt;
with the Ubuntu RT-kernel (2.6.28-3-rt) and possible in combination with some&lt;br /&gt;
motherboard issues that I haven't figured out yet.&lt;br /&gt;
&lt;br /&gt;
Anyway, the system is quick and stable even with this quirks, here are the&lt;br /&gt;
specs (and some extended info because I'm in the mood for it):&lt;br /&gt;
&lt;br /&gt;
MB:   MSI K9N SLI Platinum&lt;br /&gt;
CPU:  Athlon64 X2 6400+, 3.2 GHz&lt;br /&gt;
RAM:  8GB: 2 * Kingston ValueR. DDR2 PC6400 4096MB CL5, Kit w/two&lt;br /&gt;
      matched ValueRAM 2048MB DDR2 (total of 4 pieces)&lt;br /&gt;
GPU:  Asus Radeon HD 3450 256MB DDR2, PCI-Express 2.0, DVI, Passive&lt;br /&gt;
      (that means no fan, making the machine more quiet)&lt;br /&gt;
SC:   M-Audio DELTA 1010 which is Jack driven and the ALSA driven&lt;br /&gt;
      MB's card, an Intel HDA, which serves for light monitoring and&lt;br /&gt;
      ordinary usage purposes.     &lt;br /&gt;
OS:   Kubuntu 9.04 64 bit with 2.6.28-3-rt running and with almost&lt;br /&gt;
      every music related apps and libraries compiled from scratch.&lt;br /&gt;
Jack: In normal use, the setting are: Frames: 64, sample rate 44100,&lt;br /&gt;
      periods: 2 which gives 2.9 ms of latency. I normally reduce&lt;br /&gt;
      the frames down to 16 (0.726 ms) when i do recording and up&lt;br /&gt;
      to 512 (23.2 ms) and rarely even up to 1024 (46.4 ms) when&lt;br /&gt;
      mixing. I have experienced xruns if the latency is to high,&lt;br /&gt;
      perhaps some apps or HW are impatience? :-)&lt;br /&gt;
&lt;br /&gt;
I suspect that the MSI K9N is not an ideal solution for Audio, but that the&lt;br /&gt;
power of CPU and the system at large makes everything good anyway.&lt;br /&gt;
&lt;br /&gt;
The main apps are Ardour, Rosegarden and Linuxsampler (loaded with  4-5 GB of&lt;br /&gt;
sounds, NDK, pianos, brass and bass) and occasionally zynaddsubfx and &lt;br /&gt;
FluidSynth (Qsynth).&lt;br /&gt;
&lt;br /&gt;
I use to do files in 44100 and 24 bit. I believe that 48000 is not (very)&lt;br /&gt;
audible, in order to be audible it should be 96000 which I'm not ready to use&lt;br /&gt;
as a standard yet. I always record samples and synths and any sequencer&lt;br /&gt;
related stuff into Ardour before mixing, freeing resources to plugins.&lt;br /&gt;
Speaking of plugins: I really love the Calf plugins, especially the compressor&lt;br /&gt;
for drums, awesome! For Guitar work, I use a POD or micing up amplifiers with&lt;br /&gt;
SM 57's. IMO the POD sounds great in the mix, but the compressor really sucks,&lt;br /&gt;
so I have a Marshall ED-1 first in the chain when using guitars with low&lt;br /&gt;
output SC. I use QtPod for controlling the POD from the computer. Keyboard&lt;br /&gt;
controller is an Edirol PCR 800.&lt;br /&gt;
&lt;br /&gt;
The average or sane user will probably use a ready music distro or additions&lt;br /&gt;
like CCRMA with the apps from the repository. I use Kubuntu because I like it&lt;br /&gt;
and mainly use Ubuntu (both desktop and servers) for work. This makes my life&lt;br /&gt;
easier. I also use a similar setup on my Laptop, but with a Edirol UM-2ex&lt;br /&gt;
interface for MIDI and a M-Audio MobilePRE USB audio interface.&lt;br /&gt;
&lt;br /&gt;
I hope that this info can be of some value for someone that wonders where to&lt;br /&gt;
go or just are interested.&lt;br /&gt;
&lt;br /&gt;
Jostein&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Latència=&lt;br /&gt;
Per a un periode de 256 frames (256 frames/period) i una freqüència de 44100, la latència té un valor de  5,8 ms, i aquest és el valor que s'informa en el log de quan engeguem el Jack. Per obtenir el valor senzillament hem de fer la divisió:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
configuring for 44100Hz, period = 256 frames (5.8 ms), buffer = 2 periods&lt;br /&gt;
&lt;br /&gt;
256 frames/44100 Hz = 0,0058 s = 5,8 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Però aquest no és el valor que surt com a latència en el setup del JACK. Per calcular-lo, he de multiplicar el 5,8 ms pels periods (o buffer, depèn de la nomenclatura). Si periods/buffer=4 obtinc una latència de:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
latència = 5,8 ms * 4 = 23,2 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
i aquest sí que és el valor que em proporciona el JACK.&lt;br /&gt;
&lt;br /&gt;
Per tant, surt bé el càlcul numèric i el càlcul dimensional:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             256 frames/period * 4 period&lt;br /&gt;
latència = ______________________________ = 23,2 msec&lt;br /&gt;
            &lt;br /&gt;
                   44100 frames/sec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=man jackd=&lt;br /&gt;
*http://ccrma.stanford.edu/planetccrma/man/man1/jackd.1.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
jackd (1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAME&lt;br /&gt;
&lt;br /&gt;
       jackd, jackstart - JACK Audio Connection Kit sound server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SYNOPSYS&lt;br /&gt;
&lt;br /&gt;
       jackd [  options  ]  -d  driver [ driver options  ]&lt;br /&gt;
       jackstart [  options  ]  -d  driver [ driver options  ]&lt;br /&gt;
       jackd --help&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
&lt;br /&gt;
       jackd invokes the JACK audio server daemon.  When using JACK's built-in&lt;br /&gt;
       support for realtime capabilities, use the jackstart command,  instead.&lt;br /&gt;
       All options are the same.&lt;br /&gt;
&lt;br /&gt;
       JACK  is  a  low-latency  audio  server,  originally  written  for  the&lt;br /&gt;
       GNU/Linux operating system.  It can connect a number of different  JACK&lt;br /&gt;
       client  applications  to an audio device, and also to each other.  Most&lt;br /&gt;
       clients are external, running in their own processes as normal applica-&lt;br /&gt;
       tions.  JACK also supports internal clients, which run within the jackd&lt;br /&gt;
       process using a loadable &amp;quot;plugin&amp;quot; interface.&lt;br /&gt;
&lt;br /&gt;
       JACK differs from other audio servers in being designed from the ground&lt;br /&gt;
       up  for  professional  audio  work.   It focuses on two key areas: syn-&lt;br /&gt;
       chronous execution of all clients, and low latency operation.&lt;br /&gt;
&lt;br /&gt;
       For  the  latest  JACK  information,  please  consult  the  web   site,&lt;br /&gt;
       &amp;lt;http://jackit.sourceforge.net&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
&lt;br /&gt;
       -h, --help&lt;br /&gt;
              Print  a  brief usage message describing the main jackd options.&lt;br /&gt;
              These do not include driver options, which  are  obtained  using&lt;br /&gt;
              the --help option for that specific driver, instead.&lt;br /&gt;
&lt;br /&gt;
       -a, --asio&lt;br /&gt;
              Force  absolute  realtime  behaviour on the system.  Rather than&lt;br /&gt;
              allowing clients to take a time determined by the  kernel,  they&lt;br /&gt;
              are  determined  to have timed out on receipt of the next inter-&lt;br /&gt;
              rupt from the audio interface.  This only makes sense when  used&lt;br /&gt;
              with  an  ASIO-style configuration where there are 2 periods per&lt;br /&gt;
              buffer (see --nperiods).  It is safe to omit this parameter,  if&lt;br /&gt;
              you  don't  need  to  enforce strict realtime limits.  It can be&lt;br /&gt;
              useful for testing the realtime behavior of a new JACK  clients.&lt;br /&gt;
&lt;br /&gt;
       -t, --timeout int&lt;br /&gt;
              Set  client  timeout  limit in microseconds.  The default is 500&lt;br /&gt;
              msec when not in realtime mode (see: -R).&lt;br /&gt;
&lt;br /&gt;
       -R, --realtime&lt;br /&gt;
              Use realtime scheduling.   This  is  needed  for  reliable  low-&lt;br /&gt;
              latency  performance.   It  requires  jackd  to run with special&lt;br /&gt;
              scheduler  and  memory  allocation  privileges,  which  may   be&lt;br /&gt;
              obtained  in  two  ways.   The first method is to run jackd with&lt;br /&gt;
              root privileges, which means that all JACK clients must also run&lt;br /&gt;
              as  root.  The second method requires a kernel with &amp;quot;POSIX draft&lt;br /&gt;
              capabilities&amp;quot;  enabled  (see  the  &amp;lt;linux/capability.h&amp;gt;  include&lt;br /&gt;
&lt;br /&gt;
       -v, --verbose&lt;br /&gt;
              Give verbose output.&lt;br /&gt;
&lt;br /&gt;
       -V, --version&lt;br /&gt;
              Print the current JACK version number and exit.&lt;br /&gt;
&lt;br /&gt;
       -d, --driver  driver  [  driver-options  ]&lt;br /&gt;
              Select the output driver.  The only driver currently  documented&lt;br /&gt;
              is alsa (see below).&lt;br /&gt;
&lt;br /&gt;
   ALSA DRIVER OPTIONS&lt;br /&gt;
       -h, --help Print a brief usage message describing only the&lt;br /&gt;
              alsa driver options.&lt;br /&gt;
&lt;br /&gt;
       -d, --device name&lt;br /&gt;
              The ALSA pcm device name to use (&amp;quot;default&amp;quot; if none specified).&lt;br /&gt;
&lt;br /&gt;
       -r, --rate int&lt;br /&gt;
              Specify the sample rate.  The default is 48000.&lt;br /&gt;
&lt;br /&gt;
       -p, --period int&lt;br /&gt;
              Specify  the number of frames between JACK process() calls.  The&lt;br /&gt;
              default is 1024.  If you need low latency, set -p as low as  you&lt;br /&gt;
              can go without seeing xruns.  A larger period size yields higher&lt;br /&gt;
              latency, but makes xruns less likely.&lt;br /&gt;
&lt;br /&gt;
       -n, --nperiods int&lt;br /&gt;
              Specify the number of  periods  in  the  hardware  buffer.   The&lt;br /&gt;
              default  is 2.  The period size (-p) times --nperiods times four&lt;br /&gt;
              is the JACK buffer size in bytes.&lt;br /&gt;
&lt;br /&gt;
       -D, --duplex&lt;br /&gt;
              Provide both capture and playback ports (the default).&lt;br /&gt;
&lt;br /&gt;
       -C, --capture&lt;br /&gt;
              Provide only capture ports.&lt;br /&gt;
&lt;br /&gt;
       -P, --playback&lt;br /&gt;
              Provide only playback ports.&lt;br /&gt;
&lt;br /&gt;
       -H, --hwmon&lt;br /&gt;
              Enable hardware monitoring of capture ports.  This is  a  method&lt;br /&gt;
              for  obtaining  &amp;quot;zero  latency&amp;quot;  monitoring  of audio input.  It&lt;br /&gt;
              requires support in hardware and from the underlying ALSA device&lt;br /&gt;
              driver.&lt;br /&gt;
&lt;br /&gt;
              When  enabled,  requests to monitor capture ports will be satis-&lt;br /&gt;
              fied by creating a direct signal path  between  audio  interface&lt;br /&gt;
              input and output connectors, with no processing by the host com-&lt;br /&gt;
              puter at all.  This offers the lowest possible latency  for  the&lt;br /&gt;
              monitored signal.&lt;br /&gt;
&lt;br /&gt;
              Presently (March 2003), only the RME Hammerfall series and cards&lt;br /&gt;
              based on the ICE1712 chipset (M-Audio  Delta  series,  Terratec,&lt;br /&gt;
              and others) support --hwmon.  In the future, some consumer cards&lt;br /&gt;
              may also be supported by modifying their mixer settings.&lt;br /&gt;
&lt;br /&gt;
       -s, --softmode&lt;br /&gt;
              Ignore xruns reported by the ALSA driver.  This makes JACK  less&lt;br /&gt;
              likely  to  disconnect  unresponsive  ports when running without&lt;br /&gt;
              --realtime.&lt;br /&gt;
&lt;br /&gt;
       -z, --dither [rectangular,triangular,shaped,none]&lt;br /&gt;
              Set dithering mode.  If none or unspecified, dithering  is  off.&lt;br /&gt;
              Only the first letter of the mode name is required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
EXAMPLES&lt;br /&gt;
&lt;br /&gt;
       Print usage message for options specific to the alsa driver.&lt;br /&gt;
&lt;br /&gt;
              jackd -d alsa --help&lt;br /&gt;
&lt;br /&gt;
       Run  the  JACK daemon with realtime priority using the first ALSA hard-&lt;br /&gt;
       ware card defined in /etc/modules.conf.  This must be run on  a  kernel&lt;br /&gt;
       with capabilities enabled.&lt;br /&gt;
&lt;br /&gt;
              jackstart --realtime --driver=alsa --device=hw:0&lt;br /&gt;
&lt;br /&gt;
       Run the JACK daemon with low latency.  A reasonably well-tuned current-&lt;br /&gt;
       generation system with a decent sound card  and  a  low-latency  kernel&lt;br /&gt;
       with  capabilities  enabled can handle these values reliably.  Some can&lt;br /&gt;
       do better.  If you get xrun messages, try a larger  buffer.   Tuning  a&lt;br /&gt;
       system    for    low   latency   is   challenging.    The   JACK   FAQ,&lt;br /&gt;
       &amp;lt;http://jackit.sourceforge.net/docs/faq.php&amp;gt; has  some  useful  sugges-&lt;br /&gt;
       tions.&lt;br /&gt;
&lt;br /&gt;
              jackstart -R -d alsa -d hw:0 -p 128 -n 3 -r 44100&lt;br /&gt;
&lt;br /&gt;
       Run jackd with realtime priority using the &amp;quot;sblive&amp;quot; ALSA device defined&lt;br /&gt;
       in ~/.asoundrc.  Apply shaped dithering to playback audio.   This  must&lt;br /&gt;
       be run as root.&lt;br /&gt;
&lt;br /&gt;
              jackd -R -d alsa -d sblive --dither=shaped&lt;br /&gt;
&lt;br /&gt;
       Run  jackd  with  no  special privileges using the &amp;quot;sblive&amp;quot; ALSA device&lt;br /&gt;
       defined in ~/.asoundrc.  Any xruns reported by the ALSA driver will  be&lt;br /&gt;
       ignored.   The  larger  buffer  helps  reduce  data  loss.  Rectangular&lt;br /&gt;
       dithering will be used for playback.&lt;br /&gt;
&lt;br /&gt;
              jackd -d alsa -d sblive -p1024 -n3 --softmode -zr&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SEE ALSO:&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;http://www.alsa-project.org&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Utilitat: jack_lsp=&lt;br /&gt;
Es pot estudiar el codi font:&lt;br /&gt;
*https://github.com/jackaudio/tools/blob/master/lsp.c&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
       jack_lsp - JACK toolkit client to list informtion on ports&lt;br /&gt;
&lt;br /&gt;
SYNOPSIS&lt;br /&gt;
       jack_lsp [ -s | --server servername ] [ -AclLptvh ]&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
       jack_lsp  lists  all  known ports associated with a JACK server. It can also optionally list various kinds of&lt;br /&gt;
       information about each port.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ jack_lsp -t&lt;br /&gt;
system:capture_1&lt;br /&gt;
	32 bit float mono audio&lt;br /&gt;
system:capture_2&lt;br /&gt;
	32 bit float mono audio&lt;br /&gt;
system:playback_1&lt;br /&gt;
	32 bit float mono audio&lt;br /&gt;
system:playback_2&lt;br /&gt;
	32 bit float mono audio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=the playback device &amp;quot;hw:0&amp;quot; is already in use=&lt;br /&gt;
Aquest problema va apareixent de forma esporàdica quan vull iniciar el JACK.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
the playback device &amp;quot;hw:0&amp;quot; is already in use. Please stop the application using it and run JACK again&lt;br /&gt;
cannot load driver module alsa&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some program was probably hogging your sound card. The usual culprit is esd (the Enlightened Sound Daemon). per matar el dimoni:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ps aux|grep esd&lt;br /&gt;
$ sudo killall esd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If its not esd, then its generally software that uses OSS (the open sound system) which is severly deprecated, but yet some programs insist on using them.&lt;br /&gt;
&lt;br /&gt;
Millor és reiniciar ALSA:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ sudo /etc/init.d/alsa-utils restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
no ho soluciona, en canvi, sí que ho soluciona fer:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ sudo /sbin/alsa force-reload&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Autor}}, maig 2009&lt;br /&gt;
[[Category: Informàtica Musical]]&lt;br /&gt;
[[Category: Ubuntu Studio]]&lt;/div&gt;</summary>
		<author><name>Joan</name></author>
		
	</entry>
</feed>