nodejs-audio-visualizer 4.4.12 → 4.5.1

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 (48) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +80 -75
  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 -67
  10. package/dist/config.js +369 -356
  11. package/dist/config.js.map +1 -1
  12. package/dist/dsp.d.ts +16 -16
  13. package/dist/dsp.js +76 -76
  14. package/dist/highlight.d.ts +32 -32
  15. package/dist/highlight.js +325 -325
  16. package/dist/image.d.ts +79 -79
  17. package/dist/image.js +458 -458
  18. package/dist/index.d.ts +79 -74
  19. package/dist/index.js +531 -528
  20. package/dist/index.js.map +1 -1
  21. package/dist/subtitleConvert.d.ts +3 -3
  22. package/dist/subtitleConvert.js +61 -61
  23. package/dist/video.d.ts +80 -80
  24. package/dist/video.js +434 -430
  25. package/dist/video.js.map +1 -1
  26. package/dist/waitForEventLoop.d.ts +1 -1
  27. package/dist/waitForEventLoop.js +5 -5
  28. package/package.json +61 -61
  29. package/src/audio.ts +120 -120
  30. package/src/beats.ts +68 -68
  31. package/src/bpmEncoder.ts +97 -97
  32. package/src/config.ts +476 -462
  33. package/src/dsp.ts +95 -95
  34. package/src/highlight.ts +284 -284
  35. package/src/image.ts +602 -602
  36. package/src/index.ts +713 -685
  37. package/src/subtitleConvert.ts +63 -63
  38. package/src/tests/audio.test.ts +96 -96
  39. package/src/tests/config.test.ts +496 -475
  40. package/src/tests/dsp.test.ts +24 -24
  41. package/src/tests/highlight.test.ts +178 -178
  42. package/src/tests/image.test.ts +222 -222
  43. package/src/tests/index.test.ts +112 -112
  44. package/src/tests/subtitleConvert.test.ts +23 -23
  45. package/src/tests/video.test.ts +285 -216
  46. package/src/typings.d.ts +6 -6
  47. package/src/video.ts +550 -547
  48. package/src/waitForEventLoop.ts +2 -2
package/dist/index.d.ts CHANGED
@@ -1,74 +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
- };
63
- }
64
- export declare type SpectrumSizeValue = number | string;
65
- export declare type PositionAliasName = 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom';
66
- export declare type RotationAliasName = typeof rotationAliasValues[number];
67
- export interface RenderAudioVisualizerResult {
68
- exitCode: number;
69
- /** Human-readable failure reason; omitted on full success (exitCode 0). */
70
- reason?: string;
71
- /** Absolute paths of video files written successfully (exit code 0, full pass, no early stop). */
72
- outputVideoFiles: string[];
73
- }
74
- 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>;