@imgly/plugin-ai-audio-generation-web
Version:
AI audio generation plugin for the CE.SDK editor
41 lines (40 loc) • 1.71 kB
TypeScript
/**
* Clamps a value between a minimum and maximum value
* @param {number} value - The value to clamp
* @param {number} min - The minimum allowed value
* @param {number} max - The maximum allowed value
* @returns {number} The clamped value
*/
export declare function clamp(value: number, min: number, max: number): number;
/**
* Returns the duration of an audio blob in seconds
* @param audioBlob - The audio blob to get the duration from
* @returns A promise that resolves to the duration in seconds
*/
export declare function getAudioDuration(audioUrl: string): Promise<number>;
declare const DEFAULT_OPTIONS: {
width: number;
height: number;
backgroundColor: string;
waveformColor: string;
pixelsPerSecond: number;
};
export declare function createThumbnailFromAudio(audio: Blob, options?: Partial<typeof DEFAULT_OPTIONS>): Promise<Blob>;
/**
* Smartly truncates text to a specified length while preserving word boundaries
* and adding an ellipsis to indicate truncation.
*
* @param {string} text - The text to truncate
* @param {number} maxLength - Maximum length of the truncated text (including ellipsis)
* @param {Object} options - Optional configuration
* @param {string} options.ellipsis - The ellipsis string (default: '...')
* @param {boolean} options.preserveSentences - Try to truncate at sentence boundaries (default: false)
* @param {number} options.minLength - Minimum length before truncation (default: 0)
* @return {string} The truncated text with ellipsis if truncated
*/
export declare function truncate(text: string, maxLength: number, options?: {
ellipsis?: string;
preserveSentences?: boolean;
minLength?: number;
}): string;
export {};