4

I want to try and make my own application for my Novation Nocturn, which is a USB DJ controller surface. The application software interacts with it to send out MIDI messages to software like Traktor, Ableton and Cubase.

I'm aware of libusb, but that's as far as I've got. I've successfully installed it to interact with my device but stopped there.

I'm after some suitable reading material basically. USB specs, MIDI specs and such. If I'm honest the full USB 2.0 spec looks like it holds loads of stuff I don't need. Just looking for something interesting to do now that I've finished my degree (Computer Science). My current programming knowledge is C++ and mainly C#.

Could do with some direction on how to get stuck into this task.

edit:

Update to include some info from the Device Manager on the Nocturn.

Hardware IDs:

USB\VID_1235&PID_000A&REV_0009

USB\VID_1235&PID_000A

Compatible IDs:

USB\Class_FF&SubClass_00&Prot_00

USB\Class_FF&SubClass_00

USB\Class_FF

Device Class:

MEDIA

Harry
  • 2,429
  • 4
  • 21
  • 26

6 Answers6

1

USB MIDI is probably one abstraction layer lower than you want to deal with. I'd suggest finding a good MIDI framework and interacting with the device via MIDI instead.

For C++, Juce is probably the way to go, as you didn't mention a target platform or any other specific requirements.

Nik Reiman
  • 39,067
  • 29
  • 104
  • 160
  • Allow me to clarify something. The Novation Nocturn isn't strictly speaking a USB MIDI device. You cannot plug this into a MIDI synth that has a USB port and have it control the parameters of the synth because the Nocturn is not a MIDI device. What makes it MIDI is the software. Novation use their Automap Software to achieve this. As for a target platform, Windows 7. – Harry Nov 15 '11 at 16:08
  • 1
    Automap is entirely MIDI-based; there is nothing special happening at the USB level: http://forum.jazzmutant.com/viewtopic.php?t=23&sid=9b66e88256b68987a76fddfa132784a1 – Nik Reiman Nov 15 '11 at 16:44
  • I don't understand... The software is what makes it a MIDI device and it is this software that I would like to create. My intention is to eliminate Automap entirely and replace it with my own creation. Surely, therefore, the software I create would need to interact with the device at the USB level? – Harry Nov 15 '11 at 17:58
  • @Harreh, That is a very important detail you should post in your question. I still really doubt though that the device doesn't act as a USB MIDI device. Can you do me a quick favor? Go to device manager, open up the properties for your Novation, click the details tab, and then open up the hardware ids property and post them in your question. Do the same with compatible ids, and device class. – Brad Nov 15 '11 at 21:50
  • @Brad, Apologies for any confusions, I have added the information you asked for in my original post now. – Harry Nov 16 '11 at 15:16
  • @Harreh, Give this a try, and post a data sample if you can: http://sourceforge.net/projects/usbsnoop/ Your Novation officially has me very confused. – Brad Nov 16 '11 at 15:29
  • @Brad, I loaded up that program and followed the readme.txt instructions which made a USB log appear. I play around with some of the controls, pushing buttons and turning the encoders. Then I click the stop button and I see no result. I tried the software with my Xbox 360 controller and as I use it the number of packets increases and I can see the results when I click stop. – Harry Nov 17 '11 at 12:11
0

Old thread, but I've just recently started looking into this.

I had a look at the Python application that dewert has written. Interestingly, it turns out that the data that the Nocturn emits is in fact MIDI, although it doesn't register itself as a USB MIDI device.

But looking at the actual data coming from the device, it actually emits control change messages (0xB0 controller value) for everything. Also the control commands that are sent to it are also control change messages, albeit only the data bytes, as the Nocturn seems to support MIDI running status (i.e. when sending multiple control change messages, it is not necessary to repeat the data byte).

Indeed, the looking at the magical initialization data it is actually just a bunch of control changes: it starts with 0xb0 and from there on the data comes in twos. For instance the last two bytes in the init string are 0x7f 0x00 which simply turn off the LED for the rightmost forward button. (There is something subtle happening as a result of the initialization being sent though, as the Nocturn sometimes emits some messages which appear to be some form of timeout events, and that behavior changes depending on whether the initialization string has been sent or not.)

Using MIDI-like messages makes sense, as Novation would be well aware of the MIDI protocol, so it would be easiest for them to use it for the communication even if the device is not strictly a MIDI device.

Note though that the incrementors just send the values 1 or 127, i.e. +1 or -1 step, so even with some trivial mapping software it's not really useful as it is. (Actually, if turned quickly, one can get 3 or 125 for instance, with the 125 corresponding to -3.) The only controller which sends a continuous value is the slider, which emits an 8 bit value when moved.

ricard
  • 31
  • 3
0

If you want to go the .NET route, the easiest way to get started is with the C# MIDI Toolkit code:

http://www.codeproject.com/KB/audio-video/MIDIToolkit.aspx

In there, you'll find all the basics for opening an device, reading input, and writing output. Alternatively, NAudio has some MIDI classes, but they are somewhat incomplete.

As you develop, you'll want a reference for the MIDI spec handy.

A tool that you will find invaluable is MIDI-OX. In fact, I suggest that before you start coding, you fire up MIDI-OX and use it to sniff the messages coming from the Novation. It will give you a good idea of what the Novation sends. You can use it in conjunction with MIDI Yoke (a configurable virtual MIDI port) to insert itself between the Novation, and Ableton Live (or whatever software you normally use with your Novation) so you can see all of the messages in normal use.

Brad
  • 159,648
  • 54
  • 349
  • 530
  • I'll look into the C# MIDI Toolkit, thanks. Please refer to my above response to Reiman, as the device itself doesn't fire off MIDI messages. That's the software's job. – Harry Nov 15 '11 at 16:13
  • @Harreh, I believe you are mistaken. In any case, it doesn't matter whether or not MIDI is sent from the software or the hardware... a MIDI device (virtual or not) exists. – Brad Nov 15 '11 at 16:57
0

Done... Kidding, but I've started on this in Python - I personally want linux support. I am teaching myself python, but I only dabble in programming.

You can see basic functionality at https://github.com/dewert/nocturn-linux-midi. The guy who reverse engineered it (i.e. the leap I wouldn't have been able to make myself) doesn't seem to be doing any more with it. His code is at https://github.com/timoahummel/nocturn-game

I am using PyPortMIDI and PyUSB, both of which I believe are wrappers for the C equivalents. I think this is all ok on Windows, but haven't tried.

What is currently on my github is crap, but it is proof-of-concept. I'm working on doing it properly now, with threading and proper configuration options.

dewert
  • 1
  • 1
  • Interesting, I'll check that stuff out at some point. I was aware of that Python game but I don't know Python. Could learn it I guess or as rjmunro suggested port it using libusb. – Harry Nov 20 '11 at 11:47
  • If you've done any sort of OOP, Python is dead easy and very fun. timoahummel's code is so useful for figuring out what to send/receive on USB, so unless you want to re-reverse-engineer the protocol, it is an absolute must. I had a lot of difficulty getting usbsnoop to work, but eventually didn't need do anything with it. Another way to intercept the messages is to run automap in a VirtualBox with linux host, and log the USB communication. – dewert Nov 20 '11 at 18:26
0

The driver for the Nocturn makes it appear to system as a MIDI device, even though it isn't a USB MIDI device at the hardware level. The Automap software works entirely at the MIDI level, receiving MIDI instructions and sending different instructions in response - it is separate from the driver and not neccesary.

Alternatively, look at https://github.com/timoahummel/nocturn-game for an example of talking to it directly over USB from Python. You can probably port this to another language with libusb bindings.

rjmunro
  • 27,203
  • 20
  • 110
  • 132
-1

I suppose you'll want to know about USB classes in general and USB MIDI class in particular. The latter is the best what you can hope for in case you don't posess documentation for some proprietary protocol (whether it's used there instead).

vines
  • 5,160
  • 1
  • 27
  • 49