wave-roll
Version:
JavaScript Library for Comparative MIDI Piano-Roll Visualization
220 lines • 5.96 kB
TypeScript
import type { PlayerGroup, SynchronizationInfo } from '../master-clock';
/**
* MIDI Player Group - Synchronized with AudioMasterClock
*
* User requirements: Individual control of volume, pan, mute for each MIDI player
*/
export declare class MidiPlayerGroup implements PlayerGroup {
private players;
private part;
private notes;
private applyZeroEps;
private tempoScale;
private originalTempoBase;
private lastStartGen;
private masterVolume;
private midiManager;
private errorStats;
constructor();
/**
* Set MIDI manager (compatibility with existing code)
*/
setMidiManager(midiManager: any): void;
/**
* Initialize MIDI samplers
*/
initialize(): Promise<void>;
/**
* Wait until all MIDI samplers are ready.
*/
waitUntilReady(): Promise<void>;
/**
* Create sampler for file
*/
private createSamplerForFile;
/**
* Create MIDI Part
*/
/**
* Validate MIDI note data
*/
private validateMidiNote;
/**
* Validate note name format (supports standard notation like "C4", "C#4", "Bb3")
*/
private isValidNoteName;
/**
* Normalize pitch input to consistent note name format
* Handles both numeric MIDI notes (0-127) and string note names ('C#4', 'Db3', etc.)
*/
private normalizeNoteName;
/**
* Sanitize and filter MIDI notes
*/
/**
* Update error statistics
*/
private updateErrorStats;
/**
* Get error statistics
*/
getErrorStats(): {
uptimeMs: number;
successRate: number;
totalNoteAttempts: number;
failedNotes: number;
invalidDataErrors: number;
synthErrors: number;
lastResetTime: number;
};
/**
* Reset error statistics
*/
resetErrorStats(): void;
/**
* Comprehensive MIDI data quality analysis
*/
analyzeMidiDataQuality(): {
timestamp: string;
totalNotes: number;
fileIds: (string | undefined)[];
dataQuality: {
validNotes: number;
invalidNotes: number;
pitchRange: {
min: number;
max: number;
};
velocityRange: {
min: number;
max: number;
};
durationRange: {
min: number;
max: number;
};
timeRange: {
min: number;
max: number;
};
};
issues: string[];
recommendations: string[];
};
/**
* Get comprehensive performance report
*/
getPerformanceReport(): {
timestamp: string;
playbackPerformance: {
isHealthy: boolean;
healthStatus: string;
uptimeMs: number;
successRate: number;
totalNoteAttempts: number;
failedNotes: number;
invalidDataErrors: number;
synthErrors: number;
lastResetTime: number;
};
dataQuality: {
timestamp: string;
totalNotes: number;
fileIds: (string | undefined)[];
dataQuality: {
validNotes: number;
invalidNotes: number;
pitchRange: {
min: number;
max: number;
};
velocityRange: {
min: number;
max: number;
};
durationRange: {
min: number;
max: number;
};
timeRange: {
min: number;
max: number;
};
};
issues: string[];
recommendations: string[];
};
systemStatus: {
activePlayers: number;
totalNotes: number;
partActive: boolean;
masterVolume: number;
};
recommendations: string[];
};
/**
* Generate system recommendations based on performance and data quality
*/
private generateRecommendations;
/**
* Log comprehensive health status to console
*/
logHealthStatus(): void;
private sanitizeMidiNotes;
private createMidiPart;
/**
* Convert MIDI note number to note name
*/
private midiNoteNumberToName;
/**
* PlayerGroup interface implementation: Synchronized start
*/
startSynchronized(syncInfo: SynchronizationInfo): Promise<void>;
/**
* PlayerGroup interface implementation: Synchronized stop
*/
stopSynchronized(): void;
/**
* PlayerGroup interface implementation: Seek to time
*/
seekTo(time: number): void;
/**
* PlayerGroup interface implementation: Set tempo
*/
setTempo(bpm: number): void;
/** Set baseline tempo used to compute MIDI scheduling scale. */
setOriginalTempoBase(bpm: number): void;
/**
* PlayerGroup interface implementation: Set master volume
*/
setMasterVolume(volume: number): void;
/**
* PlayerGroup interface implementation: Set loop
*/
setLoop(mode: 'off' | 'repeat' | 'ab', markerA: number | null, markerB: number | null): void;
/**
* Set individual MIDI player volume
*/
setPlayerVolume(fileId: string, volume: number): void;
/**
* Set individual MIDI player pan
*/
setPlayerPan(fileId: string, pan: number): void;
/**
* Set individual MIDI player mute
*/
setPlayerMute(fileId: string, muted: boolean): void;
/**
* Get individual player states
*/
getPlayerStates(): Record<string, {
volume: number;
pan: number;
muted: boolean;
}>;
/**
* Resource cleanup
*/
destroy(): void;
}
//# sourceMappingURL=midi-player-group.d.ts.map