Back
Class   Sample
   
Name  

getNumFrames()

   
Examples  
// Print the number of total frames in the Sample object. 
// 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 totalFrames; 
void setup() { 
  size(100,100); 
  Sonia.start(this); 
  mySample = new Sample("sine.aiff"); 
  totalFrames = mySample.getNumFrames(); 
  println("the number of frames in the sample is:" + totalFrames); 
} 
 
// safely stop the Sonia engine upon shutdown. 
public void stop(){ 
  Sonia.stop(); 
  super.stop(); 
} 

Description   Returns the number of total available frames in the sample (per channel). A sample with 44100 kHz frame-rate will have 44,100 frames for every second of its length. For example, a 3 second Sample at 44100 kHz will contain 3 X 44100 = 132300 frames. Although stereo samples should have twice the number of frames per second, getNumFrames() returns the frames for each of these stereo channels.
   
Syntax  
mySample.getNumFrames()
   
Returns   int
   
Usage   Web & Application
   
Related   getCurrentFrame()
isPlaying()