{"id":17446004,"url":"https://github.com/jamen/pull-audio-generator","last_synced_at":"2025-04-02T11:22:24.619Z","repository":{"id":96785005,"uuid":"91276922","full_name":"jamen/pull-audio-generator","owner":"jamen","description":null,"archived":false,"fork":false,"pushed_at":"2017-05-14T23:13:07.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T02:23:57.148Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/jamen.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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":"2017-05-14T23:09:50.000Z","updated_at":"2021-12-19T15:37:36.000Z","dependencies_parsed_at":"2023-07-14T08:19:48.830Z","dependency_job_id":null,"html_url":"https://github.com/jamen/pull-audio-generator","commit_stats":null,"previous_names":["audiojs/pull-audio-generator"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-audio-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-audio-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-audio-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-audio-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/pull-audio-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246803036,"owners_count":20836472,"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":[],"created_at":"2024-10-17T18:20:10.565Z","updated_at":"2025-04-02T11:22:24.593Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# pull-audio-generator\n\n\u003e Generate audio as a pull-stream source\n\nCreates [`AudioBuffer`](https://github.com/audiojs/audio-buffer)s using a function that returns samples between `-1..1`.  Also takes options to configure the stream and generated audio.\n\n```js\npull(\n  generator(Math.random, {\n    duration: Infinity,\n    bitDepth: 8,\n    // ...\n  }),\n  drain(buf =\u003e {\n    // got chunk\n  })\n)\n```\n\n## Install\n\n```sh\nnpm install --save pull-audio-generator\n```\n\n```sh\nyarn add pull-audio-generator\n```\n\n## Usage\n\n### `generator(fn, options?)`\n\nA [pull-stream source](https://github.com/pull-stream/pull-stream) that produces `AudioBuffer`s from `fn` and `options`.  All options are inherited from [`audio-generator`'s options](https://github.com/audiojs/audio-generator).\n\nThe `fn` takes `fn(time)` and returns `-1..1` for all channels or `[-1..1, -1..1, ...]` for each channel.\n\n```js\npull(\n  generate(time =\u003e {\n    return [\n      // Channel 1:\n      Math.sin(Math.PI * 2 * time * 300),\n      // Channel 2:\n      Math.random()\n    ]\n  }),\n  drain(buf =\u003e {\n    // got chunk\n  })\n)\n```\n\n## Also see\n\n - [`audiojs`](https://github.com/audiojs) for all the audio components\n - [`pull-stream`](https://github.com/pull-stream/pull-stream) for minimal streams\n - [`audio-generator`](https://github.com/audiojs/audio-generator) for pure function of this module\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fpull-audio-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Fpull-audio-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fpull-audio-generator/lists"}