Reduce latency; change name to midikeys; include in i/o learn page
This commit is contained in:
parent
103b27c21f
commit
4743334a17
4 changed files with 16 additions and 12 deletions
|
|
@ -558,16 +558,16 @@ export async function midin(input) {
|
||||||
* The note length is fixed as Superdough is not currently set up for undetermined
|
* The note length is fixed as Superdough is not currently set up for undetermined
|
||||||
* note durations
|
* note durations
|
||||||
*
|
*
|
||||||
* @name keyboard
|
* @name midikeys
|
||||||
* @param {string | number} input MIDI device name or index defaulting to 0
|
* @param {string | number} input MIDI device name or index defaulting to 0
|
||||||
* @returns {function((number | Pattern)=): Pattern} A function that produces a pattern.
|
* @returns {function((number | Pattern)=): Pattern} A function that produces a pattern.
|
||||||
* When queried, the pattern will produces the most recently played midi notes and velocities,
|
* When queried, the pattern will produces the most recently played midi notes and velocities,
|
||||||
* lasting for the specified duration
|
* lasting for the specified duration
|
||||||
* @example
|
* @example
|
||||||
* const kb = await keyboard('Arturia KeyStep 32')
|
* const kb = await midikeys('Arturia KeyStep 32')
|
||||||
* kb().s("tri").lpf(80).lpe(6).lpd(0.1).room(2).delay(0.35)
|
* kb().s("tri").lpf(80).lpe(6).lpd(0.1).room(2).delay(0.35)
|
||||||
* @example
|
* @example
|
||||||
* const kb = await keyboard('Arturia KeyStep 32')
|
* const kb = await midikeys('Arturia KeyStep 32')
|
||||||
* kb("0.5 1")
|
* kb("0.5 1")
|
||||||
* .s("saw")
|
* .s("saw")
|
||||||
* .add(note(rand.mul(0.3)))
|
* .add(note(rand.mul(0.3)))
|
||||||
|
|
@ -575,7 +575,7 @@ export async function midin(input) {
|
||||||
*/
|
*/
|
||||||
const kHaps = {};
|
const kHaps = {};
|
||||||
const kListeners = {};
|
const kListeners = {};
|
||||||
export async function keyboard(input) {
|
export async function midikeys(input) {
|
||||||
const device = await _initialize(input);
|
const device = await _initialize(input);
|
||||||
if (!kHaps[input]) {
|
if (!kHaps[input]) {
|
||||||
kHaps[input] = [];
|
kHaps[input] = [];
|
||||||
|
|
@ -586,7 +586,7 @@ export async function keyboard(input) {
|
||||||
const [note, velocity] = dataBytes;
|
const [note, velocity] = dataBytes;
|
||||||
const noteoff = message.command === 8;
|
const noteoff = message.command === 8;
|
||||||
const key = `${input}_${note}`;
|
const key = `${input}_${note}`;
|
||||||
const t = getTime() + 0.1; // slight delay so it's not too late for cyclist to catch
|
const t = getTime() + 0.03; // slight delay so it's not too late for cyclist to catch
|
||||||
const span = new TimeSpan(t, t);
|
const span = new TimeSpan(t, t);
|
||||||
let value = { midikey: key };
|
let value = { midikey: key };
|
||||||
if (noteoff) {
|
if (noteoff) {
|
||||||
|
|
|
||||||
|
|
@ -5943,10 +5943,6 @@ exports[`runs examples > example "juxBy" example index 0 1`] = `
|
||||||
|
|
||||||
exports[`runs examples > example "keyDown" example index 0 1`] = `[]`;
|
exports[`runs examples > example "keyDown" example index 0 1`] = `[]`;
|
||||||
|
|
||||||
exports[`runs examples > example "keyboard" example index 0 1`] = `[]`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "keyboard" example index 1 1`] = `[]`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "lastOf" example index 0 1`] = `
|
exports[`runs examples > example "lastOf" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | note:c3 ]",
|
"[ 0/1 → 1/4 | note:c3 ]",
|
||||||
|
|
@ -7031,6 +7027,10 @@ exports[`runs examples > example "midicmd" example index 0 1`] = `
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "midikeys" example index 0 1`] = `[]`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "midikeys" example index 1 1`] = `[]`;
|
||||||
|
|
||||||
exports[`runs examples > example "midin" example index 0 1`] = `
|
exports[`runs examples > example "midin" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | note:c cutoff:0 resonance:0 s:sawtooth ]",
|
"[ 0/1 → 1/4 | note:c cutoff:0 resonance:0 s:sawtooth ]",
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ const midin = () => {
|
||||||
return (ccNum) => strudel.ref(() => 0); // returns ref with default value 0
|
return (ccNum) => strudel.ref(() => 0); // returns ref with default value 0
|
||||||
};
|
};
|
||||||
|
|
||||||
const keyboard = async () => {
|
const midikeys = async () => {
|
||||||
return () => strudel.silence;
|
return () => strudel.silence;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -154,7 +154,7 @@ evalScope(
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
midin,
|
midin,
|
||||||
keyboard,
|
midikeys,
|
||||||
sysex,
|
sysex,
|
||||||
// gist,
|
// gist,
|
||||||
// euclid,
|
// euclid,
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,14 @@ It is also possible to pattern other things with Strudel, such as software and h
|
||||||
|
|
||||||
Strudel supports MIDI without any additional software (thanks to [webmidi](https://npmjs.com/package/webmidi)), just by adding methods to your pattern:
|
Strudel supports MIDI without any additional software (thanks to [webmidi](https://npmjs.com/package/webmidi)), just by adding methods to your pattern:
|
||||||
|
|
||||||
## midiin(inputName?)
|
## midin(inputName?)
|
||||||
|
|
||||||
<JsDoc client:idle name="midin" h={0} />
|
<JsDoc client:idle name="midin" h={0} />
|
||||||
|
|
||||||
|
## midikeys(inputName?)
|
||||||
|
|
||||||
|
<JsDoc client:idle name="midikeys" h={0} />
|
||||||
|
|
||||||
## midi(outputName?,options?)
|
## midi(outputName?,options?)
|
||||||
|
|
||||||
Either connect a midi device or use the IAC Driver (Mac) or Midi Through Port (Linux) for internal midi messages.
|
Either connect a midi device or use the IAC Driver (Mac) or Midi Through Port (Linux) for internal midi messages.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue