Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.
Draft
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
6 changes: 2 additions & 4 deletions jsdoc/undocumented.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function getExports(code) {
let ast;
try {
ast = parse(code, {
ecmaVersion: 11,
ecmaVersion: 'latest',
sourceType: 'module',
});
} catch (err) {
Expand Down Expand Up @@ -49,9 +49,7 @@ function getExports(code) {
}

function isDocumented(name, docs) {
return docs.find(
(d) => d.name === name || d.tags?.find((t) => t.title === 'synonyms' && t.value.split(', ').includes(name)),
);
return docs.find((d) => d.name === name || d.synonyms?.includes(name));
}

async function getUndocumented(path, docs) {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/pattern.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3119,6 +3119,7 @@ export const striate = register('striate', function (n, pat) {
/**
* Makes the sample fit the given number of cycles by changing the speed.
* @name loopAt
* @synonyms loopat
* @memberof Pattern
* @returns Pattern
* @example
Expand Down Expand Up @@ -3232,6 +3233,7 @@ export const fit = register('fit', (pat) =>
* given by a global clock and this function will be
* deprecated/removed.
* @name loopAtCps
* @synonyms loopatcps
* @memberof Pattern
* @returns Pattern
* @example
Expand Down
24 changes: 19 additions & 5 deletions packages/core/signal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,27 @@ import Fraction from './fraction.mjs';

import { id, keyAlias, getCurrentKeyboardState } from './util.mjs';

/**
* A `signal` consisting of a constant value. Similar to `pure`, except that function
* creates a pattern with one event per cycle, whereas this pattern doesn't have an intrinsic
* structure.
*
* @param {*} value The constant value of the resulting pattern
* @returns Pattern
*/
export function steady(value) {
// A continuous value
return new Pattern((state) => [new Hap(undefined, state.span, value)]);
}

/**
* Creates a "signal", an unstructured pattern consisting of a single value that changes
* over time.
*
*
* @param {*} func
* @returns Pattern
*/
export const signal = (func) => {
const query = (state) => [new Hap(undefined, state.span, func(state.span.begin))];
return new Pattern(query);
Expand All @@ -23,7 +39,7 @@ export const signal = (func) => {
/**
* A sawtooth signal between 0 and 1.
*
* @return {Pattern}
* @type {Pattern}
* @example
* note("<c3 [eb3,g3] g2 [g3,bb3]>*8")
* .clip(saw.slow(2))
Expand Down Expand Up @@ -159,6 +175,7 @@ export const time = signal(id);
/**
* The mouse's x position value ranges from 0 to 1.
* @name mousex
* @synonyms mouseX
* @return {Pattern}
* @example
* n(mousex.segment(4).range(0,7)).scale("C:minor")
Expand All @@ -168,6 +185,7 @@ export const time = signal(id);
/**
* The mouse's y position value ranges from 0 to 1.
* @name mousey
* @synonyms mouseY
* @return {Pattern}
* @example
* n(mousey.segment(4).range(0,7)).scale("C:minor")
Expand Down Expand Up @@ -217,10 +235,6 @@ const timeToRandsPrime = (seed, n) => {

const timeToRands = (t, n) => timeToRandsPrime(timeToIntSeed(t), n);

/**
*
*/

/**
* A discrete pattern of numbers from 0 to n-1
* @example
Expand Down
Loading