nodejs-audio-visualizer 4.5.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +80 -80
  3. package/dist/audio.d.ts +12 -12
  4. package/dist/audio.js +120 -120
  5. package/dist/beats.d.ts +19 -19
  6. package/dist/beats.js +43 -43
  7. package/dist/bpmEncoder.d.ts +14 -14
  8. package/dist/bpmEncoder.js +97 -97
  9. package/dist/config.d.ts +77 -77
  10. package/dist/config.js +369 -369
  11. package/dist/dsp.d.ts +16 -16
  12. package/dist/dsp.js +76 -76
  13. package/dist/highlight.d.ts +32 -32
  14. package/dist/highlight.js +325 -325
  15. package/dist/image.d.ts +79 -79
  16. package/dist/image.js +458 -458
  17. package/dist/index.d.ts +79 -79
  18. package/dist/index.js +534 -531
  19. package/dist/index.js.map +1 -1
  20. package/dist/subtitleConvert.d.ts +3 -3
  21. package/dist/subtitleConvert.js +61 -61
  22. package/dist/video.d.ts +80 -80
  23. package/dist/video.js +434 -426
  24. package/dist/video.js.map +1 -1
  25. package/dist/waitForEventLoop.d.ts +1 -1
  26. package/dist/waitForEventLoop.js +5 -5
  27. package/package.json +61 -61
  28. package/src/audio.ts +120 -120
  29. package/src/beats.ts +68 -68
  30. package/src/bpmEncoder.ts +97 -97
  31. package/src/config.ts +476 -476
  32. package/src/dsp.ts +95 -95
  33. package/src/highlight.ts +284 -284
  34. package/src/image.ts +602 -602
  35. package/src/index.ts +718 -713
  36. package/src/subtitleConvert.ts +63 -63
  37. package/src/tests/audio.test.ts +96 -96
  38. package/src/tests/config.test.ts +496 -496
  39. package/src/tests/dsp.test.ts +24 -24
  40. package/src/tests/highlight.test.ts +178 -178
  41. package/src/tests/image.test.ts +222 -222
  42. package/src/tests/index.test.ts +180 -112
  43. package/src/tests/subtitleConvert.test.ts +23 -23
  44. package/src/tests/video.test.ts +285 -216
  45. package/src/typings.d.ts +6 -6
  46. package/src/video.ts +550 -542
  47. package/src/waitForEventLoop.ts +2 -2
package/dist/index.d.ts CHANGED
@@ -1,79 +1,79 @@
1
- /// <reference types="node" />
2
- import { rotationAliasValues, SpectrumEffect } from './config';
3
- import { Color } from './image';
4
- export { BeatInfo, BeatDetectorOptions } from './beats';
5
- export { computeHighlightSlice, HIGHLIGHT_DURATION_SEC, BeatFrameEvent, HighlightAudioSegment, HighlightRun } from './highlight';
6
- export declare const PCM_FORMAT: {
7
- bit: number;
8
- sign: string;
9
- parseFunction: (buffer: Buffer, start: number, end: number) => number[];
10
- };
11
- export interface Config {
12
- audio: {
13
- path: string;
14
- autoHighlight?: boolean;
15
- /** When `autoHighlight` is true, number of non-overlapping 15s windows to stitch (default 1). */
16
- autoHighlightCount?: number;
17
- };
18
- image?: {
19
- path: string;
20
- };
21
- video?: {
22
- path: string;
23
- autoEdit?: boolean;
24
- };
25
- outVideo: {
26
- path: string;
27
- subtitles?: string | {
28
- path?: string;
29
- rawContent?: string;
30
- alignment?: 'top' | 'middle' | 'bottom';
31
- };
32
- fps?: number;
33
- resolution?: {
34
- width: number;
35
- height: number;
36
- };
37
- spectrum?: {
38
- width?: SpectrumSizeValue;
39
- height?: SpectrumSizeValue;
40
- x?: number | PositionAliasName;
41
- y?: number | PositionAliasName;
42
- rotation?: RotationAliasName;
43
- effect?: SpectrumEffect;
44
- color?: Color | string;
45
- opacity?: string;
46
- };
47
- polar?: {
48
- x?: number | PositionAliasName;
49
- y?: number | PositionAliasName;
50
- innerRadius?: number;
51
- maxBarLength?: number;
52
- barWidth?: number;
53
- effect?: SpectrumEffect;
54
- color?: Color | string;
55
- opacity?: string;
56
- };
57
- };
58
- tweaks?: {
59
- ffmpeg_cfr?: string;
60
- ffmpeg_preset?: string;
61
- frame_processing_delay?: number;
62
- timeouts?: {
63
- readVideoFrame?: number;
64
- waitDrain?: number;
65
- waitForProcessExit?: number;
66
- };
67
- };
68
- }
69
- export declare type SpectrumSizeValue = number | string;
70
- export declare type PositionAliasName = 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom';
71
- export declare type RotationAliasName = typeof rotationAliasValues[number];
72
- export interface RenderAudioVisualizerResult {
73
- exitCode: number;
74
- /** Human-readable failure reason; omitted on full success (exitCode 0). */
75
- reason?: string;
76
- /** Absolute paths of video files written successfully (exit code 0, full pass, no early stop). */
77
- outputVideoFiles: string[];
78
- }
79
- export declare const renderAudioVisualizer: (config: Config, onProgress?: ((progress: number) => any) | undefined, shouldStop?: (() => boolean) | undefined) => Promise<RenderAudioVisualizerResult>;
1
+ /// <reference types="node" />
2
+ import { rotationAliasValues, SpectrumEffect } from './config';
3
+ import { Color } from './image';
4
+ export { BeatInfo, BeatDetectorOptions } from './beats';
5
+ export { computeHighlightSlice, HIGHLIGHT_DURATION_SEC, BeatFrameEvent, HighlightAudioSegment, HighlightRun } from './highlight';
6
+ export declare const PCM_FORMAT: {
7
+ bit: number;
8
+ sign: string;
9
+ parseFunction: (buffer: Buffer, start: number, end: number) => number[];
10
+ };
11
+ export interface Config {
12
+ audio: {
13
+ path: string;
14
+ autoHighlight?: boolean;
15
+ /** When `autoHighlight` is true, number of non-overlapping 15s windows to stitch (default 1). */
16
+ autoHighlightCount?: number;
17
+ };
18
+ image?: {
19
+ path: string;
20
+ };
21
+ video?: {
22
+ path: string;
23
+ autoEdit?: boolean;
24
+ };
25
+ outVideo: {
26
+ path: string;
27
+ subtitles?: string | {
28
+ path?: string;
29
+ rawContent?: string;
30
+ alignment?: 'top' | 'middle' | 'bottom';
31
+ };
32
+ fps?: number;
33
+ resolution?: {
34
+ width: number;
35
+ height: number;
36
+ };
37
+ spectrum?: {
38
+ width?: SpectrumSizeValue;
39
+ height?: SpectrumSizeValue;
40
+ x?: number | PositionAliasName;
41
+ y?: number | PositionAliasName;
42
+ rotation?: RotationAliasName;
43
+ effect?: SpectrumEffect;
44
+ color?: Color | string;
45
+ opacity?: string;
46
+ };
47
+ polar?: {
48
+ x?: number | PositionAliasName;
49
+ y?: number | PositionAliasName;
50
+ innerRadius?: number;
51
+ maxBarLength?: number;
52
+ barWidth?: number;
53
+ effect?: SpectrumEffect;
54
+ color?: Color | string;
55
+ opacity?: string;
56
+ };
57
+ };
58
+ tweaks?: {
59
+ ffmpeg_cfr?: string;
60
+ ffmpeg_preset?: string;
61
+ frame_processing_delay?: number;
62
+ timeouts?: {
63
+ readVideoFrame?: number;
64
+ waitDrain?: number;
65
+ waitForProcessExit?: number;
66
+ };
67
+ };
68
+ }
69
+ export declare type SpectrumSizeValue = number | string;
70
+ export declare type PositionAliasName = 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom';
71
+ export declare type RotationAliasName = typeof rotationAliasValues[number];
72
+ export interface RenderAudioVisualizerResult {
73
+ exitCode: number;
74
+ /** Human-readable failure reason; omitted on full success (exitCode 0). */
75
+ reason?: string;
76
+ /** Absolute paths of video files written successfully (exit code 0, full pass, no early stop). */
77
+ outputVideoFiles: string[];
78
+ }
79
+ export declare const renderAudioVisualizer: (config: Config, onProgress?: ((progress: number) => any) | undefined, shouldStop?: (() => boolean) | undefined) => Promise<RenderAudioVisualizerResult>;