speechflow 0.9.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.
@@ -0,0 +1,37 @@
1
+ /*
2
+ ** SpeechFlow - Speech Processing Flow Graph
3
+ ** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
+ ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
5
+ */
6
+
7
+ {
8
+ "formatter": {
9
+ "enabled": false
10
+ },
11
+ "organizeImports": {
12
+ "enabled": false
13
+ },
14
+ "linter": {
15
+ "enabled": true,
16
+ "rules": {
17
+ "style": {
18
+ "noNonNullAssertion": "off",
19
+ "useImportType": "off",
20
+ "noParameterAssign": "off",
21
+ "noUselessElse": "off",
22
+ "useExponentiationOperator": "off",
23
+ "useTemplate": "off"
24
+ },
25
+ "complexity": {
26
+ "noStaticOnlyClass": "off",
27
+ "noForEach": "off"
28
+ },
29
+ "suspicious": {
30
+ "noExplicitAny": "off",
31
+ "noAssignInExpressions": "off",
32
+ "useValidTypeof": "off"
33
+ }
34
+ }
35
+ }
36
+ }
37
+
package/etc/eslint.mjs ADDED
@@ -0,0 +1,95 @@
1
+ /*
2
+ ** SpeechFlow - Speech Processing Flow Graph
3
+ ** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
+ ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
5
+ */
6
+
7
+ import pluginJs from "@eslint/js"
8
+ import pluginStd from "neostandard"
9
+ import pluginN from "eslint-plugin-n"
10
+ import pluginImport from "eslint-plugin-import"
11
+ import pluginPromise from "eslint-plugin-promise"
12
+ import pluginTS from "typescript-eslint"
13
+ import globals from "globals"
14
+ import parserTS from "@typescript-eslint/parser"
15
+ import oxlint from "eslint-plugin-oxlint"
16
+ import biome from "eslint-config-biome"
17
+
18
+ export default [
19
+ pluginJs.configs.recommended,
20
+ ...pluginTS.configs.strict,
21
+ ...pluginTS.configs.stylistic,
22
+ ...pluginStd({
23
+ ignores: pluginStd.resolveIgnoresFromGitignore()
24
+ }),
25
+ {
26
+ plugins: {
27
+ "n": pluginN,
28
+ "import": pluginImport,
29
+ "promise": pluginPromise
30
+ },
31
+ files: [ "**/*.ts" ],
32
+ ignores: [ "dst/" ],
33
+ languageOptions: {
34
+ ecmaVersion: 2022,
35
+ sourceType: "module",
36
+ parser: parserTS,
37
+ parserOptions: {
38
+ parser: parserTS,
39
+ extraFileExtensions: [],
40
+ ecmaFeatures: {
41
+ jsx: false
42
+ }
43
+ },
44
+ globals: {
45
+ ...globals.browser,
46
+ ...globals.node,
47
+ ...globals.commonjs,
48
+ ...globals.worker,
49
+ ...globals.serviceworker,
50
+ "BufferEncoding": "readonly"
51
+ }
52
+ },
53
+ rules: {
54
+ "curly": "off",
55
+ "require-atomic-updates": "off",
56
+ "dot-notation": "off",
57
+ "no-labels": "off",
58
+ "no-useless-constructor": "off",
59
+ "no-dupe-class-members": "off",
60
+ "valid-typeof": "off",
61
+
62
+ "@stylistic/indent": [ "error", 4, { SwitchCase: 1 } ],
63
+ "@stylistic/linebreak-style": [ "error", "unix" ],
64
+ "@stylistic/semi": [ "error", "never" ],
65
+ "@stylistic/operator-linebreak": [ "error", "after", { overrides: { "&&": "before", "||": "before", ":": "after" } } ],
66
+ "@stylistic/brace-style": [ "error", "stroustrup", { allowSingleLine: true } ],
67
+ "@stylistic/quotes": [ "error", "double" ],
68
+
69
+ "@stylistic/no-multi-spaces": "off",
70
+ "@stylistic/no-multiple-empty-lines": "off",
71
+ "@stylistic/key-spacing": "off",
72
+ "@stylistic/object-property-newline": "off",
73
+ "@stylistic/space-in-parens": "off",
74
+ "@stylistic/array-bracket-spacing": "off",
75
+ "@stylistic/lines-between-class-members": "off",
76
+ "@stylistic/multiline-ternary": "off",
77
+ "@stylistic/quote-props": "off",
78
+
79
+ "@typescript-eslint/no-empty-function": "off",
80
+ "@typescript-eslint/no-explicit-any": "off",
81
+ "@typescript-eslint/no-unused-vars": "off",
82
+ "@typescript-eslint/ban-ts-comment": "off",
83
+ "@typescript-eslint/no-this-alias": "off",
84
+ "@typescript-eslint/no-non-null-assertion": "off",
85
+ "@typescript-eslint/consistent-type-definitions": "off",
86
+ "@typescript-eslint/array-type": "off",
87
+ "@typescript-eslint/no-extraneous-class": "off",
88
+ "@typescript-eslint/consistent-indexed-object-style": "off",
89
+ "@typescript-eslint/adjacent-overload-signatures": "off"
90
+ }
91
+ },
92
+ ...oxlint.buildFromOxlintConfigFile("etc/oxlint.jsonc"),
93
+ biome
94
+ ]
95
+
package/etc/nps.yaml ADDED
@@ -0,0 +1,40 @@
1
+ ##
2
+ ## SpeechFlow - Speech Processing Flow Graph
3
+ ## Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
+ ## Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
5
+ ##
6
+
7
+ scripts:
8
+ # multiview-style development dashboard
9
+ dev: >
10
+ stmux -w always -m beep -e "built.in.+ms" --
11
+ [ -s 40% "npm start lint-watch" :
12
+ -s 40% "npm start build-watch" :
13
+ -s 20% "npm start server-delay server-dev-watch" ]
14
+
15
+ # static code analysis (linting)
16
+ lint-watch: nodemon --exec "npm start lint" --watch src --ext ts
17
+ lint: npm start lint-tsc lint-oxlint lint-biome lint-eslint
18
+ lint-tsc: tsc --project etc/tsconfig.json --noEmit
19
+ lint-oxlint: oxlint --config etc/oxlint.jsonc src/**/*.ts
20
+ lint-biome: biome lint --diagnostic-level=warn --config-path=etc/biome.jsonc src/*.ts
21
+ lint-eslint: eslint --config etc/eslint.mjs src/**/*.ts
22
+
23
+ # code compilation/transpiling (building)
24
+ build: tsc --project etc/tsconfig.json
25
+ build-watch: nodemon --exec "npm start build" --watch src --ext ts
26
+
27
+ # start server run-time
28
+ server-delay: delay 2.0
29
+ server-dev-watch: >
30
+ cross-env NODE_OPTIONS="--enable-source-maps"
31
+ nodemon --exec "npm start server" --watch src --ext ts --delay 1.0
32
+ server: >
33
+ node --env-file=.env dst/speechflow.js -v debug -c sample@sample.yaml
34
+ server-dev: node --env-file=.env -r ts-node/register --watch src/speechflow.ts -v debug -c sample@sample.yaml
35
+ server-prd: node --env-file=.env -r ts-node/register src/speechflow.ts -v info -c sample@sample.yaml
36
+
37
+ # cleanup filesystem
38
+ clean: rimraf dst
39
+ clean-dist: rimraf dst node_modules
40
+
@@ -0,0 +1,20 @@
1
+ /*
2
+ ** SpeechFlow - Speech Processing Flow Graph
3
+ ** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
+ ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
5
+ */
6
+
7
+ {
8
+ "plugins": [
9
+ "typescript",
10
+ "unicorn",
11
+ "nextjs",
12
+ "import",
13
+ "promise",
14
+ "oxc"
15
+ ],
16
+ "rules": {
17
+ "no-unused-vars": "off"
18
+ }
19
+ }
20
+
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "../dst",
4
+ "target": "es2024",
5
+ "module": "nodenext",
6
+ "moduleResolution": "nodenext",
7
+ "useDefineForClassFields": true,
8
+ "composite": false,
9
+ "strict": true,
10
+ "jsx": "preserve",
11
+ "resolveJsonModule": true,
12
+ "isolatedModules": true,
13
+ "esModuleInterop": true,
14
+ "lib": [ "es2022" ],
15
+ "skipLibCheck": true,
16
+ "noEmit": false,
17
+ "types": [ "node" ],
18
+ "rootDir": "../src"
19
+ },
20
+ "include": [
21
+ "../src/**/*.ts"
22
+ ]
23
+ }
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "speechflow",
3
+ "version": "0.9.0",
4
+ "x-stdver": "0.9.0-EA",
5
+ "x-release": "2025-04-26",
6
+ "homepage": "https://github.com/rse/speechflow",
7
+ "description": "Speech Processing Flow Graph",
8
+ "license": "GPL-3.0-only",
9
+ "author": {
10
+ "name": "Dr. Ralf S. Engelschall",
11
+ "email": "rse@engelschall.com",
12
+ "url": "http://engelschall.com"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/rse/speechflow"
17
+ },
18
+ "dependencies": {
19
+ "cli-io": "0.9.13",
20
+ "yargs": "17.7.2",
21
+ "flowlink": "0.9.9",
22
+ "js-yaml": "4.1.0",
23
+ "@gpeng/naudiodon": "2.4.0",
24
+ "@deepgram/sdk": "3.12.1",
25
+ "deepl-node": "1.17.3",
26
+ "elevenlabs": "1.57.0",
27
+ "stream-transform": "3.3.3",
28
+ "get-stream": "6.0.1",
29
+ "speex-resampler": "3.0.1",
30
+ "pcm-convert": "1.6.5",
31
+ "object-path": "0.11.8",
32
+ "ws": "8.18.1",
33
+ "bufferutil": "4.0.9",
34
+ "utf-8-validate": "6.0.5",
35
+ "@opensumi/reconnecting-websocket": "4.4.0",
36
+ "get-stream": "9.0.1"
37
+ },
38
+ "devDependencies": {
39
+ "eslint": "9.25.1",
40
+ "@eslint/js": "9.25.1",
41
+ "neostandard": "0.12.1",
42
+ "eslint-plugin-promise": "7.2.1",
43
+ "eslint-plugin-import": "2.31.0",
44
+ "eslint-plugin-node": "11.1.0",
45
+ "@typescript-eslint/eslint-plugin": "8.31.0",
46
+ "@typescript-eslint/parser": "8.31.0",
47
+ "oxlint": "0.16.7",
48
+ "eslint-plugin-oxlint": "0.16.7",
49
+ "@biomejs/biome": "1.9.4",
50
+ "eslint-config-biome": "1.9.4",
51
+
52
+ "@types/node": "22.15.2",
53
+ "@types/yargs": "17.0.33",
54
+ "@types/js-yaml": "4.0.9",
55
+ "@types/object-path": "0.11.4",
56
+ "@types/ws": "8.18.1",
57
+
58
+ "ts-node": "10.9.2",
59
+ "stmux": "1.8.10",
60
+ "patch-package": "8.0.0",
61
+ "nodemon": "3.1.10",
62
+ "rimraf": "6.0.1",
63
+ "typescript": "5.8.3",
64
+ "delay-cli": "2.0.0",
65
+ "nps": "5.10.0",
66
+ "cross-env": "7.0.3"
67
+ },
68
+ "upd": [ "!get-stream" ],
69
+ "engines": {
70
+ "node": ">=20.6.0"
71
+ },
72
+ "main": "dst/speechflow.js",
73
+ "scripts": {
74
+ "start": "nps -c etc/nps.yaml"
75
+ }
76
+ }
package/sample.yaml ADDED
@@ -0,0 +1,32 @@
1
+ ##
2
+ ## sample.yaml -- Speechflow Sample Audio Processing Graphs
3
+ ##
4
+
5
+ # capture audio from microphone to file
6
+ capture-microphone: |
7
+ device(device: "wasapi:VoiceMeeter Output", mode: "r") |
8
+ file(path: "capture.pcm", mode: "w", type: "audio")
9
+
10
+ # generate audio file with narration of text file
11
+ generate-narration: |
12
+ file(path: argv.0, mode: "r", type: "audio") |
13
+ deepgram(key: env.SPEECHFLOW_KEY_DEEPGRAM) |
14
+ file(path: argv.1, mode: "w", type: "text")
15
+
16
+ # pass-through audio from microphone to speaker and in parallel record it to file
17
+ microphone-to-speaker: |
18
+ device(device: "wasapi:VoiceMeeter Output", mode: "r") | {
19
+ file(path: "capture.pcm", mode: "w", type: "audio"),
20
+ device(device: "wasapi:VoiceMeeter VAIO3 Input", mode: "w")
21
+ }
22
+
23
+ # translate stdin to stdout
24
+ translation: |
25
+ file(path: "-", mode: "r", type: "text") |
26
+ deepl(key: env.SPEECHFLOW_KEY_DEEPL, src: "de", dst: "en-US") |
27
+ file(path: "-", mode: "w", type: "text")
28
+
29
+ sample: |
30
+ device(device: "wasapi:Voicemeeter Out B1", mode: "r") |
31
+ file(path: "capture.pcm", mode: "w", type: "audio")
32
+
package/src/lib.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ /*
2
+ ** SpeechFlow - Speech Processing Flow Graph
3
+ ** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
+ ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
5
+ */
6
+
7
+ declare module "pcm-convert" {
8
+ interface Format {
9
+ dtype: string
10
+ channels: number
11
+ interleaved: boolean
12
+ endianness: string
13
+ }
14
+ export default function pcmconvert (
15
+ data: Buffer,
16
+ srcFormat: Format,
17
+ dstFormat: Format
18
+ ): Buffer
19
+ }
20
+