[Jack-Devel] Using USB sound card with Jack

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[Jack-Devel] Using USB sound card with Jack

benravin
Hi,

I'm using latest jack audio server version jackd 1.9.12. I have built simple client.c app
and able to capture audio from microphone input and play it out.

I have another USB soundcard which is connected to pc through USB.
How to get input from USB soud card ?

After connecting USB sound card and when printed the ports[] array
after executing the jack API jack_get_ports()
I could see only PC microphone capture ports, not showing USB ports.

-ben

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

David Kastrup
Benny Alexandar <[hidden email]> writes:

> Hi,
>
> I'm using latest jack audio server version jackd 1.9.12. I have built
> simple client.c app
> and able to capture audio from microphone input and play it out.
>
> I have another USB soundcard which is connected to pc through USB.
> How to get input from USB soud card ?
>
> After connecting USB sound card and when printed the ports[] array
> after executing the jack API jack_get_ports()
> I could see only PC microphone capture ports, not showing USB ports.

Start jackd as

jackd -d alsa -d hw:1 ...

Instead of hw:1 you may use whatever ALSA decides to call this device
(cf the verbose name in [...] in /proc/asound/cards: if it is
[Satellite   ], -d hw:Satellite may word).

--
David Kastrup
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

benravin
I checked proc/asound/cards aftre connecting a USB sound card. and it listed both PC sound card and
USB sound card as [HD] - usb soundcard and [PCH] - pc sound card.

However when I started jack with
jackd -d alsa -d hw:HD   and printed the ports it was showing only one two ports (left & right).

I want both PC and USB sound card ports to be accessed at the same time.

How to enable all sound card input and output ports ?


-ben

From: Jack-Devel <[hidden email]> on behalf of David Kastrup <[hidden email]>
Sent: Sunday, January 14, 2018 3:38 PM
To: [hidden email]
Subject: Re: [Jack-Devel] Using USB sound card with Jack
 
Benny Alexandar <[hidden email]> writes:

> Hi,
>
> I'm using latest jack audio server version jackd 1.9.12. I have built
> simple client.c app
> and able to capture audio from microphone input and play it out.
>
> I have another USB soundcard which is connected to pc through USB.
> How to get input from USB soud card ?
>
> After connecting USB sound card and when printed the ports[] array
> after executing the jack API jack_get_ports()
> I could see only PC microphone capture ports, not showing USB ports.

Start jackd as

jackd -d alsa -d hw:1 ...

Instead of hw:1 you may use whatever ALSA decides to call this device
(cf the verbose name in [...] in /proc/asound/cards: if it is
[Satellite   ], -d hw:Satellite may word).

--
David Kastrup
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

Chris Caudle
On Mon, January 15, 2018 10:13 am, Benny Alexandar wrote:
> I want both PC and USB sound card ports to be accessed at the same time.

The design of jackd (really any sound server) requires it to be
synchronized to the sampling clock of the interface, and since your two
interfaces are not synchronized to each other then jackd cannot use both
at the same time without some intervention.

Using two  at the same time requires choosing one card to the be the main
backend device, then loading a sample rate converter to make the sample
stream rate to and from the secondary card(s) match exactly that of the
main card.

The packages you want are zita-alsa2jack and zita-jack2alsa, in Fedora
both come together in a package named zita-ajbridge.
This is covered in the jack FAQ, which needs to be updated, the section
describing alsa_in and alsa_out bridges is the relevant section, but those
older implementations had some problems, the zita bridges are higher
quality replacements.
http://jackaudio.org/faq/multiple_devices.html

The zita tools are included in the audio aware distributions, if you are
using a distribution which does not package them for some reason you can
get them along with the other zita applications here:
https://kokkinizita.linuxaudio.org/linuxaudio/

The jackd v1 implementation includes the equivalent of the zita bridges
internally, they need to be enabled from the command line but not loaded
as an external component.  The jackd v2 implementation (I think you said
you were using jackd 1.9.12, that is considered jackd v2) does not yet
include the zita bridges as part of the server, you will need to load them
externally.

--
Chris Caudle


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

benravin
Hi,

I want to test how zita-ajbridge behaves when there is a drift in clock.
Any idea how to artificially create clock drift for testing purpose.

Any test code available in Jack audio.

-ben

From: Jack-Devel <[hidden email]> on behalf of Chris Caudle <[hidden email]>
Sent: Monday, January 15, 2018 9:58 PM
To: [hidden email]
Subject: Re: [Jack-Devel] Using USB sound card with Jack
 
On Mon, January 15, 2018 10:13 am, Benny Alexandar wrote:
> I want both PC and USB sound card ports to be accessed at the same time.

The design of jackd (really any sound server) requires it to be
synchronized to the sampling clock of the interface, and since your two
interfaces are not synchronized to each other then jackd cannot use both
at the same time without some intervention.

Using two  at the same time requires choosing one card to the be the main
backend device, then loading a sample rate converter to make the sample
stream rate to and from the secondary card(s) match exactly that of the
main card.

The packages you want are zita-alsa2jack and zita-jack2alsa, in Fedora
both come together in a package named zita-ajbridge.
This is covered in the jack FAQ, which needs to be updated, the section
describing alsa_in and alsa_out bridges is the relevant section, but those
older implementations had some problems, the zita bridges are higher
quality replacements.
http://jackaudio.org/faq/multiple_devices.html

The zita tools are included in the audio aware distributions, if you are
using a distribution which does not package them for some reason you can
get them along with the other zita applications here:
https://kokkinizita.linuxaudio.org/linuxaudio/

The jackd v1 implementation includes the equivalent of the zita bridges
internally, they need to be enabled from the command line but not loaded
as an external component.  The jackd v2 implementation (I think you said
you were using jackd 1.9.12, that is considered jackd v2) does not yet
include the zita bridges as part of the server, you will need to load them
externally.

--
Chris Caudle


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

Chris Caudle
On Tue, January 16, 2018 10:36 am, Benny Alexandar wrote:
> I want to test how zita-ajbridge behaves when there is a drift in clock.
> Any idea how to artificially create clock drift for testing purpose.

The clocks are going to naturally drift if they are not synchronized
externally.
In a lab environment I would use a frequency generator on a device that
could provide a S/PDIF stream for one of the devices to lock to, and
slowly vary the frequency.

Without lab equipment the best you could do would be to change the
temperature of the crystal that controls the sampling rate for one of the
devices.
Typically the equipment would be running around 30 degrees C, but the
components should be able to handle up to 50 degrees or 60 degrees C, and
down to about 0 degrees.  The quartz oscillators will vary in frequency
several PPM as the temperature swings.  Just be careful not to swing the
temperature too quickly, you could crack a solder joint, or potentially
cause the clock generator to lose sync if the frequency changes faster
than any PLL can track.
Assuming you don't have any lab rework equipment that can generate
controlled temperature air over a small area, your best bet might be a
hair dryer on low, and control the temperature by distance from the
blower.

--
Chris Caudle


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

John Rigg-16
In reply to this post by benravin
On Tue, Jan 16, 2018 at 04:36:54PM +0000, Benny Alexandar wrote:
> Hi,
>
> I want to test how zita-ajbridge behaves when there is a drift in clock.
> Any idea how to artificially create clock drift for testing purpose.

Just try it with two unsynchronised sound cards. There will be drift
between the two clocks. It may even be possible to try it with the two
cards set to different rates (I haven't tried it).

You can disable the resampling in zita-ajbridge with the -S option to
compare behaviour without it.

John
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

Fons Adriaensen-3
In reply to this post by benravin
On Tue, Jan 16, 2018 at 04:36:54PM +0000, Benny Alexandar wrote:

> I want to test how zita-ajbridge behaves when there is a drift in clock.

It will just track the drift and compensate for it.

> Any idea how to artificially create clock drift for testing purpose.

You don't need to, no two sound cards will have exactly the
same sample rate if they are not synced.

The simple way to test ajbridge is to measure the delay
of a loop through both soundcards, using e.g. jack_delay.

There are some test results in the LAC paper as well.

Ciao,

--
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

benravin

>> The simple way to test ajbridge is to measure the delay
of a loop through both soundcards, using e.g. jack_delay.

How to measure the delay between two sound cards ? 
What does the jack_delay measures, the delay between
what and what ? 

Any documentation on how to use the jack_delay for measuring ?

-ben



From: Jack-Devel <[hidden email]> on behalf of Fons Adriaensen <[hidden email]>
Sent: Wednesday, January 17, 2018 3:23 AM
To: [hidden email]
Subject: Re: [Jack-Devel] Using USB sound card with Jack
 
On Tue, Jan 16, 2018 at 04:36:54PM +0000, Benny Alexandar wrote:

> I want to test how zita-ajbridge behaves when there is a drift in clock.

It will just track the drift and compensate for it.

> Any idea how to artificially create clock drift for testing purpose.

You don't need to, no two sound cards will have exactly the
same sample rate if they are not synced.

The simple way to test ajbridge is to measure the delay
of a loop through both soundcards, using e.g. jack_delay.

There are some test results in the LAC paper as well.

Ciao,

--
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

Chris Caudle
On Tue, January 23, 2018 10:12 am, Benny Alexandar wrote:
> Any documentation on how to use the jack_delay for measuring ?

$ man jack_iodelay

NAME
       jack_iodelay - JACK toolkit client to measure roundtrip latency

SYNOPSIS
       jack_iodelay

DESCRIPTION
       jack_iodelay  will  create  one  input and one output port, and
then measures the latency
       (signal delay) between them. For this to work, the output port must
be connected  to  its
       input port. The measurement is accurate to a resolution of greater
than 1 sample.

       The  expected  use  is to connect jack_iodelay's output port to a
hardware playback port,
       then use a physical loopback cable from the corresponding hardware
output connector to an
       input  connector,  and  to connect that corresponding hardware
capture port to jack_iode&#8208;
       lay's input port. This creates a roundtrip that goes through  any
analog-to-digital  and
       digital-to-analog converters that are present in the audio hardware.

       Although  the  hardware  loopback latency is the expected use, it
is also possible to use
       jack_iodelay to measure the latency along any fully connected
signal path, such as  those
       involving other JACK clients.

       Once  jack_iodelay  completes  its  measurement  it  will  print
the total latency it has
       detected. This will include the JACK buffer length in addition to
any  other  latency  in
       the  signal  path.  It  will continue to print the value every 0.5
seconds so that if you
       wish you can vary aspects of the signal path to see their effect on
the measured latency.

       If no incoming signal is detected from the input port, jack_iodelay
will print

        Signal below threshold... .

       every second until this changes (e.g. until you establish the
correct connections).

       To use the value measured by jack_iodelay with the -I and -O
arguments of a JACK  backend
       (also  called Input Latency and Output Latency in the setup dialog
of qjackctl), you must
       subtract the JACK buffer size from the result. The buffer size is
determined by multiply&#8208;
       ing  the  number  of  frames per period (given to the jackd backend
by the -p or --period
       option) by the number of periods per buffer (given to the jackd
backend  by  the  -n  or
       --nperiods  option).   Note  that JACK2 will add an implicit
additional period when using
       the default asynchronous mode, so for JACK1 or JACK2 in synchronous
mode, the buffer size
       is  n*p,  but  for  JACK2 in asynchronous mode the buffer size is
(n+1)*p.  Once the JACK
       buffer size is subtracted from the measured latency, the result is
the  "extra"  latency
       due  to the interface hardware. Then, if you believe that the
latency is equally distrib&#8208;
       uted between the input and output parts of your audio hardware
(extremely likely), divide
       the  result  by two and use that for input and output latency
values. Doing this measure&#8208;
       ment will enable JACK clients that use the JACK latency API to
accurately  position/delay
       audio  to keep signals synchronized even when there are inherent
delays in the end-to-end
       signal pathways.

AUTHOR
       Originally written in C++ by Fons Adriaensen, ported to C by Torben
Hohn.

1.9.10                                     August 2017                    
      JACK_IODELAY(1)


--
Chris Caudle


_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

Fons Adriaensen-3
In reply to this post by benravin
On Tue, Jan 23, 2018 at 04:12:16PM +0000, Benny Alexandar wrote:
>
> >> The simple way to test ajbridge is to measure the delay
> of a loop through both soundcards, using e.g. jack_delay.
>
> How to measure the delay between two sound cards ?
> What does the jack_delay measures, the delay between
> what and what ?

1. Read available documentation.
2. Think.
3. If after (1) and (2) some things remain unclear proceed to (4).
4. Ask questions on mailing lists.

You have a habit of skipping the first three. That is getting
on my nerves, and not only on mine.

Ciao,

--
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

David Kastrup
Fons Adriaensen <[hidden email]> writes:

> On Tue, Jan 23, 2018 at 04:12:16PM +0000, Benny Alexandar wrote:
>>
>> >> The simple way to test ajbridge is to measure the delay
>> of a loop through both soundcards, using e.g. jack_delay.
>>
>> How to measure the delay between two sound cards ?
>> What does the jack_delay measures, the delay between
>> what and what ?
>
> 1. Read available documentation.
> 2. Think.
> 3. If after (1) and (2) some things remain unclear proceed to (4).
> 4. Ask questions on mailing lists.
>
> You have a habit of skipping the first three. That is getting
> on my nerves, and not only on mine.

Well, to be fair it is hard to interpret the results of just trying, and
"available documentation" could be better in many cases.  It's pretty
exhaustive in the case of jack_delay's man page I'll admit (though the
need to differentiate between JACK1 and JACK2 and various behaviors is
really good for a head ache, requiring more of 2. than users might have
readily available, probably hard for an insider to the program to
fathom).

On the LilyPond (batch music typesetter with plain text input language)
user list I often get puzzled at requests of the "can I do this" kind of
questions where one wants to shout "why don't you ask LilyPond?".  Some
people seem more comfortable risking annoying another human rather than
annoying a program.

At least with regard to latencies it is rather tricky to "just try".

--
David Kastrup
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

benravin
Hi,

I downloaded  ajbridge (zita-ajbridge-0.7.0.tar.bz2 )   
, resampler version 1.6  and   alsa-pcmi version 0.2.0
and built all successfully.

However while running zita-a2j I got the following error.

$zita-a2j: error while loading shared libraries: libzita-resampler.so.1: cannot open shared object file: No such file or directory

When checked the installation message, it says it installed under /usr/local/lib64

install -d /usr/local/include/zita-resampler
install -d /usr/local/lib64
install -m 644 zita-resampler/resampler.h zita-resampler/resampler-table.h zita-resampler/vresampler.h zita-resampler/cresampler.h /usr/local/include/zita-resampler
install -m 644 libzita-resampler.so.1.6.0 /usr/local/lib64
ln -sf libzita-resampler.so.1.6.0 /usr/local/lib64/libzita-resampler.so
ldconfig

So, I modified the  /etc/ld.so.conf file and added the path for lib64
/usr/local/lib
/usr/local/lib64

Then, things started to work.

Now, I connected USB sound card and it shows the sound card as follows,

cat /proc/asound/cards
 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xf7d30000 irq 35
 1 [HD             ]: USB-Audio - USB Sound Blaster HD
                      Creative Technology USB Sound Blaster HD at usb-0000:00:14.0-2, full speed

After starting jack server  using qjackctl, opened terminal and
ran the following cmd

$zita-a2j -d hw:HD  -p 1056  -v

Then in qjackctl connected the graph as shown in the attached picture.
USB sound card input (line-in) is connected to an audio output from other PC.
But I can't hear the audio using zita-j2a.
I mean audio was not heard in PC where zita-j2a is running.

Anything wrong in the connections, how to debug and check why
no audio is heard.

-ben





From: Jack-Devel <[hidden email]> on behalf of David Kastrup <[hidden email]>
Sent: Wednesday, January 24, 2018 5:26 PM
To: [hidden email]
Subject: Re: [Jack-Devel] Using USB sound card with Jack
 
Fons Adriaensen <[hidden email]> writes:

> On Tue, Jan 23, 2018 at 04:12:16PM +0000, Benny Alexandar wrote:
>>
>> >> The simple way to test ajbridge is to measure the delay
>> of a loop through both soundcards, using e.g. jack_delay.
>>
>> How to measure the delay between two sound cards ?
>> What does the jack_delay measures, the delay between
>> what and what ?
>
> 1. Read available documentation.
> 2. Think.
> 3. If after (1) and (2) some things remain unclear proceed to (4).
> 4. Ask questions on mailing lists.
>
> You have a habit of skipping the first three. That is getting
> on my nerves, and not only on mine.

Well, to be fair it is hard to interpret the results of just trying, and
"available documentation" could be better in many cases.  It's pretty
exhaustive in the case of jack_delay's man page I'll admit (though the
need to differentiate between JACK1 and JACK2 and various behaviors is
really good for a head ache, requiring more of 2. than users might have
readily available, probably hard for an insider to the program to
fathom).

On the LilyPond (batch music typesetter with plain text input language)
user list I often get puzzled at requests of the "can I do this" kind of
questions where one wants to shout "why don't you ask LilyPond?".  Some
people seem more comfortable risking annoying another human rather than
annoying a program.

At least with regard to latencies it is rather tricky to "just try".

--
David Kastrup
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org

S45A6J~L.PNG (77K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

Chris Caudle
In reply to this post by David Kastrup
On Sun, January 28, 2018 9:34 am, Benny Alexandar wrote:
> After starting jack server  using qjackctl

What jack settings were used in qjackctl?  Which driver was chosen, and
which interface?

> Then in qjackctl connected the graph as shown in the attached picture.

That graph works if j2a is controlling the sound card, if jack was started
with the ALSA driver and the USB device as the interface then jackd would
already be controlling the sound card.

When providing information it will save a lot of time if you actually copy
and past the command line you used as well as the resulting messages.  For
example you stated that you started zita-a2j, did you start zita-j2a with
the same command line parameters as zita-a2j?  What status messages were
printed at that time?  What was in the messages window of qjackctl (that
is where the output from the jackd server is displayed)?
You have given about a fourth of the information needed to help you
determine what is happening on your system.

--
Chris Caudle






_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: Using USB sound card with Jack

John Rigg-16
In reply to this post by benravin
On Sun, Jan 28, 2018 at 03:34:08PM +0000, Benny Alexandar wrote:

> Now, I connected USB sound card and it shows the sound card as follows,
>
> cat /proc/asound/cards
>  0 [PCH            ]: HDA-Intel - HDA Intel PCH
>                       HDA Intel PCH at 0xf7d30000 irq 35
>  1 [HD             ]: USB-Audio - USB Sound Blaster HD
>                       Creative Technology USB Sound Blaster HD at usb-0000:00:14.0-2, full speed
>
> After starting jack server  using qjackctl, opened terminal and
> ran the following cmd
>
> $zita-a2j -d hw:HD  -p 1056  -v
>
> Then in qjackctl connected the graph as shown in the attached picture.
> USB sound card input (line-in) is connected to an audio output from other PC.
> But I can't hear the audio using zita-j2a.
> I mean audio was not heard in PC where zita-j2a is running.
>
> Anything wrong in the connections, how to debug and check why
> no audio is heard.

Starting jackd from the command line is preferable to qjackctl for debugging.
Use jack_connect to make connections.
Use jack_disconnect to break connections.
Use jack_lsp to show existing jack connections.

Read man pages:
man jackd
man jack_connect
man jack_disconnect
man jack_lsp


John
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org