Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ node_modules
*.crt
*.key

example/dist/*.js
examples/p5-ocr/dist/*.js
28 changes: 2 additions & 26 deletions dist/p-code.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions dist/p-code.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Tone.js
* @author Yotam Mann
* @license http://opensource.org/licenses/MIT MIT License
* @copyright 2014-2019 Yotam Mann
*/

//! NOTE: Clamp frequency,

//! TODO;

//! because outside of [Tone.Signal<"frequency">.minValue to Tone.Signal<"frequency">.maxValue] range crash Tone.js
2 changes: 1 addition & 1 deletion dist/p-code.js.map

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions examples/p5-ocr/dist/main.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.8+1e68dce6
*/

/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */

/*! https://mths.be/codepointat v0.2.0 by @mathias */

/**
* Tone.js
* @author Yotam Mann
* @license http://opensource.org/licenses/MIT MIT License
* @copyright 2014-2019 Yotam Mann
*/

//! NOTE: Clamp frequency,

//! TODO;

//! because outside of [Tone.Signal<"frequency">.minValue to Tone.Signal<"frequency">.maxValue] range crash Tone.js
16 changes: 3 additions & 13 deletions examples/p5-ocr/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
const path = require('path');
const fs = require('fs');
const WorkboxPlugin = require('workbox-webpack-plugin');

module.exports = {
mode: 'development',
entry: './src/index.js',
devServer: {
contentBase: './dist',
static: './dist',
host: '0.0.0.0',
hot: true,
// https: {
// key: fs.readFileSync('./server.key'),
// cert: fs.readFileSync('./server.crt')
// }
server: 'https',
},
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true
})
]
plugins: []
};
10 changes: 5 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,16 @@ export class PCode {
try {
switch (t) {
case '~':
this.sine.start(this.looper ? this.interval : 0);
this.sine.start(this.looper ? this.interval : `+${1/60}`);
break;
case 'N':
this.saw.start(this.looper ? this.interval : 0);
this.saw.start(this.looper ? this.interval : `+${1/60}`);
break;
Comment on lines +202 to 206
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+${1/60} is a hard-coded, repeated scheduling offset and is embedded as a template string in multiple cases. To make the timing behavior easier to understand and adjust, consider defining a named constant (or deriving it from an existing timing setting like this.interval) and reusing it for all oscillator starts.

Copilot uses AI. Check for mistakes.
case '^':
this.tri.start(this.looper ? this.interval : 0);
this.tri.start(this.looper ? this.interval : `+${1/60}`);
break;
case '[':
this.square.start(this.looper ? this.interval : 0);
this.square.start(this.looper ? this.interval : `+${1/60}`);
break;
case '=':
this.sine.stop(0);
Expand All @@ -225,7 +225,7 @@ export class PCode {
case '>':
break;
default:
this.noise.start(this.looper ? this.interval : 0);
this.noise.start(this.looper ? this.interval : `+${1/60}`);
}
} catch(err) {
console.error(err);
Expand Down
Loading