Back
Class   Sample
   
Name  

setVolume()

   
Examples  
// Set the volume of a sample object to 50% of its original amplitude. 
// Notes: Make sure to include the specified audio file in your project's 'data' folder. 
 
Sample mySample; 
void setup() { 
  size(100,100); 
  Sonia.start(this); 
  mySample = new Sample("sine.aiff"); 
  mySample.setVolume(.5) 
  mySample.repeat(); 
} 
 
public void stop(){ 
  Sonia.stop(); 
  super.stop(); 
} 

Description   Set the sample's volume. If the sample is stereo, each channel should be controlled seperately. Values range from 0.0 and up: 0.0 being muted, 1.0 being the original amplitude of the sample, and 7.0 being 7 times the amplitude of the origianl sample. Notices that when playing several samples at once, it is recomended to lower their volume in order to avoid clipping (combined amplitude of over 0dB).
   
Syntax  
mySample.setVolume(volumeValue)
mySample.setVolume(volumeValue, channel)
   
Parameters  
volumeValue   float

channel   int: 0 or Sonia.LEFT for Left channel, 1 or Sonia.RIGHT for Right channel

   
Returns   None
   
Usage   Web & Application
   
Related   getVolume()