Maurisson Music Hub

Music HubGuidesGear and studio › Connecting a USB MIDI keyboard to a computer: the complete guide

MIDI Studio guide·21 min readPiano

Connecting a USB MIDI keyboard to a computer: the complete guide

A USB MIDI keyboard connects with a single cable: if it is class compliant, which is true of nearly all recent models, the computer recognizes it with no driver to install. MIDI itself carries no sound at all, only short digital messages (which key, how hard, on which channel), which is why the protocol adds almost no perceptible latency: the delay you sometimes hear almost always comes from downstream audio processing, set by the software's buffer size, not the MIDI cable. A master keyboard makes no sound on its own and depends on a virtual instrument or an external sound module; a synth or workstation carries its own sound engine. The Music Hub relies on this same standard, through the browser's Web MIDI API, to let a physical keyboard play inside its MIDI Studio.
Open the Music Hub →

The MIDI protocol: what actually travels down the cable

MIDI stands for Musical Instrument Digital Interface. The most common misconception for anyone new to the subject is thinking a MIDI cable carries sound: it never does. A MIDI stream only carries short digital messages, instructions, never audio. A typical MIDI message fits in two or three bytes: a status byte, which identifies the message type and the channel involved, followed by one or two data bytes.

The most common message is Note On, sent the moment a key is pressed: it specifies which key, using a numbering scheme from 0 to 127 (128 possible notes, with note 60 corresponding to middle C, often labeled C3 or C4 depending on the octave convention used by the software, since there is no universal standard on this point), and how hard it was struck, the velocity, also coded from 0 to 127. This velocity typically drives the volume and timbre of the sound produced by the virtual instrument or synth that receives the message. Releasing the key sends a matching Note Off message, or sometimes a Note On with a velocity of zero, an equivalent shorthand used by many manufacturers.

Alongside notes, the protocol defines a whole family of Control Change (CC) messages, which continuously drive a sound parameter while you play: each CC carries a controller number from 0 to 127 and a value from 0 to 127. Some numbers have been standardized since the origin of the specification, such as CC 1 for the modulation wheel, CC 7 for channel volume, or CC 64 for the sustain pedal (past the halfway point of its travel, the pedal is treated as pressed). The Program Change message switches instrument or sound on a given channel, again among 128 possible values, matching the number of sounds in the General MIDI standard. Two less visible messages round out the toolkit: aftertouch (the pressure held after the initial strike) and pitch bend, the pitch wheel, which enjoys a far finer resolution than ordinary CC messages, 16,384 values instead of 128, for smooth, stepless glissandos.

All these messages can travel on any of the 16 MIDI channels carried by a single cable, numbered 1 to 16 for the user but 0 to 15 in the actual transmitted bytes. Each channel can drive a different instrument: a single cable can therefore, in theory, drive sixteen independent instruments at once, each one only listening to messages carrying its own channel number.

The main messages of the MIDI protocol
MessageWhat it carriesValue rangeTypical use
Note On / Note OffKey number + velocity (how hard it was struck)0 to 127 for the note, 0 to 127 for velocityTriggers or cuts a note on the virtual instrument
Control Change (CC)Controller number + value0 to 127 for eachSustain pedal (CC 64), volume (CC 7), modulation (CC 1)
Program ChangeProgram (sound) number0 to 127 (128 sounds)Switching instrument on a channel
Pitch BendPitch wheel position0 to 16383 (14 bit)Smooth glissando between two notes
Aftertouch (pressure)Pressure held after the initial strike0 to 127Vibrato or timbre variation while holding a note

This architecture traces back to 1981, when American engineer Dave Smith, founder of Sequential Circuits, and his colleague Chet Wood presented a proposal for a universal synthesizer interface to the Audio Engineering Society, after talks with manufacturer Tom Oberheim and with Roland founder Ikutaro Kakehashi. The proposal was refined in 1982 with input from Roland, Korg, Yamaha and Kawai, then publicly demonstrated in January 1983 at the NAMM Show, where a Sequential Circuits Prophet-600 drove a Roland Jupiter-6 over the cable for the first time. The complete specification, the MIDI 1.0 Detailed Specification, was published in August 1983 by that same group of manufacturers; the International MIDI Association was formed the same month to distribute it to musicians. The organization that officially maintains the standard today, the MIDI Manufacturers Association, was formed two years later, in 1985, following a meeting of all interested companies at the summer 1984 NAMM Show; it has run a public online community called The MIDI Association since 2016. A remarkable fact for such an old electronic standard: the basic structure of MIDI 1.0 messages has never changed since 1983, even as the instruments using it moved from analog synthesizers to virtual instruments inside a laptop.

USB MIDI class compliant: plugging in without installing anything, mostly

The term class compliant describes a device that follows a standard class recognized natively by the operating system, without needing manufacturer-specific software. For MIDI, this class was standardized by the USB Implementers Forum in 1999, with the first version of the USB Device Class Definition for MIDI Devices specification, developed in cooperation with the MIDI Manufacturers Association and attached to the USB Audio class. In practice, every modern operating system already ships the generic driver that understands this protocol: Windows, macOS and Linux can all recognize a class-compliant USB MIDI keyboard with nothing to download at all.

The vast majority of MIDI keyboards and controllers sold today follow this standard. In practice, that means plugging in the cable is enough: the computer immediately detects a new MIDI device, visible in the system's audio settings and in the MIDI input list of any compatible software, including software running inside a browser through the Web MIDI API.

Some keyboards, particularly older models that predate this standard becoming widespread, or high-end controllers sold with proprietary editing software for fine-tuning every button and pad, still require installing a driver supplied by the manufacturer before the first connection. That driver rarely handles the basic MIDI stream, already covered natively, but instead unlocks advanced model-specific features: custom mappings stored in the device's own memory, a graphical patch editor, or sometimes a dedicated low-latency audio mode on models that combine a keyboard and an audio interface in the same unit. The most reliable rule of thumb is to check the product page or the manufacturer's site before buying: if nothing says class compliant or plug and play, plan to grab the driver from the manufacturer's website before plugging the device in for the first time.

Physical connections: USB cable, power, and the old DIN port

In the vast majority of cases today, a single USB cable is all it takes: it carries both the MIDI data and the keyboard's power, known as bus power. A standard USB 2.0 port supplies up to 500 mA, a USB 3.0 port up to 900 mA: plenty for a small controller with a few octaves, but sometimes tight for a 61- or 88-key keyboard loaded with per-key LED backlighting or motorized faders. In that case, the manufacturer often supplies a Y-shaped USB cable that draws power from two ports at once, or recommends plugging the keyboard into a powered USB hub rather than directly into a computer port, otherwise the device may randomly restart or refuse certain power-hungry features.

Before USB, and still today on plenty of older or higher-end studio gear, MIDI traveled over a round 5-pin connector in the DIN format. A typical device has three ports: IN receives messages, OUT sends the ones the device generates itself, and THRU passes on, unmodified, an exact copy of whatever just came in on IN, which lets several synths be chained in series without any of them adding to or dropping from the stream. Electrically, DIN MIDI runs as a current loop through an optocoupler, a component that electrically isolates the two connected devices while still letting the signal through, which avoids ground loops and the hum they cause, a common issue with other cabled connections. The original specification sets a maximum cable length of 15 meters, beyond which a line driver is needed to keep the signal reliable.

That DIN connector has not disappeared: plenty of external audio interfaces built for home studios still carry a pair of MIDI IN and OUT ports in the DIN format, precisely so an old synth or a keyboard with no USB port can be linked to a modern computer. In that setup, the audio interface acts as a translator, converting the DIN signal into USB data the computer understands. A Bluetooth MIDI keyboard is a third, more recent option: it pairs like any other wireless device on the operating system, handy for a light setup, at the cost of slightly less predictable latency and connection stability than a wired link.

USB direct, 5-pin DIN or Bluetooth: comparing connections
ConnectionDriver neededRange / lengthTypical use case
USB directNone if class compliantA few meters (USB cable limit)A modern MIDI keyboard or controller plugged into a computer
5-pin DIN (via an audio interface)The interface's own driver, not the DIN itself15 meters maximum recommendedLinking an old synth or keyboard with no USB port
Bluetooth MIDINone, standard system pairingA few meters, wirelessA light, cable-free setup for occasional use

System-side setup and recognition inside a DAW

Once the keyboard is plugged in and recognized, every operating system offers a panel to confirm it is properly seen. On macOS, the Audio MIDI Setup application shows a MIDI Studio window with an icon for each detected device; on Windows, the device shows up in Device Manager and, more usefully day to day, in the MIDI input list offered by each piece of audio software; on Linux, the ALSA subsystem manages MIDI ports, viewable and connectable with tools like aconnect or a dedicated graphical interface.

Inside the music software itself, often called a DAW for Digital Audio Workstation, the physical MIDI input generally needs to be explicitly enabled in the preferences before it can be used on a track: some software automatically detects and enables any newly plugged-in controller, others require checking a box by hand. Once the input is active, it still needs to be assigned to a specific instrument track, armed for recording or simply for live listening, before pressing a key actually triggers a sound.

Beyond the physical port there is the concept of a virtual MIDI port, an entirely software-based cable that links two applications on the same computer, with no hardware involved. macOS builds this in natively under the name IAC Driver, for Inter-Application Communication: in Audio MIDI Setup, checking Device is online and adding one or more buses is enough for any application to connect to it, whether sending or receiving. Windows offers nothing equivalent out of the box, which is what made the free utility loopMIDI a de facto standard for creating virtual ports on that system. Linux has a comparable mechanism built directly into its ALSA sequencer. A virtual port is typically used to make two separate pieces of software talk to each other, for instance a notation program and a DAW, or an application running in a browser and a software synthesizer installed alongside it, exactly as a physical cable would between two separate devices.

One last point clearly sets MIDI apart from audio here: a single physical MIDI stream can usually be read by several open applications on the computer at the same time, whereas an audio stream is most often reserved for a single application at a time, unless routed through dedicated audio-routing software. That is what lets the same keyboard feed both a DAW and a small web app open in a separate tab at once, with no conflict and no complicated setup.

Latency: why MIDI is almost never the culprit

Latency is the perceived delay between the moment a key is pressed and the moment sound actually comes out of the speakers or headphones. It is one of the topics that worries beginners in home recording the most, often unfairly: the MIDI protocol itself is almost never the source of an audible delay.

A classic serial MIDI link runs at a fixed rate of 31,250 bits per second, a figure locked into the specification since 1983. At that speed, each byte, framed by a start bit and a stop bit, takes about 320 microseconds to transmit; a Note On message, which fits in three bytes, therefore takes roughly one millisecond to cross the cable entirely, a delay far below the roughly 10-millisecond threshold under which the human ear no longer perceives any lag. Over a USB connection, transmission is even faster, with messages riding inside high-speed USB packets rather than over a dedicated serial line. Either way, the MIDI protocol itself is almost never a meaningful factor in the total latency a musician actually feels.

The real bottleneck is almost always on the audio side, after the MIDI message has already triggered the virtual instrument. To turn that trigger into audible sound, the computer processes audio in small chunks called buffers, whose size is set in the number of samples in the DAW's or the audio interface's preferences. The latency introduced by this buffer is easy to calculate: it equals the buffer size divided by the sample rate, multiplied by a thousand to get milliseconds, then doubled to account for the full round trip from input to output. A 128-sample buffer at 48,000 Hz works out to roughly 2.7 milliseconds one way, a bit over 5 milliseconds round trip; a more comfortable buffer of 512 or 1024 samples, often chosen to save processing power during mixing, can instead exceed 20 milliseconds and become clearly noticeable at the keyboard, with the unpleasant feeling that the sound is dragging behind your fingers.

Setting the buffer is therefore always a trade-off: lowering it cuts latency but demands more from the computer, risking clicks, crackles or audio dropouts if the processor cannot keep up; raising it secures stability but introduces a more noticeable delay. The most effective habit is to lower the buffer to the smallest stable value while playing or recording live, then raise it again for mixing or exporting, where stability matters more than instant response. A poor-quality USB cable or an old USB 1.1 port on an aging computer can occasionally add a noticeable delay, but that remains the exception rather than the rule on recent hardware.

Virtual instruments: master keyboard, synth and workstation

A USB MIDI keyboard makes, on its own, absolutely no sound: it sends messages, and it is a virtual instrument, a plugin in the VST, AU or AAX format depending on the system and host software, that turns those messages into audio inside the DAW. These plugins cover the entire imaginable palette, from a sampled acoustic piano to the most experimental synthetic pad, and it is precisely this separation between the gesture (the keyboard) and the sound (the plugin) that makes MIDI so flexible: the same gesture at the keyboard can trigger a piano, then an organ, then a string pad, without ever swapping hardware.

This separation splits devices into two broad families, often confused by beginners. A master keyboard has no internal sound engine at all: it is a pure controller, built to transmit MIDI messages as faithfully as possible, generally lighter, more compact and cheaper than a full instrument, but completely silent without a computer or a sound module plugged in alongside it. A synthesizer, by contrast, carries its own sound-generating engine, with oscillators, filters and amplifiers, and can therefore produce sound on its own, unplugged from any computer, while usually still being able to send and receive MIDI to double as a controller when needed. A workstation pushes this even further by adding an internal sequencer and often a much larger sound library, enough to compose an entire song without ever touching a computer.

The choice between these families mostly depends on intended use. A master keyboard remains the most economical choice for anyone who already owns a plugin library and works exclusively at a computer; a synth or workstation makes far more sense for anyone who also wants to play with no computer switched on, in rehearsal or on tour, or simply wants an independent backup rig that does not depend on any software. This same logic of a plugin driven by MIDI shows up in lighter tools too, such as virtual instruments built directly into a browser using the Web MIDI API: the Music Hub's MIDI Studio is one example, where a physical keyboard plugged in over USB directly drives pre-recorded studio sounds, with no extra software to install.

Common issues and how to diagnose them

The most common problem remains a keyboard the computer or the software does not detect. The first thing to check is the USB cable itself: some cheap cables, particularly ones originally meant for charging a phone, only carry the two power wires and not the two data wires, which is enough to power the device but blocks any MIDI exchange. Next comes the port itself: plugging directly into a port on the computer rather than into an unpowered USB hub removes a frequent source of trouble, especially for a power-hungry keyboard. If the operating system does see the device in its MIDI settings but the music software does not offer it, the usual fix is to reopen the software's MIDI preferences: many DAWs only scan for available devices at launch, and so ignore a keyboard plugged in afterward until the software is restarted or its device list is manually refreshed.

The second classic problem has a precise name: the stuck note, a note that keeps sounding indefinitely long after the key has been released. The most common cause is a Note Off message lost along the way or never sent at all, for instance because playback was stopped mid-song while a sustain pedal was held down, or because a software bug let a Note On through without its matching Note Off. Nearly every DAW and synth offers a panic or all notes off button precisely for this case: under the hood it sends the standardized MIDI message Control Change number 123 with a value of zero, on every channel, which forces an immediate stop to every note currently sounding, wherever it got stuck.

A third point of confusion is worth clearing up: the difference between MIDI thru and MIDI merge. Thru simply duplicates, unmodified, whatever arrives on one input to one or more outputs, useful for chaining several synths in series; merge, by contrast, combines several separate MIDI streams into one, handy for connecting, say, two different keyboards to the single input of one sound module. Chaining devices incorrectly into a closed loop through thru, or stacking software virtual ports without paying attention, can recreate the same kind of stuck note or duplicated messages, even when the hardware itself is working perfectly.

Finally, if perceived latency is still bothersome after all these checks, the cause is almost always the audio buffer covered above, never the MIDI cable itself. The one real exception is Bluetooth MIDI: the wireless link inherently adds an extra layer of processing compared to wired USB, which usually goes unnoticed for casual playing but can become bothersome for demanding recording, where a direct wired connection remains the safest choice.

Going further: mapping faders, wheels and control surfaces

Many MIDI keyboards and controllers go well beyond a simple row of keys: they also carry assignable faders, wheels, knobs and pads, which send Control Change messages rather than note messages. Each of these physical controls can, in theory, drive any parameter in the DAW or in a plugin, from a track's volume to a filter's cutoff frequency, provided it is mapped to the right software parameter.

Most modern DAWs make this mapping easy through a feature often called MIDI Learn: right-click a parameter on screen, choose learn or map, then move the physical fader or wheel you want, and the software automatically remembers its CC number, with no need to look it up in a manual or a reference chart.

A step above that sits a family of protocols built specifically for dedicated mixing control surfaces, rather than for a plain keyboard. The HUI protocol, developed by Mackie and Digidesign in 1997 for Pro Tools, was later folded in 2003 into the Mackie Control Universal protocol, which combines the functionality of Mackie Control, Logic Control and HUI into a single standard now natively supported by many DAWs, including Cubase, Ableton Live, Studio One, Reason and Ardour. The difference from plain manual CC mapping is fundamental: every button, fader and wheel on the control surface is automatically wired to the right on-screen elements, with nothing to assign by hand, and some models even physically motorize their faders so they move on their own to reflect the software's state in real time. These protocols even go beyond MIDI's usual 128-value resolution, with a much finer range of values for noticeably more precise adjustments by hand.

Whether you stick with plain CC mapping or move to a full dedicated control surface, the basic transport underneath has not changed since 1983: it is still MIDI messages, simply more numerous and better organized, linking the physical gesture to what appears on screen.

Common pitfalls to avoid

MistakeBlaming the MIDI keyboard or the USB cable for latency that actually comes from the audio buffer

Why — A MIDI message takes roughly one millisecond to cross a classic serial link, and even less over USB: the protocol itself is almost never responsible for an audible delay. The real lag comes from downstream audio processing, set by the buffer size in the DAW's or the audio interface's preferences.

Do this instead : Before suspecting the keyboard or the cable, check and lower the audio buffer size in the DAW's preferences while playing live, then raise it again afterward for mixing, where stability matters more than instant response.

MistakeUsing a USB cable that only carries power wires, not data wires

Why — Some cheap cables, particularly ones originally meant for charging a phone, do power the device but carry no data at all: the keyboard appears to be on, its lights sometimes turn on, but no MIDI message can ever reach the computer.

Do this instead : Always use the cable supplied with the keyboard, or a USB cable explicitly rated for data transfer, never a charge-only cable, for any MIDI connection.

MistakeLetting a stuck note ring indefinitely instead of using the software's panic function

Why — A stuck note almost always comes from a Note Off message that was lost or never sent, for instance after playback was abruptly stopped while a sustain pedal was being held. Replaying and releasing the same key does not always fix it if the virtual instrument has lost track of the note's actual state.

Do this instead : Use the DAW's or synth's panic or all notes off button the moment a note gets stuck: it sends the standardized Control Change 123 message on every channel, which immediately cuts every currently sounding note, whatever its origin.

MistakeAssuming a master keyboard will produce sound on its own once plugged in

Why — A master keyboard, unlike a synthesizer or a workstation, has no internal sound engine at all: it only sends MIDI messages. Without a virtual instrument loaded in the DAW, an armed track and a correctly assigned MIDI input, the keyboard stays completely silent even when it is working perfectly.

Do this instead : Always check that an instrument plugin is loaded on a track, that this track is actually listening to the keyboard's MIDI input, and that the master volume is not muted, before concluding the keyboard itself is faulty.

Explore in the Music Hub

More guides

It is all in the app, for free

The Music Hub gathers over 2 597 songs with chords, click-to-hear piano, transposition and a capo helper. Free, no account required.

Open the Music Hub →

Frequently asked questions

Do I always need to install a driver for a USB MIDI keyboard?

No, if the keyboard is class compliant, which is true of nearly all recent models: the computer recognizes it directly, with nothing to install. Only some older models or high-end controllers sold with proprietary editing software require a driver, generally to unlock advanced features, not for the basic MIDI stream.

Why isn't my MIDI keyboard detected by my software?

First check that the USB cable actually carries data, not just power, then plug directly into a port on the computer rather than into an unpowered hub. If the operating system sees the device but the software does not, restart the software or refresh its MIDI device list in its preferences: many only scan at startup.

Does MIDI have latency?

Very little: a typical MIDI message takes about one millisecond to cross the cable, a delay far below the threshold of human perception. The latency you feel at the keyboard almost always comes from downstream audio processing, set by the buffer size in the DAW, not from the MIDI protocol itself.

What is the difference between a master keyboard and a synthesizer?

A master keyboard has no sound engine at all: it only sends MIDI messages and depends entirely on a virtual instrument or an external module to produce sound. A synthesizer carries its own sound engine and can play on its own, unplugged from any computer, while usually still being able to send and receive MIDI.

My notes are getting stuck, how do I fix that?

It is almost always a Note Off message lost or never sent. Use the DAW's or synth's panic or all notes off button: it sends the standardized Control Change 123 message on every channel, which immediately cuts any stuck note, whatever its cause.

Can I plug an old keyboard with DIN MIDI ports into a recent computer?

Yes, through an audio interface that carries MIDI IN and OUT ports in the 5-pin DIN format, or a dedicated DIN-to-USB adapter: the interface then acts as a translator between the old DIN format and the USB the computer understands. The DIN cable itself stays limited to 15 meters under the original specification.