Friday, February 27, 2015

Cheaper Music Making - part 2 - OS

In the last post, I wrote up all the hardware steps needed to prepare your chromebook to be a music studio. In this post, I want to pick up and continue with setting up the operating system (Linux) that we will use to host our music software on the chromebook.

Chrome OS itself is a variant of Linux but very scaled down to just the essentials. If you are looking for just cloud-based software such as google Docs or online Microsoft Word, Excel, etc. you won't need any of this. In fact there is a pretty cool online Audio making site called Audiotool (thanks to Rok Kova─Ź for the information) that looks pretty cool and requires no hacking at all. Of course it is limited to the instruments it includes, but still looks fun.

To run a full localized DAW and music software, however, we have to install a more robust operating system with its own file storage and software repository. Since we are going for "free", we are going open source with Linux on the chromebook. The chromebook is already optimized in many ways for Linux and it is an easy fit.

For Linux on a chromebook, there are 2 popular options. One option is to replace the bios, create a dual-boot solution and create a completely independent environment. The other option is to use the Chrome OS kernel but install a "chroot" environment to provide a separate disk image. There is an open source project called chrubuntu that addresses the first option, but I am going with the second option which is supported by a utility called crouton.

Crouton allows us to create a new OS as a chroot but still keep the Chrome OS kernel. This means that we can switch back and forth between the two environments and all of the hardware resources will be fully supported. In the case of chrubuntu, it is up to you to get the drivers needed for your particular hardware. For purely music making purposes, chrubuntu might be a more stable solution once you have sorted out all the hardware issues, but for ease of installation and maintenance, I much prefer the crouton solution. As with my iPad, I don't use my chromebook "just for music". I also do software development on it with python/django so the ability to hot key back and forth is really a plus for me.

Installing crouton is fairly straight-forward - the link I provided has good instructions. However, there are many installation possibilities. I recommend installing the default ubuntu release (and older 12.04) along with the light XFCE desktop environment.

To do this, you first have to download crouton here. This will put a script into your Downloads folder on the chrome box. I suggest that you install your Linux chroot as follows:

  1. Press Ctrl-Alt-T to get a terminal window
  2. Type shell and press enter
  3. Type sudo sh -e ~/Downloads/crouton -t chrome,keyboard,xfce -n kxstudio
This will download a lot of files, take around 15-30 minutes and will eventually prompt you to create a logon name and password. Once you do that, you have a full Linux installation! Note - I recommend not installing the xiwi target which lets your linux run in a chrome tab. While this is nice, it does not allow for hardware video acceleration and will cause problems with music apps. 

To enter this new installation, you will type sudo startxfce4 to start your graphical linux environment. This will put you into an X-Windows based Linux environment! Get acquainted, google xfce, play around. To switch back and forth between Linux and Chrome OS, type ctrl-alt-shift and right or left arrow. This will toggle back and forth. 

To close your Linux shell, select logout from the menu and it will drop you back into chrome. Whenever you want to get back into Linux, type Ctrl-Alt-T, type shell and then type sudo startxfce4.

Just one more thing (sorry Steve).... There is a minor fix you need to make in the startxfce4 script in order to enable midi and the sound device in your new Linux chroot. Let's do that now.

  1. Press Ctrl-Alt-T to get the terminal window
  2. Type shell and press enter
  3. type cd /usr/local/bin and press enter
  4. type sudo vi startxfce4 (welcome to the horror that is vi!!!)
  5. Navigate in the editor down to the blank line just above the line reading "exec sh....." using either the arrow keys (wimp!) or the much cooler j,k,l and ; keys.
  6. On the blank line, press i (this puts you in insert mode in this retro editor)
  7. Type the following lines:
# set up audio device
sudo modprobe snd-seq-midi
sudo chmod 777 /dev/snd/seq

Now press the esc key to exit insert mode.
Press the ":" key followed by wq and then press enter.

Congratulations! You are a unix wizard. Now the next time you start up your Linux chroot, the sound device will be enabled, you should be able to plug in MIDI keyboards and hopefully things will work!

This might be a good time to take a backup of your new Linux environment. If you did not do the bios trick to lock developer mode OR you find it necessary to "power wash" (its a thing) your chrome book to fix a chrome issue, you will lose your data. If you have a backup, you can easily recover it.

To backup your chroot using crouton, do the following:

  1. Type Ctrl-Alt-T and type shell and enter
  2. Type sudo edit-chroot -b kxstudio
  3. This will run for a few minutes and will create a file in your Downloads folder named with your Linux chroot and a timestamp. Once this completes, copy this file off to a usb stick in case you wipe your computer's storage.

Please refer to the crouton site here for instructions on how to recover from a backup if you need to.

No comments:

Post a Comment