Skip to content

Commit

Permalink
Revert "#16 EMUdata renamed"
Browse files Browse the repository at this point in the history
This reverts commit d8c4fa5.
  • Loading branch information
balandinodidonato committed Mar 14, 2015
1 parent d8c4fa5 commit 62519e9
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions MyoToMIDI/MyoToMIDI.myo
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ scriptId = 'com.balandinodidonato.MyoToMIDI' -- define the script ID
scriptTitle = "MyoToMIDI" -- define the script title
scriptDetailsUrl = ""

IMUdata = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
EMUdata = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

note = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 , 11, 12, 13, 14, 15, 16, 17, 18, 19}
velocity = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

function ExtractionIMUdata()
IMUdata[1], IMUdata[2], IMUdata[3] = myo.getAccel() -- Get the acceleration of Myo in the world reference frame in units of g. World reference frame values are such that the X and Y axes are parallel to the ground while the Z axis faces up, perpendicular to the ground. Returns: Acceleration of Myo in the world reference frame. (Returns 3 values). Delimit return values as follows: x,y,z = myo.getAccel().
function ExtractionEMUdata()
EMUdata[1], EMUdata[2], EMUdata[3] = myo.getAccel() -- Get the acceleration of Myo in the world reference frame in units of g. World reference frame values are such that the X and Y axes are parallel to the ground while the Z axis faces up, perpendicular to the ground. Returns: Acceleration of Myo in the world reference frame. (Returns 3 values). Delimit return values as follows: x,y,z = myo.getAccel().
direction = myo.getXDirection() -- Provides the orientation of Myo on the wearer's arm. The value represents the direction in which the positive X axis of Myo's coordinate system faces. Returns "towardWrist" if Myo's positive X axis is facing the wearer's wrist, "towardElbow" if Myo's positive X axis is facing the wearer's elbow, "unknown" if unknown.
IMUdata[4], IMUdata[5], IMUdata[6] = myo.getGyro() -- Get the angular velocity of Myo about its axes, in radians / second. Returns: Angular velocity of Myo about its X, Y and Z axes. (Returns 3 values). Delimit return values as follows: x,y,z = myo.getGyro().
IMUdata[7], IMUdata[8], IMUdata[9] = myo.getOrientationWorld() -- Get a unit vector representing the direction Myo is facing in the world reference frame. X and Y axes are parallel to the ground, while the Z axis faces up, perpendicular to the ground. Returns Unit vector representing Myo's orientation. (Returns 3 values). Delimit return values as follows: x,y,z = myo.getOrientationWorld().
IMUdata[10] = myo.getYaw() -- Get an angular value for Myo's orientation about its Z axis. Positive yaw indicates rotation to the wearer's right. Returns Myo "yaw" value, in radians.
IMUdata[11] = myo.getPitch() -- Get an angular value for Myo's orientation about its Y axis. Positive pitch indicates the wearer moving their arm upwards, away from the ground. Returns: Myo "pitch" value, in radians.
IMUdata[12] = myo.getRoll() -- Get an angular value for Myo's orientation about its X axis, i.e. the wearer's arm. Positive roll indicates clockwise rotation (from the point of view of the wearer). Returns Myo "roll" value, in radians.
EMUdata[4], EMUdata[5], EMUdata[6] = myo.getGyro() -- Get the angular velocity of Myo about its axes, in radians / second. Returns: Angular velocity of Myo about its X, Y and Z axes. (Returns 3 values). Delimit return values as follows: x,y,z = myo.getGyro().
EMUdata[7], EMUdata[8], EMUdata[9] = myo.getOrientationWorld() -- Get a unit vector representing the direction Myo is facing in the world reference frame. X and Y axes are parallel to the ground, while the Z axis faces up, perpendicular to the ground. Returns Unit vector representing Myo's orientation. (Returns 3 values). Delimit return values as follows: x,y,z = myo.getOrientationWorld().
EMUdata[10] = myo.getYaw() -- Get an angular value for Myo's orientation about its Z axis. Positive yaw indicates rotation to the wearer's right. Returns Myo "yaw" value, in radians.
EMUdata[11] = myo.getPitch() -- Get an angular value for Myo's orientation about its Y axis. Positive pitch indicates the wearer moving their arm upwards, away from the ground. Returns: Myo "pitch" value, in radians.
EMUdata[12] = myo.getRoll() -- Get an angular value for Myo's orientation about its X axis, i.e. the wearer's arm. Positive roll indicates clockwise rotation (from the point of view of the wearer). Returns Myo "roll" value, in radians.
end

function onPoseEdge(pose, edge) -- Pose trigger
Expand Down Expand Up @@ -64,22 +64,22 @@ end

function generationMIDImessages () -- Resize Myo data values into MIDI value to control the velocity of the MIDI controlChange
for i = 1, 3 do
velocity[i] = math.floor((IMUdata[i]/3)*127)
velocity[i+3] = math.floor((IMUdata[i+3]/2000)*127)
velocity[i+6] = math.floor(((IMUdata[i+6]+1)*0.5)*127)
velocity[i] = math.floor((EMUdata[i]/3)*127)
velocity[i+3] = math.floor((EMUdata[i+3]/2000)*127)
velocity[i+6] = math.floor(((EMUdata[i+6]+1)*0.5)*127)
end

velocity[10] = math.floor(((IMUdata[10]+3.141592653589793)/6.28318530717959)*127)
velocity[11] = math.floor(((IMUdata[11]+1.5707963267949)*42.33333333333333))
velocity[12] = math.floor(((IMUdata[12]+3.141592653589793)/6.28318530717959)*127)
velocity[10] = math.floor(((EMUdata[10]+3.141592653589793)/6.28318530717959)*127)
velocity[11] = math.floor(((EMUdata[11]+1.5707963267949)*42.33333333333333))
velocity[12] = math.floor(((EMUdata[12]+3.141592653589793)/6.28318530717959)*127)

for i = 1, 19 do -- Generation of MIDI message
myo.midi(0, "controlChange", note[i], velocity[i])
end
end

function onPeriodic() -- call the function sendMidiValues every 10 milliseconds
ExtractionIMUdata()
ExtractionEMUdata()
generationMIDImessages()
end

Expand Down

0 comments on commit 62519e9

Please sign in to comment.