{"id":22048691,"url":"https://github.com/smona/faust-loader","last_synced_at":"2025-05-08T23:07:04.871Z","repository":{"id":57153051,"uuid":"377660966","full_name":"Smona/faust-loader","owner":"Smona","description":"Webpack loader for Faust .dsp files","archived":false,"fork":false,"pushed_at":"2023-07-22T03:18:06.000Z","size":171,"stargazers_count":7,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-08T23:06:56.986Z","etag":null,"topics":["audio","dsp","faust","loader","webpack"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Smona.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-17T00:24:39.000Z","updated_at":"2024-12-13T21:08:49.000Z","dependencies_parsed_at":"2023-02-08T17:01:24.183Z","dependency_job_id":null,"html_url":"https://github.com/Smona/faust-loader","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smona%2Ffaust-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smona%2Ffaust-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smona%2Ffaust-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smona%2Ffaust-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Smona","download_url":"https://codeload.github.com/Smona/faust-loader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160777,"owners_count":21863629,"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":["audio","dsp","faust","loader","webpack"],"created_at":"2024-11-30T14:13:07.601Z","updated_at":"2025-05-08T23:07:04.830Z","avatar_url":"https://github.com/Smona.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# faust-loader\n\nWebpack loader for the [Faust language](https://faust.grame.fr/). Import `.dsp` files, and get back an AudioWorklet or ScriptProcessor node.\n\nThis loader is confirmed working with Faust v2.30.5, but may break on lower versions.\n[Help is wanted](https://github.com/Smona/faust-loader/issues/1) on\ngetting the WASM version of libfaust working in NodeJS.\n\n## Installation\n\n1. Install the Faust compiler version \u003e=2.30.5. You can [download it](https://faust.grame.fr/downloads/) or\n   [build it from source](https://github.com/grame-cncm/faust/wiki/BuildingSimple). It's also available from the AUR.\n\n2. Install faust-loader and standardized-audio-context:\n\n```bash\nnpm install --save faust-loader standardized-audio-context\n# OR\nyarn add faust-loader standardized-audio-context\n```\n\n3. Add faust-loader to your webpack config:\n\n```ts\nmodule: {\n    rules: [\n      // ...\n      {\n        test: /\\.dsp$/,\n        use: [\n          {\n            loader: \"faust-loader\",\n            options: { inline: true },\n          },\n        ],\n      },\n    ],\n  },\n```\n\n## Usage\n\n```ts\nimport { AudioContext } from \"standardized-audio-context\";\nimport createCompressor from \"./Compressor.dsp\";\n\nconst context = new AudioContext();\ncreateCompressor(context).then((node) =\u003e {\n  node.connect(context.destination);\n  node.getParams();\n  node.setParam(\"attack\", 0.3);\n});\n```\n\nfaust-loader makes use of [standardized-audio-context](https://github.com/chrisguttandin/standardized-audio-context) for\ninstantiating AudioWorkletNodes. This allows it to automatically fallback to a ScriptProcessorNode on Safari and other\nbrowsers that don't support AudioWorklets, as well as interoperate seamlessly with [Tone.js](https://github.com/Tonejs/Tone.js), a popular web audio framework.\n\nBecause of this, you have to use an AudioContext from `standardized-audio-context` when creating Faust nodes. If you want\nto use this loader with a vanilla AudioContext, please submit an issue or PR!\n\n## Loader Options\n\n### `inline = false`\n\nSwitch between inline and split file modes.\n\nInline mode embeds the AudioWorkletProcessor and WASM code in the Javascript bundle as base64 data URLs . This allows for single-file builds, and supports code splitting via dynamic imports (`await import()`).\n\nSplit file mode (the default) emits separate files for the AudioWorkletProcessor and WASM in a specified `outputPath`, fetching them over the network from `publicPath`.\n\nInline mode is recommended, since it's more flexible and easier to configure, and will likely become the default in a future release. However, emitting and fetching separate files may make sense if you are already serving webpack static assets and want to keep your main bundle size as small as possible.\n\n### `outputPath = \"\"`\n\nWhere the generated files should be placed relative to the output directory in split file mode. Ignored when `inline: true`.\n\n### `publicPath = \"/\"`\n\nWhat base path the generated files will be served from in split file mode. Ignored when `inline: true`.\n\n## Examples\n\n### With Typescript\n\nTypescript definitions are available for the imported modules. To automatically get the correct types when you\nimport a `.dsp` file, add a file ending in `.d.ts` to your project containing the following:\n\n```ts\n// faust-modules.d.ts\n\ndeclare module \"*.dsp\" {\n  import { ProcessorLoader } from \"faust-loader\";\n  const loader: ProcessorLoader;\n  export = loader;\n}\n```\n\nYou may need to update your `tsconfig.json` to ensure declaration files in your\nproject are included by the Typescript compiler.\n\n### With Tone.js\n\n```ts\nimport { getContext, connect } from \"tone\";\nimport createSynth from \"./Synthesizer.dsp\";\n\nasync function connectSynth() {\n  const context = getContext();\n\n  // `context` is the Tone Context, we need to get the raw standardized-audio-context.\n  const node = await createSynth(context.rawContext);\n\n  // We also need to use the global `connect` function since the node isn't a Tone AudioNode.\n  connect(node, context.destination);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmona%2Ffaust-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmona%2Ffaust-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmona%2Ffaust-loader/lists"}