Java Lab Documentation

SoundLoader

Category:org.code.media

Method Details

read

public static double[] read(String filename) throws SoundException, FileNotFoundException

Extracts audio samples from a WAV or AU file into an array. It returns an array of samples as double values, at 44.1 kilohertz. This means that 441000 samples are played per second.

This method will throw SoundException if there is an error reading the file.

Parameters

NameTypeRequired?Description
filenameString

the name of the audio file

Examples

double[] musicSamples = SoundLoader.read("mysong.wav");