Hi! I am an artist trying to get the Arduino Pulse sensor amped processing sketch to beep (through the computer) every BPM (Beat per minute). The sketch already enlarges a picture of a heart every BPM, I just want to add sound so it sounds like an ECG scanner (like in a hospital).
This is the code I've been using, I bolded the things that I tried to add in, but don't really know what I am doing, can you see my error? I think part of it is I don't have any kind of stop to the sound, but when I add one, it doesn't play at all then. The sound is really short that I am using, less than a second long.:
/*
THIS PROGRAM WORKS WITH PulseSensorAmped_Arduino-xx ARDUINO CODE
THE PULSE DATA WINDOW IS SCALEABLE WITH SCROLLBAR AT BOTTOM OF SCREEN
PRESS 'S' OR 's' KEY TO SAVE A PICTURE OF THE SCREEN IN SKETCH FOLDER (.jpg)
MADE BY JOEL MURPHY AUGUST, 2012
*/
import ddf.minim.*;
import processing.serial.*;
PFont font;
Scrollbar scaleBar;
Minim minim;
AudioPlayer player;
Serial port;
int Sensor; // HOLDS PULSE SENSOR DATA FROM ARDUINO
int HRV; // HOLDS TIME BETWEN HEARTBEATS FROM ARDUINO
int BPM; // HOLDS HEART RATE VALUE FROM ARDUINO
int[] RawY; // HOLDS HEARTBEAT WAVEFORM DATA BEFORE SCALING
int[] ScaledY; // USED TO POSITION SCALED HEARTBEAT WAVEFORM
int[] rate; // USED TO POSITION BPM DATA WAVEFORM
float zoom; // USED WHEN SCALING PULSE WAVEFORM TO PULSE WINDOW
float offset; // USED WHEN SCALING PULSE WAVEFORM TO PULSE WINDOW
color eggshell = color(255, 253, 248);
int heart = 0; // This variable times the heart image 'pulse' on screen
// THESE VARIABLES DETERMINE THE SIZE OF THE DATA WINDOWS
int PulseWindowWidth = 490;
int PulseWindowHeight = 512;
int BPMWindowWidth = 180;
int BPMWindowHeight = 340;
boolean beat = false; // set when a heart beat is detected, then cleared when the BPM graph is advanced