Working version of bus

This commit is contained in:
Aria 2025-12-11 11:37:20 -06:00
parent 82ca77be9d
commit 2aeba2e53f
6 changed files with 111 additions and 25 deletions

View file

@ -2046,6 +2046,28 @@ export const { octave, oct } = registerControl('octave', 'oct');
* )
*/
export const { orbit } = registerControl('orbit', 'o');
/**
* A `bus` is a send which can be used for mixing patterns. It combines with..
* s("bus") to play that bus through another pattern (for, say, applying non-linear
* effects like distortion to multiple signals)
*
* otherPat.bmod(..) (to modulate another pattern with the bus)
*
* @name bus
* @param {number | Pattern} number
*/
export const { bus } = registerControl('bus');
/**
* Postgain multiplier prior to sending the signal to the audio bus.
*
* @name busgain
* @synonyms bgain
* @param {number | Pattern} number
*/
export const { busgain, bgain } = registerControl('busgain', 'bgain');
// TODO: what is this? not found in tidal doc Answer: gain is limited to maximum of 2. This allows you to go over that
export const { overgain } = registerControl('overgain');
// TODO: what is this? not found in tidal doc. Similar to above, but limited to 1

View file

@ -3743,18 +3743,18 @@ addConfigAlias('env', 'depthabs', 'da');
addConfigAlias('env', 'acurve', 'ac');
addConfigAlias('env', 'dcurve', 'dc');
addConfigAlias('env', 'rcurve', 'rc');
addConfigAlias('omod', 'orbit', 'o');
addConfigAlias('omod', 'target', 't');
addConfigAlias('omod', 'depth', 'dep', 'dr');
addConfigAlias('omod', 'depthabs', 'da');
addConfigAlias('omod', 'dc');
addConfigAlias('bmod', 'orbit', 'o');
addConfigAlias('bmod', 'target', 't');
addConfigAlias('bmod', 'depth', 'dep', 'dr');
addConfigAlias('bmod', 'depthabs', 'da');
addConfigAlias('bmod', 'dc');
Pattern.prototype.modulate = function (type, config, idx) {
if (config == null || typeof config !== 'object') {
return this;
}
if (!['lfo', 'env', 'omod'].includes(type)) {
logger(`[core] Modulation type ${type} not found. Please use one of 'lfo', 'env', 'omod'`);
if (!['lfo', 'env', 'bmod'].includes(type)) {
logger(`[core] Modulation type ${type} not found. Please use one of 'lfo', 'env', 'bmod'`);
return this;
}
let output = this;
@ -3828,13 +3828,15 @@ Pattern.prototype.env = function (config, idx) {
export const env = (config) => pure({}).env(config);
/**
* Modulates with the output from a given `orbit`
* Can be called in sequence like pat.obus(...).obus(...) to set up multiple modulators
* Modulates with the output from a given `bus`.
* Can be called in sequence like pat.bmod(...).bmod(...) to set up multiple modulators
*
* @name omod
* Send to an audio bus with `otherPat.bus(..)`.
*
* @name bmod
* @memberof Pattern
* @param {Object} config Orbit bus configuration.
* @param {string | Pattern} [config.orbit] Orbit to get modulation signal from
* @param {Object} config Bus modulation configuration.
* @param {string | Pattern} [config.bus] Bus to get modulation signal from
* @param {string | Pattern} [config.target] Node (and parameter if specified like `lpf.frequency`) to modulate. Aliases: t
* @param {number | Pattern} [config.depth] Relative modulation depth. Aliases: dep, dr
* @param {number | Pattern} [config.depthabs] Absolute modulation depth. Aliases: da
@ -3842,7 +3844,7 @@ export const env = (config) => pure({}).env(config);
* @param {number | Pattern} [config.dc] DC offset prior to application
* @returns Pattern
*/
Pattern.prototype.omod = function (config, idx) {
return this.modulate('omod', config, idx);
Pattern.prototype.bmod = function (config, idx) {
return this.modulate('bmod', config, idx);
};
export const omod = (config) => pure({}).omod(config);
export const bmod = (config) => pure({}).bmod(config);