Topic: Pianoteq - Linux - Bitwig Studio

This discussion thread was started in response to a sub-discussion in the "Really a Fantastic Product" thread, here: https://forum.modartt.com/viewtopic.php...04#p977704

Nathan Shirley wrote:

Now that JACK is running I have another issue. Pianoteq standalone works perfectly with JACK, but for some reason Bitwig gives a "MIDI input error" saying "device or resource busy." I read that a2jmidid needs to be stopped for Bitwig (something about it requiring exclusive control), but stopping it in Ubuntu Studio Controls and in the terminal don't seem to change anything. I looked into using Cadence, but apparently KXStudio (which includes it) is no longer supported.

And now if I try to load Pianoteq as a VST in Bitwig it fails, citing the path to the VST along with "could not read metadata." Otherwise audio plays within Bitwig via JACK. I can check on the Bitwig forum since this seems to be more of a Bitwig issue.

I downloaded the latest version of Bitwig Studio (currently 4.0.1), and am using the current version of Pianoteq (7.4.2), to test using the Pianoteq plugin within Bitwig using a Linux OS (Linux Mint XFCE edition, in my case). Everything seems to be working fine so far. Informational notes and suggestions follow--

-- -- -- -- --

First, do not start the JACK audio/MIDI system and a2jmidid (the ALSA to JACK MIDI bridge). Stop both apps if they are running. Although Bitwig Studio can (be configured to) use JACK, it likes to start/stop and control everything within its own, separated, insulated universe, or so it seems. (For interaction between Bitwig and other apps running outside of Bitwig, such as the Pianoteq standalone app or other MID/audio apps, the configuration to get everything working well together might be a little more challenging, and JACK (and possibly a2jmidid) might be necessary or helpful. But configuring all that to work together will of course be a good learning experience.)

In Pianoteq's Linux version, the Pianoteq virtual instrument is included as a Linux-native LV2 (.lv2) plugin package. (The VST version of the plugin is simply the Pianoteq_7.so file within the "Pianoteq 7.lv2" directory/folder.)

In Linux, personal VST and LV2 virtual instruments by convention are placed most conveniently within a user's home directory, in two hidden directories (.vst and .lv2, respectively). To use the Pianoteq plugin within Bitwig Studio, first make a copy of the Pianoteq LV2 plugin, which is a directory containing several files, at (for example) Pianoteq 7 --> x86-64-bit --> Pianoteq 7.lv2, and paste the copy of that LV2 directory into the .lv2 directory inside your home directory (create the .lv2 directory first, if one does not already exist). Use your file browser's settings to display hidden "dot" files (perhaps the "View" menu --> display hidden directories; in Linux, directories that begin with a dot (a period) are normally invisible or not shown by default).

Launch Bitwig Studio. In Bitwig's Settings (the main dashboard icon at top center of Bitwig) --> Locations --> Plug-in Locations, click the "+ Add Location" and navigate to the .lv2 hidden directory (right-click in the file-browser window and select "show hidden files" or equivalent, if necessary), and select and/or open the .lv2 directory. It should now appear in Bitwig's list of locations in which to look for VST and other plugins. In that list, click the circular two-arrow icon for that directory's listing to cause Bitwig to monitor/check the directory for any changes (such as new plugins added to the .lv2 directory). If Bitwig does not immediately recognize and list the Pianoteq plugin (in Settings --> Plug-ins), cause Bitwig to rescan for plugins or Quit and then re-launch Bitwig so that it will make an initial scan of the plug-in locations listed in its settings.

The VST version of the Pianoteq plugin is simply the single file named Pianoteq_7.so, within the "Pianoteq 7.lv2" directory, so instead of the procedure in the previous paragraph (or in addition to it), the Pianoteq_7.so file can be copied and pasted inside the user's home directory's .vst folder/directory.

Bitwig Studio works well with any of the Linux audio-MIDI system backends, selected in Settings --> Audio --> Audio System Driver model. For example, one could choose from Bitwig's list of audio backends, ALSA (Advanced Linux Sound Architecture), JACK (Jack Audio Connection Kit), or Pulse Audio (the sound/audio system usually active by default in most Linux distributions.

In Bitwig, one can set up or add one's MIDI controllers (digital piano or other keyboard, various other MIDI controller hardware) in Settings --> Controllers.

After doing the processes above, add the Pianoteq plugin to an instrument track in Bitwig, open the Pianoteq plugin's window (by clicking the little window icon at the right of the plugin's listing in the instrument-track sidebar), to test whether one's MIDI and audio settings are working correctly, and that MIDI data (when one presses the notes of one's MIDI piano/keyboard, for example) are routed through the Pianoteq plugin, and audio is produced and routed to one's speakers or headphones, through whatever audio interface or connection one has configured/set-up.

A note-- Bitwig will start the JACK daemon on its own, if JACK is not already running. However, Bitwig will use the last settings JACK was configured to use, which is stored at {home-directory}/.config/jack/conf.xml (you can open this file in a text editor to see which settings were stored and will be in effect when JACK is started, whether JACK is started by Bitwig or by QJackctl or manually in a terminal commandline. SO-- if you hear pops and overruns in the audio in Bitwig, when using JACK, quit Bitwig and reconfigure the settings for JACK using QJackctl, for sample rate, number of samples per period (per buffer), and number of periods/buffers. It's easiest to choose a larger number for samples-per-period, which will increase audio latency but will decrease Xruns that cause the audio pops. Once that is done, and JACK is started, then stopped, in QJackctl, those new settings will be saved by QJackctl into JACK's configuration file mentioned above, and the next time Bitwig is launched and JACK is selected as the audio engine backend, those new settings will be used and set by Bitwig when it starts the JACK daemon (independently of QJackctl). You can confirm these changes by launching the system monitor or task manager, typing "jack" in the search field to filter out all other non-jack related processes, and look at the command that Bitwig issued in the background to start JACK, which will look something like this--

jackd -T -ndefoult -dalsa -r48000 -p128 -n2 -D -C{audio-interface} -P{audio-interface}

You can also edit the JACK config file manually in a plain-text editor (like xed or gedit), rather than using the QJackctl GUI interface to change basic settings.

Following the suggestions above should at least help to get the Pianoteq plugin working with Bitwig and supply a little immediate gratification. Then with that confidence, one can later tackle some potentially more complex inter-application configuration and audio/MIDI routing. Have fun; good luck.

Last edited by Stephen_Doonan (01-09-2021 00:10)
--
Linux, Pianoteq Pro, Organteq

Re: Pianoteq - Linux - Bitwig Studio

Stephen_Doonan wrote:

Bitwig will use the last settings JACK was configured to use, which is stored at {home-directory}/.config/jack/conf.xml

Or /home/{username}/.jackdrc

Currently, although I can record MIDI and audio in Bitwig using JACK, I can't hear audio playback (not sure what the issue is). Using ALSA instead of JACK in Bitwig, I am able to route and hear the audio output from the master bus and/or the individual tracks within Bitwig, and use Bitwig with neither JACK nor a2jmidid involved or running. I guess this might be one reason I prefer the Mixbus32C DAW (or Mixbus or Ardour) in Linux, rather than Bitwig. Reaper also seems more friendly and flexible in Linux. I'm sure that Bitwig Studio can be effectively used in Linux, once one understands the way it is willing or able to interact with the processes outside itself.

Last edited by Stephen_Doonan (04-09-2021 14:28)
--
Linux, Pianoteq Pro, Organteq

Re: Pianoteq - Linux - Bitwig Studio

Stephen_Doonan wrote:
Stephen_Doonan wrote:

Bitwig will use the last settings JACK was configured to use, which is stored at {home-directory}/.config/jack/conf.xml

Or /home/{username}/.jackdrc

Currently, although I can record MIDI and audio in Bitwig using JACK, I can't hear audio playback (not sure what the issue is). Using ALSA instead of JACK in Bitwig, I am able to route and hear the audio output from the master bus and/or the individual tracks within Bitwig, and use Bitwig with neither JACK nor a2jmidid involved or running. I guess this might be one reason I prefer the Mixbus32C DAW (or Mixbus or Ardour) in Linux, rather than Bitwig. Reaper also seems more friendly and flexible in Linux. I'm sure that Bitwig Studio can be effectively used in Linux, once one understands the way it is willing or able to interact with the processes outside itself.

Strange, I never have had an issue playing anything back within Bitwig. Once I got JACK working (thanks in large part to your help), everything worked perfectly.

One of the huge benefits that Bitwig offers is the ability to switch between instruments seamlessly, without any audio glitches, and even while sustaining notes from the previously selected instrument. This can be done using the "instrument selector" (requires the full 'Studio' version). In addition to that, Bitwig can be made to control any of Pianoteq's parameters in an automated way, which really opens up a lot of possibilities. If I didn't need those two features (particularly the instrument selector), I probably would have gone with Ardour on Linux.

Having setup Linux Mint (Cinnamon) for audio use the hard way, and then recently re-doing the process on a newer computer, I'll write down the steps I took in case it helps simplify the process for anyone down the road (in the spirit of Linux).

Last edited by NathanShirley (13-11-2021 22:00)

Re: Pianoteq - Linux - Bitwig Studio

Stephen's information above is excellent. I thought I might add a fairly easy set of directions that worked for me to setup Linux Mint (Cinnamon 20.2) for use with Pianoteq and Bitwig. I've read that at least most, if not all of these steps should work for most distros, but who knows?

All of these steps could possibly be avoided if you just use an audio optimized Linux distro, like Ubuntu Studio (you might still need to do step 6b and maybe 5a?). I specifically wanted to use Mint, plus wanted to learn a bit more about Linux by setting it up manually. So these are the steps I took:

1) Install the low latency kernel by running the following command in the terminal: sudo apt install linux-lowlatency

2) Install JACK and an interface to easily control it, run: sudo apt install pulseaudio-module-jack

3) Install QJackCTL, run: sudo apt install qjackctl

(When prompted, allow the installation process to configure real time access/add your user name to the audio group.)

4) Install Ubuntu Studio Controls, run: sudo apt install ubuntustudio-controls

5) Now open QJackCTL and go to "Setup"
     a) Select your audio interface under "Interface" (don't leave on "auto")
     b) Adjust the Sample Rate, Frames, and Buffer as you like for latency
     c) Then close out of QJackCTL

6) Open Ubuntu Studio Controls
     a) Set "CPU Governor" to "Performance"
     b) Uncheck "Bridge ALSA to Jack MIDI (turn on a2jmidid)"
     c) Under the "Audio Setup" tab, copy your sample rate and buffer numbers (they're in the same order as in QJackCTL, just named differently). I'm not sure if you really have to set it in both, Ubuntu Studio Controls might override QJackCTL, but I make sure they're the same to be safe).
     d) Click "Apply Audio Settings"
     e) Close out

Now you should be able to run Bitwig, select JACK as your audio driver (Settings>Audio), and navigate to Pianoteq's VST and/or LV2 folder(s) (settings>Locations>Plug-in Locations). And of course select your keyboard controller (Settings>Controllers). Done.

It's probably possible to simplify this process further, but it worked for me. Jack is nice in part because it allows you to hear audio from Pianoteq/Bitwig and something like YouTube at the same time. But if you don't care about that and don't need to route audio from one program to another, you could probably just use ALSA (already installed) and skip all the JACK related steps above, including Ubuntu Studio Controls (so only do step one)--although configuring real time access might give you a noticeable latency improvement. Pianoteq comes with a handy "Read Me" file that explains how to set that up, no JACK required. But the JACK steps automate the real time access process which makes it easier.

Last edited by NathanShirley (13-11-2021 21:53)

Re: Pianoteq - Linux - Bitwig Studio

That's a very clearly written and helpful step-by-step guide regarding configuring Linux for audio use, Nathan. That should be helpful to a lot of people. I just have a few notes to add.

Ubuntu Studio Controls and Qjackctl are both graphical frontends used to start, stop and control JACK (the Jack Audio Connection Kit), and either app can be used to specify the audio interface (in Ubuntu Studio Controls, an external USB-connected audio interface can be specified in Jack Master Settings-->USB device that should be Master), and to specify the preferred sample rate, buffer size and number of buffers (periods) for lowest audio-latency without producing Xruns (overruns or underruns of the audio buffers). Both GUI apps pretty much do the same thing, and either can be used to configure JACK settings and start/stop JACK, but a person should probably specify the audio interface, sample rate, buffer size and periods (number of buffers) in the same app that one uses to launch/stop/restart JACK.

In Qjackctl, the audio interface, as you mentioned, should be explicitly specified in Setup-->Settings-->Interface, rather than left at "(default)".

Ubuntu Studio Controls is such a nice graphical app to control JACK and other audio settings, that it might be redundant to also install Qjackctl. However, a person might benefit from installing the CPUpower-gui app (mentioned below) in addition to Ubuntu Studio Controls, to control the CPU cores' governor and frequency settings.

The Ubuntu Studio Controls, in addition to controlling JACK, offers a few extra configuration options (System Tweaks and Audio Setup-->Pulse Bridging). Under System Tweaks, the Performance governor can be selected for the CPU cores to cause them to operate at the higher end of their rated frequencies, although the CPUpower-GUI app, in addition to allowing the CPU governor to be specified, allows one to choose which frequency or range of frequencies for the CPUs to operate at, so it can be a nice alternative app for specifying the CPU governor and frequency(ies).

-- -- --

Regarding the a2jmidid app, although it is probably not necessary to use in most cases, can sometimes be helpful (but see the warning below), since it reads ALSA MIDI devices and makes them available in easy-to-read form to JACK and to apps that use or can use JACK as the audio backend (rather than using ALSA or PulseAudio). a2jmidid (once installed) can be turned on or off using either Ubuntu Studio Controls-->Bridge ALSA to Jack MIDI, or by Qjackctl in Setup-->Options-->Execute script after Startup; the script to type into the editable field to the right of the setting in Qjackctl is: a2jmidid -e &

If the a2jmidid app is installed and started by Qjackctl (or Ubuntu Studio Controls), the devices made available from ALSA to JACK by a2jmidid will appear in Qjackctl-->Connect-->MIDI, and will often also appear in apps that are using JACK as the audio-engine backend.

However, the a2jmidid app might conflict with or cause problems in some DAW apps (like Bitwig), so it might be better in some cases not to install and launch a2jmidid, or to kill any currently-running instance of a2jmidid using the System Monitor app (or Task Manager app in some Linux installations).

-- -- --

All the apps mentioned can be installed or uninstalled using the graphical software package manager Synaptic, or by using the "sudo apt install" command in a text terminal app (as you suggested).

Just a few extra notes, that's all. Thank you very much for writing such a nice step-by-step guide, which can be especially helpful to new Linux users.

Last edited by Stephen_Doonan (14-11-2021 16:22)
--
Linux, Pianoteq Pro, Organteq

Re: Pianoteq - Linux - Bitwig Studio

Thanks, great information again.

Yes, this was one of the areas where I thought it might be possible to simplify things a bit further. One reason why I included the redundancy of installing both QJackCTL and Ubuntu Studio Controls was because of how QJackCTL automated the process of configuring real time access, which isn't all that hard, but it definitely wouldn't be a piece of cake for most beginners. Since you pointed out where to specify an audio interface in Ubuntu Studio Controls I'll update it.

As a test I ran: sudo apt remove qjackctl Everything seems to still work just fine. I'll still keep the QJackCTL step for its automated real time configuration, although I now see that Ubuntu Studio Controls says "Real Time Permissions Enabled", so perhaps it has a way to automate the process too if real time permissions aren't already configured (which in my case they already had been)?

Good to know about CPUpower-GUI and all the info on a2jmidid (which yes, Bitwig definitely doesn't seem to like). As someone without a huge amount of Linux experience, I actually find Synaptic even more overwhelming than using the terminal!

Thanks again.

(Oh strange. Looks like you can't edit a post one it's been 'liked'?)

Last edited by NathanShirley (15-11-2021 01:38)

Re: Pianoteq - Linux - Bitwig Studio

Revised steps to configure Linux for use with Bitwig without an audio optimized distro. Ubuntu Studio Controls requires a Ubuntu based distro. Tested with Linux Mint Cinnamon 20.2. (Bitwig running Pianoteq as a VST/LV2.)

1) Install the low latency kernel by running the following command in the terminal:

sudo apt install linux-lowlatency

2) Install JACK and an interface to easily control it, run:

sudo apt install pulseaudio-module-jack

3) Install Ubuntu Studio Controls, run:

sudo apt install ubuntustudio-controls

4) Open Ubuntu Studio Controls
     a) Click the button at the top to enable "real time permissions" and follow the instructions.
     b) Set "CPU Governor" to "Performance"
     c) Under the "Audio Setup" tab, select your audio interface next to "USB device that should be Master:"
     d) Enter your desired sample rate and buffer/period numbers to adjust latency.     
     e) Uncheck "Bridge ALSA to Jack MIDI (turn on a2jmidid)"
     f) Click "Apply Audio Settings" then "Start or Restart Jack"
     g) Close out

Now you should be able to run Bitwig, select JACK as your audio driver (Settings>Audio), and navigate to Pianoteq's VST and/or LV2 folder(s) (Settings>Locations>Plug-in Locations). And of course select your keyboard controller (Settings>Controllers). Done.

Last edited by NathanShirley (15-11-2021 17:47)

Re: Pianoteq - Linux - Bitwig Studio

NathanShirley wrote:

I'll still keep the QJackCTL step for its automated real time configuration, although I now see that Ubuntu Studio Controls says "Real Time Permissions Enabled"

Qjackctl is also useful for its "Connect" window, to route and connect audio and MIDI inputs and outputs of various apps and physical hardware to each other, although one might wish to install the Carla app, which has a patchbay window that has a graphical representation of audio and MIDI inputs and outputs that can be connected by dragging virtual wires from one to another.

In addition to your great step-by-step audio setup for Linux, here is a webpage that gives a lot of helpful information--

https://frontpagelinux.com/tutorials/ub...-tutorial/

And regarding realtime permissions and UbuntuStudio-controls, here is a quote from that website--

Make sure that you see Real Time Permissions Enabled . If for some reason those are not enabled, Studio Control will prompt you to click, so it can be fixed.

Anyway, all this information will be helpful to people not familiar with but interested in audio applications and Linux.

Last edited by Stephen_Doonan (15-11-2021 04:45)
--
Linux, Pianoteq Pro, Organteq

Re: Pianoteq - Linux - Bitwig Studio

Ah, all very good to know. I might update those instructions once more assuming that statement from the link you shared is correct...should make things even easier.

Re: Pianoteq - Linux - Bitwig Studio

Regarding a2jmidid and Ubuntustudio Controls, in Audio Setup-->Jack Master Settings

If you checkmark "Bridge ALSA to Jack MIDI (turn on a2jmidid)," then click the "Start or Restart Jack" button, Ubuntu Studio Controls will first launch JACK (autojack and jackdbus auto) in the background, and then will launch the a2jmidid daemon.

If you uncheckmark the "Bridge ALSA to Jack MIDI ...," then click the "Start or Restart Jack" button again, Ubuntu Studio Controls will stop (kill) both the jackdbus and a2jmidid processes, and then relaunch JACK (jackdbus auto) but will not relaunch a2jmidid.

These actions can be seen by using the "System Monitor" or "Task Manager" app of your Linux distribution, and filtering the process list by typing "a2j" or "jack" into the search field.

So a2jmidid can be enabled or disabled at will during a running session, without logging out or rebooting the computer.

Last edited by Stephen_Doonan (15-11-2021 14:44)
--
Linux, Pianoteq Pro, Organteq

Re: Pianoteq - Linux - Bitwig Studio

It's been a month since I migrated from Windows to Ubuntu Studio. The superiority of performance is unparalleled. I am very happy with all the software packages that are included. I haven't tried them all yet, but the ones I used with Pianoteq worked really well.

ALSA is an amazing drive, far superior to the experience I had with ASIO. JACK manages virtual connections that simulate reality, a new experience for me, I am in awe of the new Linux world for Pianoteq.

Pianoteq & Linux: a perfect marriage!

Respeito, Esforço e Sabedoria

Re: Pianoteq - Linux - Bitwig Studio

Using Debian with Pianoteq and Bitwig works well. In addition have Guitar pro 7.5 and Addictive keys(not using much anymore :-), working with wine.

Re: Pianoteq - Linux - Bitwig Studio

Congratulations on making the switch from Windows to Ubuntu Studio! It's great to hear that you're enjoying the superior performance and software packages that come with it.

Re: Pianoteq - Linux - Bitwig Studio

Congratulations on making the switch from Windows to Ubuntu Studio! It's great to hear that you're enjoying the superior performance and software packages that come with it. It sounds like your experience with Pianoteq has been particularly impressive with the use of ALSA and JACK. I'm glad that you're finding new and exciting features to explore in the Linux world for music production. By the way, have you considered trying CentOS 7 Extended Lifecycle Support? It's a popular choice for industrial use and may be worth checking out. Keep enjoying your music-making journey on Linux!