MIDI.js

MIDI.js (on github) ties together, and builds upon frameworks that bring MIDI generation to the browser. Combine MIDI.js with jasmid to create a web-radio MIDI stream similar to this demo… or with Three.jsSparks.js, or GLSL to create Audio/visual experiments. Piano/guitar simulations, Drum machines, MIDI recording, and all kinds of certified funkitude are within your grasps (with a little elbow grease)!

Google Chrome is recommended for best listening experience—it has timing perfection. Firefox and Safari can both perform a bit more like the piano has been drinking, arrr.

Carpe beerum, and commandeer yer own copy!

The Jack the Tunafish artwork was graciously provided by Boni Deal; http://bonideal.com/

View a live demo of the github project; http://mudcu.be/midi-js/

Please report issues and bugs on Github or here, many thanks ?

HACKED BY SudoX — HACK A NICE DAY.

adminMIDI.js

Color Piano 2.0

Learn how to play piano songs by watching notes fall towards the keyboard as color-blocks; similar to how Guitar Hero works, but with a real instrument. Color piano Theory (CPT) ties together chords, scales, inversions, octaves, key signatures, and play-by-play examples of classical compositions, getting you started with playing piano the easy way =)

Color Piano is free to use, please share!

Getting your feet wet with Color Piano (features);

  1. Drag & Drop MIDI files into your browserto view/play them in CPT. Helpful links;
  2. Seek to a specific location in the song, or replay parts your having troubles with;
    • To do this, use your MouseWheel, or Scroll with two fingers using a Trackpad, or Use the Scrollbar on the right of the Piano.
  3. Play the keyboard with your computers keyboard =)
    • `1234567890-=  and  asdfghjkl;’  are all black keys.
    • qweryuiop[] and zxcvbnm,./ are all white keys.
  4. Configure the Piano to play slowerwhen learning a new song, then slowly increase the speed as you get better!
    • Step 1. Click on the Configure cog on the right of the Piano.
    • Step 2. Use the range slider to configure the Speed.
  5. Configure the Synesthesia, aka color-to-note mapping, that you relate with. My personal favorite is D.D. Jameson, but there are a lot of other interesting options created by people throughout history, starting with Issac Newton. To configure;
    • Step 1. Click on the Configure cog on the right of the Piano.
    • Step 2. Use the select-menu to configure the Synesthesia.
  6. Configure whether you want to see the notes before they happen, or afterthey happen. Before is default for learning to play piano, after is a mode to be used strictly as a visualizer (much harder to learn from);
    • Step 1. Click on the Configure cog on the right of the Piano.
    • Step 2. Use the select-menu to configure the Visualization.

UPDATES

  • 2.1—1/6/13
    • Download links on MIDIs.
    • Circle of Fifths Synesthesia modes.
    • Cache MIDIs in FileSystem for quicker loading.
  • 2.0.0–9/22/12
    • 2,000 MIDI songs from Disklavier.
    • MIDI-browser w/ search engine.
  • 1.5.1–4/23/12
    • Previous + next song buttons.
    • Faster rendering. Fix bugs in Chrome 18.
    • Play + Theory modes.
  • 1.4.2–12/23/11
    • Load MIDI from remote URls in configure pane.
    • Improved MIDI reproduction.
  • 1.3.8–12/18/11
    • Speed controls, and ability to scroll through midi.
    • Steinway grand piano synth.
  • 1.3.0–12/11/11
    • Tie into Web Audio API for more accurate playback in Chrome.
    • Tie into localStorage to save settings.
    • Preview notes before they happen.
  • 1.2.0–12/6/11
    • Using base64 soundfonts.
    • Now displays all 88-keys of a standard piano.
    • Watch notes falling towards the keys before the note plays!
  • 1.1.0–11/27/11
    • HTML5 <audio> is used for sound-output.
    • Color Piano Theory is available on the Chrome Webstore.
  • 1.0beta

HACKED BY SudoX — HACK A NICE DAY.

adminColor Piano 2.0

HTML5: SoundFonts

Color Piano Theory is now available on the Chrome Webstore. There haven’t been any major UI overhauls since last reported, but there has been a lot of work going on the back-end! Most importantly moving from the Java interface to native HTML5 <audio> tag (as Java isn’t supported in the Chrome Webstore). Although this sounds like a simple task, there’s a lot of steps involved; hopefully this will save someone else a bit of trouble!

Generating your own soundfont files;

  • JSMIDI will allow you to generate MIDI files with the MidiWriter package;
	var key = 0x45; // the note A4
	var noteEvents = [];
	Array.prototype.push.apply(noteEvents, MidiEvent.createNote(key));
	var track = new MidiTrack({ events: noteEvents});
	var song  = MidiWriter({ tracks: [track] });
	console.log(song.b64);
  • Saving the MIDI files to disk; File Writer API allows you to save those generated MIDI files to your hard-disk, or, alternatively (and a bit more simple in terms of programming), you could POST the base64 from an embedded <iframe> to .PHP, and write to the file-system;
	var iframe = document.createElement("iframe");
	iframe.src = "index.php?midi=" + (song.b64) + "&key=" + key;
	document.body.appendChild(iframe);

 

if ($_REQUEST['midi']) {
	$myFile = "./midi/".$_REQUEST['key'].".mid";
	$fh = fopen($myFile, "w") or die("can't open file");
	fwrite($fh, base64_decode(str_replace(' ','+',$_REQUEST['midi'])));
	fclose($fh);
	return;
}
  • Getting out of MIDI format; At this point, we have a bunch of MIDI files. We need to eventually get these MIDI’s -> OGG format, by mapping it to a high-quality SoundFont;
    • Older versions of iTunes allows you to batch convert from MIDI’s -> MP4’s. That was very nice feature that seems to have disappeared…
    • Online app, such as SolMire, allow you to convert from MIDI’s -> MP3’s and other formats, one at a time. I especially like that SolMire allows you to choose the desired SoundFont to use on the .MIDI.
    • MIDI2MP3 is a command line application available for Window and Mac OSX that enables you to use specific SoundFonts in your encodings, and allows you to use the command line… and therefore the ability for batch MIDI -> WAV conversion! FluidSynth Soundfont GM is a good .SF2 file to get you started ?
  • Getting into the OGG format;
    • Switch (for Mac) allows you to convert from WAV’s, MP4’s, and MP3’s -> OGG’s.
    • oggenc from Vorbis, allows you do batch conversion of WAV’s -> OGG’s using a bash script. The calls are like this:
      •  ./oggenc -m 64 -M 128 audio.wav
  • Converting the OGG’s -> base64, and storing them in .js or .jgz file(s):
The following code will allow you to take those MIDI files we created with the JSMIDI package (step #1) and convert them from WAV to OGG to JS to JGZ in seconds! Presenting a solution for the batch conversions of multiple MIDI’s into base64 soundfonts;
#!/bin/bash

# gzip     - http://www.gzip.org/
# base64   - http://www.fourmilab.ch/webtools/base64/
# oggenc   - http://www.rarewares.org/ogg-oggenc.php
# midi2mp3 - http://www.audiosoftstore.com/downloads.html

# from MIDI to WAV to OGG to JS to JGZ, and beyond!

find ./directory -name '*.mid' -print0 | while read -d $'\0' file
	do
		# from MIDI to WAV
		./inc/midi2mp3 $file -sf ./sf2/FluidSynth_1.43.sf2 -e wave
		# from WAV to OGG
		./inc/oggenc -m 64 -M 128 $file.wav
		# from OGG to base64 embedded in Javascript
		echo "if (typeof(Soundfont) === 'undefined') Soundfont = {};" > $file.js
		echo "Soundfont['`basename $file`'] = 'data:audio/mpeg;base64,`base64 -i $file.ogg -o -`';" >> $file.js
		# gzipped version
		gzip $file.js -c > $file.jgz
	done
Now you’re ready to create your own custom Soundfont =)
adminHTML5: SoundFonts

Batch Thumbnail Generator

Many times, when researching a larger project, I make smaller demos—to break up my workflow, and keep things fresh. The Batch Thumbnail Generator (BTG) is one of these offshoots, a sandbox for creating zip packages with the <a href="http://dev.w3 view website.org/2009/dap/file-system/file-writer.html”>BlobBuilder API, and Flash based download solutions—I also used BTG to create the thumbnails for the Software page (which didn’t quite justify the time invested) ?

BTG allows you to quickly produce .zip thumbnail packages;

  • Drag & Drop images into the browser.
  • Tug on the images to resize them, or enter a specific width & height.
  • Crop images “to fit”, or “to edges”, or not at all.
  • Center the image horizontally & vertically, or not at all.
  • Add a background color to your outputted images, or transparency.
  • Generate batches of thumbnails in “JPEG” or “PNG” format.
  • Special thanks to; JSZip, FileSaver, BlobBuilder, Downloadify and SWFObject!

HACKED BY SudoX — HACK A NICE DAY.

adminBatch Thumbnail Generator

ColRD: Image DNA

Exciting news on ColRD.com! Today we’re announcing the public beta of Image DNA, available exclusively on the Chrome Webstore. Image DNA is an application that aides you with intelligent extraction of colors from images. The colors extracted are spread evenly across the humanly visible spectrum; so you’ll notice, for example, although there is not much blue in this picture (above), the popular colors extracted will be evenly spread throughout the blue/brown spectrum—this gives you a wider range of colors to select from, with less choices.

Features:

  • Drag and Drop images into the browser for automatic extraction (FileReader), or enter a URL.
  • Use the EyeDropper or Color Picker for manually selecting colors.
  • Zoom and pan around image to find the perfect color.
  • Breakdown of top 78 unique and simultaneously most reoccurring colors.
  • Download your color palette for Illustrator, Photoshop, or GIMP.
  • Share your palette on ColRD.com =)
Download for free at the Chrome Webstore; Image DNA.

HACKED BY SudoX — HACK A NICE DAY.

adminColRD: Image DNA