{"_id":"@basementuniverse/noise-generator","_rev":"2-c63684cbb37d984413803a05c66514a5","name":"@basementuniverse/noise-generator","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@basementuniverse/noise-generator","version":"1.0.0","author":{"name":"gordon"},"license":"MIT","_id":"@basementuniverse/noise-generator@1.0.0","maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"dist":{"shasum":"4dd0535820eb6e640ef8eac6e1a58eec63dd5a10","tarball":"https://registry.npmjs.org/@basementuniverse/noise-generator/-/noise-generator-1.0.0.tgz","fileCount":29,"integrity":"sha512-DOiqiocayZezKsnF+VRvEUXWSVEUdTQ+gmvWNX6HGu4QcSeHfl7Fran6EVv3mlTKQkP1Kv14kdUcBahQ2FoOpQ==","signatures":[{"sig":"MEUCIASX/7np0blYz3+gS8xmC5Rth1RGgbf3xWmFGnVLiv0XAiEAvK99jE8xurxty69MZjPEg+nhtet84/yU7+qEaZmwkP0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1289347},"main":"build/index.js","types":"./build/index.d.ts","gitHead":"d6f7655e3b7ffd17f633da1f66433aa3d7fdc3e2","scripts":{"build":"webpack","watch":"webpack --watch"},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"_npmVersion":"11.6.2","description":"Generate noise, waveforms, and other interesting signals for games and visual effects.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"noisejs":"^2.1.0","@basementuniverse/graph-builder":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{"webpack":"^5.3.2","ts-loader":"^8.0.7","typescript":"^4.9.4","@types/node":"^18.11.12","webpack-cli":"^4.1.0","clean-webpack-plugin":"^4.0.0-alpha.0"},"_npmOperationalInternal":{"tmp":"tmp/noise-generator_1.0.0_1779204644628_0.8146921111852228","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@basementuniverse/noise-generator","version":"1.1.0","description":"Generate noise, waveforms, and other interesting signals for games and visual effects.","main":"build/index.js","scripts":{"build":"webpack --mode production","build:dev":"webpack --mode development","watch":"webpack --watch"},"author":{"name":"gordon"},"license":"MIT","dependencies":{"@basementuniverse/graph-builder":"^1.4.1","noisejs":"^2.1.0"},"devDependencies":{"@types/node":"^18.11.12","clean-webpack-plugin":"^4.0.0-alpha.0","ts-loader":"^8.0.7","typescript":"^4.9.4","webpack":"^5.3.2","webpack-cli":"^4.1.0"},"gitHead":"8f84cf017c7a48286622401d4da44bb6005cbd10","types":"./build/index.d.ts","_id":"@basementuniverse/noise-generator@1.1.0","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-ozEAQ2SXAkxpeaudoLly/cvAX5y+XOie2FReZEmk1kLn97NPUlDIM1xRHec6WwVChZaVlLQhNvnIr6bybj8n+g==","shasum":"ead85b062abe12541210831202c1147e4d50ecd0","tarball":"https://registry.npmjs.org/@basementuniverse/noise-generator/-/noise-generator-1.1.0.tgz","fileCount":34,"unpackedSize":1275481,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAU+akkFcLN65j/u+4K+26CCcx3c6oykMTJuPorj/hTJAiEA9Kotu7heW0+MTxUAVlTXBJt6WsRbSUWbfwsI0KRlkds="}]},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"directories":{},"maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/noise-generator_1.1.0_1786899737739_0.44026375899133696"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T15:30:44.477Z","modified":"2026-08-16T17:02:18.034Z","1.0.0":"2026-05-19T15:30:44.791Z","1.1.0":"2026-08-16T17:02:17.876Z"},"author":{"name":"gordon"},"license":"MIT","description":"Generate noise, waveforms, and other interesting signals for games and visual effects.","maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"readme":"# Game Component: Noise Generator\n\nGenerate noise, waveforms, and other interesting signals for games and visual effects.\n\n## Installation\n\n```bash\nnpm install @basementuniverse/noise-generator\n```\n\nFor direct browser usage, include the UMD build with a script tag:\n\n```html\n<script src=\"build/index.js\"></script>\n```\n\nThe build exposes its exports through the `BasementUniverseNoiseGenerator` browser\nnamespace. It does not add each export directly to `window`.\n\n## How to use\n\nThe library has two parts: a **compiler** that turns a saved graph document into a portable compiled program, and a **runner** that evaluates that program step-by-step.\n\n### 1. Compile a graph\n\nUse the visual editor to build a graph, then save it as a JSON file (a *graph document*). Pass that document to `compile()`:\n\n```ts\nimport { compile, CompileError } from '@basementuniverse/noise-generator';\nimport graphDocument from './my-graph.json';\n\nlet program;\ntry {\n  program = compile(graphDocument);\n} catch (e) {\n  if (e instanceof CompileError) {\n    console.error('Invalid graph:', e.message);\n  }\n}\n```\n\nWhen using the library directly from a browser script, prefix exports with\n`BasementUniverseNoiseGenerator`:\n\n```html\n<script src=\"build/index.js\"></script>\n<script>\n  const program = BasementUniverseNoiseGenerator.compile(graphDocument);\n\n  const runner = new BasementUniverseNoiseGenerator.NoiseGeneratorRunner(program);\n</script>\n```\n\n`compile()` returns a `CompiledProgram` — a plain, JSON-serialisable object. You can save it to disk and load it later; there is no need to recompile on every run.\n\n### 2. Run the compiled program\n\nCreate a `NoiseGeneratorRunner` from the compiled program and call `sample()` each frame (or tick):\n\n```ts\nimport { NoiseGeneratorRunner } from '@basementuniverse/noise-generator';\n\nconst runner = new NoiseGeneratorRunner(program);\n\n// In your game loop:\nconst { outputs } = runner.sample();\nconsole.log(outputs); // e.g. { \"result\": 0.42 }\n```\n\n#### Passing input parameters\n\nIf your graph has `input-parameter-*` nodes you can supply values each sample:\n\n```ts\nconst { outputs } = runner.sample({ frequency: 2.0, amplitude: 0.5 });\n```\n\nMissing keys fall back to the default value configured on the node.\n\n#### Overriding time and random sources\n\nPass a `RuntimeServices` object to control the clock or RNG:\n\n```ts\nconst { outputs } = runner.sample(\n  { frequency: 2.0 },\n  {\n    time:   () => myEngine.elapsedSeconds,\n    random: () => mySeededRng(),\n  }\n);\n```\n\n#### Resetting state\n\nCall `reset()` to rewind all stateful nodes (tick counters, buffers, sequences) to their initial values:\n\n```ts\nrunner.reset();\n```\n\n#### Output values\n\n`sample()` returns a `SampleResult` whose `outputs` map contains one entry per `output-parameter-*` node, keyed by the parameter's configured key. Values are either a `number` or a `Vec4` (`{ x, y, z, w }`).\n","readmeFilename":"README.md"}