-
Notifications
You must be signed in to change notification settings - Fork 57
/
options.ts
24 lines (23 loc) · 1012 Bytes
/
options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const getOptions = (opts: Partial<Options> = {}): Options => {
const options: Options = {
...opts,
dash: opts.dash || '-',
dot: opts.dot || '.',
space: opts.space || '/',
separator: opts.separator || ' ',
invalid: opts.invalid || '#',
priority: opts.priority || 1,
wpm: opts.wpm, // words per minute - PARIS method used in favour of unit/fwUnit options
unit: opts.unit || 0.08, // period of one unit, in seconds, 1.2 / c where c is speed of transmission, in words per minute
fwUnit: opts.fwUnit || opts.unit || 0.08, // Farnsworth unit to control intercharacter and interword gaps
volume: opts.volume || 100,
oscillator: {
...opts.oscillator,
type: opts.oscillator?.type || 'sine', // sine, square, sawtooth, triangle
frequency: opts.oscillator?.frequency || 500, // value in hertz
onended: opts.oscillator?.onended || null // event that fires when the tone has stopped playing
}
};
return options;
};
export default getOptions;