Sound Processing

The sounds package allows students to load, transform, save, and record digital sound clips. For example, the following Java code loads an sound clip, plays it, and increases its volume:

import sounds.APSoundClip;
import sounds.Sample;
public class TestVolume{
    public static void main(String[]args){
        APSoundClip clip = new APSoundClip("BlueBossa.wav");
        clip.draw();
        clip.play()
        for (Sample s: clip)
            s.setValue(s.getValue() * 2);      
    }
}

The APSoundClip class includes methods to

  • get the length of a sound clip
  • get a sample at a given position
  • replace a sample at a given position
  • iterate through all samples
  • save a sound clip to a file
  • create a copy (clone) of a sound clip

The Sample class includes methods to

  • get a sample's value
  • replace a sample's value

 

Download the sounds package

View the sounds API