Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fadecandy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scanlime
Fadecandy
Commits
656a42f2
Commit
656a42f2
authored
11 years ago
by
Micah Elizabeth Scott
Browse files
Options
Downloads
Patches
Plain Diff
Command line args
parent
2a67a788
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/node/midi_particles.coffee
+31
-10
31 additions, 10 deletions
examples/node/midi_particles.coffee
examples/node/package.json
+2
-1
2 additions, 1 deletion
examples/node/package.json
with
33 additions
and
11 deletions
examples/node/midi_particles.coffee
+
31
−
10
View file @
656a42f2
...
@@ -4,27 +4,47 @@
...
@@ -4,27 +4,47 @@
#
#
# Dependencies: run `npm install` in this directory.
# Dependencies: run `npm install` in this directory.
#
#
# Assumes the default MIDI input port (0).
# Command line options:
# Specify a layout file on the command line, or use the default (grid32x16z)
#
# --midiport <int> Use a different MIDI port. Defaults to zero.
# --layout <file> Pick a JSON layout file. Defaults to grid32x16z
# --opchost <hostname> Network host running the OPC server. Defaults to localhost.
# --opcport <port> Network port for the OPC server. Defaults to 7890.
#
#
# Controls:
# Controls:
# (Tested with Alesis Q49 keyboard controller)
# Left hand -> Low frequency oscillators (wobble)
# Left hand -> Low frequency oscillators (wobble)
# Right hand -> Particles, shifting in color and pointiness
# Right hand -> Particles, shifting in color and pointiness
#
#
# Supported MIDI keyboards:
# - Basic MIDI works for any keyboard
# - Pitch bend / modulation / data knobs on Alesis Q49
# - Data sliders on Oxygen 61
#
# 2014, Micah Elizabeth Scott & Keroserene
# 2014, Micah Elizabeth Scott & Keroserene
#
#
# Default MIDI input
parseArgs
=
require
'minimist'
midi
=
require
'midi'
midi
=
require
'midi'
OPC
=
new
require
'./opc'
argv
=
parseArgs
process
.
argv
.
slice
(
2
),
default
:
layout
:
'../layouts/grid32x16z.json'
midiport
:
0
opchost
:
'localhost'
opcport
:
7890
input
=
new
midi
.
input
input
=
new
midi
.
input
input
.
openPort
1
if
argv
.
midiport
>=
input
.
getPortCount
()
input
.
ignoreTypes
false
,
false
,
false
console
.
log
"MIDI port
#{
argv
.
midiport
}
isn't available!"
process
.
exit
1
# Default OPC output
console
.
log
"Using MIDI port
#{
argv
.
midiport
}
:
#{
input
.
getPortName
argv
.
midiport
}
"
OPC
=
new
require
'./opc'
input
.
openPort
argv
.
midiport
model
=
OPC
.
loadModel
process
.
argv
[
2
]
||
'../layouts/grid32x16z.json'
client
=
new
OPC
'localhost'
,
7890
console
.
log
"Using OPC server at
#{
argv
.
opchost
}
:
#{
argv
.
opcport
}
"
model
=
OPC
.
loadModel
argv
.
layout
client
=
new
OPC
argv
.
opchost
,
argv
.
opcport
# Live particles
# Live particles
particles
=
[]
particles
=
[]
...
@@ -70,6 +90,7 @@ LOWEST_A = 1
...
@@ -70,6 +90,7 @@ LOWEST_A = 1
HIGHEST_C
=
124
HIGHEST_C
=
124
getKeyName
=
(
key
)
->
FLAT_NAMES
[(
key
-
LOWEST_A
)
%
12
]
getKeyName
=
(
key
)
->
FLAT_NAMES
[(
key
-
LOWEST_A
)
%
12
]
input
.
ignoreTypes
false
,
false
,
false
input
.
on
'message'
,
(
deltaTime
,
message
)
->
input
.
on
'message'
,
(
deltaTime
,
message
)
->
logMsg
=
message
logMsg
=
message
msgType
=
Math
.
floor
parseInt
(
message
[
0
])
/
16
# Examine the 0xF0 byte.
msgType
=
Math
.
floor
parseInt
(
message
[
0
])
/
16
# Examine the 0xF0 byte.
...
...
This diff is collapsed.
Click to expand it.
examples/node/package.json
+
2
−
1
View file @
656a42f2
...
@@ -5,7 +5,8 @@
...
@@ -5,7 +5,8 @@
},
},
"dependencies"
:
{
"dependencies"
:
{
"flags"
:
"~0.1.1"
,
"flags"
:
"~0.1.1"
,
"midi"
:
"~0.8.1"
"midi"
:
"~0.8.1"
,
"minimist"
:
"~0.0.8"
},
},
"private"
:
true
"private"
:
true
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment