@omnimedia/omnitool 1.0.0 → 1.1.0-10
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.
- package/LICENSE +21 -0
- package/README.md +120 -2
- package/package.json +59 -27
- package/s/_archive/types.ts +107 -0
- package/s/context.ts +7 -0
- package/s/demo/demo.bundle.ts +68 -0
- package/s/demo/demo.css +59 -0
- package/s/demo/routines/filmstrip-test.ts +68 -0
- package/s/demo/routines/load-video.ts +7 -0
- package/s/demo/routines/transcode-test.ts +46 -0
- package/s/demo/routines/transcriber-test.ts +34 -0
- package/s/demo/routines/transitions-test.ts +43 -0
- package/s/demo/routines/waveform-test.ts +12 -0
- package/s/driver/driver.test.ts +15 -0
- package/s/driver/driver.ts +124 -0
- package/s/driver/driver.worker.bundle.ts +7 -0
- package/s/driver/fns/host.ts +13 -0
- package/s/driver/fns/schematic.ts +106 -0
- package/s/driver/fns/work.ts +249 -0
- package/s/driver/parts/constants.ts +17 -0
- package/s/driver/parts/machina.ts +27 -0
- package/s/driver/utils/load-decoder-source.ts +12 -0
- package/s/driver/utils/sleep.ts +3 -0
- package/s/features/speech/transcribe/default-spec.ts +11 -0
- package/s/features/speech/transcribe/parts/load-pipe.ts +19 -0
- package/s/features/speech/transcribe/parts/prep-audio.ts +23 -0
- package/s/features/speech/transcribe/parts/transcribe.ts +70 -0
- package/s/features/speech/transcribe/transcriber.ts +46 -0
- package/s/features/speech/transcribe/types.ts +82 -0
- package/s/features/speech/transcribe/worker.bundle.ts +40 -0
- package/s/features/transition/parts/fragment.ts +24 -0
- package/s/features/transition/parts/types.ts +94 -0
- package/s/features/transition/parts/uniforms.ts +29 -0
- package/s/features/transition/parts/vertex.ts +31 -0
- package/s/features/transition/transition.ts +60 -0
- package/s/index.html.ts +58 -0
- package/s/index.ts +2 -39
- package/s/tests.test.ts +8 -0
- package/s/timeline/index.ts +15 -0
- package/s/timeline/parts/basics.ts +17 -0
- package/s/timeline/parts/compositor/export.ts +77 -0
- package/s/timeline/parts/compositor/parts/html-tree.ts +37 -0
- package/s/timeline/parts/compositor/parts/schedulers.ts +85 -0
- package/s/timeline/parts/compositor/parts/tree-builder.ts +184 -0
- package/s/timeline/parts/compositor/parts/webcodecs-tree.ts +30 -0
- package/s/timeline/parts/compositor/playback.ts +81 -0
- package/s/timeline/parts/compositor/samplers/html.ts +115 -0
- package/s/timeline/parts/compositor/samplers/webcodecs.ts +60 -0
- package/s/timeline/parts/filmstrip.ts +159 -0
- package/s/timeline/parts/item.ts +90 -0
- package/s/timeline/parts/media.ts +35 -0
- package/s/timeline/parts/resource-pool.ts +27 -0
- package/s/timeline/parts/resource.ts +11 -0
- package/s/timeline/parts/waveform.ts +62 -0
- package/s/timeline/sugar/builders.ts +102 -0
- package/s/timeline/sugar/o.ts +150 -0
- package/s/timeline/sugar/omni-test.ts +38 -0
- package/s/timeline/sugar/omni.ts +40 -0
- package/s/timeline/types.ts +29 -0
- package/s/timeline/utils/audio-stream.ts +15 -0
- package/s/timeline/utils/checksum.ts +20 -0
- package/s/timeline/utils/datafile.ts +21 -0
- package/s/timeline/utils/dummy-data.ts +7 -0
- package/s/timeline/utils/matrix.ts +33 -0
- package/s/timeline/utils/video-cursor.ts +40 -0
- package/s/tools/common/loader.ts +26 -0
- package/s/tools/common/transformer-pipeline.ts +26 -0
- package/s/tools/speech-recognition/common/model.ts +26 -0
- package/s/tools/speech-recognition/whisper/fns/host.ts +25 -0
- package/s/tools/speech-recognition/whisper/fns/schematic.ts +23 -0
- package/s/tools/speech-recognition/whisper/fns/work.ts +91 -0
- package/s/tools/speech-recognition/whisper/parts/types.ts +38 -0
- package/s/tools/speech-recognition/whisper/parts/worker.bundle.ts +7 -0
- package/s/tools/speech-recognition/whisper/tool.ts +70 -0
- package/x/context.d.ts +4 -0
- package/x/context.js +6 -0
- package/x/context.js.map +1 -0
- package/x/demo/demo.bundle.d.ts +1 -0
- package/x/demo/demo.bundle.js +55 -0
- package/x/demo/demo.bundle.js.map +1 -0
- package/x/demo/demo.bundle.min.js +120 -0
- package/x/demo/demo.bundle.min.js.map +7 -0
- package/x/demo/demo.css +59 -0
- package/x/demo/routines/filmstrip-test.d.ts +1 -0
- package/x/demo/routines/filmstrip-test.js +62 -0
- package/x/demo/routines/filmstrip-test.js.map +1 -0
- package/x/demo/routines/load-video.d.ts +1 -0
- package/x/demo/routines/load-video.js +6 -0
- package/x/demo/routines/load-video.js.map +1 -0
- package/x/demo/routines/transcode-test.d.ts +6 -0
- package/x/demo/routines/transcode-test.js +40 -0
- package/x/demo/routines/transcode-test.js.map +1 -0
- package/x/demo/routines/transcriber-test.d.ts +4 -0
- package/x/demo/routines/transcriber-test.js +33 -0
- package/x/demo/routines/transcriber-test.js.map +1 -0
- package/x/demo/routines/transitions-test.d.ts +5 -0
- package/x/demo/routines/transitions-test.js +35 -0
- package/x/demo/routines/transitions-test.js.map +1 -0
- package/x/demo/routines/waveform-test.d.ts +1 -0
- package/x/demo/routines/waveform-test.js +11 -0
- package/x/demo/routines/waveform-test.js.map +1 -0
- package/x/driver/driver.d.ts +20 -0
- package/x/driver/driver.js +104 -0
- package/x/driver/driver.js.map +1 -0
- package/x/driver/driver.test.d.ts +5 -0
- package/x/driver/driver.test.js +12 -0
- package/x/driver/driver.test.js.map +1 -0
- package/x/driver/driver.worker.bundle.d.ts +1 -0
- package/x/driver/driver.worker.bundle.js +4 -0
- package/x/driver/driver.worker.bundle.js.map +1 -0
- package/x/driver/driver.worker.bundle.min.js +3537 -0
- package/x/driver/driver.worker.bundle.min.js.map +7 -0
- package/x/driver/fns/host.d.ts +25 -0
- package/x/driver/fns/host.js +7 -0
- package/x/driver/fns/host.js.map +1 -0
- package/x/driver/fns/schematic.d.ts +84 -0
- package/x/driver/fns/schematic.js +2 -0
- package/x/driver/fns/schematic.js.map +1 -0
- package/x/driver/fns/work.d.ts +26 -0
- package/x/driver/fns/work.js +201 -0
- package/x/driver/fns/work.js.map +1 -0
- package/x/driver/parts/constants.d.ts +2 -0
- package/x/driver/parts/constants.js +17 -0
- package/x/driver/parts/constants.js.map +1 -0
- package/x/driver/parts/machina.d.ts +23 -0
- package/x/driver/parts/machina.js +14 -0
- package/x/driver/parts/machina.js.map +1 -0
- package/x/driver/utils/load-decoder-source.d.ts +3 -0
- package/x/driver/utils/load-decoder-source.js +11 -0
- package/x/driver/utils/load-decoder-source.js.map +1 -0
- package/x/driver/utils/sleep.d.ts +1 -0
- package/x/driver/utils/sleep.js +4 -0
- package/x/driver/utils/sleep.js.map +1 -0
- package/x/features/speech/transcribe/default-spec.d.ts +2 -0
- package/x/features/speech/transcribe/default-spec.js +8 -0
- package/x/features/speech/transcribe/default-spec.js.map +1 -0
- package/x/features/speech/transcribe/parts/load-pipe.d.ts +2 -0
- package/x/features/speech/transcribe/parts/load-pipe.js +13 -0
- package/x/features/speech/transcribe/parts/load-pipe.js.map +1 -0
- package/x/features/speech/transcribe/parts/prep-audio.d.ts +5 -0
- package/x/features/speech/transcribe/parts/prep-audio.js +21 -0
- package/x/features/speech/transcribe/parts/prep-audio.js.map +1 -0
- package/x/features/speech/transcribe/parts/transcribe.d.ts +5 -0
- package/x/features/speech/transcribe/parts/transcribe.js +56 -0
- package/x/features/speech/transcribe/parts/transcribe.js.map +1 -0
- package/x/features/speech/transcribe/transcriber.d.ts +5 -0
- package/x/features/speech/transcribe/transcriber.js +33 -0
- package/x/features/speech/transcribe/transcriber.js.map +1 -0
- package/x/features/speech/transcribe/types.d.ts +66 -0
- package/x/features/speech/transcribe/types.js.map +1 -0
- package/x/features/speech/transcribe/worker.bundle.d.ts +1 -0
- package/x/features/speech/transcribe/worker.bundle.js +33 -0
- package/x/features/speech/transcribe/worker.bundle.js.map +1 -0
- package/x/features/speech/transcribe/worker.bundle.min.js +2916 -0
- package/x/features/speech/transcribe/worker.bundle.min.js.map +7 -0
- package/x/features/transition/parts/fragment.d.ts +1 -0
- package/x/features/transition/parts/fragment.js +25 -0
- package/x/features/transition/parts/fragment.js.map +1 -0
- package/x/features/transition/parts/types.d.ts +23 -0
- package/x/features/transition/parts/types.js +2 -0
- package/x/features/transition/parts/types.js.map +1 -0
- package/x/features/transition/parts/uniforms.d.ts +31 -0
- package/x/features/transition/parts/uniforms.js +27 -0
- package/x/features/transition/parts/uniforms.js.map +1 -0
- package/x/features/transition/parts/vertex.d.ts +1 -0
- package/x/features/transition/parts/vertex.js +32 -0
- package/x/features/transition/parts/vertex.js.map +1 -0
- package/x/features/transition/transition.d.ts +5 -0
- package/x/features/transition/transition.js +50 -0
- package/x/features/transition/transition.js.map +1 -0
- package/x/index.d.ts +2 -9
- package/x/index.html +115 -0
- package/x/index.html.d.ts +2 -0
- package/x/index.html.js +52 -0
- package/x/index.html.js.map +1 -0
- package/x/index.js +2 -29
- package/x/index.js.map +1 -1
- package/x/tests.test.d.ts +1 -0
- package/x/tests.test.js +6 -0
- package/x/tests.test.js.map +1 -0
- package/x/timeline/index.d.ts +11 -0
- package/x/timeline/index.js +12 -0
- package/x/timeline/index.js.map +1 -0
- package/x/timeline/parts/basics.d.ts +12 -0
- package/x/timeline/parts/basics.js +2 -0
- package/x/timeline/parts/basics.js.map +1 -0
- package/x/timeline/parts/compositor/export.d.ts +9 -0
- package/x/timeline/parts/compositor/export.js +64 -0
- package/x/timeline/parts/compositor/export.js.map +1 -0
- package/x/timeline/parts/compositor/parts/html-tree.d.ts +3 -0
- package/x/timeline/parts/compositor/parts/html-tree.js +40 -0
- package/x/timeline/parts/compositor/parts/html-tree.js.map +1 -0
- package/x/timeline/parts/compositor/parts/schedulers.d.ts +15 -0
- package/x/timeline/parts/compositor/parts/schedulers.js +64 -0
- package/x/timeline/parts/compositor/parts/schedulers.js.map +1 -0
- package/x/timeline/parts/compositor/parts/tree-builder.d.ts +37 -0
- package/x/timeline/parts/compositor/parts/tree-builder.js +147 -0
- package/x/timeline/parts/compositor/parts/tree-builder.js.map +1 -0
- package/x/timeline/parts/compositor/parts/webcodecs-tree.d.ts +3 -0
- package/x/timeline/parts/compositor/parts/webcodecs-tree.js +28 -0
- package/x/timeline/parts/compositor/parts/webcodecs-tree.js.map +1 -0
- package/x/timeline/parts/compositor/playback.d.ts +19 -0
- package/x/timeline/parts/compositor/playback.js +71 -0
- package/x/timeline/parts/compositor/playback.js.map +1 -0
- package/x/timeline/parts/compositor/samplers/html.d.ts +3 -0
- package/x/timeline/parts/compositor/samplers/html.js +106 -0
- package/x/timeline/parts/compositor/samplers/html.js.map +1 -0
- package/x/timeline/parts/compositor/samplers/webcodecs.d.ts +2 -0
- package/x/timeline/parts/compositor/samplers/webcodecs.js +55 -0
- package/x/timeline/parts/compositor/samplers/webcodecs.js.map +1 -0
- package/x/timeline/parts/filmstrip.d.ts +39 -0
- package/x/timeline/parts/filmstrip.js +117 -0
- package/x/timeline/parts/filmstrip.js.map +1 -0
- package/x/timeline/parts/item.d.ts +68 -0
- package/x/timeline/parts/item.js +16 -0
- package/x/timeline/parts/item.js.map +1 -0
- package/x/timeline/parts/media.d.ts +10 -0
- package/x/timeline/parts/media.js +30 -0
- package/x/timeline/parts/media.js.map +1 -0
- package/x/timeline/parts/resource-pool.d.ts +7 -0
- package/x/timeline/parts/resource-pool.js +19 -0
- package/x/timeline/parts/resource-pool.js.map +1 -0
- package/x/timeline/parts/resource.d.ts +8 -0
- package/x/timeline/parts/resource.js +2 -0
- package/x/timeline/parts/resource.js.map +1 -0
- package/x/timeline/parts/waveform.d.ts +8 -0
- package/x/timeline/parts/waveform.js +51 -0
- package/x/timeline/parts/waveform.js.map +1 -0
- package/x/timeline/sugar/builders.d.ts +1 -0
- package/x/timeline/sugar/builders.js +104 -0
- package/x/timeline/sugar/builders.js.map +1 -0
- package/x/timeline/sugar/o.d.ts +32 -0
- package/x/timeline/sugar/o.js +114 -0
- package/x/timeline/sugar/o.js.map +1 -0
- package/x/timeline/sugar/omni-test.d.ts +1 -0
- package/x/timeline/sugar/omni-test.js +22 -0
- package/x/timeline/sugar/omni-test.js.map +1 -0
- package/x/timeline/sugar/omni.d.ts +14 -0
- package/x/timeline/sugar/omni.js +28 -0
- package/x/timeline/sugar/omni.js.map +1 -0
- package/x/timeline/types.d.ts +24 -0
- package/x/timeline/types.js +2 -0
- package/x/timeline/types.js.map +1 -0
- package/x/timeline/utils/audio-stream.d.ts +6 -0
- package/x/timeline/utils/audio-stream.js +17 -0
- package/x/timeline/utils/audio-stream.js.map +1 -0
- package/x/timeline/utils/checksum.d.ts +8 -0
- package/x/timeline/utils/checksum.js +21 -0
- package/x/timeline/utils/checksum.js.map +1 -0
- package/x/timeline/utils/datafile.d.ts +9 -0
- package/x/timeline/utils/datafile.js +20 -0
- package/x/timeline/utils/datafile.js.map +1 -0
- package/x/timeline/utils/dummy-data.d.ts +2 -0
- package/x/timeline/utils/dummy-data.js +3 -0
- package/x/timeline/utils/dummy-data.js.map +1 -0
- package/x/timeline/utils/matrix.d.ts +8 -0
- package/x/timeline/utils/matrix.js +26 -0
- package/x/timeline/utils/matrix.js.map +1 -0
- package/x/timeline/utils/video-cursor.d.ts +10 -0
- package/x/timeline/utils/video-cursor.js +36 -0
- package/x/timeline/utils/video-cursor.js.map +1 -0
- package/x/tools/common/loader.d.ts +19 -0
- package/x/tools/common/loader.js +18 -0
- package/x/tools/common/loader.js.map +1 -0
- package/x/tools/common/transformer-pipeline.d.ts +8 -0
- package/x/tools/common/transformer-pipeline.js +24 -0
- package/x/tools/common/transformer-pipeline.js.map +1 -0
- package/x/tools/speech-recognition/common/model.d.ts +14 -0
- package/x/tools/speech-recognition/common/model.js +16 -0
- package/x/tools/speech-recognition/common/model.js.map +1 -0
- package/x/tools/speech-recognition/whisper/fns/host.d.ts +13 -0
- package/x/tools/speech-recognition/whisper/fns/host.js +19 -0
- package/x/tools/speech-recognition/whisper/fns/host.js.map +1 -0
- package/x/tools/speech-recognition/whisper/fns/schematic.d.ts +19 -0
- package/x/tools/speech-recognition/whisper/fns/schematic.js +2 -0
- package/x/tools/speech-recognition/whisper/fns/schematic.js.map +1 -0
- package/x/tools/speech-recognition/whisper/fns/work.d.ts +12 -0
- package/x/tools/speech-recognition/whisper/fns/work.js +74 -0
- package/x/tools/speech-recognition/whisper/fns/work.js.map +1 -0
- package/x/tools/speech-recognition/whisper/parts/types.d.ts +31 -0
- package/x/tools/speech-recognition/whisper/parts/types.js +2 -0
- package/x/tools/speech-recognition/whisper/parts/types.js.map +1 -0
- package/x/tools/speech-recognition/whisper/parts/worker.bundle.d.ts +1 -0
- package/x/tools/speech-recognition/whisper/parts/worker.bundle.js +4 -0
- package/x/tools/speech-recognition/whisper/parts/worker.bundle.js.map +1 -0
- package/x/tools/speech-recognition/whisper/parts/worker.bundle.min.js +8 -0
- package/x/tools/speech-recognition/whisper/parts/worker.bundle.min.js.map +7 -0
- package/x/tools/speech-recognition/whisper/tool.d.ts +12 -0
- package/x/tools/speech-recognition/whisper/tool.js +63 -0
- package/x/tools/speech-recognition/whisper/tool.js.map +1 -0
- package/s/parts/compositor.ts +0 -5
- package/s/parts/export.ts +0 -5
- package/s/parts/video-decoder.ts +0 -27
- package/s/parts/video-encoder.ts +0 -15
- package/s/tools/generate-id.ts +0 -7
- package/s/tools/mp4boxjs/LICENSE.md +0 -24
- package/s/tools/mp4boxjs/demuxer.ts +0 -106
- package/s/tools/mp4boxjs/mp4box.adapter.ts +0 -148
- package/s/tools/mp4boxjs/mp4box.js +0 -8206
- package/s/types.ts +0 -10
- package/x/parts/compositor.d.ts +0 -4
- package/x/parts/compositor.js +0 -5
- package/x/parts/compositor.js.map +0 -1
- package/x/parts/export.d.ts +0 -7
- package/x/parts/export.js +0 -5
- package/x/parts/export.js.map +0 -1
- package/x/parts/video-decoder.d.ts +0 -8
- package/x/parts/video-decoder.js +0 -20
- package/x/parts/video-decoder.js.map +0 -1
- package/x/parts/video-encoder.d.ts +0 -6
- package/x/parts/video-encoder.js +0 -12
- package/x/parts/video-encoder.js.map +0 -1
- package/x/tools/generate-id.d.ts +0 -1
- package/x/tools/generate-id.js +0 -8
- package/x/tools/generate-id.js.map +0 -1
- package/x/tools/mp4boxjs/demuxer.d.ts +0 -24
- package/x/tools/mp4boxjs/demuxer.js +0 -88
- package/x/tools/mp4boxjs/demuxer.js.map +0 -1
- package/x/tools/mp4boxjs/mp4box.adapter.d.ts +0 -128
- package/x/tools/mp4boxjs/mp4box.adapter.js +0 -11
- package/x/tools/mp4boxjs/mp4box.adapter.js.map +0 -1
- package/x/types.d.ts +0 -7
- package/x/types.js.map +0 -1
- /package/x/{types.js → features/speech/transcribe/types.js} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Machina } from "../parts/machina.js";
|
|
2
|
+
export declare const setupDriverHost: (machina: Machina) => import("@e280/comrade").SetupHost<{
|
|
3
|
+
work: {
|
|
4
|
+
hello(): Promise<void>;
|
|
5
|
+
decodeAudio(input: {
|
|
6
|
+
source: import("./schematic.js").DecoderSource;
|
|
7
|
+
audio: WritableStream<AudioData>;
|
|
8
|
+
start?: number;
|
|
9
|
+
end?: number;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
decodeVideo(input: {
|
|
12
|
+
source: import("./schematic.js").DecoderSource;
|
|
13
|
+
video: WritableStream<VideoFrame>;
|
|
14
|
+
start?: number;
|
|
15
|
+
end?: number;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
encode(input: import("./schematic.js").EncoderInput & {
|
|
18
|
+
bridge: WritableStream<StreamTargetChunk>;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
composite(input: import("./schematic.js").Composition): Promise<VideoFrame>;
|
|
21
|
+
};
|
|
22
|
+
host: {
|
|
23
|
+
world(): Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../../s/driver/fns/host.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AAIrC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,CACpD,OAAO,CAAC,IAAI,CAAkB,MAAM,CAAC,EAAE,CAAC,CAAC;IACxC,KAAK,CAAC,KAAK;QACV,OAAO,CAAC,KAAK,EAAE,CAAA;IAChB,CAAC;CACD,CAAC,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { AsSchematic } from "@e280/comrade";
|
|
2
|
+
import type { AudioEncodingConfig, StreamTargetChunk, VideoEncodingConfig } from "mediabunny";
|
|
3
|
+
import { Mat6 } from "../../timeline/utils/matrix.js";
|
|
4
|
+
export type DriverSchematic = AsSchematic<{
|
|
5
|
+
work: {
|
|
6
|
+
hello(): Promise<void>;
|
|
7
|
+
decodeAudio(input: {
|
|
8
|
+
source: DecoderSource;
|
|
9
|
+
audio: WritableStream<AudioData>;
|
|
10
|
+
start?: number;
|
|
11
|
+
end?: number;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
decodeVideo(input: {
|
|
14
|
+
source: DecoderSource;
|
|
15
|
+
video: WritableStream<VideoFrame>;
|
|
16
|
+
start?: number;
|
|
17
|
+
end?: number;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
encode(input: EncoderInput & {
|
|
20
|
+
bridge: WritableStream<StreamTargetChunk>;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
composite(input: Composition): Promise<VideoFrame>;
|
|
23
|
+
};
|
|
24
|
+
host: {
|
|
25
|
+
world(): Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
28
|
+
export interface EncoderInput {
|
|
29
|
+
video?: ReadableStream<VideoFrame>;
|
|
30
|
+
audio?: ReadableStream<AudioData>;
|
|
31
|
+
config: RenderConfig;
|
|
32
|
+
}
|
|
33
|
+
export interface RenderConfig {
|
|
34
|
+
video: VideoEncodingConfig;
|
|
35
|
+
audio: AudioEncodingConfig;
|
|
36
|
+
}
|
|
37
|
+
export type DecoderSource = Blob | string | URL;
|
|
38
|
+
export interface DecoderInput {
|
|
39
|
+
source: DecoderSource;
|
|
40
|
+
start?: number;
|
|
41
|
+
end?: number;
|
|
42
|
+
onFrame?: (frame: VideoFrame) => Promise<VideoFrame>;
|
|
43
|
+
}
|
|
44
|
+
export interface MuxOpts {
|
|
45
|
+
config: {
|
|
46
|
+
video: {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
};
|
|
50
|
+
audio?: {
|
|
51
|
+
codec: "opus" | "aac";
|
|
52
|
+
numberOfChannels: number;
|
|
53
|
+
sampleRate: number;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export type Composition = Layer | (Layer | Composition)[];
|
|
58
|
+
export type TextLayer = {
|
|
59
|
+
kind: 'text';
|
|
60
|
+
content: string;
|
|
61
|
+
fontSize?: number;
|
|
62
|
+
color?: string;
|
|
63
|
+
matrix?: Mat6;
|
|
64
|
+
};
|
|
65
|
+
export type ImageLayer = {
|
|
66
|
+
kind: 'image';
|
|
67
|
+
frame: VideoFrame;
|
|
68
|
+
matrix?: Mat6;
|
|
69
|
+
};
|
|
70
|
+
export type TransitionLayer = {
|
|
71
|
+
kind: 'transition';
|
|
72
|
+
name: string;
|
|
73
|
+
progress: number;
|
|
74
|
+
from: VideoFrame;
|
|
75
|
+
to: VideoFrame;
|
|
76
|
+
};
|
|
77
|
+
export type GapLayer = {
|
|
78
|
+
kind: 'gap';
|
|
79
|
+
};
|
|
80
|
+
export type Audio = {
|
|
81
|
+
kind: "audio";
|
|
82
|
+
data: AudioData;
|
|
83
|
+
};
|
|
84
|
+
export type Layer = TextLayer | ImageLayer | TransitionLayer | GapLayer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schematic.js","sourceRoot":"","sources":["../../../s/driver/fns/schematic.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Input } from "mediabunny";
|
|
2
|
+
import { Composition, DecoderSource } from "./schematic.js";
|
|
3
|
+
export declare const setupDriverWork: import("@e280/comrade").SetupWork<{
|
|
4
|
+
work: {
|
|
5
|
+
hello(): Promise<void>;
|
|
6
|
+
decodeAudio(input: {
|
|
7
|
+
source: DecoderSource;
|
|
8
|
+
audio: WritableStream<AudioData>;
|
|
9
|
+
start?: number;
|
|
10
|
+
end?: number;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
decodeVideo(input: {
|
|
13
|
+
source: DecoderSource;
|
|
14
|
+
video: WritableStream<VideoFrame>;
|
|
15
|
+
start?: number;
|
|
16
|
+
end?: number;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
encode(input: import("./schematic.js").EncoderInput & {
|
|
19
|
+
bridge: WritableStream<Input>;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
composite(input: Composition): Promise<VideoFrame>;
|
|
22
|
+
};
|
|
23
|
+
host: {
|
|
24
|
+
world(): Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { Comrade } from "@e280/comrade";
|
|
2
|
+
import { autoDetectRenderer, Container, Sprite, Text, Texture, DOMAdapter, WebWorkerAdapter } from "pixi.js";
|
|
3
|
+
import { Input, ALL_FORMATS, VideoSampleSink, Output, Mp4OutputFormat, VideoSampleSource, VideoSample, AudioSampleSink, AudioSampleSource, AudioSample, StreamTarget, BlobSource, UrlSource } from "mediabunny";
|
|
4
|
+
import { mat6ToMatrix } from "../../timeline/utils/matrix.js";
|
|
5
|
+
import { makeTransition } from "../../features/transition/transition.js";
|
|
6
|
+
DOMAdapter.set(WebWorkerAdapter);
|
|
7
|
+
const loadSource = async (source) => {
|
|
8
|
+
if (source instanceof Blob) {
|
|
9
|
+
return new BlobSource(source);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return new UrlSource(source);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export const setupDriverWork = (Comrade.work(shell => ({
|
|
16
|
+
async hello() {
|
|
17
|
+
await shell.host.world();
|
|
18
|
+
},
|
|
19
|
+
async decodeAudio({ source, audio, start, end }) {
|
|
20
|
+
const input = new Input({
|
|
21
|
+
source: await loadSource(source),
|
|
22
|
+
formats: ALL_FORMATS
|
|
23
|
+
});
|
|
24
|
+
const audioTrack = await input.getPrimaryAudioTrack();
|
|
25
|
+
const audioDecodable = await audioTrack?.canDecode();
|
|
26
|
+
const audioWriter = audio.getWriter();
|
|
27
|
+
if (audioDecodable && audioTrack) {
|
|
28
|
+
const sink = new AudioSampleSink(audioTrack);
|
|
29
|
+
for await (const sample of sink.samples(start, end)) {
|
|
30
|
+
const frame = sample.toAudioData();
|
|
31
|
+
await audioWriter.write(frame);
|
|
32
|
+
sample.close();
|
|
33
|
+
frame.close();
|
|
34
|
+
}
|
|
35
|
+
await audioWriter.close();
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
async decodeVideo({ source, video, start, end }) {
|
|
39
|
+
const input = new Input({
|
|
40
|
+
source: await loadSource(source),
|
|
41
|
+
formats: ALL_FORMATS
|
|
42
|
+
});
|
|
43
|
+
const videoTrack = await input.getPrimaryVideoTrack();
|
|
44
|
+
const videoDecodable = await videoTrack?.canDecode();
|
|
45
|
+
const videoWriter = video.getWriter();
|
|
46
|
+
if (videoDecodable && videoTrack) {
|
|
47
|
+
const sink = new VideoSampleSink(videoTrack);
|
|
48
|
+
for await (const sample of sink.samples(start, end)) {
|
|
49
|
+
const frame = sample.toVideoFrame();
|
|
50
|
+
await videoWriter.write(frame);
|
|
51
|
+
sample.close();
|
|
52
|
+
frame.close();
|
|
53
|
+
}
|
|
54
|
+
await videoWriter.close();
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
async encode({ video, audio, config, bridge }) {
|
|
58
|
+
const output = new Output({
|
|
59
|
+
format: new Mp4OutputFormat(),
|
|
60
|
+
target: new StreamTarget(bridge, { chunked: true })
|
|
61
|
+
});
|
|
62
|
+
// since AudioSample is not transferable it fails to transfer encoder bitrate config
|
|
63
|
+
// so it needs to be hardcoded not set through constants eg QUALITY_LOW
|
|
64
|
+
const promises = [];
|
|
65
|
+
if (video) {
|
|
66
|
+
const videoSource = new VideoSampleSource(config.video);
|
|
67
|
+
output.addVideoTrack(videoSource);
|
|
68
|
+
const videoReader = video.getReader();
|
|
69
|
+
promises.push((async () => {
|
|
70
|
+
while (true) {
|
|
71
|
+
const { done, value } = await videoReader.read();
|
|
72
|
+
if (done)
|
|
73
|
+
break;
|
|
74
|
+
const sample = new VideoSample(value);
|
|
75
|
+
await videoSource.add(sample);
|
|
76
|
+
sample.close();
|
|
77
|
+
}
|
|
78
|
+
})());
|
|
79
|
+
}
|
|
80
|
+
if (audio) {
|
|
81
|
+
const audioSource = new AudioSampleSource(config.audio);
|
|
82
|
+
output.addAudioTrack(audioSource);
|
|
83
|
+
const audioReader = audio.getReader();
|
|
84
|
+
promises.push((async () => {
|
|
85
|
+
while (true) {
|
|
86
|
+
const { done, value } = await audioReader.read();
|
|
87
|
+
if (done)
|
|
88
|
+
break;
|
|
89
|
+
const sample = new AudioSample(value);
|
|
90
|
+
await audioSource.add(sample);
|
|
91
|
+
sample.close();
|
|
92
|
+
value.close();
|
|
93
|
+
}
|
|
94
|
+
})());
|
|
95
|
+
}
|
|
96
|
+
await output.start();
|
|
97
|
+
await Promise.all(promises);
|
|
98
|
+
await output.finalize();
|
|
99
|
+
},
|
|
100
|
+
async composite(composition) {
|
|
101
|
+
const { stage, renderer } = await renderPIXI(1920, 1080);
|
|
102
|
+
stage.removeChildren();
|
|
103
|
+
const { dispose } = await renderLayer(composition, stage);
|
|
104
|
+
renderer.render(stage);
|
|
105
|
+
// make sure browser support webgl/webgpu otherwise it might take much longer to construct frame
|
|
106
|
+
// if its very slow on eg edge try chrome
|
|
107
|
+
const frame = new VideoFrame(renderer.canvas, {
|
|
108
|
+
timestamp: 0,
|
|
109
|
+
duration: 0,
|
|
110
|
+
});
|
|
111
|
+
renderer.clear();
|
|
112
|
+
dispose();
|
|
113
|
+
shell.transfer = [frame];
|
|
114
|
+
return frame;
|
|
115
|
+
}
|
|
116
|
+
})));
|
|
117
|
+
// TODO suspicious global, probably bad
|
|
118
|
+
let pixi = null;
|
|
119
|
+
async function renderPIXI(width, height) {
|
|
120
|
+
if (pixi)
|
|
121
|
+
return pixi;
|
|
122
|
+
const renderer = await autoDetectRenderer({
|
|
123
|
+
width,
|
|
124
|
+
height,
|
|
125
|
+
preference: "webgl", // webgl and webgl2 causes memory leaks on chrome
|
|
126
|
+
background: "black",
|
|
127
|
+
preferWebGLVersion: 2
|
|
128
|
+
});
|
|
129
|
+
const stage = new Container();
|
|
130
|
+
pixi = { renderer, stage };
|
|
131
|
+
return pixi;
|
|
132
|
+
}
|
|
133
|
+
const transitions = new Map();
|
|
134
|
+
async function renderLayer(layer, parent) {
|
|
135
|
+
if (Array.isArray(layer)) {
|
|
136
|
+
const disposers = [];
|
|
137
|
+
for (const child of layer) {
|
|
138
|
+
const result = await renderLayer(child, parent);
|
|
139
|
+
disposers.push(result.dispose);
|
|
140
|
+
}
|
|
141
|
+
return { dispose: () => disposers.forEach(d => d()) };
|
|
142
|
+
}
|
|
143
|
+
switch (layer.kind) {
|
|
144
|
+
case 'text':
|
|
145
|
+
return renderTextLayer(layer, parent);
|
|
146
|
+
case 'image':
|
|
147
|
+
return renderImageLayer(layer, parent);
|
|
148
|
+
case 'transition':
|
|
149
|
+
return renderTransitionLayer(layer, parent);
|
|
150
|
+
case 'gap': {
|
|
151
|
+
pixi?.renderer.clear();
|
|
152
|
+
return { dispose: () => { } };
|
|
153
|
+
}
|
|
154
|
+
default:
|
|
155
|
+
console.warn('Unknown layer kind', layer.kind);
|
|
156
|
+
return { dispose: () => { } };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function renderTextLayer(layer, parent) {
|
|
160
|
+
const text = new Text({
|
|
161
|
+
text: layer.content,
|
|
162
|
+
style: {
|
|
163
|
+
fontFamily: 'sans-serif',
|
|
164
|
+
fontSize: layer.fontSize ?? 48,
|
|
165
|
+
fill: layer.color ?? 'white'
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
applyTransform(text, layer.matrix);
|
|
169
|
+
parent.addChild(text);
|
|
170
|
+
return { dispose: () => text.destroy(true) };
|
|
171
|
+
}
|
|
172
|
+
function renderImageLayer(layer, parent) {
|
|
173
|
+
const texture = Texture.from(layer.frame);
|
|
174
|
+
const sprite = new Sprite(texture);
|
|
175
|
+
applyTransform(sprite, layer.matrix);
|
|
176
|
+
parent.addChild(sprite);
|
|
177
|
+
return { dispose: () => {
|
|
178
|
+
sprite.destroy(true);
|
|
179
|
+
texture.destroy(true);
|
|
180
|
+
layer.frame.close();
|
|
181
|
+
} };
|
|
182
|
+
}
|
|
183
|
+
function renderTransitionLayer({ from, to, progress, name }, parent) {
|
|
184
|
+
const transition = transitions.get(name) ??
|
|
185
|
+
(transitions.set(name, makeTransition({
|
|
186
|
+
name: "circle",
|
|
187
|
+
renderer: pixi.renderer
|
|
188
|
+
})),
|
|
189
|
+
transitions.get(name));
|
|
190
|
+
const texture = transition.render({ from, to, progress, width: from.displayWidth, height: from.displayHeight });
|
|
191
|
+
const sprite = new Sprite(texture);
|
|
192
|
+
parent.addChild(sprite);
|
|
193
|
+
return { dispose: () => sprite.destroy(false) };
|
|
194
|
+
}
|
|
195
|
+
function applyTransform(target, worldMatrix) {
|
|
196
|
+
if (!worldMatrix)
|
|
197
|
+
return;
|
|
198
|
+
const mx = mat6ToMatrix(worldMatrix);
|
|
199
|
+
target.setFromMatrix(mx);
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=work.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work.js","sourceRoot":"","sources":["../../../s/driver/fns/work.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AACrC,OAAO,EAAC,kBAAkB,EAAE,SAAS,EAAY,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAC5H,OAAO,EAAC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1280,
|
|
6
|
+
height: 720,
|
|
7
|
+
bitrate: 9_000_000, // 9 Mbps
|
|
8
|
+
framerate: 60,
|
|
9
|
+
bitrateMode: "variable",
|
|
10
|
+
hardwareAcceleration: "no-preference" // prefer-hardware seems like 2x slower from what i been testing
|
|
11
|
+
};
|
|
12
|
+
export const audioEncoderDefaultConfig = {
|
|
13
|
+
codec: "opus",
|
|
14
|
+
numberOfChannels: 2,
|
|
15
|
+
sampleRate: 44100
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../s/driver/parts/constants.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAuB;IACvD,KAAK,EAAE,aAAa;IACpB,GAAG,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC;IACvB,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,SAAS,EAAE,SAAS;IAC7B,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,UAAU;IACvB,oBAAoB,EAAE,eAAe,CAAC,gEAAgE;CACtG,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAuB;IAC5D,KAAK,EAAE,MAAM;IACb,gBAAgB,EAAE,CAAC;IACnB,UAAU,EAAE,KAAK;CACjB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WebMediaInfo } from "web-demuxer";
|
|
2
|
+
type Events = {
|
|
3
|
+
type: "config";
|
|
4
|
+
config: {
|
|
5
|
+
audio: AudioDecoderConfig;
|
|
6
|
+
video: VideoDecoderConfig;
|
|
7
|
+
};
|
|
8
|
+
} | {
|
|
9
|
+
type: "info";
|
|
10
|
+
data: WebMediaInfo;
|
|
11
|
+
} | {
|
|
12
|
+
type: "encoderQueueSize";
|
|
13
|
+
size: number;
|
|
14
|
+
};
|
|
15
|
+
type Handler = (event: Events) => void;
|
|
16
|
+
export declare class Machina {
|
|
17
|
+
#private;
|
|
18
|
+
count: number;
|
|
19
|
+
register(id: number, handler: Handler): void;
|
|
20
|
+
unregister(id: number): void;
|
|
21
|
+
dispatch(id: number, event: Events): void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class Machina {
|
|
2
|
+
count = 0;
|
|
3
|
+
#handlers = new Map();
|
|
4
|
+
register(id, handler) {
|
|
5
|
+
this.#handlers.set(id, handler);
|
|
6
|
+
}
|
|
7
|
+
unregister(id) {
|
|
8
|
+
this.#handlers.delete(id);
|
|
9
|
+
}
|
|
10
|
+
dispatch(id, event) {
|
|
11
|
+
this.#handlers.get(id)?.(event);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=machina.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machina.js","sourceRoot":"","sources":["../../../s/driver/parts/machina.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,OAAO;IACnB,KAAK,GAAG,CAAC,CAAA;IAET,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAA;IAEtC,QAAQ,CAAC,EAAU,EAAE,OAAgB;QACpC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;IAED,UAAU,CAAC,EAAU;QACpB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,KAAa;QACjC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlobSource, UrlSource } from "mediabunny";
|
|
2
|
+
// only streamable sources
|
|
3
|
+
export async function loadDecoderSource(source) {
|
|
4
|
+
if (source instanceof Blob) {
|
|
5
|
+
return new BlobSource(source);
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
return new UrlSource(source);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=load-decoder-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-decoder-source.js","sourceRoot":"","sources":["../../../s/driver/utils/load-decoder-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,YAAY,CAAA;AAGhD,0BAA0B;AAC1B,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAqB;IAC5D,IAAG,MAAM,YAAY,IAAI,EAAE,CAAC;QAC3B,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAA;IAC9B,CAAC;SAAM,CAAC;QACP,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../../s/driver/utils/sleep.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,EAAU;IAC/B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-spec.js","sourceRoot":"","sources":["../../../../s/features/speech/transcribe/default-spec.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAoB,EAAE,CAAC,CAAC;IAC7D,KAAK,EAAE,yCAAyC;IAChD,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,CAAC;CACf,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { pipeline } from "@huggingface/transformers";
|
|
2
|
+
export async function loadPipe(options) {
|
|
3
|
+
const { spec, onLoading } = options;
|
|
4
|
+
const pipe = await pipeline("automatic-speech-recognition", spec.model, {
|
|
5
|
+
device: spec.device,
|
|
6
|
+
dtype: spec.dtype,
|
|
7
|
+
progress_callback: (data) => {
|
|
8
|
+
onLoading({ total: data.total, progress: data.progress });
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
return pipe;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=load-pipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-pipe.js","sourceRoot":"","sources":["../../../../../s/features/speech/transcribe/parts/load-pipe.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,2BAA2B,CAAA;AAIlD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAA+B;IAC7D,MAAM,EAAC,IAAI,EAAE,SAAS,EAAC,GAAG,OAAO,CAAA;IAEjC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,8BAA8B,EAAE,IAAI,CAAC,KAAK,EAAE;QACvE,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,iBAAiB,EAAE,CAAC,IAAS,EAAE,EAAE;YAChC,SAAS,CAAC,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAC,CAAC,CAAA;QACxD,CAAC;KACD,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export async function prepAudio(driver, source) {
|
|
2
|
+
const arrayBuffer = await source.arrayBuffer();
|
|
3
|
+
const audioCTX = new AudioContext({ sampleRate: 16000 });
|
|
4
|
+
const audioData = await audioCTX.decodeAudioData(arrayBuffer);
|
|
5
|
+
let audio;
|
|
6
|
+
if (audioData.numberOfChannels === 2) {
|
|
7
|
+
const SCALING_FACTOR = Math.sqrt(2);
|
|
8
|
+
const left = audioData.getChannelData(0);
|
|
9
|
+
const right = audioData.getChannelData(1);
|
|
10
|
+
audio = new Float32Array(left.length);
|
|
11
|
+
for (let i = 0; i < audioData.length; ++i) {
|
|
12
|
+
audio[i] = (SCALING_FACTOR * (left[i] + right[i])) / 2;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
audio = audioData.getChannelData(0);
|
|
17
|
+
}
|
|
18
|
+
const duration = await driver.getAudioDuration(source);
|
|
19
|
+
return { audio, duration };
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=prep-audio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prep-audio.js","sourceRoot":"","sources":["../../../../../s/features/speech/transcribe/parts/prep-audio.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAc,EAAE,MAAY;IAC3D,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAA;IAC9C,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC,CAAA;IACtD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;IAC7D,IAAI,KAAmB,CAAA;IACvB,IAAI,SAAS,CAAC,gBAAgB,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACnC,MAAM,IAAI,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAA;QACxC,MAAM,KAAK,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAA;QACzC,KAAK,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YAC3C,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACvD,CAAC;IACF,CAAC;SAAM,CAAC;QACP,KAAK,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAA;IACpC,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACtD,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { WhisperTextStreamer } from "@huggingface/transformers";
|
|
2
|
+
export async function transcribe(options) {
|
|
3
|
+
const { pipe, spec, request, callbacks } = options;
|
|
4
|
+
if (!pipe.processor.feature_extractor)
|
|
5
|
+
throw new Error("no feature_extractor");
|
|
6
|
+
const timePrecision = (pipe.processor.feature_extractor?.config.chunk_length /
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
pipe.model.config.max_source_positions);
|
|
9
|
+
let chunkCount = 0;
|
|
10
|
+
let startTime = null;
|
|
11
|
+
let tokenCount = 0;
|
|
12
|
+
let tokensPerSecond = 0;
|
|
13
|
+
const chunkDuration = spec.chunkLength - spec.strideLength;
|
|
14
|
+
const calculateProgress = () => {
|
|
15
|
+
const audioProgressSeconds = chunkCount * chunkDuration;
|
|
16
|
+
return Math.min(audioProgressSeconds / request.duration, 1);
|
|
17
|
+
};
|
|
18
|
+
// TODO type error on pipe.tokenizer
|
|
19
|
+
const tokenizer = pipe.tokenizer;
|
|
20
|
+
const streamer = new WhisperTextStreamer(tokenizer, {
|
|
21
|
+
time_precision: timePrecision,
|
|
22
|
+
token_callback_function: () => {
|
|
23
|
+
startTime ??= performance.now();
|
|
24
|
+
if (++tokenCount > 1) {
|
|
25
|
+
tokensPerSecond = (tokenCount / (performance.now() - startTime)) * 1000;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
callback_function: (textChunk) => {
|
|
29
|
+
// TODO
|
|
30
|
+
callbacks.onTranscription(textChunk);
|
|
31
|
+
callbacks.onReport({ tokensPerSecond, progress: calculateProgress() });
|
|
32
|
+
},
|
|
33
|
+
on_finalize: () => {
|
|
34
|
+
startTime = null;
|
|
35
|
+
tokenCount = 0;
|
|
36
|
+
chunkCount++;
|
|
37
|
+
callbacks.onReport({ tokensPerSecond, progress: calculateProgress() });
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const result = await pipe(new Float32Array(request.audio), {
|
|
41
|
+
top_k: 0,
|
|
42
|
+
do_sample: false,
|
|
43
|
+
chunk_length_s: spec.chunkLength,
|
|
44
|
+
stride_length_s: spec.strideLength,
|
|
45
|
+
language: request.language,
|
|
46
|
+
task: "transcribe",
|
|
47
|
+
return_timestamps: "word", // if using "word" the on_chunk_start & end is not called thus we cant retrieve timestamps, only after whole thing finishes
|
|
48
|
+
force_full_sequences: false,
|
|
49
|
+
streamer,
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
text: result.text,
|
|
53
|
+
chunks: result.chunks
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=transcribe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcribe.js","sourceRoot":"","sources":["../../../../../s/features/speech/transcribe/parts/transcribe.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAA;AAG7D,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAA0B;IAC1D,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAC,GAAG,OAAO,CAAA;IAEhD,IAAI,CAAC,IAAI,CAAC,SAAS,CAA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,EAAC,CAAC,CAAA;QACrE,CAAC;QACD,WAAW,EAAE,GAAG,EAAE;YACjB,SAAS,GAAG,IAAI,CAAA;YAChB,UAAU,GAAG,CAAC,CAAA;YACd,UAAU,EAAE,CAAA;YACZ,SAAS,CAAC,QAAQ,CAAC,EAAC,eAAe,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAC,CAAC,CAAA;QACrE,CAAC;KACD,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAC1D,KAAK,EAAE,CAAC;QACR,SAAS,EAAE,KAAK;QAChB,cAAc,EAAE,IAAI,CAAC,WAAW;QAChC,eAAe,EAAE,IAAI,CAAC,YAAY;QAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,IAAI,EAAE,YAAY;QAClB,iBAAiB,EAAE,MAAM,EAAE,2HAA2H;QACtJ,oBAAoB,EAAE,KAAK;QAC3B,QAAQ;KACR,CAAC,CAAA;IAEF,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM;KACrB,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TranscriberOptions, TranscriptionOptions } from "./types.js";
|
|
2
|
+
export declare function makeTranscriber({ driver, spec, workerUrl, onLoading }: TranscriberOptions): Promise<{
|
|
3
|
+
transcribe: (info: TranscriptionOptions) => Promise<import("./types.js").Transcription>;
|
|
4
|
+
dispose: void;
|
|
5
|
+
}>;
|