Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
.DS_Store
node_modules
dist
!**/krispai/dist
.vercel
.vscode
.idea
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"build:video-filters-web": "yarn workspace @stream-io/video-filters-web run build",
"build:video-filters-react-native": "yarn workspace @stream-io/video-filters-react-native run build",
"build:noise-cancellation-react-native": "yarn workspace @stream-io/noise-cancellation-react-native run build",
"build:react:deps": "yarn build:client && yarn build:styling && yarn build:react:bindings && yarn build:video-filters-web && yarn build:audio-filters-web && yarn build:react:sdk",
"build:react-native:deps": "yarn build:client && yarn build:react:bindings && yarn build:video-filters-react-native && yarn build:noise-cancellation-react-native && yarn build:react-native:sdk",
"build:react:deps": "yarn workspaces foreach -Apv --topological-dev --include 'packages/{client,react-{sdk,bindings},styling,{video,audio}-filters-web}' run build",
"build:react-native:deps": "yarn workspaces foreach -Apv --topological-dev --include 'packages/{client,react-bindings,{video-filters,noise-cancellation}-react-native,react-native-sdk}' run build",
"build:vercel": "yarn build:react:deps && yarn build:react:dogfood",
"start:egress": "yarn workspace @stream-io/egress-composite start",
"build:egress": "yarn workspace @stream-io/egress-composite build",
Expand Down
2 changes: 0 additions & 2 deletions packages/audio-filters-web/index.ts

This file was deleted.

23 changes: 14 additions & 9 deletions packages/audio-filters-web/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"name": "@stream-io/audio-filters-web",
"version": "0.6.0",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
"types": "./dist/index.d.ts",
"main": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"default": "./dist/cjs/index.js"
}
},
"license": "See license in LICENSE",
"scripts": {
"clean": "rimraf dist",
"start": "rollup -c -w",
"build": "NODE_ENV=production rollup -c"
"start": "vite build --watch",
"build": "yarn clean && concurrently 'vite build' 'tsc'"
},
"repository": {
"type": "git",
Expand All @@ -19,6 +24,7 @@
"files": [
"dist",
"src",
"!src/krispai/*",
"index.ts",
"package.json",
"README.md",
Expand All @@ -29,10 +35,9 @@
"wasm-feature-detect": "^1.8.0"
},
"devDependencies": {
"@rollup/plugin-replace": "^6.0.2",
"@rollup/plugin-typescript": "^12.1.4",
"concurrently": "^9.2.1",
"rimraf": "^6.0.1",
"rollup": "^4.52.4",
"typescript": "^5.9.3"
"typescript": "^5.9.3",
"vite": "^7.1.9"
}
}
37 changes: 0 additions & 37 deletions packages/audio-filters-web/rollup.config.mjs

This file was deleted.

11 changes: 5 additions & 6 deletions packages/audio-filters-web/src/NoiseCancellation.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// RollupError: @rollup/plugin-typescript TS7016: Could not find a declaration file for module './krispai/krispsdk.mjs'
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - issues with typescript on CI
import KrispSDK from './krispai/krispsdk.mjs';
import KrispSDK from './krispai';
import type {
IAudioFilterNode,
IKrispSDK,
ISDKPartialOptions,
} from './krispai/krispsdk';
} from './krispai';
import { packageName, packageVersion } from './version';
import { promiseWithResolvers } from './withResolvers';
import { simd } from 'wasm-feature-detect';
import type { Tracer } from './tracer';

const MODEL_FILENAME = 'krisp-nc-o-med-v7.kef';

/**
* Options to pass to the NoiseCancellation instance.
*/
Expand Down Expand Up @@ -142,7 +141,7 @@ export class NoiseCancellation implements INoiseCancellation {
useSharedArrayBuffer: false,
models: {
// https://sdk-docs.krisp.ai/docs/krisp-audio-sdk-model-selection-guide
modelNC: `${this.basePath}/c6.f.s.da1785.kef`,
modelNC: `${this.basePath}/${MODEL_FILENAME}`,
},
...this.krispSDKParams,
},
Expand Down
2 changes: 2 additions & 0 deletions packages/audio-filters-web/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { version } from './krispai/package.json';
export * from './NoiseCancellation';
16 changes: 6 additions & 10 deletions packages/audio-filters-web/src/krispai/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
KRISP TECHNOLOGIES, INC
__________________
KRISP TECHNOLOGIES, INC

[2018] - [2023] Krisp Technologies, Inc
All Rights Reserved.
---

NOTICE: By accessing this programming code, you acknowledge that you have read, understood, and agreed to the User Agreement available at
https://krisp.ai/terms-of-use.
Please note that ALL information contained herein is and remains the property of Krisp Technologies, Inc., and its affiliates or assigns, if any. The intellectual property
contained herein is proprietary to Krisp Technologies, Inc. and may be covered by pending and granted U.S. and Foreign Patents, and is further protected by
copyright, trademark and/or other forms of intellectual property protection.
Dissemination of this information or reproduction of this material IS STRICTLY FORBIDDEN.
[2018] - [2024] Krisp Technologies, Inc.
All Rights Reserved.

NOTICE: Access to and use of the Software are expressly conditioned upon compliance with the terms and conditions set forth in the Technology License Agreement or Software Evaluation Agreement executed between Krisp Technologies, Inc. and Your Company. In the absence of such an executed agreement, you are not authorized and have no right to access or use the Software, and any such unauthorized use is strictly prohibited.
157 changes: 157 additions & 0 deletions packages/audio-filters-web/src/krispai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Krisp Javascript SDK

Welcome to the Krisp JS SDK!

In this README file you can find JS SDK overview and installation options.
Find more details in the [documentaiton](https://sdk-docs.krisp.ai/docs/getting-started-js).

## Overview

Krisp provides a JS SDK with an out-of-the-box application architecture that allows developers and teams to integrate AI-powered speech clarity features in real-time communication applications. The SDK receives audio buffers in chunks then processes them in a dedicated worker thread on top of WebAssembly.

## Package Structure

```
├── dist # Main JS SDK files
│   ├── assets
│   │   └── bvc-allowed.txt
│   ├── krispsdk.d.ts
│   ├── krispsdk.js
│   ├── krispsdk.mjs
│   ├── usermedia.d.ts
│   ├── usermedia.js
│   ├── usermedia.mjs
│   ├── krispsdk.d.ts
│   ├── krispsdk.es5.js
│   ├── krispsdk.js
│   ├── krispsdk.mjs
│   └── models
│   ├── model_16.kef
│   ├── model_32.kef
│   ├── model_8.kef
│   ├── model_bvc.kef
│   └── model_inbound_8.kef
|   └── model_rt.kef
├── reference-apps # Reference applications
│   ├── audioElement
│   │   ├── app.js
│   │   ├── index.html
│   │   └── style.css
│   ├── bvcAudioElement
│   │   ├── app.js
│   │   ├── index.html
│   │   ├── style.css
│   │   └── ui.mjs
│   └── callingApp
│   │ ├── app.js
│   │ ├── index.html
│   │ └── style.css
│ └── deviceChange
│ │ ├── app.js
│ │ ├── index.html
│ │ ├── style.css
│ │ └── ui.mjs
| └── withPreloadState
| ├── app.js
| ├── index.html
| └── style.css
├── package.json
├── LICENSE.md
└── README.md
```

## Installation

Once you've extracted the folder, the KrispSDK files that you can include in your project will be in the /dist directory.
You have to serve Krisp models from server and load them dynamically. The models are located in /dist/models directory.

## NPM dependency

You can pack KrispSDK files as a npm package and include in your project.

Using this method, you can import the KrispSDK SDK using ES Module or TypeScript syntax:

```
import KrispSDK from '@krispai/javascript-sdk';
```

### Installation Steps

1. Open your terminal or command prompt.
2. Navigate to the package directory.
3. pack the library

```
npm pack
```

4. move generated library archive to your project
5. install as a dependency

```
npm install ./krispai-javascript-sdk-${VERSION}.tgz
```

## Import as a module

In case you are not using npm you can directly import '/dist/krispsdk.mjs' in your project

```
import KrispSDK from '/dist/krispsdk.mjs';
```

## Include via script tag

You can copy /dist/krispsdk.es5.js file into your project and then provide a link to it in your html. For example:

```
<script type="text/javascript" src="/dist/krispsdk.es5.js"></script>
```

Using this method, you can access the SDK through the browser global:

```
const krispSDK = new KrispSDK({
params: {
useBVC: true,
debugLogs: false,
models: {
model8: '/dist/models/model_8.kef',
model16: '/dist/models/model_16.kef',
model32: '/dist/models/model_32.kef',
modelBVC: {
url: '/dist/models/model_32.kef',
preload: true
}
},
inboundModels: {
model8: '/dist/models/model_inbound_8.kef',
},
bvc: {
allowedDevices: '/dist/assets/bvc-allowed.txt', // This is mandatory
}
}
});

await krispSDK.init();

const audioContext = new AudioContext();

const stream = await navigator.mediaDevices.getUserMedia({
audio: true
});

const filterNode = await krispSDK.createNoiseFilter({
audioContext,
stream, // make sure to add stream here
isInbound: false
});

const source = audioContext.createMediaStreamSource(stream);

source.connect(filterNode).connect(audioContext.destination);

filterNode.addEventListener('ready', () => {
filterNode.enable()
});
```
Loading
Loading