Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rasdasd committed Dec 1, 2015
1 parent 15d28c5 commit 5b18dfd
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/app.iml
Expand Up @@ -87,8 +87,8 @@
<orderEntry type="library" exported="" name="commons-math3-3.5" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
<orderEntry type="library" exported="" name="JTransforms-3.1" level="project" />
<orderEntry type="library" exported="" name="JLargeArrays-1.5" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
</component>
</module>
Expand Up @@ -36,12 +36,12 @@ public class AccellerationActivity extends Activity {
private int counter = -1;
private int fftcounter = -1;
private int maxSizeGraph = 100;
private int fftsize = 10;
private int fftsize = 20;
private BarChart fftchart;
private FloatFFT_1D fft;
private int a = 0;
private float threshold = 8;
private long threshdelay = 300;
private long threshdelay = 500;
private boolean drawDisplay = false;
private ToggleButton graphB, bassB, floorB, mountB, snareB, resetB;
private TextView bassT, floorT, mountT, snareT;
Expand Down Expand Up @@ -162,6 +162,10 @@ private void manipData() {
fft.complexForward(xarrfft);
fft.complexForward(yarrfft);
fft.complexForward(zarrfft);
if (System.currentTimeMillis() - lastplayed < threshdelay) {
return;
}
lastplayed = System.currentTimeMillis();
if (!learned)
addpoint(xarr, yarr, zarr, xarrfft, yarrfft, zarrfft);
else
Expand All @@ -180,7 +184,6 @@ public void trainingTime(View v) {
snareB.setChecked(false);
for(Holder h : holderArray) {
h.train();
break;
}
learned = true;
bassC = 0;
Expand All @@ -196,10 +199,6 @@ public void trainingTime(View v) {
}
long lastplayed = 0;
private void classifyPoint(float[] xarr, float[] yarr, float[] zarr, float[] xarrfft, float[] yarrfft, float[] zarrfft) {
if (System.currentTimeMillis() - lastplayed < threshdelay) {
return;
}
lastplayed = System.currentTimeMillis();
float[] datapoint = new float[fftsize * 9];
float abssum = 0;
for (int i = 0; i < fftsize * 2; i++) {
Expand Down Expand Up @@ -231,10 +230,6 @@ private void classifyPoint(float[] xarr, float[] yarr, float[] zarr, float[] xar
}

private void addpoint(float[] xarr, float[] yarr, float[] zarr, float[] xarrfft, float[] yarrfft, float[] zarrfft) {
if (System.currentTimeMillis() - lastplayed < threshdelay) {
return;
}
lastplayed = System.currentTimeMillis();
float[] datapoint = new float[fftsize * 9];
float abssum = 0;
for (int i = 0; i < fftsize * 2; i++) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/rasdasd/com/handstodrums/ML1_Holder.java
Expand Up @@ -11,7 +11,7 @@ public class ML1_Holder implements Holder {
public int classes = 0;
MLP mlp;
int outputsize;
int iterations = 10000;
int iterations = 100;
public ML1_Holder(int classes, int inputsize)
{
outputsize = Integer.SIZE-Integer.numberOfLeadingZeros(classes-1);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/rasdasd/com/handstodrums/ML2_Holder.java
Expand Up @@ -11,7 +11,7 @@ public class ML2_Holder implements Holder{
public int classes = 0;
MLP mlp;
int outputsize;
int iterations = 10000;
int iterations = 100;
public ML2_Holder(int classes, int inputsize)
{
outputsize = Integer.SIZE-Integer.numberOfLeadingZeros(classes-1);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/rasdasd/com/handstodrums/ML3_Holder.java
Expand Up @@ -11,7 +11,7 @@ public class ML3_Holder implements Holder{
public int classes = 0;
MLP mlp;
int outputsize;
int iterations = 10000;
int iterations = 100;
public ML3_Holder(int classes, int inputsize)
{
outputsize = Integer.SIZE-Integer.numberOfLeadingZeros(classes-1);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/rasdasd/com/handstodrums/ML4_Holder.java
Expand Up @@ -11,7 +11,7 @@ public class ML4_Holder implements Holder{
public int classes = 0;
MLP mlp;
int outputsize;
int iterations = 10000;
int iterations = 100;
public ML4_Holder(int classes, int inputsize)
{
outputsize = Integer.SIZE-Integer.numberOfLeadingZeros(classes-1);
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/main.xml
Expand Up @@ -104,13 +104,13 @@
android:id="@+id/mntCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Floor: "
android:text="Mount: "
/>
<TextView
android:id="@+id/flrCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mount: "
android:text="Floor: "
/>
<TextView
android:id="@+id/snareCount"
Expand Down

0 comments on commit 5b18dfd

Please sign in to comment.