cw
Version:
A comprehensive Morse Code (CW) library
26 lines (25 loc) • 812 B
TypeScript
export interface AudioContextOptions {
tone?: number;
wpm?: number;
fwpm?: number;
actx?: AudioContextResult;
}
export interface AudioContextResult {
actx: AudioContext;
osc: OscillatorNode;
gain: GainNode;
}
/**
* Initialize the Web Audio API context
* @param opts Options for initializing the audio context
* @returns The initialized audio context or undefined if window is not available
*/
declare function initAudioContext(opts?: AudioContextOptions): AudioContextResult | undefined;
/**
* Play a word or phrase in Morse code
* @param word The word or phrase to play
* @param opts Options for playback
* @returns The total duration of playback in milliseconds
*/
declare function play(word: string, opts?: AudioContextOptions): number;
export { initAudioContext, play };