Skip to main content

The hako command

tools/bin/hako is the computer's side: Linux, Python 3 with numpy, ALSA. It finds the unit as the ALSA card ELZ_1; --dev /dev/snd/midiCxDy names another port. hako COMMAND --help says more about each.

Building​

hako pack APP.out APP.BIN [--lz4]an app's ELF as an app file (--lz4: half the size, for the disk)
hako image loader.out ELZ_1.BINthe loader as the update file SYSTEM UPDATE flashes
hako check ELF...an app calls nothing outside itself

On the unit​

hako run APP.BINrun an app from RAM; nothing is written
hako install FILE --as NAME.APPwrite an app into its own folder, NAME/NAME.APP
hako install FILE --as NAME/SUB/FILE.EXTwrite a file into an app's folder
hako open NAMEstart NAME.APP from the disk, as if picked in the menu
hako stock FILEcheck your Sonicware firmware (the zip or its ELZ_1.bin) and write it to STOCK/ for the STOCK app
hako stockwith the unit's disk mounted: move the ELZ_1.bin a Sonicware update left in its root into STOCK/
hako setup [DISK]from the boot menu's USB MSC: keep Sonicware's ELZ_1.bin in STOCK/, put Hako on; then SYSTEM UPDATE
hako uninstall [DISK]from the boot menu's USB MSC: Sonicware's ELZ_1.bin back in the root; then SYSTEM UPDATE
hako menuback to the launcher's menu
hako recoverafter a reset: wait for the unit and get to the menu
hako disk unit|computerwho writes the unit's disk
hako hellowhich app is running, and its build
hako screen text|shot|video|crcthe console's rows, a screenshot, a video, a checksum
hako press NAME, hako key N, hako turn ENC Npress a button (OK, MENU, A+B), a key (0-39), turn an encoder
hako watchthe unit's control events as they happen

install and open refuse while the computer has the unit's disk mounted: eject it first.

In a browser instead: tools/web/sendapp.html, served on localhost and opened in Chrome or Edge (Web MIDI), runs and installs apps from any computer.

Tests and measurements​

hako test SCRIPT...test scripts (Python, hako.testing): the last line says ALL PASS
hako film SCRIPT OUT.mp4 [--use 1,2]a test filmed: the screen, the sound, the steps as subtitles
hako listen --use 1,2record the unit's line out through an audio interface: level, pitch, pulses; --dropouts
hako play WAV or --tone HZplay into the unit's AUX IN
hako clock lead|measurethe other end of the unit's MIDI clock: send it, or time it

The audio interface is named by --device or HAKO_AUDIO (arecord -L lists them), and how many channels it opens with by --channels or HAKO_AUDIO_CHANNELS. Many interfaces open only with all their inputs; listen and film keep only those named with --use, in memory, and drop the rest before anything is written, so a microphone on another input is never recorded.

A shared unit​

HAKO_LOCK=/path/to/module.py:NAME makes every command take turns: the module has claim(name, wait=seconds), called when a port is opened, and touch(name), called as messages are sent. HAKO_LOCK_WAIT is how long to wait in line (30 minutes by default).

As a library​

tools/ on sys.path, then from hako import unit, lab, testing: the SysEx protocol and the port (unit.Port, unit.launcher, unit.send), lab mode (lab.press, lab.rows, lab.shot, lab.Video), and the test helper.