Skip to content

Commit

Permalink
Fix note output to be continuous spectrum.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjwarner committed Nov 18, 2017
1 parent abaec84 commit 24ad7bd
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/Theremin.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,20 @@ public void onFrame(Controller controller) {
continue;
}

// do volume stuff
float yPos = hand.palmPosition().getY();
instrumentPlayer.setVolume((int) yPos/3);
System.out.println("Left hand is at: " + yPos);

// do some pitch stuff
float zPos = hand.palmPosition().getZ();
instrumentPlayer.setPitch((int) ((zPos / 12) + 60));
System.out.println("Right hand is at: " + zPos);

instrumentPlayer.playNote();
if (hand.isLeft()) {
// do volume stuff
float yPos = hand.palmPosition().getY();
instrumentPlayer.setVolume((int) yPos / 3);
System.out.println("Left hand is at: " + yPos);
} else {
// do some pitch stuff
float zPos = hand.palmPosition().getZ();
instrumentPlayer.setPitch((int) ((zPos / 12) + 60));
System.out.println("Right hand is at: " + zPos);
}

}
instrumentPlayer.playNote();

try {
Thread.sleep(10);
Expand Down

0 comments on commit 24ad7bd

Please sign in to comment.