Creating a Song in Squarp Instruments Hermod

I created a video to illustrate the use of the Squarp Instruments Hermod Modular Brain. This is a multi-sequence, polyphonic sequencer for Eurorack that interfaces with MIDI, USB, and CV made by the creators of the very popular Pyramid. Check it out!

I also have a more detailed video that goes into how Hermod’s step mode and zoom levels work.

Advertisements

Upgrading the Kilpatrick Carbon Firmware

I recently purchased a Kilpatrick Audio Carbon made by Kilpatrick Audio. The Carbon is a multi-track, multi-step sequencer that controls instruments using MIDI and CV. So far, it’s been fantastic and it’s allowed me to start doing loop-based music live.

I’ve been communicating with the author, Andrew Kilpatrick, about some bugs about the device, and he recently released a new firmware update. He doesn’t have a Mac so he’s not able to test the Carbon’s firmware updating process.

For all of you visiting who have a Carbon that needs updating, here’s the instructions for Mac (they’ll also work on Linux).

Updating the Carbon using dfu-util

The Carbon uses DFU for its firmware updates. There are many DFU utilities out there, but an open-source one that works is called dfu-util, which runs on Mac and Linux. (If you’re using Windows instead, instructions exist on the Kilpatrick Audio firmware site).

Get the DFU program

1. (on macOS) Install home-brew (http://brew.sh). You’ll need Xcode for this (with the command-line tools).
2. (on macOS) Install dfu-util. “brew install dfu-util”

On Linux, the instructions will be different, but will probably involve using your system’s package manager in a similar way.

Get the firmware from Kilpatrick Audio

Download and unzip the firmware from the Kilpatrick Audio firmware updates web site. The latest firmware as of writing is v1.06.

Do the update

Restart Carbon in firmware update mode. To do this:

  1. Connect your Carbon to your computer using USB.
  2. Unplug the power connector.
  3. Hold down the power button.
  4. Plug in the power connector.

The LEDs will be a solid color and the screen will be blank. Sometimes, the LEDs will be different colors. That’s normal.

Open Terminal (macOS) or another command-line window.

In the prompt, type the following to check that the program can see your carbon:

dfu-util —list

Your output will resemble the following:

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Deducing device DFU version from functional descriptor length
Found Runtime: [05ac:828d] ver=0118, devnum=8, cfg=1, intf=3, path="20-6.3", alt=0, name="UNKNOWN", serial="UNKNOWN"
Found DFU: [0483:df11] ver=2200, devnum=27, cfg=1, intf=0, path="20-4.1.2", alt=3, name="@Device Feature/0xFFFF0000/01*004 e", serial="376837513335"
Found DFU: [0483:df11] ver=2200, devnum=27, cfg=1, intf=0, path="20-4.1.2", alt=2, name="@OTP Memory /0x1FFF7800/01*512 e,01*016 e", serial="376837513335"
Found DFU: [0483:df11] ver=2200, devnum=27, cfg=1, intf=0, path="20-4.1.2", alt=1, name="@Option Bytes  /0x1FFFC000/01*016 e", serial="376837513335"
Found DFU: [0483:df11] ver=2200, devnum=27, cfg=1, intf=0, path="20-4.1.2", alt=0, name="@Internal Flash  /0x08000000/04*016Kg,01*064Kg,07*128Kg", serial=“376837513335"

The Carbon’s device ID is 0483:df11. In this particular case, you want to write to the “alt bank 0”, which is the Carbon’s internal flash.

Install the firmware with the following command:

dfu-util -a 0 -D K66-carbon-1.06-firmware.dfu

You will see output that looks like the following:

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Match vendor ID from file: 0483
Match product ID from file: df11
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
file contains 1 DFU images
parsing DFU image 1
image for alternate setting 0, (1 elements, total size = 272176)
parsing element 1, address = 0x08000000, size = 272168
Download [=========================] 100%       272168 bytes
Download done.
done parsing DfuSe file

This will take a minute or two to do the transfer.

When it’s done, remove the power from the Carbon, and plug it back in again. Start the power normally. Press SYS (SHIFT-MIDI) to check the firmware version.

If you’re updating from v1.02, the first few things that you’ll notice is a new font (I’m not 100% sold on it honestly) and that the Carbon now takes MIDI input from any channel instead of channel 1. There are also a number of bug fixes.

The Carbon also has a Github page, so if you have bugs to report or suggestions to send about the device, that’s the place to do it.

Enjoy your noodling!

Quickie: Upgrading Windows 8 to Windows 8.1 Problems?

I’ve been using Windows 8 as a dual-boot option on my iMac for a while. When Windows 8.1 came out, I was pretty excited, as Peter Bright’s review on Ars Technica was quite positive about it.

Unfortunately, I was getting errors doing the upgrade it directly from the Microsoft Store, eventually getting Error 0x0073B92 - 0x20009. I was a little stumped about how to get around this.

The solution was actually simple: disconnect all of your USB devices during the installation. (Internet searching seems to indicate that this is related to a problem with a second hard drive).

Sublime Text: Always run a single file in a project no matter what is focused

When I program, I often try to split up my code into modules. This requires that I use different files. However, I also want to run my code from a “main” or a “master” file as well. It’s pretty annoying in Sublime Text, or any text editor, to have to switch to your main file to run your project.

I’ve talked about how to do this in TextMate but how can you pull this off in Sublime Text? Let me show you how.

  1. Create a Sublime Text project for your program. You can do this by using the menu Project > Save Project As…”.
  2. Open the settings for your project using the menu Project > Edit Project.
  3. You’ll get a mostly empty text window. Modify this window to include a build definition, such as the following one for Python:
    • "build_systems": [
        {
          "name": "PyProj",
          "cmd": ["python", "-u", "$file"],
          "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
          "selector": "source.python"
        }
      ]
      
  4. Modify the line with “cmd” and change “$file” to the master file you always want to run. For example, if your main file is called pyproj.py, then change it to pyproj.py.
Add the "build_systems" JSON field in your project settings file, accessible through the Project menu > Edit project.

Add the “build_systems” JSON field in your project settings file, accessible through the Project menu > Edit project.

That’s it! While you’re editing your project settings, you can make other customizations as well as you see fit.

Obviously, this isn’t limited to just setting a file to be run no matter what file you’re focused on. You could use this to add command-line arguments to a single project, to run project-specific scripts for building and testing, or to otherwise customize the way the “Control-B” (Command-B on Mac OS X) works when you are running the project. You can essentially define your own build system on a per-project basis in a project file’s “build_systems” section and use any information in Sublime Text’s build system documentation to do so. Unfortunately, the build system documentation doesn’t really describe this because it’s focused more toward Package development.

For more information about how project settings work, look at Sublime Text’s documentation for build systems and for projects!

The Function (Fn) key is on the full-size Apple Keyboard

Are you one of those Mac users who generally turns on the F1, F2, keys as standard function keys option in System Preferences? If you do that, then if you want to use your keyboard to control the volume or the screen brightness, you need to find the Function (or Fn) key. (Alternatively, if you don’t turn it on then you need the Fn key to simulate F1, F2, and so forth keypresses).

Do you check off the box in System Preferences > Keyboard that makes the F keys behave as standard function keys?

Do you check off the box in System Preferences > Keyboard that makes the F keys behave as standard function keys? I usually do. I think I only ever use the Volume Control function on the keyboard anyway.

On the laptop and the wireless keyboards, Apple usually puts the Fn key on the lower-left hand corner, next to the “Control” key. But it’s not there on the full-sized Apple Keyboard with the numeric keypad!

Or is it?

The Fn Key on an Apple Keyboard is next to the home and above the delete key in the area above the arrow keys.

Ha, it’s in the middle of the keyboard between the letters and the numeric keypad, right below the F13 key and above the Delete key!

Eject All of your Removable Mac OS X Disks Quickly!

Are you always using hard disks and USB keys in your Mac? Getting annoyed with having to go to the Finder, scrolling down in the sidebar, and then ejecting these disks before you can unplug all of these devices to move your computer? Or, maybe you just pull out the USB and let Mac OS X complain at you about how the disk was removed without you ejecting it first?

Try using this AppleScript along with a launcher application like QuickSilver to save time and eject all of your disks with one command! A launcher application is basically a quick way to start up applications – you press a keystroke like “Ctrl-Space” and then begin typing, and QuickSilver will find applications that match what you’ve typed. Ejecting disks is quite literally at your fingertips.

  1. Open up the AppleScript Editor (it’s in /Applications/Utilities)
  2. Copy and paste the following code:
    try
      tell application "Finder"
        eject the disks
        display dialog "Successfully ejected disks." buttons {"Close"} default button "Close"
      end tell
    on error
      display dialog "Unable to eject all disks." buttons {"Close"} default button "Close"
    end try

    AppleScript Editor with the Eject All script

    AppleScript Editor with the Eject All script.
  3. Save it into a place you’ll find it later. I used ~/Library/Scripts and called the script “EjectAll.scpt”.
  4. Compile it!

Now, if you double-click on that script, it’ll automatically eject all of your media and give you a dialog box to let you know when it’s finished.

quickSilverCatalogScripts

QuickSilver Catalog Preferences Window

In QuickSilver, I added the ~/Library/Scripts directory to my catalog by opening the QuickSilver Preferences, clicking on Catalog, then going to Scripts in the sidebar. I then ensured that “Scripts (User)” was checked.

Then, you can relaunch QuickSilver, press its hotkey (Ctrl-Space by default), and type “EjectAll” and press enter to run the script. It’ll automatically eject all of your media and then you can pull out all of your plugged-in devices without worry!

Do People Seek Information Like Animals Forage for Food? An Introduction to Information Foraging Theory

Much of my research at Oregon State University examines debugging using a lens called Information Foraging Theory. I’ve written a few posts on this topic but I haven’t really given a good overview of what Information Foraging Theory is and what it provides for software engineering.

The theory, in a nutshell, is a theory of human behaviour that describes how people forage for information. They are theorized to forage in a way to provide maximum benefit for minimum value and to make decisions based on input from the environment that affects this cost/benefit ratio. This theory is applicable to software engineering because software engineering is a very information-seeking intensive activity. People spend a lot of time looking for things—whether it’s “What does this variable do?” down to, “Where can I start investigating this problem?”

Another reason why this theory is valuable in software engineering is because software engineering research often is built on ideas but not necessarily on underlying theories. Information foraging theory provides a theoretical framework that can help consolidate previous results and provide not only an explanation for why previous tools and findings have worked in the past, but also can make predictions for how people may behave in the future.

Now that we have an idea of what it is and why it’s relevant to software engineering, let’s dive into what information foraging is. Much of this post is adapted from material that appears in An Information Foraging Theory Perspective on Tools for Debugging, Refactoring, and Reuse Tasks that appears in the ACM Transactions on Software Engineering and Methodology (TOSEM), 2013. In another post, we’ll talk about how it relates to software engineering research.

Information Foraging Theory: What it is

Information Foraging Theory was originally proposed by Peter Pirolli and Stuart Card at what was then Xerox PARC to explain how individuals search the web for information. The idea was inspired by ecology’s Optimal Foraging Theory which is the idea that foraging animals attempt to maximize their energy intake (by finding food) over the time required to find that food.

Constructs and Theory

In Information Foraging Theory, the human, called a predator, is looking for information in an environment, like the web. A predator can seek information from an information source, called an information patch, and a topology is made up of many patches. Many patches make up an information topology. Patches are connected to each other through links—each link requires a certain cost to go from one patch to another. Within each patch, there are information features. These features might be words or sentences on a screen, graphics and pictures, icons, even colours and shapes.

A rounded, shaded rectangle contains hexagons with numbers inside them. Some of these hexagons are associated with outgoing links to other shaded rectangles that each have their own hexagons with numbers in them. The links have a number on top of them representing the cost of traversing the link.

Information patches (shaded boxes) in an information topology. In each information patch, there are features (hexagons) with a numerical value. Some of these features are attached to links (dashed line). Each link navigates to a different patch and has a cost.

The predator has an information goal in mind and want to seek information that satisfies that goal. This predator forages through the information topology seeking prey, which are information features that are related to the predator’s goal.

The activity of getting at information has a cost (usually time) but consuming information from a source also has an associated value (how relevant or important the information is). After consuming some amount of information (which is called prey), the predator may decide that it’s no longer worth the predator’s time to continue processing that patch and the predator navigates away from the patch to a new one that is considered more valuable.

Some information features are connected to links. In web pages, links are usually located in particular places, are coloured differently, and are sometimes underlined when you mouse over them. These features are called cues. A predator can use these cues to try to predict the value of the information on the other side of a link.

Three-panel representation of a developer looking at a screen of information. In the first panel, the developer is staring at a panel at the top of the screen. In the second panel, the developer is choosing to move to a new part of the same screen. In the third panel, the developer has chosen an alternate route of changing the view to look at an entirely new screen.

A developer decides whether to continue foraging in the same screen of information, or whether to refresh a view (which has a cost) and getting new information.

So, a developer who is foraging for information has to make a decision whether to stay within the current patch and continue processing the information in it or to access a different patch and process information from there. To make the optimal decision, the developer wants highest value information for the lowest cost!

If we decide to use math to represent this relationship, it looks like this:

A mathematical formula: Predator's desired choice equals max(V over C).

The predator wants to maximize value V of processing information and minimize the cost C of travelling to find information.

This is pretty basic so far—everyone wants to maximize their value and get the lowest cost! What is really interesting about this theory is what people’s perceptions of high value and low cost are.

Perceptions and Scents

Even though a predator wants to maximize value and get low cost, one of the main issues is that predators don’t know everything. They only know what they can see currently. Thus, predators perceive an expected value and an expected cost whenever they are processing information features from a patch, including the cues that indicate if a patch is worth leaving.

Since most patches have multiple cues, this means that the predator has to make a number of estimations, based on the cue (and possibly other factors) about whether to leave the patch. This is called information scent. Scent is often represented in practice by measures of textual similarity. Scent is also influenced by the amount of attention—for example, how big the cue’s visual size is, or the position of the cue.

Summary of Information Foraging Theory Constructs

That’s a lot of constructs. Fortunately, Fleming et al. (in an article that I helped write) built a pretty handy table to remind everyone what all of these concepts are.

Construct Description
Topology Collection of information patches and links between those patches within a particular information environment
Information patch Region in the topology that contain information features
Links L Traversable arcs between patches
Information features Elements of the environment that the predator can process to gain knowledge
Cues Set of information features associated with a particular link
Predator Person in search of information
Information goal Set of information features that the predator wants to find
Prey An individual feature in the goal set
Information scent Given a link with an associated cue, the predator’s estimation of the probability that traversing the link will lead to prey
Attention Amount of attention that a predator pays to a particular cue
Information value V Benefit of processed information to the predator
Interaction cost C Value that the predator anticipates gaining through a particular course of action (e.g., following a particular link)
Expected value E(V) Value that the predator anticipates gaining through a particular course of action (e.g., following a particular link)
Expected cost E(C) Cost that the predator anticipates incurring in following of a particular course of action

IFT’s Key Constructs, adapted from Fleming et al. 2013, An Information Foraging Theory Perspective on Tools for Debugging, Refactoring, and Reuse Tasks, ACM Transactions on Software Engineering and Methodology.

Predictions and Validations

There’s a lot of scientific work that has designed mathematical models of information foraging theory in the web domain. Pirolli and Card, 1999 investigated models to predict how people surf the web; this work was further augmented by incorporationg scent Chi et al. 2000, Chi et al. 2001.

Information foraging theory has also since been used to investigate collaborative search on the web, as well as social media tagging.

Next time: Information Foraging Theory in Software Engineering

Now that we have an idea of what information foraging theory is, I will present an overview next time about how this theory’s been applied in software engineering. So far, information foraging theory has been applied primarily to debugging tasks. Margaret Burnett has been leading the charge in this direction, but the concept is beginning to take hold in other areas of software engineering. Nan Niu, for instance, recently published at ICSE a requirements engineering paper on traceability using constructs from information foraging theory.

Stay tuned for the next part in this series!