Close

Jack basics & floating point

A project log for The ultimate vlogging mic

Recording the best headset audio in a portable form factor

lion-mclionheadlion mclionhead 01/08/2018 at 01:250 Comments

The mane thing Jack does to achieve low latency is set the optimum buffering parameters for full duplex.  The best parameters for a USB card came from 

https://wiki.linuxaudio.org/wiki/raspberrypi

OSS used the terms "fragment" & "sample" to define its buffering, with all the fragments combined to form a "buffer".  Audio programs read or wrote 1 fragment at a time.  ALSA uses the terms "period" & "frame" with audio being processed 1 period at a time & all the periods combined to still form a "buffer".  The unfortunate terms are probably because ALSA was designed by a Hungarian speaker.  

Unfortunately, a scratch built audio monitor using mmap is not as easy as Jack makes it look.  There are some gnarly buffer alignment problems.

jack_lsp shows the ports which can be passed to jack_connect

These commands route the microphone to the speakers through the DSP:

jack_connect system:capture_1 system:playback_1

jack_connect system:capture_1 system:playback_2

This disconnects a route:

jack_disconnect system:capture_1 system:playback_1

This command records from the microphone:

jack_rec -d -1 -f test.wav system:capture_1

jack_thru creates a dummy signal processor & 4 ports which are shown on jack_lsp which can then be connected.  You can see how a signal processor can be built up from the command line.

Developing jack programs requires 'apt-get install libjack-jackd2-dev'

The jack_thru example is in the jack2 source code.  Compiling thru_client.c requires merely 'gcc thru_client.c -ljack'  The source filenames have nothing to do with the executable names.

Unfortunately, it promotes all the samples to floats.  

Discussions