TelegramPWA/src/util/generateWaveform.ts
2024-11-27 20:33:48 +04:00

7 lines
289 B
TypeScript

import { MAX_EMPTY_WAVEFORM_POINTS } from '../components/common/helpers/waveform';
export function generateWaveform(duration: number) {
const arr = Math.min(Math.round(duration), MAX_EMPTY_WAVEFORM_POINTS);
return Array.from({ length: arr }, () => Math.floor(Math.random() * 256));
}