Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Programming On a Piano Keyboard

Soulskill posted about 2 months ago | from the well-tempered-claiverlang dept.

Input Devices 57

An anonymous reader writes: Here's a fun project: engineer Yuriy Guts built a Visual Studio extension that lets people program using MIDI instruments. You can write code letter by letter on a piano keyboard. Granted, it's not terribly efficient, but it's at least artistic — you can compose music that is also a valid computer program. Somewhat more usefully, it also allows you to turn a simple MIDI input device, like a trigger pad into a set of buttons that will run tests, push/pull code, or other tasks suitable for automation. The extension is open source and open to contributions.

cancel ×

57 comments

Sorry! There are no comments related to the filter you selected.

That's going to be embarrassing... (3, Funny)

K. S. Kyosuke (729550) | about 2 months ago | (#47310801)

...you play one of Chopin's Études, and a Perl program falls out...

Re:That's going to be embarrassing... (1)

MightyMartian (840721) | about 2 months ago | (#47310823)

If it can't pump out Java byte code, I'm not interested.

Re:That's going to be embarrassing... (1)

angel'o'sphere (80593) | about 2 months ago | (#47311113)

I doubt you are able to write a class file byte wise.
Well in ancient times gurus piped their code with cat into asm, perhaps _you_ indeed can do that with a midi device ;D

Re:That's going to be embarrassing... (0)

Anonymous Coward | about 2 months ago | (#47311799)

In ancient times people did write byte-code. Granted, they had the good sense of not using Java, and there was not a clusterfuck of instructions like in a modern x86(_64).

Re:That's going to be embarrassing... (4, Funny)

msauve (701917) | about 2 months ago | (#47311647)

That's nothing. Play something by John Cage, and you get Windows OS.

Re:That's going to be embarrassing... (0)

Anonymous Coward | about 2 months ago | (#47314867)

Just listen to the different compiler optimized versions of 4'33. GCC totally misses the point, but clang, oh, it gets it.

Re:That's going to be embarrassing... (1)

AnalogDiehard (199128) | about 2 months ago | (#47317739)

That's nothing. Play something by John Cage, and you get Windows OS.

Clippy: It looks like you're trying to play John Cage's "4:33". Would you like help?

Re:That's going to be embarrassing... (1)

Douglas Goodall (2973317) | about a month and a half ago | (#47391443)

Actually, if one hundred monkeys play on the keyboard, that is how you get Windows.

What programs sound like (0)

Anonymous Coward | about 2 months ago | (#47310833)

That's strange, when I play my programs back all I hear is Schoenberg...?

Combine this with the Internet of Things... (1)

Em Adespoton (792954) | about 2 months ago | (#47310895)

Now we just need to make every day objects MIDI instruments and your plant (via midi-enabled soil sensor) can write the code to turn on the tap to give it more water....

PHBs (3, Funny)

TechyImmigrant (175943) | about 2 months ago | (#47310897)

Beware! Write your stream encryptor in a lydian mode and the PHB will come back and ask for it in phrygrian.

Bring on Vi Hart (0)

Anonymous Coward | about 2 months ago | (#47310949)

I bet she could weave not only a functioning program but a nice tune--plus an interesting video of the process.

I dub thee (2)

Horshu (2754893) | about 2 months ago | (#47310999)

Loom#

Re:I dub thee (1)

Kojiro Ganryu Sasaki (895364) | about 2 months ago | (#47313765)

That was a truly great game.

The gameplay itself was a bit lacking, but the atmosphere was amazing.

Teach A Pig To Sing (1)

GrahamCox (741991) | about 2 months ago | (#47311005)

"Never try to teach a pig to sing; it wastes your time and it annoys the pig".

Likewise, I expect this produces terrible music and not very good code.

Music + tech stories Re:Teach A Pig To Sing (0)

Anonymous Coward | about 2 months ago | (#47311133)

As a software engineer focused on music software, this is about as frivolous as nearly every story combines music and tech. At least it's a twist on the really, really, really tired but still ubiquitous gimmick of "They used software to take non-music data and made music from it! OMGWTFBBQ!" If you were to judge the state of music and technology based on tech stories, you'd think people working in the field were hacks and imbeciles with bad taste.

Re:Music + tech stories Re:Teach A Pig To Sing (0)

Anonymous Coward | about 2 months ago | (#47311235)

Then please share some non-hack work? Some of us are interested in these concepts, but don't know where to look (or don't have the time/energy).

Heh. Captcha: indolent.

As a hardware engineer.... (2)

anubi (640541) | about 2 months ago | (#47312673)

As far as I am concerned... just because a MIDI port was originally used for keyboards does not mean its limited to that. A MIDI port is really quite versatile and can be used for many other things. [philipstorr.id.au]

Now, one thing I used to like a lot is the 15-pin game and MIDI port was on damned near every PC, and very few people had it tied up. It was simply a great way for me to get data in and out of the computer. All I needed to do was coin a protocol on my Borland C++ compiler, and talk to the port. I could always design hardware on the other end to talk to it. Shift registers. It was very easily optically isolated, which again made it ideal for what I was doing where I did not want to risk a very expensive PC because I had a ground fault somewhere.

I really liked that port. I used it a lot when I was building custom things controlled by a PC in the early DOS days.

Another neat protocol out these days is DMX. Used for light controllers.

They may make these for one thing, but when you see just what it is and how it works, they have usually made something that will work for a lot of stuff.

Re:As a hardware engineer.... (0)

Anonymous Coward | about 2 months ago | (#47312811)

Sure, and in software the same thing happens. The Audiobus third party API on iOS, which preceded Apple getting AudioUnits on there for between-app audio, worked by running audio through the OS's MIDI ports. (It may have changed since AudioUnits came in.)

Hmm... (1, Interesting)

Gareth Iwan Fairclough (2831535) | about 2 months ago | (#47311141)

I wonder what would happen if someone took this concept and reversed it, what would currently used code sound like?

Re:Hmm... (1)

mythosaz (572040) | about 2 months ago | (#47311331)

...I'll spare you the trouble of the finding anything made from it.

It'll sound like a bunch of random notes. If the coders were thoughtful enough, they'd have taken simple common strings and made them correspond to notes in a chord, but beyond that it'd be atonal garbage with occasional breaks for My Dog Has Fleas.

Re:Hmm... (1)

drinkypoo (153816) | about 2 months ago | (#47311413)

Perhaps then functions need to correspond to chords, operators to notes, etc etc

Re:Hmm... (0)

Anonymous Coward | about 2 months ago | (#47311949)

That already exists. There are various little (and some not so little) utilities that add sounds to your key presses. I use one when I program and can easily recognize when I misspell something (though the IDE detects that too). The biggest issue is when you're typing faster than the sounds are playing. Some programs drop the sounds, some cut them off, and some queue them up. I had originally wanted to passively learn Morse Code, but I'd have to type far too slow for that. I haven't gotten around to making a better musical typing program yet. There's plenty of room for improvements.

There's also at least one musical programming language. Look it up instead of wondering.

Re:Hmm... (1)

jd2112 (1535857) | about 2 months ago | (#47312315)

I wonder what would happen if someone took this concept and reversed it, what would currently used code sound like?

I suspect that some of my code would sound like Death Metal.

Hmm... (0)

Anonymous Coward | about 2 months ago | (#47314769)

Well, "cat codefile > /dev/audio".

I once had a cd player that would play any cd - including cdroms. It turns out that any cdrom sounds like a duet for circular saw & vacuum cleaner. Quite tiring to listen to.

I Saw This Movie (0)

Anonymous Coward | about 2 months ago | (#47311341)

That reminds me of the movie where Kevin Bacon played Kevin Mitnick, doing a pair-coding duet, dancing on a giant 15-foot keyboard, to fix the Y2K bug for the USSR, thus stopping WOPR and averting World War 3.

This one time... (-1)

Anonymous Coward | about 2 months ago | (#47311449)

This one time, like eight months ago, I saw two guys kissing in a park. And that was the gayest thing I'd ever seen, until I saw engineer Yuriy Guts' Visual Studio extension that lets people program using MIDI instruments.

Wow, programming with a keyboard (2)

ghn (2469034) | about 2 months ago | (#47311545)

A keyboard is a keyboard. Might not be qwerty but it is still a effing keyboard.

lol (1)

Charliemopps (1157495) | about 2 months ago | (#47311625)

My Piano keyboard has MORE keys than my computer keyboard. Have you people seen these things lately? It's got your standard 88 keys, 20 trigger pads, 4 analog controllers, 9 analog sliders, 8 analog turny nobs, and a dozen or so buttons like "Select" "pause" etc...

Re:lol (0)

Anonymous Coward | about 2 months ago | (#47312157)

Umm, a piano ONLY has 88 keys. What you have is not a piano. ;-)

C# (1)

Anonymous Coward | about 2 months ago | (#47311685)

Does all MS code need to be written in the key of C#?

Re:C# (0)

Anonymous Coward | about 2 months ago | (#47312709)

Would be awesome if that was the case... Too much Java$cript nowadays

Did that 23 years ago (2)

hyc (241590) | about 2 months ago | (#47311903)

with my Atari ST. It was trivial then since the same chip controlled both the keyboard and MIDI ports, just redirect one of the intercept vectors to catch the incoming MIDI packets and feed the notes to the keyboard buffer.

It's more fun to do this with a Zeta MIDI violin. I programmed it to move the mouse pointer on glissandos too, could do pretty much anything without touching keyboard or mouse.

Re:Did that 23 years ago (1)

slapout (93640) | about 2 months ago | (#47314917)

I remember playing around with GFA Basic and a Midi keyboard hooked to my Atari ST. I had it set up so that whatever note you played on the musical keyboard, the computer would calculate a note an octave higher and then send that note back out to the musical keyboard and it'd play that note. It was pretty cool.

Funny, I was just thinking about this today... (1)

jeffb (2.718) (1189693) | about 2 months ago | (#47311981)

It seems like there should be useful mappings between the linear layout and chording affordances of a piano keyboard, and some computer-based tasks (although probably not "typing", I'd think). Maybe a less wrist-wracking rendition of Emacs commands?

Let's see. If you're typing with a normal alphanumeric keyboard, keystroke ordering matters, but keystroke force (velocity) doesn't, and hold time matters only crudely. How would you take advantage of velocity sensitivity?

Re: Funny, I was just thinking about this today... (0)

Anonymous Coward | about 2 months ago | (#47313459)

CAPS LOCK

Re: Funny, I was just thinking about this today... (0)

Anonymous Coward | about 2 months ago | (#47314133)

FORTlSSlMO lS CRUlSE CONTROL for COOL

Re:Funny, I was just thinking about this today... (0)

Anonymous Coward | about 2 months ago | (#47316027)

How would you take advantage of velocity sensitivity?

"It seems like you are trying to demolish the computer. It is safer to do this while it is powered down. Shall I power the computer down for you now?"

Agatha Hetrodyne wasn't faking it after all! (0)

Anonymous Coward | about 2 months ago | (#47312023)

before you ask I'm referring to the really awesome steampunk webcomic called "Girl Genius"

Watch out (0)

Anonymous Coward | about 2 months ago | (#47312407)

Just don't put the git commit and git revert keys too close together :-)

It's Emacs all over again (0)

Anonymous Coward | about 2 months ago | (#47312505)

Always wanted a Hyper pedal.

What about ... (1)

rnturn (11092) | about 2 months ago | (#47312663)

... using computer code or math to make music. Back in the (early) '70s, you'd sometimes see these weird commercials where Fred MacMurray (I imagine most /.ers just said to themselves "Fred Who?") was showing how a bunch of Korean schoolkids were doing math using their fingers on their desks in a piano-playing sort of action. The commercial was for some kind of learning aid to teach your kids how to do that. (Q: Does anyone recall those ads? What the heck was the name of the technique being hawked?) This was some years before hand-held calculators even existed let alone were actually affordable. I thought it might be interesting to use that to numerically integrate equations, somehow translate the finger action involved onto a standard 88-key keyboard, and see what comes out. Composition titles would be the equation being integrated. I figured the resulting music would have sounded something like Philip Glass or Steve Reich so public performances might have been hazardous to your health in certain venues. (For example, a place like this [ibiblio.org] .)

MIDI? (0)

Anonymous Coward | about 2 months ago | (#47312719)

people still use MIDI? I haven't seen a MIDI song since the Windows 95 days. I also thought all electrical pianos use USB ports. I learned something kinda new today. Thanks for sharing.

Re:MIDI? (1)

RDW (41497) | about 2 months ago | (#47313409)

You can send MIDI through USB if you have the drivers and your keyboard supports it, but pro keyboards will also have dedicated MIDI ports. The idea is to transmit which keys are played (with timing and velocities, etc.) to a virtual instrument on the connected computer. When set up this way, your keyboard's built-in sounds aren't used. This arrangement gives you access to a huge range of sophisticated virtual instruments, light years away from the unconvincing beeps you probably heard in the 90s. There are single instrument libraries (e.g. from a specific grand piano) with well over 100Gb of samples.

autohotkey... (0)

Anonymous Coward | about 2 months ago | (#47312733)

Has been around for years... Turning my midi input devices, like TouchDAW, into macro buttons.

But of all midi input devices, my keyboard is probably my last choice.

Other way around? (0)

Anonymous Coward | about 2 months ago | (#47312791)

Would be cool if you could do it the other way around too. Create music out of code :)

Shoutout for Godel Escher Bach (2)

cpm99352 (939350) | about 2 months ago | (#47312929)

The ridiculous summary suggesting that garbage produced from a computer program could be considered music immediately reminded me of Douglas Hofstadter's [wikipedia.org] Gödel Escher Bach [wikipedia.org] , where music and its relevance to AI form much of the book. The book (unlike the article) has meaningful thoughts on Chopin, Bach and AI.

Anyone seriously interested in music & computers needs to read this book now.

Re:Shoutout for Godel Escher Bach (0)

Anonymous Coward | about 2 months ago | (#47313971)

Anyone seriously interested in music & computers needs to read this book now.

What if I'm in the midst of my 23rd reading of Finnegan's Wake? Can I at least wait until I've finished?

Re:Shoutout for Godel Escher Bach (0)

Anonymous Coward | about 2 months ago | (#47314173)

No, you just need to stop reading Joyce.

What's old is new again (1)

mrgren (630298) | about 2 months ago | (#47313083)

Two words: chord keyboard.

I used one in '87 or '88 at SRI. It was old then, part of Engelbart's mouse/keyset interface. He first demo'd it in '68.

Better than simple character entry! (0)

Anonymous Coward | about 2 months ago | (#47313283)

You can use your regular keyboard for character-by-character text. Why not use your midi keyboard for syntactic shortcuts like common types, punctuations, variable names and function calls? That way you have one keyboard on hand for regular typing and another for very quick shortcuts.

I like the idea of making the root chord of a scale a simple dot and your common names as notes on that same scale.

I Play Piano on a Computer Keyboard (1)

tomxor (2379126) | about 2 months ago | (#47314021)

:P It lacks certain subtleties of a proper midi keyboard such as velocity, but with 2-3 stacked octaves it's possible to play quite a lot. Learning a different arrangement isn't all that hard, it's just like playing a slightly different instrument. I actually find certain types of playing like monotone arpeggios easier with the supper light action laptop style keyboards, i guess it's also not that dissimilar to using a programmable midi pad.

My most fun tune to play this way yet has to be "The Halls of Science" by Mike Morasky (from portal), as a pure sine wave of course :D and what more appropriate way than performing on a computer keyboard.

Re:I Play Piano on a Computer Keyboard (0)

Anonymous Coward | about 2 months ago | (#47314947)

That's a little bit like if Da Vinci decided to draw the Mona Lisa in MS Paint.

Re:I Play Piano on a Computer Keyboard (1)

mangobrain (877223) | about 2 months ago | (#47314949)

Yep - anyone who's ever composed music using a tracker should be familiar with this.

Weapon of mass destruction (1)

t_ban (875088) | about 2 months ago | (#47317757)

Convert Windows Vista to music, hijack a shortwave radio station & broadcast it around the globe! Muahahahahahaha!

...Or you could just use GlovePIE (0)

Anonymous Coward | about 2 months ago | (#47320613)

http://glovepie.org/ Turns inputs into outputs. Seriously, if you can find a way to plug your blender into a computer, it can turn it into your new numpad. Or run it backwards, and have it crush a goldfish every time Java throws an exception. You murderer.

duplicate content (0)

Anonymous Coward | about 2 months ago | (#47331527)

This guy did it 2 years ago: https://github.com/Riateche/piano-keyboard

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>