{"id":23908194,"url":"https://github.com/jacoblincool/smart-whisper","last_synced_at":"2025-04-11T07:45:59.524Z","repository":{"id":215525075,"uuid":"739129211","full_name":"JacobLinCool/smart-whisper","owner":"JacobLinCool","description":"Smart Whisper is a native Node.js addon designed for efficient and streamlined interaction with the whisper.cpp, with automatic model offloading and model manager.","archived":false,"fork":false,"pushed_at":"2024-04-22T17:01:32.000Z","size":320,"stargazers_count":13,"open_issues_count":14,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-23T14:05:32.153Z","etag":null,"topics":["nodejs","transcription","whisper","whisper-cpp"],"latest_commit_sha":null,"homepage":"http://jacoblin.cool/smart-whisper/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JacobLinCool.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-04T20:54:35.000Z","updated_at":"2024-04-30T00:43:24.385Z","dependencies_parsed_at":"2024-02-24T15:24:40.442Z","dependency_job_id":"a5142f13-1f0f-498c-8643-705deb60a8a7","html_url":"https://github.com/JacobLinCool/smart-whisper","commit_stats":null,"previous_names":["jacoblincool/smart-whisper"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2Fsmart-whisper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2Fsmart-whisper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2Fsmart-whisper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2Fsmart-whisper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JacobLinCool","download_url":"https://codeload.github.com/JacobLinCool/smart-whisper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248359398,"owners_count":21090522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","transcription","whisper","whisper-cpp"],"created_at":"2025-01-05T04:26:44.833Z","updated_at":"2025-04-11T07:45:59.494Z","avatar_url":"https://github.com/JacobLinCool.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smart-whisper\n\nSmart-Whisper is a native Node.js addon designed for efficient and streamlined interaction with the [whisper.cpp](https://github.com/ggerganov/whisper.cpp), with automatic model offloading and reloading and model manager.\n\n## Features\n\n- **Node.js Native Addon Interaction**: Directly interact with whisper.cpp, ensuring fast and efficient processing.\n- **Single Model Load for Multiple Inferences**: Load the model once and perform multiple and parallel inferences, optimizing resource usage and reducing load times.\n- **Automatic Model Offloading and Reloading**: Manages memory effectively by automatically offloading and reloading models as needed.\n- **Model Manager**: Automates the process of downloading and updating models, ensuring that the latest models are always available.\n\n## Installation\n\nThe standard installation supports Windows, macOS, and Linux out of the box. And it also automatically enables the GPU and CPU acceleration on macOS.\n\n```sh\nnpm i smart-whisper\n```\n\nSupport Matrix:\n\n| OS and Arch         | CPU              | GPU       |\n| ------------------- | ---------------- | --------- |\n| macOS Apple Silicon | ✅ (Acceleration) | ✅ (Metal) |\n| macOS Intel         | ✅ (Acceleration) | BYOL      |\n| Linux / Windows     | ✅                | BYOL      |\n\n\u003e - ✅: Out of the box support with standard installation.\n\u003e - BYOL: Bring Your Own Library, see [Acceleration](#acceleration) for more information.\n\n### Acceleration\n\nDue to the complexity of the different acceleration methods for different devices. You need to compile the `libwhisper.a` or `libwhisper.so` from [whisper.cpp](https://github.com/ggerganov/whisper.cpp) yourself.\n\nAnd then set the `BYOL` (Bring Your Own Library) environment variable to the path of the compiled library.\n\n```sh\nBYOL='/path/to/libwhisper.a' npm i smart-whisper\n```\n\nYou may need to link other libraries like:\n\n```sh\nBYOL='/path/to/libwhisper.a -lopenblas' npm i smart-whisper\n```\n\n#### OpenBLAS\n\nFor Linux and Windows without GPU, the best acceleration method might be using OpenBLAS. After installing OpenBLAS, you can compile the `libwhisper.a` with the following command:\n\n```sh\ngit clone https://github.com/ggerganov/whisper.cpp\ncd whisper.cpp\nWHISPER_OPENBLAS=1 make -j\n```\n\n#### CUDA and other acceleration methods\n\nCheck out the [whisper.cpp](https://github.com/ggerganov/whisper.cpp#nvidia-gpu-support) repository for more information.\n\n## Documentation\n\nThe documentation is available at \u003chttps://jacoblincool.github.io/smart-whisper/\u003e.\n\n## Example\n\nSee [examples](./examples) for more examples.\n\n```ts\nimport { Whisper } from \"smart-whisper\";\nimport { decode } from \"node-wav\";\nimport fs from \"node:fs\";\n\nconst model = process.argv[2];\nconst wav = process.argv[3];\n\nconst whisper = new Whisper(model, { gpu: true });\nconst pcm = read_wav(wav);\n\nconst task = await whisper.transcribe(pcm, { language: \"auto\" });\nconsole.log(await task.result);\n\nawait whisper.free();\nconsole.log(\"Maunally freed\");\n\nfunction read_wav(file: string): Float32Array {\n    const { sampleRate, channelData } = decode(fs.readFileSync(file));\n\n    if (sampleRate !== 16000) {\n        throw new Error(`Invalid sample rate: ${sampleRate}`);\n    }\n    if (channelData.length !== 1) {\n        throw new Error(`Invalid channel count: ${channelData.length}`);\n    }\n\n    return channelData[0];\n}\n```\n\nThe transcribe method returns a task object that can be used to retrieve the result of the transcription, which also emits events for the progress of the transcription.\n\n```ts\nconst task = await whisper.transcribe(pcm, { language: \"auto\" });\ntask.on(\"transcribed\", (result) =\u003e {\n    console.log(\"Transcribed\", result);\n});\nconsole.log(await task.result);\n```\n\n## Links\n\n- [GitHub Repository](https://github.com/JacobLinCool/smart-whisper)\n- [NPM Package](https://www.npmjs.com/package/smart-whisper)\n- [Documentation](https://jacoblincool.github.io/smart-whisper/)\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacoblincool%2Fsmart-whisper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacoblincool%2Fsmart-whisper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacoblincool%2Fsmart-whisper/lists"}