{"id":16125788,"url":"https://github.com/dy/app-audio","last_synced_at":"2025-09-12T20:32:11.285Z","repository":{"id":66081298,"uuid":"65862956","full_name":"dy/app-audio","owner":"dy","description":"Get audio for application, demo or tests.","archived":false,"fork":false,"pushed_at":"2017-04-14T16:42:28.000Z","size":170,"stargazers_count":5,"open_issues_count":14,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T00:21:16.439Z","etag":null,"topics":["audio","web-audio"],"latest_commit_sha":null,"homepage":"https://a-vis.github.io/app-audio","language":"JavaScript","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/dy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-17T00:26:38.000Z","updated_at":"2022-10-21T16:22:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb8fbb2c-06bf-492f-8884-7c66d32830c1","html_url":"https://github.com/dy/app-audio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fapp-audio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fapp-audio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fapp-audio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fapp-audio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dy","download_url":"https://codeload.github.com/dy/app-audio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232786428,"owners_count":18576416,"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","web-audio"],"created_at":"2024-10-09T21:32:09.193Z","updated_at":"2025-01-06T21:03:27.654Z","avatar_url":"https://github.com/dy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# app-audio [![unstable](http://badges.github.io/stability-badges/dist/unstable.svg)](http://github.com/badges/stability-badges)\n\nGet audio for your application, demo or tests.\n\nIt will create a component with every possible audio source for Web Audio API - an audio file, url, soundcloud, microphone or primitive signal. Also it tackles play/stop/reset controls, drag-n-drop, recent tracks, soundcloud tracklists, queuing multiple tracks, saving to session storage, progress bar, looping etc.\n\n[![app-audio](https://raw.githubusercontent.com/audio-lab/app-audio/gh-pages/preview.png \"app-audio\")](http://audio-lab.github.io/app-audio/)\n\n\n## Usage\n\n[![npm install app-audio](https://nodei.co/npm/app-audio.png?mini=true)](https://npmjs.org/package/app-audio/)\n\n```js\nconst createAudio = require('app-audio');\n\nlet audioSrc = createAudio({\n\tsource: './my-audio.mp3'\n}).on('ready', (node, url) =\u003e {\n\tnode.connect(myAnalyzer);\n});\n```\n\n\u003c!-- [**`See in action`**](TODO requirebin) --\u003e\n\n## API\n\n\u003cdetails\u003e\u003csummary\u003e**`const createAudio = require('app-audio');`**\u003c/summary\u003e\n\nGet app-audio constructor. It can also serve as a class.\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003e**`let appAudio = createAudio(options);`**\u003c/summary\u003e\n\nCreate app-audio instance based off options:\n\n```js\n//initial source\nsource: null,\n\n//container to place UI\ncontainer: document.body,\n\n//audio context to use\ncontext: require('audio-context'),\n\n//Enable file select\nfile: true,\n\n//Enable url input\nurl: true,\n\n//Enable soundcloud input\nsoundcloud: true,\n\n//Enable primitive signal input\nsignal: true,\n\n//Enable mic input\nmic: true,\n\n//Show play/payse buttons\nplay: true,\n\n//Start playing whenever source is selected\nautoplay: true,\n\n//Repeat track list after end\nloop: true,\n\n//Show progress indicator at the top of container\nprogress: true,\n\n//Save/load tracks to sessionStorage\nsave: true,\n\n//Show list of recent tracks\nrecent: true,\n\n//Enable drag and drop files\ndragAndDrop: true,\n\n//Default color\ncolor: 'black'\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003e**`appAudio.on(event, callback);`**\u003c/summary\u003e\n\nBind event callback. Available events:\n\n```js\n//called whenever new source is set and loaded, like mic, file, signal etc.\n//source audioNode is passed as a first argument, so do connection routine here\nappAudio.on('load', (audioNode, sourceUrl) =\u003e {\n\taudioNode.connect(myAnalyzer);\n});\n\n//whenever play is pressed or called\nappAudio.on('play', (audioNode) =\u003e {});\n\n//whenever pause is pressed or called\nappAudio.on('pause', (audioNode) =\u003e {});\n\n//whenever reset is called\nappAudio.on('reset', () =\u003e {});\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003e**`appAudio.set(source);`**\u003c/summary\u003e\n\nSet source to play. Source can be whether `File`, `FileList`, URL, soundcloud URL, list of URLs, `MediaStream` etc.\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003e**`appAudio.play();`**\u003c/summary\u003e\n\nPlay selected source. Other playback methods:\n\n```js\n//pause current source, for mic - mute output\nappAudio.pause();\n\n//reset current source, stop playback\nappAudio.reset();\n\n//play next track, if there are multiple tracks\nappAudio.playNext();\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003e**`appAudio.show();`**\u003c/summary\u003e\n\nOpen menu. To hide menu, call `appAudio.hide()`\n\n\u003c/details\u003e\n\u003cdetails\u003e\u003csummary\u003e**`appAudio.update(options?);`**\u003c/summary\u003e\n\nUpdate view or options, if required. Possible options are all the same as in the constructor.\n\n\u003c/details\u003e\n\n## In the wild\n\n\u003e [gl-waveform](https://dfcreative.github.io/gl-waveform)\u003cbr/\u003e\n\u003e [gl-spectrogram](https://dfcreative.github.io/gl-spectrogram)\u003cbr/\u003e\n\u003e [gl-spectrum](https://audio-lab.github.io/gl-spectrum)\u003cbr/\u003e\n\n## Credits\n\n**[@mattdesl](https://github.com/mattdesl)** for [web-audio-player](https://github.com/jam3/web-audio-player) covering gotchas of playing web-audio.\n\nBeautiful myself, who spent like a week on that, and another week before on [start-app](https://github.com/dfcreative/start-app).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fapp-audio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdy%2Fapp-audio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fapp-audio/lists"}