Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions dist/types/audiokeys.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
type AudioKeysOptions = {
polyphony: number
rows: 1 | 2
priority: 'last' | 'first' | 'highest' | 'lowest'
rootNote: number
octaveControls: boolean
velocityControls: boolean
}

interface AudioKeysNoteData {
velocity: number // the velocity, between 0 and 127
keyCode: number // the keyboard key pressed or released
note: number
frequency: number
isActive: boolean
}

declare module 'audiokeys' {
export default class AudioKeysDefault {
constructor(options?: Partial<AudioKeysOptions>)
up(callback: (note: AudioKeysNoteData) => void): void
down(callback: (note: AudioKeysNoteData) => void): void
clear: () => void
}
export class AudioKeys extends AudioKeysDefault {}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"type" : "git",
"url" : "https://github.com/kylestetz/AudioKeys.git"
},
"types": "dist/types/audiokeys.d.ts",
"keywords": [
"web audio",
"audio",
Expand Down
3 changes: 2 additions & 1 deletion src/AudioKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ AudioKeys.prototype._specialKeyMap = special._specialKeyMap;

// Browserify will take care of making this a global
// in a browser environment without a build system.
module.exports = AudioKeys;
module.exports = AudioKeys;
module.exports.AudioKeys = AudioKeys;