Back
Class   Sample
   
Name  

getCurrentFrame()

   
Examples  
// Print the current frame (playhead position) of the Sample object as it is playing. 
// Notes: - a 44100 Hz (44.1 kHz) sample has 44100 frames stored for each second. 
//        - Make sure to include the specified audio file in your project's 'data' folder. 
 
Sample mySample; 
int playHead; 
 
void setup() { 
  size(100,100); 
  Sonia.start(this); 
  mySample = new Sample("sine.aiff"); 
  mySample.repeat();  // play the sample in a loop 
} 
 
void loop(){ 
  playHead = mySample.getCurrentFrame(); 
  println("the sample is currently on frame:" + playHead); 
} 
 
// safely stop the Sonia engine upon shutdown. 
public void stop(){ 
  Sonia.stop(); 
  super.stop(); 
} 

Description   Returns the current frame of the sample as it is playing.
   
Syntax  
mySample.getCurrentFrame()
   
Returns   int
   
Usage   Web & Application
   
Related   getNumFrames()
isPlaying()