Free Software Audio Production, Part 1: Setting up JACK

A few months ago, I became very curious about audio production. The idea of writing, recording, mixing, and distributing my own original music has long been an enticing fantasy. But most of all, I wanted to know: is it possible to use only Free Software to produce good music?

The short answer is, ultimately: yes, you absolutely can! It’s entirely possible to use a Linux distribution as a daily driver, and leverage a workflow that only contains Free Software applications.

The longer answer is, again, yes. But there are some fundamental quirks to consider, and you’ll need to expand your knowledge a lot in order to get a usable workflow. I’d love to talk about my own setup, what tools I use, and what things I had to do to get the whole stack working.

Today, we’re going to focus on the basics: getting JACK audio set up with a desktop GNU/Linux distribution.

Linux Distribution

There are a couple of Linux distributions available today that focus specifically on audio production, such as Ubuntu Studio or the more contemporary KXStudio. That being said, you can pretty much use any general Linux distribution you please.

In my case, I ended up sticking with elementaryOS, which is a great generalist distro that focuses on visual design and usability.

Low-Latency Kernel

One important tweak that I made was that I installed the lowlatency Linux kernel, which is a must if you’re working with real-time audio applications. Most deb-based distributions have a package for this, which makes installation easy:

sudo apt-get install linux-lowlatency

After installation, you can load that kernel specifically by rebooting and choosing your kernel options in GRUB. You should boot to this kernel whenever you intend to work on audio production.

Understanding JACK

The sound system situation in Linux has historically been a mess in one way or another. Despite the existence of backends such as PulseAudio, or perhaps because of it, users can find it challenging to get different audio applications to play nice with each other.

For example, you might be using ALSA to play an audio track in a music sequencer, while simultaneously using a PortAudio application to record microphone input. If you’re trying to use real-time microphone monitoring, this can confuse applications such as Audacity!

One great way to work around this is to use JACK, which is specifically geared for audio production work. The project describes itself as infrastructure for audio applications to communicate with each other and audio hardware.

Have you ever wanted to take the audio output of one piece of software and send it to another? How about taking the output of that same program and send it to two others, then record the result in the first program? Or maybe you’re a programmer who writes real-time audio and music applications and who is looking for a cross-platform API that enables not only device sharing but also inter-application audio routing, and is incredibly easy to learn and use? If so, JACK may be what you’ve been looking for.

It’s a bit of a beast to work with, and can initially seem intimidating to newcomers, but JACK is extremely versatile and makes up for a lot of shortcomings one might feel when trying to use ALSA or PulseAudio.

There’s a few steps to setting JACK set up, so let’s run through them.

Step 1 – Install JACK

JACK is pretty widely packaged across Linux distributions, so you should be able to easily obtain it from your distribution’s package manager.

In a deb-based system, you’ll likely want to run:

sudo apt-get install jack-tools qjackctl

Step 2 – Add Real-Time Permissions

This part is a little more hairy, but we only have to address it once. Basically, we need to make sure that the system gives the JACK daemon permissions for real-time capabilities. The official JACK site has a really great guide that makes this process pretty cut-and-dry. Here’s what I did specifically:

Create a file at /etc/security/limits.d/99-realtime.conf

Give the file these contents:

@realtime   -  rtprio     99
@realtime   -  memlock    unlimited

Then create a realtime group:

groupadd realtime
usermod -a -G realtime yourUserID

Where yourUserID is whatever your system user id is.

After that, just log out and log back in!

Step 3 – Use QJackCtl

The easiest way to use the JACK system is to use a frontend – otherwise, you’re going to have to do everything in the terminal. qjackctl is a great app that makes this process mostly transparent.

The UI for QJackCtl, an interface for handling JACK audio
qjackctl, a qt-based frontend for handling the JACK system

All you need to do is click Start, and the daemon will begin. During this time, it may block audio coming from other backends, such as YouTube videos playing in Firefox. I’m not sure whether this is a bug or intended behavior, so as a rule I simply turn JACK on when I need to work with an audio application specifically, and turn it off when I need to use other programs.

Moving forward, I’ll dig into what audio apps I’m using specifically, and some lessons learned in getting them to play nice with JACK.

The Price of Freedom — A Review of the Librem 15 v3

Edit: Thanks so much for your feedback! An earlier version of this article missed a few key points — check out the FAQ on the bottom of the review.

Purism is a wild startup located in South San Francisco. Their mission? Providing a superior hardware experience for people who love privacy and software freedom. Purism is building and shipping GNU/Linux laptops, and is interested in developing a phone as well.

The Purism campaign originally launched on CrowdSupply late 2014. Since then, the company has shipped two revisions, and now offers three different models to choose from: an 11-inch convertible tablet, a 13-inch laptop, and a 15-inch powerhouse.

For a few years, I have strongly desired having a quality Linux laptop that has great hardware. So, I’ve taken the plunge on getting the latest 15-inch Librem model from Purism.

Buying Experience

Purism is a much newer brand compared to other, more established computer companies. So far, this company has largely dealt with a crowdfunding purchase model — in short, you donate X amount to the campaign, and receive physical hardware as a contribution reward.

Generally, this model of fulfillment takes a lot longer than more traditional on-demand methods of manufacturing a product and shipping it.

Purism seems to have outgrown this way of doing things, and now takes orders directly from their site. I placed my order on June 28th, with an estimated delivery in July 2017.

Because I was traveling in the middle of July, I reached out to their support team for when I might expect the order. An agent got back to me in less than 24 hours, and cheerfully informed me that the team would bump up my order in the queue.

Sure enough, my laptop arrived ahead of schedule.

Hardware

My first impression of the hardware was pretty positive. The v3 ships with an anodized black finish, and the frame feels sleek and solid. The only downside here is the color — it immediately attracts smudges.

Purism branding is completely nondescript — there’s no logo of half-eaten fruit on the lid. Only a humble brand sits on the bottom of the device. I’m vaguely reminded of Soylent.

Smudges aside, Purism has really done their homework on hardware. Everything works out-of-the-box, and with a few minor adjustments I found myself getting comfortable.

Coming from a world of Macbooks, I was initially disappointed with the trackpad, which felt less smooth and much slower. Gnome applications don’t all deal with multitouch in the same fashion yet, either. The good news is that the trackpad’s responsiveness can be managed by adjusting the cursor speed.

Power management in laptops has long been an achilles heel for many GNU/Linux distributions out there. Many laptops offer motherboard configurations and hardware combinations that are under-documented, which can lead to issues with suspend and waking from sleep.

Happily, Librem wakes from sleep with no issues to speak of. Wireless drivers pick up right where they left off, and the whole system feels smooth and responsive.

The device ships with a 3.1GHz Intel Core i7 CPU. This is from the Skylake family of Intel processors, and it works favorably well. By default, this laptop comes with 4GB of DDR4 Memory and a 120 GB SSD. For the purposes of my convenience, I upgraded to a 250GB SSD and 8GB of DDR4 for $138 extra, bringing my overall cost to $1,737.

The Atheros wireless hardware is well-documented to work with Linux-based systems, and performance of the Intel HD Graphics 520 is perfectly comparable to a mid-range 2017 Macbook Pro. That’s important, because those graphics have to support a 1920 x 1080 matte display @ 60Hz, and the picture looks all the better for it.

Bluetooth does not currently work without installing proprietary firmware, but the hardware does indeed ship with a bluetooth module. Purism is currently trying to hire a developer to write a libre driver for it.

In the third revision of the 15-inch, the number of kill switches has been reduced to just two, and they have been moved from the side of the computer to the hinge of the monitor. The kill switches can disable wireless, bluetooth, the microphone, and video all on the hardware level.

The web cam and microphone work well, and the video quality is comparable to a high-end Macbook. In good lighting, images look vibrant, and the picture remains sharp with a decent framerate. Video calls should for the most part be smooth, though that still depends on what app you’re using as well as your internet connection.

Additionally, if you’re coming from a 13″ Macbook, the keyboard will feel strange to you for about two days. I had to retrain my fingers to account for a change in key spacing and hotkey combinations.

Software

PureOS running stock Gnome. Theme customizations set by me.

Purism’s laptops ship with PureOS by default, which includes a stock Gnome 3.22. PureOS is based on Debian, and generally seems to work with Debian/Ubuntu packages. For proprietary debs (Slack, Steam, Skype, etc) you may have to do a little detective work to determine their dependencies to get them to run properly.

By default, the system runs on Wayland, the new display successor to Xorg, and you’ll barely notice. Overall, the new display server works perfectly well with Intel graphics, and the Mutter compositor in Gnome runs quite smoothly. A basic glxgears demo can pull somewhere between 66 to 76 FPS — part of this is because Wayland has excellent support for running classical Xorg applications in a wrapper (XWayland).

This works nicely as a glue layer for apps that have not natively implemented Wayland support yet themselves, but XWayland’s support for drawing tablets is only available in upstream Gnome. As a consequence, I’ll have to run a Xorg session any time I want to get some digital painting done.

On a similar note, Coreboot is present, but practically invisible in terms of system operation. It’s definitely on the Librem, but the boot process is quick and Coreboot mostly stays out of the way. Thanks to the use of open source graphics, the boot system is visually smooth and animated.

One nice surprise is that PureOS was able to play all of my backed-up music from iTunes, making this transition a million times easier than expected.

Web Experience

Most people would generally agree that desktops and laptops are increasingly using web applications in lieu of native desktop apps. If an OS is capable of providing a solid experience for web, the computer can meet most basic user needs, from social networking to processing tax returns. We can already see minimal examples of this taking hold in the market — take ChromeOS, for one.

How does pureOS stack up?

I ended up choosing Gnome Web as my default browser because it integrates directly into Gnome. Despite a few minor quibbles (why can’t tabs be pinned?), the WebKit support it ships with is very, very good. Multimedia plugins work out of the box (just install the GStreamer plugins), HTML5 media elements are incredibly smooth, and web applications all render correctly without any major issues…except for one.

When I initially tried to write this review, I found that Medium.com prevented me from creating or editing any stories. This is because Gnome Web, my browser of choice, is not officially supported. A quick application of a spoofed user-agent string completely fixes the issue, however.

Overall, the web experience works well. The Librem’s display lends itself to a high resolution, with fonts rendering smoothly and HTML5 sites working out-of-the-box.

One novel feature of Gnome Web is that it is possible to turn websites into web applications for the desktop. This is accomplished with a minimal wrapper, similar in fashion to Electron. This works particularly well for apps that don’t have Linux versions. Above is the team inbox Front, and it looks practically native.

Wrap-Up:

Overall, my experience with Librem has been highly positive, and I’m glad to switch away from a Macbook Pro for it. Though this is a system that will require some configuration to fit a person’s liking, it’s essentially a “set and forget it” affair.

Is it worth it?

For some people, this all may seem like some masochistic pursuit of technological asceticism. If you don’t have a reason to switch to a Linux-based system and don’t particularly care about proprietary drivers on your computer, this product probably isn’t for you.

Some people may balk at the price of Purism’s products, but I’m convinced that this was the right purchase for me. The dependent factor here involves two things: how experienced you are with using GNU/Linux, and whether you care about Free Software or privacy in computing.

In a way, this product is something of a philosophical statement for people who are interested in both. If you’re comfortable in a *nix environment, want to use a Free Software OS full-time, and prefer a premium build quality, this is a great laptop.


FAQ

A number of people wrote in with additional questions that were not covered by this review. I wanted to take a moment to clear up any ambiguous details that people wanted to know about.

Q: What’s the deal with the BIOS? Is it running Coreboot? Is it 100% free?

Librem v15 rev3 ships with Coreboot, and the experience is rather nondescript. Apparently, using the application me_cleaner makes it possible to get about 98% of the binary blobs free, though that means there is more work to be done.

Purism intends to get Coreboot support on all of their devices, and are working on improving me_cleaners capabilities to remove more of those blobs. At some point, it may be entirely possible Purism products will even support Libreboot by meeting the Respects Your Freedom certification requirements.

Q: How quick does a cold boot (power off, not sleeping) take?

The entire system can boot to desktop in under 10 seconds.

Q: How are the shortcut keys?

Overall, key placement and spacing is good, but Purism has made a few unusual design decisions with hotkeys. Volume has been superimposed on the up/down arrow keys, and there aren’t any dedicated keys for media controls. This can be fixed with a basic key remap, but it is initially puzzling.

Q: Is the whole body aluminum as the macbooks or does it have a plastic frame?

The entire body seems to be anodized aluminum. The only exception is the hinge, which is plastic and not noticeable.

Q: What’s the experience like on disassembly?

Although I haven’t dived into this too far yet, the laptop is designed to be 100% serviceable, meaning that you can take it apart completely and swap out components to your liking. The screws aren’t proprietary, nothing is sectioned off, and you can play with the guts of the machine all you’d like.

This guy’s video on the Librem 15 v2 is super informative on the subject: https://www.youtube.com/watch?v=thjkyGIMlyc&t=19s

Q: What does the warranty look like?

By default, the Librem ships with a 1 year warranty (you can upgrade to a 3-year during checkout). I haven’t needed to use it yet, but if anything comes up, I’ll update my answer to this question.

Q: Where is Purism at in dealing with the Intel Management Engine?

It is now possible to neutralize Intel ME, and the Purism team is doing some extra QA on it to ensure that there aren’t any nasty performance or driver regressions that come out of enabling the fix. Here’s a post back from March about the team’ experience with it so far.

Important Update to the AGS Linux Runtime!

So, the other day something rather extraordinary happened for me. I received a message from Elektroshokker, the developer maintaining the Linux port of the Adventure Game Studio runtime. As some of you know, AGS is my tool of choice when it comes to working on retro-styled adventure games, but the editor is largely Windows-only. (It works wonderfully in Wine, however).

Progress has been made with both a Mac and a Linux port of the game runtime, which means anyone can technically take an AGS game and, following the instructions, port it to run in Mac or Linux very easily thanks to the Allegro library dependencies. There is, however, one very crucial problem with the Linux version, however: it was impossible to put into a distribution package and have it work!

The problem itself derives from the way AGS games save and load files. For the longest time, the default behaviour was that the AGS executable would save or load files directly in the folder of the executable itself. Every time the game is launched, it creates a “temporary” save file to start the game at the very beginning.

Now, this is all fine and dandy if you’re running it in an isolated folder that you have access to, but it will not save and load files if it’s in a directory with root permissions under, say, /usr/share/games/$gamename, because it doesn’t have access to save or load files there without creating a huge security hole in the permissions system. The game will not even start, which also means that it will be impractical to package in, say, a .deb package file. Why package a game that cannot run under standard directories, and why package a game that can run, but each user has to install it on a multi-user operating system?

The solution I proposed was a relatively simple one, and I’m overly happy that it was implemented: now, AGS executables will use the standard place most Linux applications save and load configuration files and other data: under the home directory.

So, with the game binary installed under /usr/share/games/$gamename, the game itself will save files to /home/Username/ ./$gamename, meaning everyone wins.

This is particularly important because in a few months, Canonical (the backers of the Ubuntu project) will be opening up the Ubuntu Software Center to third party developers. With the hundreds upon hundreds of great independent titles out in the AGS community, I think this could definitely give a great boost to game development on Linux, and it’ll give users some great titles. Furthermore, the USC is implementing a model in which developers can be paid for their applications, meaning that all of the people doing commercial AGS games can make a quick buck off of Linux users, too.

4 Totally Insane Ideas That Canonical Ought to Consider

Canonical (and consequently, the Ubuntu project) is constantly growing. The Ubuntu distribution has grown to be one of the most popular desktop systems out there, garnering millions of users worldwide. Mark Shuttleworth has come out many times with ideas to help boost Free Software in the commercial and private sectors, and Canonical should be applauded for what they’ve achieved so far.

However, here’s a few ideas I think they ought to mull over. Just keep in mind that I’m throwing around ideas, these aren’t exactly “practical” ideas so much as that they’re just ideas that I think happen to be neat.

1. Buy Out System76

It’s no secret that System76 is one of the biggest supporters of Ubuntu. They install the Ubuntu system on every device they ship, have the rights to place the Ubuntu logo on all of their products, and have a fantastic make quality. They work together with Canonical to provide updates, drivers, codecs, etc. If anything, I think it would be a wise move some time in the future for Canonical to consider buying out System76 and using them to produce Canonical-branded hardware. Mark Shuttleworth even mused over the idea of going into hardware with Canonical in the past, this would be one way to do it. Also, with Ubuntu as the main operating systems on their own hardware, Canonical could look into…oh, I dunno…switching the boards over to Coreboot and looking into using Free Software hardware and drivers.

2. Provide an alternative repository for Free Software Android Applications

Canonical turned a lot of heads by introducing a music store into the Ubuntu One service package. It’s a welcome change of pace, and gives many Linux users the ability to purchase and download music legally (albeit in an MP3 format, more on this later)

The more important question, however: Ubuntu can now download music in a function not unlike iTunes, but…what about mobile apps? As the libraries for Ubuntu’s desktop system have gotten more and more robust for device syncing, I’ve been wondering how this could best be used to kill two birds with one stone.

Why Android, rather than the other half-dozen linux-based smartphones out there? As far as I can tell, Android is rapidly becoming the most-used linux-based smartphone platform around, and sales have surpassed that of the iPhone. This would be a way to get to as many people as possible.

See, there’s a bit of a jam going on with Android: You can get paid apps, and you can get free (as in gratis) apps, but it’s not always the easiest to find Free Software applications. Oh, they’re out there, don’t get me wrong. But finding them is less than obvious, and if you have a custom Android ROM such as CyanogenMOD, you can’t even use Google’s regular app store. The need for an alternative to step around these issues is obvious. This would stimulate FOSS development on apps for Android, and in turn would also provide a free repository for anyone using an Android device.

3. Make Ogg Available for the UbuntuOne Music Store

This has been one of the biggest complaints about the U1MS. It would be really, really nice to be able to download music in a Free Software format. While it isn’t exactly a requirement per se, it would be a nice way to begin circumventing the need to install MPEG-based patented codecs. I started a petition a while ago here, feel free to sign it and present it to Canonical. As of this writing, there’s about 245 signatures of users that would be willing to use U1MS if it switched over to OGG.

4. Switch to “Feature-Based” Releases

I’ve wondered for a while why they haven’t done this already. I suppose doing the “100 Papercuts” is at least a start for the sake of usability, but in my mind something a little bit more needs to be done. I think Ubuntu developers ought to consider the possibility of splitting up development to focus on specific system features for each release. What do I mean by this?

Let’s assume that, under this model, their next main focus for the next release will specifically be business applications. Rather than just touching base with upstream, they could focus a whole bunch of usability bugs, features, etc, into strictly the business and office apps in the Ubuntu repositories. They could package and refine some of the really nifty office applications you don’t normally hear much about. Then, for the next release they could focus specifically on multimedia creation, and look at ways to iron out PulseAudio, possible multimedia frameworks they could integrate into applications, different workflows they could put together, etc. They could focus on areas that they’re currently a bit lacking in, and as such they could find ways to strengthen the user experience across the board.


Goodbye Kubuntu, Hello Fedora!

So, the day has finally come. For the longest time, I was an Ubuntu user. I’ve dabbled in the Occult of FreeBSD and learned quite a lot. However, I’ve always felt comfortable in a linux environment. It’s just that I feel Ubuntu had gotten worse over the release cycle of 10.04, and Kubuntu has simply gotten worse and worse over the last few years. It’s gotten to the point where Kubuntu will slow down to such a crawl that Kwin breaks. I’m putting my foot down, this is unacceptable.

After talking it over with some of my friends that have used other distributions, I finally came to the conclusion that I ought to give Fedora 13 a try.

Let’s just say that my mind is blown. It’s…fast. Ridiculously fast. Okay, kPackagekit still isn’t that great, but learning to install RPM’s via YUM was simple enough to figure out. It took a much longer time to get accustomed to due to the fact that things are simply done differently. But look at the quality! Look at how absolutely solid the KDE system is, even though Fedora 13 is still a Beta.

My question is: why is this such a difficulty with Debian-based distros such as Ubuntu? Why is the bar for quality set so high by the Fedora community, yet it’s so much considerably lower for others? Aren’t we sharing the same code?

My theory is that perhaps it’s because a large-scale corporation like Red Hat is funding a good part of the distribution, and the release cycle is more spaced out. But that’s just my perspective, and there’s probably a lot more to it than that.

Either way, I’m on Fedora 13 now. Loving it.

Goodbye, GUI! 30 Days of Command Line

So, I’ve decided to do something REALLY out of the ordinary for me. My friend Steven said that I don’t understand enough about Linux. Fair enough. To completely immerse myself in tech know-how, I am going to use my computer every day…with nothing but a command line. I’m going to program, compile, update twitter, email people, read email, surf the web, and hit up people on AIM…all by command line. No pretty interface, nothing.

For 30 Days. On July 24th, I shall climb out of the Caverns of the Command Line, and see how various interfaces have changed within a month. Also, KDE 4.1 will be out fairly soon after.

I think this will be a fantastic exercise. I begin at 12:00 Midnight CT here in the US.

I end 12:00 Midnight CT on July 25th, 2008.

Some people have been really helpful and recommended apps. What I’m using:

IRC Chat: irssi
Web: w3m and links2
Mail: Mutt, or a web browser
Text editing: Nano
AIM, MSN, Yahoo, Myspace IM: Finch
Twitter: irssi, if I can get the bitlbee extension to properly work. Otherwise, it’ll likely be w3m.

Call me crazy, but I need an incentive to go outside more. Also, it’d increase my manliness on just about every forum.

And on a final note, I will release a T-Shirt in my small Caffeepress store on July 26th, after a day of rest.

Update: Please Help Spread my Story! I’ve got it on Digg and FS Daily now. Thanks!