sound
Class Oscillator

java.lang.Object
  extended by sound.Oscillator

public class Oscillator
extends java.lang.Object


Constructor Summary
Oscillator(double frequency_, int length)
           
 
Method Summary
 double actualFrequency()
           
static double[] add(double[] a, double[] b)
           
static void asynchronousToneTest()
           
static void beep()
          Plays the system beep.
 void debug()
           
 double[] getAM()
           
static javax.sound.sampled.AudioFormat getAudioFormat()
           
 double getDuration()
           
 double[] getFM()
           
 double getFrequency()
           
 int getSampleRate()
           
 double[] getSawWave()
           
 double[] getSineWave()
           
static double[] getSineWave(int frequency1, int frequency2, long duration)
          Get a tone.
 double[] getSquareWave()
           
 double[] getTriangleWave()
           
static void main(java.lang.String[] arg)
           
static double[] mult(double[] d, double a)
           
static void playAndDisplayTone(int frequency)
           
static void playInputStream(java.io.InputStream bis)
           
static void playLinearData(double[] d)
           
static void playTone(int frequency)
           
 void setModulationFrequency(double fm)
           
 void setModulationIndex(double I)
           
 int sign(double d)
           
static void testAudioDft()
           
static void testAudioFft()
           
static void testPlayAndDisplayTone()
           
static void testPlayTone()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Oscillator

public Oscillator(double frequency_,
                  int length)
Method Detail

beep

public static void beep()
Plays the system beep. I only put this here because I did not know where else to put it. After all, it uses the AWT tool kit, and how does that make any sense?


main

public static void main(java.lang.String[] arg)

testPlayTone

public static void testPlayTone()

asynchronousToneTest

public static void asynchronousToneTest()

testPlayAndDisplayTone

public static void testPlayAndDisplayTone()

playAndDisplayTone

public static void playAndDisplayTone(int frequency)

playTone

public static void playTone(int frequency)

actualFrequency

public double actualFrequency()

debug

public void debug()

getSineWave

public double[] getSineWave()

getSineWave

public static double[] getSineWave(int frequency1,
                                   int frequency2,
                                   long duration)
Get a tone.

Parameters:
frequency1 - the first tone
frequency2 - the second tone
duration - the duration, in ms
Returns:
an array that ranges from -1 to 1

getSquareWave

public double[] getSquareWave()

getSawWave

public double[] getSawWave()

getTriangleWave

public double[] getTriangleWave()

sign

public int sign(double d)

getDuration

public double getDuration()

getSampleRate

public int getSampleRate()

getFrequency

public double getFrequency()

setModulationIndex

public void setModulationIndex(double I)

setModulationFrequency

public void setModulationFrequency(double fm)

getFM

public double[] getFM()

getAM

public double[] getAM()

testAudioFft

public static void testAudioFft()

testAudioDft

public static void testAudioDft()

mult

public static double[] mult(double[] d,
                            double a)

add

public static double[] add(double[] a,
                           double[] b)

playLinearData

public static void playLinearData(double[] d)
                           throws javax.sound.sampled.LineUnavailableException,
                                  java.io.IOException
Throws:
javax.sound.sampled.LineUnavailableException
java.io.IOException

playInputStream

public static void playInputStream(java.io.InputStream bis)
                            throws javax.sound.sampled.LineUnavailableException,
                                   java.io.IOException
Throws:
javax.sound.sampled.LineUnavailableException
java.io.IOException

getAudioFormat

public static javax.sound.sampled.AudioFormat getAudioFormat()