LitDev Extension API

LD3DView LDArray LDBits LDBlueTooth LDCall
LDChart LDClient LDClipboard LDColours LDCommPort
LDController LDControls LDCursors LDDataBase LDDateTime
LDDebug LDDialogs LDDictionary LDEffect LDEmail
LDEncryption LDEvents LDFastArray LDFastShapes LDFigures
LDFile LDFocus LDftp LDGraph LDGraphicsWindow
LDHID LDImage LDInline LDIOWarrior LDList
LDLogic LDMath LDMathX LDMatrix LDMusic
LDNetwork LDPhysics LDProcess LDQueue LDRegex
LDResources LDScrollBars LDSearch LDServer LDSettings
LDShapes LDShell LDSort LDSound LDSpeech
LDStatistics LDStopwatch LDText LDTextWindow LDTimer
LDTranslate LDUnits LDUtilities LDWaveForm LDWebCam
LDWindows LDxml LDZip

LDWaveForm
Create PPM (Pulse Position Modulation) sound signals to control RC (remote control) devices.
See http://blogs.msdn.com/b/smallbasic/archive/2014/05/10/smallbasic-pulse-position-modulation-extension.aspx.
Additonally create simple sound waveforms, which can be played asynchronously at the same time.

SlimDX runtme for .Net 4.0 requires to be installed before this object can be used (http://slimdx.org/download.php).


Amplitude Async Loop
Pan PlayDX7 PlayHarmonics
PlaySineWave PlaySquareWave PlayWave
PlayWavFile Stop Volume

Amplitude
Signal amplitude (maximum is 2^15 = 32768, default is 20262).

Async
Play the sound asynchronously (return before sound completes), "True" or "False" default.

Loop
Continuously loop the sound, "True" or "False" default.
Lopping sounds can be stopped by calling Stop method as they are playing.


Pan
The left (-100) to right (100) stereo panning, (default 0).

PlayDX7(channels)
Play DX7.
channels An array of values for each channel (values between 0 and 1, usually 8 channels).
returns The wave name or "" on failure.

PlayHarmonics(frequency,duration,harmonics)
Play a user defined wave form as a sum of harmonics.
frequency Frequency (HZ).
duration Duration (ms). If this is negative then the waveform is repeated (-duration) times.
harmonics Harmonic amplitudes.
This is an array, where the index is a harmonic multiple of the base frequency (2, 3, etc) and the value is the relative amplitude of the harmonic.
A square wave can be formed by (https://en.wikipedia.org/wiki/Square_wave):
For i = 3 To 21 Step 2
harmonics[i] = 1/i
EndFor
squareWave = LDWaveForm.PlayHarmonics(256,1000,harmonics)

returns The wave name or "" on failure.

PlaySineWave(frequency,duration)
Play a Sine wave form.
frequency Frequency (HZ).
duration Duration (ms). If this is negative then the waveform is repeated (-duration) times.
returns The wave name or "" on failure.

PlaySquareWave(frequency,duration)
Play a square wave form.
frequency Frequency (HZ).
duration Duration (ms). If this is negative then the waveform is repeated (-duration) times.
returns The wave name or "" on failure.

PlayWave(frequency,duration,waveform)
Play a user defined wave form.
frequency Frequency (HZ).
duration Duration (ms). If this is negative then the waveform is repeated (-duration) times.
waveform Form for the repeating wave.
This is an array, where the index is an increasing relative time (the actual value is normalised to the frequency) and the value is an amplitude (-1 to 1).
Example of a triangular wave would be "0=-1;1=1;2=-1;"

returns The wave name or "" on failure.

PlayWavFile(fileName,duration)
Play a wav file.
fileName The *.wav file.
duration Duration (ms). If this is negative then the waveform is repeated (-duration) times.
returns The wave name or "" on failure.

Stop(waveName)
Stop a playing sound.
waveName The sound wave name.

Volume
The volume to play the waveform (0 to 100).