mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-10 21:28:31 +00:00
remove midisounds for now
This commit is contained in:
parent
848edb1f69
commit
efd4071637
@ -165,37 +165,6 @@ export async function midimaps(map) {
|
|||||||
// registry for midi sounds, converting sound names to controls
|
// registry for midi sounds, converting sound names to controls
|
||||||
export const midisoundMap = new Map();
|
export const midisoundMap = new Map();
|
||||||
|
|
||||||
/**
|
|
||||||
* Maps a sound name to a set of controls:
|
|
||||||
* @example
|
|
||||||
* midisounds({ bd: { note: 'c2' } })
|
|
||||||
* $: s("bd").midi()
|
|
||||||
* @example
|
|
||||||
* // notes can be set directly to simplify typical midi drum kit mappings
|
|
||||||
* midisounds({ bd: 'c2', rim: 'c#2' })
|
|
||||||
* $: s("bd rim").midi()
|
|
||||||
**/
|
|
||||||
export async function midisounds(map) {
|
|
||||||
if (typeof map === 'object') {
|
|
||||||
Object.entries(map).forEach(([name, mapping]) => midisoundMap.set(name, mapping));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyMidisounds(hapValue) {
|
|
||||||
const { s } = hapValue;
|
|
||||||
if (!midisoundMap.has(s)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let controls = midisoundMap.get(hapValue.s);
|
|
||||||
if (Array.isArray(controls)) {
|
|
||||||
controls = controls[hapValue.n || 0];
|
|
||||||
}
|
|
||||||
if (typeof controls === 'string') {
|
|
||||||
controls = { note: controls };
|
|
||||||
}
|
|
||||||
Object.assign(hapValue, controls);
|
|
||||||
}
|
|
||||||
|
|
||||||
// normalizes the given value from the given range and exponent
|
// normalizes the given value from the given range and exponent
|
||||||
function normalize(value = 0, min = 0, max = 1, exp = 1) {
|
function normalize(value = 0, min = 0, max = 1, exp = 1) {
|
||||||
if (min === max) {
|
if (min === max) {
|
||||||
@ -260,8 +229,6 @@ Pattern.prototype.midi = function (output) {
|
|||||||
const latencyMs = 34;
|
const latencyMs = 34;
|
||||||
// passing a string with a +num into the webmidi api adds an offset to the current time https://webmidijs.org/api/classes/Output
|
// passing a string with a +num into the webmidi api adds an offset to the current time https://webmidijs.org/api/classes/Output
|
||||||
const timeOffsetString = `+${getEventOffsetMs(targetTime, currentTime) + latencyMs}`;
|
const timeOffsetString = `+${getEventOffsetMs(targetTime, currentTime) + latencyMs}`;
|
||||||
// convert s to midisounds preset (if set)
|
|
||||||
applyMidisounds(hap.value);
|
|
||||||
|
|
||||||
// destructure value
|
// destructure value
|
||||||
let {
|
let {
|
||||||
|
|||||||
@ -20,7 +20,6 @@ const skippedExamples = [
|
|||||||
'accelerationX',
|
'accelerationX',
|
||||||
'defaultmidimap',
|
'defaultmidimap',
|
||||||
'midimaps',
|
'midimaps',
|
||||||
'midisounds',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
describe('runs examples', () => {
|
describe('runs examples', () => {
|
||||||
|
|||||||
@ -56,10 +56,6 @@ Instead of setting `ccn` and `ccv` directly, you can also create mappings with `
|
|||||||
|
|
||||||
<JsDoc client:idle name="defaultmidimap" h={0} />
|
<JsDoc client:idle name="defaultmidimap" h={0} />
|
||||||
|
|
||||||
## midisounds
|
|
||||||
|
|
||||||
<JsDoc client:idle name="midisounds" h={0} />
|
|
||||||
|
|
||||||
# OSC/SuperDirt/StrudelDirt
|
# OSC/SuperDirt/StrudelDirt
|
||||||
|
|
||||||
In TidalCycles, sound is usually generated using [SuperDirt](https://github.com/musikinformatik/SuperDirt/), which runs inside SuperCollider. Strudel also supports using SuperDirt, although it requires installing some additional software.
|
In TidalCycles, sound is usually generated using [SuperDirt](https://github.com/musikinformatik/SuperDirt/), which runs inside SuperCollider. Strudel also supports using SuperDirt, although it requires installing some additional software.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user