diff --git a/Filter.cs b/Filter.cs
new file mode 100644
index 0000000..50bd719
--- /dev/null
+++ b/Filter.cs
@@ -0,0 +1,33 @@
+using Microsoft.Kinect;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Ventuz.OSC;
+
+namespace GesturalMusic
+{
+ class Filter
+ {
+ private String instrumentName;
+
+ public Filter(String instrumentName)
+ {
+ this.instrumentName = instrumentName;
+ }
+
+ public void SendFilterData(Body body)
+ {
+ CameraSpacePoint rWrist = body.Joints[JointType.WristRight].Position;
+ CameraSpacePoint rShoulder = body.Joints[JointType.ShoulderRight].Position;
+
+ // X works fairly well
+ // Y is somewhat bad
+ // Z is bad
+ MainWindow.osc.Send(new OscElement("/" + instrumentName + "/filterX", rWrist.X - rShoulder.X));
+ MainWindow.osc.Send(new OscElement("/" + instrumentName + "/filterY", rWrist.Y));
+ MainWindow.osc.Send(new OscElement("/" + instrumentName + "/filterZ", rShoulder.Z - rWrist.Z));
+ }
+ }
+}
diff --git a/GesturalMusic.csproj b/GesturalMusic.csproj
index 4312367..fcd89c4 100644
--- a/GesturalMusic.csproj
+++ b/GesturalMusic.csproj
@@ -75,6 +75,7 @@
MSBuild:Compile
Designer
+
diff --git a/Instrument.cs b/Instrument.cs
index b8baf18..75b4453 100644
--- a/Instrument.cs
+++ b/Instrument.cs
@@ -15,8 +15,8 @@ class Instrument
public readonly static String INSTRUMENT = "Instrument";
-
public string name;
+ private Filter filter;
// For rate limiting
private DateTime lastNotePlayed;
@@ -29,6 +29,7 @@ class Instrument
public Instrument(string name)
{
this.name = name;
+ filter = new Filter(this.name);
lastNotePlayed = DateTime.Now;
handStateLast = HandState.Unknown;
@@ -58,6 +59,9 @@ public void PlayNote(int pitch, int velocity = 127, int duration = 500, int midi
}
public bool CheckAndPlayNote(Body body)
{
+ // first thing, send filters
+ filter.SendFilterData(body);
+
double rightThreshold = 0.2;
double leftThreshold = 0.1;
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index b1f27e1..1eabadf 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -204,7 +204,7 @@ public MainWindow()
{
instruments[i] = new Instrument("instr" + i);
}
- instruments[2] = new MidiPad("pad0");
+ //instruments[2] = new MidiPad("pad0");
///////////////////////////////////////////////////////////////////////
diff --git a/Other/test Project/test.als b/Other/test Project/test.als
index 1d17510..e8ee491 100644
Binary files a/Other/test Project/test.als and b/Other/test Project/test.als differ