{"id":16731426,"url":"https://github.com/skratchdot/web-audio-api-v2-issue-7","last_synced_at":"2025-08-03T23:34:55.281Z","repository":{"id":66198182,"uuid":"287846629","full_name":"skratchdot/web-audio-api-v2-issue-7","owner":"skratchdot","description":"a demo worket of: https://github.com/WebAudio/web-audio-api-v2/issues/7","archived":false,"fork":false,"pushed_at":"2020-08-18T13:24:22.000Z","size":5439,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T07:51:33.088Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://projects.skratchdot.com/web-audio-api-v2-issue-7/","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/skratchdot.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":"2020-08-16T00:26:56.000Z","updated_at":"2020-08-18T13:21:45.000Z","dependencies_parsed_at":"2023-06-19T06:41:59.704Z","dependency_job_id":null,"html_url":"https://github.com/skratchdot/web-audio-api-v2-issue-7","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/skratchdot%2Fweb-audio-api-v2-issue-7","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Fweb-audio-api-v2-issue-7/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Fweb-audio-api-v2-issue-7/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Fweb-audio-api-v2-issue-7/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skratchdot","download_url":"https://codeload.github.com/skratchdot/web-audio-api-v2-issue-7/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243770285,"owners_count":20345276,"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-12T23:37:06.646Z","updated_at":"2025-03-15T18:19:35.149Z","avatar_url":"https://github.com/skratchdot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pulse Oscillator\n\nA prototype worklet from the github issue here:  \nhttps://github.com/WebAudio/web-audio-api-v2/issues/7\n\nThe demo page is here:  \nhttps://projects.skratchdot.com/web-audio-api-v2-issue-7\n\nWorklet source code is here:  \nhttps://github.com/skratchdot/web-audio-api-v2-issue-7/blob/master/public/pulse-oscillator.js\n\nThis project was bootstrapped with:  \n[Create React App](https://github.com/facebook/create-react-app).\n\n![Demo Image](./public/worklet-demo.gif)\n\n## Running locally\n\n```\ngit clone git@github.com:skratchdot/web-audio-api-v2-issue-7.git\nnpm install\nnpm start\n```\n\n## Notes\n\n- Since create-react-app does not have a \"loader\" for `audioWorklet.addModule()`, I had to put\nthe worklet code in the public folder here: `public/pulse-oscillator.js`.\n\n- This demo app creates 3 different oscillators:\n\n### 1. square\n- available in v1\n- cannot set pulseWidth\n- cannot automate/modulate pulseWidth\n- example:\n```\nconst osc = new OscillatorNode(context, { type: 'square' });\n```\n\n### 2. custom\n- available in v1\n- can set pulseWidth using `setPeriodicWave()` (which cannot be automated/modulated smoothly)\n- cannot automate/modulate pulseWidth\n- example:\n```\nconst osc = new OscillatorNode(context, { type: 'square' });\nosc.setPeriodicWave(wave); // we generate real/imag with a pulseWidth\n```\n\n### 3. worklet\n- not available in v1. potentially available in v2\n- can set pulseWidth\n- can automate/modulate pulseWidth\n- example:\n```\ncosnt osc = new AudioWorkletNode(context, 'pulse-oscillator');\n```\n\n#### SuperCollider examples\n\n```\n{ Pulse.ar(freq: 440.0, width: 0.25, mul: 1, add: 0) }.play\n```\n\n##### FFT frqScl=lin\n![frqScl=lin](./public/pulse-fft-lin.png)\n\n##### FFT frqScl=log\n![frqScl=log](./public/pulse-fft-log.png)\n\n#### Links\n\n- https://ccrma.stanford.edu/~juhan/vas.html\n- https://ccrma.stanford.edu/~stilti/papers/blit.pdf\n- https://scp.web.elte.hu/papers/synthesis1.pdf\n- https://www.cs.cmu.edu/~eli/papers/icmc01-hardsync.pdf\n- https://www.desmos.com/calculator/a1jnxwffof\n- https://www.experimentalscene.com/articles/minbleps.php\n- https://www.music.mcgill.ca/~gary/307/week5/bandlimited.html#SECTION00027000000000000000\n- https://www.musicdsp.org/en/latest/Synthesis/112-waveform-generator-using-minbleps.html\n\n#### ToneJS\n\n- evaluate how ToneJS is doing it:\n  - https://github.com/Tonejs/Tone.js/blob/master/Tone/source/oscillator/PWMOscillator.ts\n  - https://github.com/Tonejs/Tone.js/blob/master/Tone/source/oscillator/PulseOscillator.ts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskratchdot%2Fweb-audio-api-v2-issue-7","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskratchdot%2Fweb-audio-api-v2-issue-7","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskratchdot%2Fweb-audio-api-v2-issue-7/lists"}