{"id":18645156,"url":"https://github.com/danigb/step-seq","last_synced_at":"2025-07-08T00:34:06.162Z","repository":{"id":57370787,"uuid":"47106626","full_name":"danigb/step-seq","owner":"danigb","description":"A tiny step sequencer for web audio","archived":false,"fork":false,"pushed_at":"2015-12-07T22:09:00.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-24T14:17:59.795Z","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/danigb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-30T08:57:50.000Z","updated_at":"2021-03-01T21:48:45.000Z","dependencies_parsed_at":"2022-09-18T10:41:11.613Z","dependency_job_id":null,"html_url":"https://github.com/danigb/step-seq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danigb/step-seq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fstep-seq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fstep-seq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fstep-seq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fstep-seq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danigb","download_url":"https://codeload.github.com/danigb/step-seq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danigb%2Fstep-seq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264169221,"owners_count":23567274,"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-11-07T06:14:52.299Z","updated_at":"2025-07-08T00:34:06.130Z","avatar_url":"https://github.com/danigb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Step sequencer  [![npm](https://img.shields.io/npm/v/step-seq.svg)](https://www.npmjs.com/package/step-seq)\n\nA tiny web audio step sequencer:\n\n```js\nvar sequencer = require('step-seq')\n\nvar ctx = new AudioContext()\nvar sequence = sequencer(ctx, function (event, data, time, duration) {\n  if (event !== 'data') return\n  var osc = ctx.createOscillator()\n  osc.connect(ctx.destination)\n  osc.frequency.value = data\n  osc.start(time)\n  osc.stop(time + 0.8 * duration)\n})\n\n// run a sequence\nsequence([261.63, 293.66, 329.63, 349.23, 392.00, 440.00, 493.88, 523.25]).start()\n```\n\n## Install\n\nVia npm: `npm i --save step-seq` or use the browser based distribution (exports `sequencer` to the window globals)\n\n## Usage\n\nIts just one function:\n\n#### `sequencer(ctx, scheduler)`\n\nCreate a sequencer with an scheduler:\n\n```js\nvar sequence = sequencer(ctx, function (event, data, time, duration) {\n  if (event === 'start') { ... }\n  else if (event === 'stop') { ... }\n  else if (event === 'data') {\n    // play('something').at(time)\n  }\n})\n```\n\nThe scheduler function receives the following parameters:\n\n- event: the event type. Can be 'start', 'stop' or 'data'\n- data: the data payload (depends on the sequence data)\n- time: the time in the audio context reference\n- duration: the duration in seconds of each beat\n\nThe returned sequence function has the following signature:\n\n#### `sequence(source)`\n\nIt creates sequence objects. The source can be:\n\n- An array: iterates over the array\n- A number: iterates from 0 to n-1\n- A string: split it using spaces and iterate its elements\n- A function: a generator-type function\n- Nothing: iterates from 0 to Infinity\n\n```js\nvar s = sequence('A B C D')\ns.tempo(100).start()\n```\n\nThe sequence object has the following (chainable) methods:\n\n- __`start(when)`__: starts the sequence when the audio context currentTime is `when`\n- __`stop(when)`__: stops the sequence when audio context currentTime is greater than `when`\n- __`tempo(newTempo)`__: set/get the sequence tempo\n\n## Examples\n\nTo run the example `npm install -g beefy` and then `beefy example/oscillator.js`\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanigb%2Fstep-seq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanigb%2Fstep-seq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanigb%2Fstep-seq/lists"}