There is a basic sketch that lets you use an M-Audio Trigger Finger to control deck 3 in Traktor as a Remix Deck. The pads map to the cells as expected and the knobs map to gain and filter. It is still rough though but it works and it illustrates how you send commands to the remix decks.
This project has a couple pros and cons when it comes to controlling the remix decks:
Pro - you don’t need to do any mappings in Traktor
Pro - there are no latency issues from either MIDI or Traktor mappings
Pro - using Arduino sketches you can programme any behaviour you’d like, e.g. play a whole row of cells at once, etc., including possibly things that are not doable with mappings in Traktor
Pro - using Arduino sketches you can easily build custom hardware controllers and map these to the remix decks, ala MIDI Fighter Twister
Con - it requires an extra piece of hardware or two(the Arduino board and a MIDI shield)
Con - doesn’t receive output from Traktor to light up LEDs (yet)
yes there is a specific reason - with the Leonardo (and the Teensy I think) the USB emulation is in software on the main processor, so I think this makes loading Arduino sketches harder after you’ve loaded the emulation firmware. What I am doing is flashing the USB chip (ATmega16u2 in this case) to emulate the F1, then loading sketches in a standard way with an ISP onto the main processor.
But I could be wrong - it is possible just as easy on the single chip boards like the Teensy, etc.
I need to double check on the HID stuff on the leonardo but I’ve just adapted midi serial code to usb midi to work on the arduino leonardo, that is using a midi-usb firmware, are you aware that the midifighter uses a single atmega chip? 16u2 I think it is but the code will work on a 32u2, 32u4 etc.
The leonardo doesn’t come with native usb midi support, you have to add a ‘core’ to the arduino ide called ‘Arcore’, this allows you just write your program directly in the arduino IDE using USBMidi.noteon(xx,yy,zz); style calls and upload from there too I think it’s got HID support in the arcore code.
I’ll look into this a bit more but all of the teensy boards can be programmed directly from the arduino 1.0.5 IDE using teensyduino, you get a bunch of extra option in the tools menu, with the main one being ‘USB Type’, for the teensy 2.0, this gives you 8 options:
Serial
Keyboard + mouse + joystick
Serial + keyboard + mouse + joystick
Disk(internal) + keyboard
Disk(external) + keyboard
Midi
Raw HID
Flight Sim Controls
I’ve just noticed you’re using an external midi unit to provide the controls and then using the uno to recieve that midi and convert it to HID, I wondered how you were getting all those inputs from an uno
I wasn’t going to do that, i was just going to look at adding a couple of port expanders and doing it all on the leonardo, clearly something like a mega would be most suitable though as it doesn’t require any extra hardware, it does have the issue though that it needs moco lufa but from what I’ve been reading, you simply need to jumper a pair of pins to be able to swap it from programming mode to HID mode.
I haven’t had to touch the bootloader at all, it stays the same, when you turn it on/reset it, it goes into bootloader mode, once it realises nothing is trying to program it, it switches itself into midi-usb mode, whilst also retaining the usb-serial connection so it can still be programmed.
I have been using it to write usb midi controller code, I started from someone’s code on an instructable which was basically cloning the midi fighter for arduino uno etc. I adapted it to work with the leonardo + arcore, I’ve now improved it to do loads of stuff, I cleaned up all the analog input code, added rotary encoders, added RGB addressable LED support which light up via midi, added the ability to change the colours via midi note + velocity on ‘spare’ channels and also added the ability to save custom colours to eeprom. Oh, I also added rudimentary midi thru support too.
The leonardo + arcore is incredibly versatile, all of that fits in about 8kb of code, in theory, it should support up to 128 inputs.
I’m not entirely sure how it would work directly on a leonardo or teensy 2.0 at this moment with the way it is, I take it the emulator library is expecting hid information via serial from this line in the example sketch?
// send HID message
Serial.write(report, 22);
if so that might need adapting depending on the board, for teensyduino at least, you can write the HID code directly in the main program, no need to send it out of the serial at all.
That’s the ‘core’ that makes it happen on an arudino leonardo, I’ve adapted the code slightly so can send note on/note off/CC messages instead of 3 raw bytes for the midi, I haven’t checked the HID side of things yet but the author is active.
yes - the code in the ATmega16u2 has a buffer that just waits for 22 bytes (the size of the F1 HID report) and then sends that data out as an HID report
I think the only real task to adapt this to a different board would be get the HID emulation write, and change where it listens to for data.
I’ve just fired off an email to the arcore author to see what he says about using HID with his code.
Also, the leonardo can natively do keyboard/mouse emulation, I’m just reading a web page on some one adapting the arduino core code to do hid joystick, I’m not sure it even needs that doing to it, just access to writing raw HID.
I don’t know a great deal about usb hid, so excuse me if this is a stupid question, I couldn’t see where the actual report values are coming from for the report? I can see how it’s triggered and constructed but the only array I could see was the descriptor? If it is the descriptor, might be an idea to comment it to give an idea of what does what?
I did experiment a bit with the Teensy and Leonardo at first, but the tricky part (even with the Uno) was getting the emulation to be exactly like an F1 - meaning the descriptor has to be exact and it has to respond exactly how Traktor expects the F1 to respond. The Uno turned out to be more straightforward, since the stock LUFA code was easily hacked to do this.
Look in SerialToF1.c - the main loop just reads 22 bytes from the serial in (hardwired on the board to the main proc) and then calls the send HID report function with this data, which sends it out the USB port as an HID report
Also, if the leonardo etc. are capable of doing hid keyboard/mouse support, then they’re capable of raw hid too, so it could just be a question of adding the descriptor and a raw send/receive method into the existing HID core files, rather than even using arcore. The teensy duino core gives raw functionality, so perhaps there is something to be learnt from there too?