diff -r d7ae02390fac -r fce3d6290c40 relpipe-data/examples-jack-ports.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/relpipe-data/examples-jack-ports.xml Thu Oct 22 01:51:32 2020 +0200 @@ -0,0 +1,170 @@ + + + Working with JACK ports + list ports and connections, connect and disconnect ports, both MIDI and audio + 04400 + + + +

+ A powerful audio system called JACK allows us to + build pipelines consisting of audio interfaces, players, recorders, filters and effects… + and route sound streams (both PCM and MIDI) through them. + MIDI messages can come from keyboards or other hardware MIDI controllers or from MIDI players and other software. +

+ +

+ In JACK, we have clients (applications) and they have ports (input and output channels). + The JACK graph consists of connections between input and output ports. + There might be multiple connections from or to a single port – singals are then replicated or combined. + Obviously, we can connect MIDI ports only to other MIDI ports and PCM/audio ports only to other ports of the same kind. + However there can be applications with both kinds of ports that e.g. translate MIDI signal to audio signal (synthesizers). +

+ + + +

+ The JACK daemon is responsible for maintaining the graph and transmitting the messages. + Clients connect to the daemon. +

+ +

+ Since v0.17, we can list the ports using the relpipe-in-jack command: +

+ + + +

and see it as a relation:

+ +
+ +

+ Port names are prefixed with the names of clients. + We see the port direction in the input and output attributes + and can distinguish MIDI and audio ports by the value of the midi attribute. +

+ +

+ We can also list the connections using the --list-connections true option: +

+ +
+ +

+ Instead of formatting as a table, we can direct this relation into a file and later recreate the saved connections: +

+ + connections.rp +cat connections.rp | relpipe-out-jack --required-connections 0]]> + +

+ If we want to store the connections in a human readable format in order to be able to edit them, + we should add e.g. relpipe-out-csv (or XML, or Recfile) stage before redirecting the stream to the file + and add relpipe-in-csv etc. stage to the second pipeline. +

+ +
+ + +

+ Or we can write the file by hand and just send it to the JACK output module: +

+ + + +

+ The primary purpose of the relpipe-out-jack is sending MIDI messages. + And because it does not make much sense to send them nowhere, it waits for at least one connection. + But if we are not sending any messages and are using this tool just to connect or disconnect the ports, + we should set --required-connections 0. +

+ +

+ We can also connect or disconnect particular ports specified on the command line: +

+ + + +

+ The primary purpose of the relpipe-in-jack command is monitoring the MIDI commands. + If we want just to connect or disconnect some ports, we can disable monitoring by setting --list-midi-messages false + and the command will return immediately. +

+ +

+ The port names are suggested by the Bash-completion, so we do not have to memorize them. + Because these names contain the colon, we should use quotes (otherwise the Bash-completion may be confused). +

+ +

+ Disconnecting works the same way – just use the --disconnect-ports option + or specify the disconnect command in the event attribute. +

+ +

+ Note: there are sophisticated GUI tools focused on working with the JACK graph + like QjackCtl or KXStudio/Claudia. + But sometimes it is useful to have a simple CLI tool for this job. +

+ +
+ +