Sunday, 15 April 2018

AKAI MidiMIX & Processing Midibus



I got this AKAI MIDImix USB controller. It's principally meant for Ableton, like apparently half the stuff nowadays is. My only real interest is to connect it to my computer with the Processing MidiBus library.

Previously I have have been messing with MicroKORGs, Electribe and a Nanokontrol 2, so a controller like this is not a big deal. Compared to synths, the major difference is that the lights can be set independently of the key presses. They even need to be set because the physical button presses only send information about the key press itself and do not change the light state.

I'll look at the Processing midi library a bit and then at the AKAI mapping.


Midibus

MidiBus is a clever library for Processing that eases the use of MIDI considerably. It handles input, output, program change, control change, raw midi data on multiple channels. Here I'm not going into song player routines, which are a bit tricky but doable. (The Midibus does not have a player).

After installing MidiBus to the Processing install, this will activate it in the source:

import themidibus.*;

void setup()
{
  MidiBus.list();
  mybus=new MidiBus(this,1,2);
  println(mybus);
}

The "(this,1,2)" can be adjusted to input and output of the given list of MIDI devices you get from running the sketch.

The MidiBus.list() produces a list to the console with the relevant information. My USB/MIDI interface is an UM1G, and as the AKAI MIDImix works through a separate USB cable (not a MIDI cable) it will be listed as a separate device:

Available MIDI Devices:
----------Input----------
[0] "UM1G [hw:2,0,0]"
[1] "Mix [hw:3,0,0]"
[2] "Real Time Sequencer"
----------Output----------
[0] "Gervill"
[1] "UM1G [hw:2,0,0]"
[2] "Mix [hw:3,0,0]"
[3] "Real Time Sequencer"


After the Midibus has been set correctly, sending a note is simple:

mybus.sendNoteOn(midi_channel, pitch, velocity);

You need to shut the notes too:

mybus.sendNoteOff(midi_channel, pitch, velocity);

For example, these could be directly inserted within the Processing keyPressed() and keyReleased()events to facilitate a simple MIDI keyboard.

Control Changes for things like Modulation Wheel, Cutoff, Resonance, can be sent like this:

output.sendControllerChange(midi_channel, CC, value);

Just as an aside, some devices use NRPN (Non-Registered Parameter Number) for similar things. In such cases the data has to be sent as raw MIDI information. This worked for my Korg Electribe:

output.sendMessage(0xb0, 0x63, 0x05);
output.sendMessage(0xb0, 0x62, NRPN);
output.sendMessage(0xb0, 0x06, VALUE);  

The 0xb0 signifies MIDI channel 1, whereas 0xb1 would be 2, and so on. Good manufacturer manuals and datasheets should give Control Change and NRPN values for each device.

But it's also possible to find out the CCs and note values by displaying the incoming MIDI data. The values can shown by adding controllerChange() and noteOn() events to the sketch:

void noteOn(int channel, int number, int value){
  println("Received note channel:" + channel);
  println("Received note number:" + number);
  println("Received note value:" + value);
}

void controllerChange(int channel, int number, int value) {
  println("Received CC channel:" + channel);
  println("Received CC number:" + number);
  println("Received CC value:" + value);
}  


AKAI midimix

Ok, back to the MIDImix. Physically, the knobs could have been taller, it's not easy to get a good grip of them. Also the faders could have been a bit longer but this is less of a problem. Yet the MIDImix is compact and quite cheap, although not as cheap as a Nanokontrol might be.

The nice thing with these modern controllers is that the data is transmitted through an USB cable and it's also USB-powered, so no power cable / MIDI cable hassle.


AKAI works on MIDI channel #1, and I didn't see how it could be changed. For the purposes of my tests I simply disconnected the MIDI cable from my UM1G box.

All potentiometer and slider values are Control Change messages with the value 0-127 with them.
The buttons are "keys" that send a velocity of 127 with them.

Potentiometer CCs:

I   II III  IV   V  VI VII VIII
16  20  24  28  46  50  54  58        TOP ROW
17  21  25  29  47  51  55  59        MIDDLE ROW
18  22  26  30  48  52  56  60        BOTTOM ROW

Slider CCs:

19  23  27  31  49  53  57  61  (62 = MASTER)

MUTE button Note values:

01  04  07  10  13  16  19  22  (27 = SOLO)

Individual SOLO button Note values: *)

02  04  08  11  14  17  20  23

REC ARM button Note values:

03  06  09  12  15  18  21  24

Bank Left Note value:

25

Bank Right Note value:

26

Solo button Note value:

27

*) Holding down the "SOLO" key shows the individual SOLO status for each channel instead of the MUTEs. So, sending a SOLO light change only shows up if the "SOLO" key is held. In other MIDImix devices there may even be separate lights for the SOLOs. Pressing the "SOLO" key does send a note value, though.

Sending note-ons to MUTE, REC ARM or Bank button values with velocity 127 will turn the associated lights on. Sending note-ons with velocity 0 will turn the lights off. Sending note-offs does nothing. The "SOLO" key cannot be lit this way, possibly there's no LED at all.

Pressing SEND ALL will cause the MIDImix to send all the above values in succession. This key also may not have a LED in it.


Tuesday, 3 April 2018

QL Tetroid Gold Card clone


Last year, I was so eager to get Tetroid's Disk Interface for the QL I didn't notice Tetroid's Miracle Gold Card clone - that would have been more interesting for me. I cursed myself a bit, waited for some time, then decided to order it anyway.

The Gold Card has a 68000 processor, a floppy disc interface, battery for backing up the clock/date and 2 megabytes of memory. I had a slow moment, thinking, "How can this be, the QL cannot address more than 1MB?" But of course the 68000 can access more memory than the 68008, that's the whole point.

The speed increase (~4x they say) is the main reason I was interested in the Gold Card. The speed is not about processor frequency, it's just that the 68000 does not need to "convert" 16/32 bit instructions to a 8-bit data path the way the 68008 does.

Theoretically, if a program is coded in a way that avoids 68008 bottlenecks, it might not be radically faster on the 68000.

The even faster Super Gold Card is probably eventually going to be cloned too (I'm hoping), but I just could not wait.

Unlike the Tetroid Disk Interface (TDI), there is no Compact Flash card reader built in. The Gold Card has a floppy disk interface which together with my HxC Floppy Emulator is enough for loading programs from an SD card. But the card seems to work well with the QL-SD and Minerva ROM, so I can have both FLP and SDC connected.

To make the difference between the three products clearer, I've created this table:

                      TDI      GC       QL-SD
Card Reader:          YES(CF)  NO       YES(SD)
68000/Acceleration:   NO       YES      NO
Memory:               800K     2MB      NO *)
Disk interface:       YES      YES      NO
Battery-backed clock: NO       YES      NO
Toolkit 2:            YES      YES      NO
Minerva ROM:          NO       NO       YES

*) The file allocation table takes memory

The QL-SD is not really comparable, but I included it to make clear how these devices might complement each other. Note also that none of the solutions enable a direct file-transfer between a PC/MAC file system and the card reader.

Looking at the Gold Card board, it is the same professional quality as the TDI. Installing was easy. There are no jumpers or settings to consider, nothing to screw or un-screw, just remove the extension port cover and push the card in gently along the rails.



The card is a bit longer than the TDI, although it does not extend over the computer footprint.

When connected, take care: Do not grab the card when picking up the computer, as this can bend the boards inside.


Booting & BASIC test drive

Although the booting sequence must be technically faster, there is also more memory to check and therefore it takes a tiny while. Then I get the "Gold Card v 2.49" message and I'm off to superBASIC.

With the Minerva ROM, I have to look at the added boot option screens - the QL-SD also needs a short waiting time. For some reason I had to do my mode selection "twice" if I go for the F4/Dual screen. But the Minerva boot and memory check have been optimized so it's pretty quick.

It's instantly clear the speed makes it much more pleasurable to work in the BASIC environment. I no longer have a feeling the system stays behind my moves. Before the upgrade, all listing, editing, typing, scrolling and similar actions were about bearable, now they are quite slick.

Again, TK2_EXT activates the Toolkit 2 extensions (the command itself is faster) and after that you can use the semi-fullscreen editor ED, FSERVE file server, or use WTV to set the BASIC window size to work better with a television.

Just eyeballing a couple of BASIC graphics routines shows the 4 x speed increase is quite real. Testing also highlights how slow the SuperBASIC is to begin with, so I'll have to say even now the BASIC does not give lightning-fast graphics.

When comparing an unexpanded QL with a Minerva ROM+68000, not all speed increases are due to the processor, as Minerva improves the ROM routines a bit. Taken together, SuperBASIC on Minerva+68000 is clearly 4 times faster and even more.

For example, the following line-drawing test could finish nearly 7 of the 8 color sweeps before the unexpanded QL without Minerva could finish even one.

100 MODE 8
110 PAPER 0: CLS
120 FOR I=0 TO 7
130 INK I
140 FOR Y=0 TO 100
150 LINE 0,0 TO 100,Y
160 NEXT Y
170 NEXT I

With output something like this.
QED text editor is smoother and begins to remind me of typing on ST/Amiga editors. My QMAC compiler setup works faster, and I guess the file access from RAM drive should also benefit from the acceleration.

The Qliberator-compiled BASIC increases the speed further. The compiler by itself does not do that much and my rough estimate is that even the non-compiled BASIC on 68000+Minerva is faster than compiled programs were on a completely unexpanded QL.

There are probably accurate benchmarks and testing software around, but this kind of simple observations are enough for me.


Final remarks

Decades after, it's easy to say that a full 68000 is what the QL should have had in the beginning. But old 68000 processors were costly and they also took up room on the board (64 vs 48 pins). QL would have jumped to a different price category and likely eaten up more desk space. The 68008 helped to make a very cheap and tiny computer with enough 16-bit sensibilities, yet more portable than many "portables" were back in the day.

But what about the Miracle Card Clone in this day and age? Because the card has a processor, memory and a disk interface, maybe Tetroid might clone a full computer, integrate the (Super) Gold Card and fit it all inside original QL case and connectors? That would be wonderful.