Skip to content

Instantly share code, notes, and snippets.

@Visuelle-Musik
Visuelle-Musik / _interference.rb
Created January 16, 2010 18:08
Set operations based music generation from two incoming MIDI-note-streams into one result-set
# === Interference: take MIDI-in from two channels, merge to one output - dependent on "set-operation"-method selected from menu... ===
# Options for calling: :frame_rate => nn sets framerate, :verbose => true|false gives additional printout-information... (see last line of this file!)
# --- Options, see Panel-GUI (when application is started) : ---------------------------------------------------------------------------------------------------------------
# ° dropdown "velocity_option" used for include or exclude filter range of velocity for operations including this filter-option...
# ° slider "in A Channel": Channel for notes of "set A"
# ° slider "in B Channel": Channel for notes of "set B"
# ° slider "in switch Channel": Channel for notes to switch an operation, only if operation equals "midi_note_selected"
# -> Caution: be sure to select 3 different MIDI-Channels for each functionality, or you may get unpreditible results (default is 1,2,3 anyway)
# ° slider "velocity lower limit": range-start for opera
@Visuelle-Musik
Visuelle-Musik / aVisualSynth44.rb
Created December 8, 2009 20:41
MIDI driven "VJ"-application in ruby-processing, 'manual' see "visualSynthSettings14.rb"
# --- parameters to be set in ./data/java_args.txt ---
# -Xms256m -Xmx256m # Heap at least 256 MB
# -Djna.library.path="/ruby-processing/library/gsvideo/library/gstreamer/win" # optional for future video extension...
require "jrMidiVsynth22" # class JRmidi for basic MIDI I/O in JRuby, adapt your MIDI-ports here if necessary
SETTINGS = "visualSynthSettings14" # contains changable settings for "which function to call" by modifier-keys
# === helper functions === (map internal representation of layers to external for "print-out"
class Range
def inspect_plus_one
@Visuelle-Musik
Visuelle-Musik / jr_midi_solresol.rb
Created September 19, 2009 22:28
MIDI I/O with JRuby, ruby-processing example 2
# === MIDI-Notes to solresol-colours in RubyProcessing. Example for the use of JRmidi, very basic Midi-Implementation for JRuby, especially for use with ruby-processing ===
# --- ruby-processing see: http://wiki.github.com/jashkenas/ruby-processing / solresol is a universal language, where words can be put out as musical notes, colours or other ---
# --- solresol see: http://en.wikipedia.org/wiki/Solresol ---
# Notes have to come as MIDI-note-events from MIDI-in, and are for demonstration purposes redirected to two other output ports as well, adopt your MIDI-ports below!
MIDI_PORT_IN = 0 # your MIDI-input where notes will be mapped to coulors
MIDI_PORT_OUT_DAW_IN = 12 # the ports are numberes from 0 to n in the java-sound-API, this is a virtual in port of my "Digital Audio Wortstation", where this output is sent to
MIDI_PORT_OUT_SYNTH = 9 # in my configuration this is the synth as provided by the operating-system
require "jr_midi" # class JRmidi for basic MIDI I/O in JRuby...
@Visuelle-Musik
Visuelle-Musik / jr_midi_io_solresol.rb
Created September 19, 2009 22:27
MIDI I/O with JRuby, ruby-processing example 1
# === MIDI-Notes to solresol-colours in RubyProcessing. Example for the use of JRmidi, very basic Midi-Implementation for JRuby, especially for use with ruby-processing ===
# --- ruby-processing see: http://wiki.github.com/jashkenas/ruby-processing / solresol is a universal language, where words can be put out as musical notes, colours or other ---
# --- solresol see: http://en.wikipedia.org/wiki/Solresol ---
# Notes have to come as MIDI-note-events from MIDI-in, and are so we can hear them redirected to a synth as well
# ! ==> adopt your MIDI-ports below !!!!
MIDI_PORT_IN = 0 # your MIDI-input where notes will be mapped to coulors
MIDI_PORT_OUT = 11 # select this port so, that is redirected to MIDI-in by hardware, with JACK, ableton live or something (ports are numbered from 0 to n, no difference if in or out)
MIDI_OUT_SYNTH = 9 # the OS-System's synth, port number may differ on your system
@Visuelle-Musik
Visuelle-Musik / jr_midi.rb
Created September 19, 2009 22:25
basic MIDI I/O for JRuby
# --- Very basic Midi-Implementation for JRuby (note on/off, pitchbend, controller, aftertouch), especially for use with ruby-processing, http://wiki.github.com/jashkenas/ruby-processing ---
module JavaMidi
midi = javax.sound.midi
import midi.MidiSystem
import midi.MidiDevice
import midi.MidiEvent
import midi.ShortMessage
import midi.Receiver
end