public class Wave extends Object
Constructor and Description |
---|
Wave(double freq,
double[] data,
int sampleFrequency,
int sampleSize,
int channels,
boolean bigEndian,
boolean omitTail,
boolean square,
boolean divide)
Generates a wave audio file from its arguments.
|
Wave(File file)
Reads a wave file into a Wave object.
|
Wave(ModulatedIrSequence irSequence,
AudioFormat audioFormat,
boolean omitTail,
boolean square,
boolean divide)
Generates a wave audio file from its arguments.
|
Wave(ModulatedIrSequence irSequence,
int sampleFrequency,
int sampleSize,
int channels,
boolean bigEndian,
boolean omitTail,
boolean square,
boolean divide)
Generates a wave audio file from its arguments.
|
Modifier and Type | Method and Description |
---|---|
ModulatedIrSequence |
analyze(boolean divide)
Analyzes the data and computes a ModulatedIrSequence.
|
void |
dump(File dumpfile)
Print the channels to a tab separated text file, for example for debugging purposes.
|
void |
export(File file)
Write the signal to the file given as argument.
|
static SourceDataLine |
getLine(AudioFormat audioFormat)
Returns a line to the audio mixer on the local machine, suitable for sound with
the parameter values given.
|
static void |
main(String[] args)
Provides a command line interface to the export/import functions.
|
void |
play()
Sends the generated wave to the local machine's audio system, if possible.
|
void |
play(SourceDataLine line)
Sends the generated wave to the line in argument, if possible.
|
public Wave(File file) throws UnsupportedAudioFileException, IOException
file
- Wave file as input.UnsupportedAudioFileException
IOException
public Wave(double freq, double[] data, int sampleFrequency, int sampleSize, int channels, boolean bigEndian, boolean omitTail, boolean square, boolean divide) throws IncompatibleArgumentException
freq
- Carrier frequency in Hz.data
- double array of durations in micro seconds.sampleFrequency
- Sample frequency of the generated wave file.sampleSize
- Sample size (8 or 16) in bits of the samples.channels
- If == 2, generates two channels in perfect anti-phase.bigEndian
- if true, use bigendian byte order for 16 bit samples.omitTail
- If true, the last trailing gap will be omitted.square
- if true, use a square wave for modulation, otherwise a sine.divide
- If true, divides the carrier frequency by 2, to be used with full-wave rectifiers, e.g. a pair of IR LEDs in anti-parallel.IncompatibleArgumentException
public Wave(ModulatedIrSequence irSequence, int sampleFrequency, int sampleSize, int channels, boolean bigEndian, boolean omitTail, boolean square, boolean divide) throws IncompatibleArgumentException
irSequence
- ModulatedIrSequence to be used.sampleFrequency
- Sample frequency of the generated wave file.sampleSize
- Sample size (8 or 16) in bits of the samples.channels
- If == 2, generates two channels in perfect anti-phase.bigEndian
- if true, use bigendian byte order for 16 bit samples.omitTail
- If true, the last trailing gap will be omitted.square
- if true, use a square wave for modulation, otherwise a sine.divide
- If true, divides the carrier frequency by 2, to be used with full-wave rectifiers, e.g. a pair of IR LEDs in anti-parallel.IncompatibleArgumentException
public Wave(ModulatedIrSequence irSequence, AudioFormat audioFormat, boolean omitTail, boolean square, boolean divide) throws IncompatibleArgumentException
irSequence
- ModulatedIrSequence to be used.audioFormat
- AudioFormat bundling sampleFrequency, sample size, channels, and bigEndian together.omitTail
- If true, the last trailing gap will be omitted.square
- if true, use a square wave for modulation, otherwise a sine.divide
- If true, divides the carrier frequency by 2, to be used with full-wave rectifiers, e.g. a pair of IR LEDs in anti-parallel.IncompatibleArgumentException
public static SourceDataLine getLine(AudioFormat audioFormat) throws LineUnavailableException
audioFormat
- LineUnavailableException
public static void main(String[] args)
Usage: Wave [options] [parameters] Options: -c, --config Path to IrpProtocols.ini Default: data/IrpProtocols.ini -h, --help, -? Display help message Default: false -m, --macrofile Macro filename -1, --nodivide Do not divide modulation frequency Default: false -t, --omittail Skip silence at end Default: false -o, --outfile Output filename Default: irpmaster.wav -p, --play Send the generated wave to the audio device of the local machine Default: false -r, --repeats Number of times to include the repeat sequence Default: 0 -f, --samplefrequency Sample frequency in Hz Default: 44100 -q, --square Modulate with square wave instead of sine Default: false -S, --stereo Generate two channels in anti-phase Default: false -v, --version Display version information Default: false -s, samplesize Sample size in bits Default: 8 parameters: protocol deviceno [subdevice_no] commandno [toggle] or ProntoCode or importfile
args
- public ModulatedIrSequence analyze(boolean divide)
divide
- consider the carrier as having its frequency halved or not?public void dump(File dumpfile) throws FileNotFoundException
dumpfile
- Output file.FileNotFoundException
public void export(File file)
file
- Output File.public void play(SourceDataLine line) throws LineUnavailableException, IOException
line
- Line to used. Should be open, and remains open. User must make sure AudioFormat is compatible.LineUnavailableException
IOException
public void play() throws LineUnavailableException, IOException
LineUnavailableException
IOException
Copyright © 2016. All rights reserved.