Audio Toolkit - audioOscillator
Methods
- :
obj =
audioOscillator()
- :
obj =
audioOscillator(signalTypeValue)
- :
obj =
audioOscillator(signalTypeValue, frequencyValue)
- :
obj =
audioOscillator(__, propertyname, propertyvalue)
Create a audioOscillator object
Inputs
signalTypeValue - signal type of "sine" (default), "square", "sawtooth".
frequencyValue - hz frequency value of waveform (default 100).
propertyname, propertyvalue - properties to set on the object.Known properties are:
- SignalType
signal type of "sine" (default), "square" or "sawtooth". (readonly)
- Frequency
frequency of the waveform (default 100)
- Amplitude
amplitude of the signal (default 1)
- SampleRate
sample rate of the signal (default 44100)
- PhaseOffset
phase offset of signal 0 (default) - 1 (readonly)
- DutyCycle
dutycycle of the signal 0 - 1 (default 0.5) when signal is a square wave.
- SamplePerFrame
Samples per frame as returned from () (default 512)
- MaxSamplePerFrame
Max samples per frame (default 192000)
- DCOffset
DC Offset of signal (default 0)
- Width
Width of sawtooth (default 1)
- OutputDataType
Output data type of ’single’ or ’double’ (default ’double’)
Outputs
obj - signalGenerator object
Examples
Create a 100 hz sine wave and plot first 512 samples
sinosc = audioOscillator data = sinosc(); plot(data);
Create a 2 hz square wave with duty cycle of 0.5
sqosc = audioOscillator('square', 'DutyCycle', 0.50, 'Frequency', 2);
- :
data =
obj() Generate a frame of waveform data from the generator function
Inputs
obj - signalGenerator object
Outputs
data - waveform data