add midicmd documentation 2

- MiniRepl for input-output.mdx
- addresses #789 #710
This commit is contained in:
nkymut 2025-01-20 01:26:41 +08:00
parent 268c66cd3d
commit 1349ecb4af
2 changed files with 26 additions and 15 deletions

View File

@ -56,7 +56,7 @@ It supports the following commands:
// You can control the clock with a pattern and ensure it starts in sync when the repl begins. // You can control the clock with a pattern and ensure it starts in sync when the repl begins.
// Note: It might act unexpectedly if MIDI isn't set up initially. // Note: It might act unexpectedly if MIDI isn't set up initially.
stack( stack(
midicmd("clock*24,<start stop>/2").midi('RHYTHM DESIGNER RD-6') //Trigger start and stop on Behringer RD-6 midicmd("clock*48,<start stop>/2").midi('IAC Driver')
) )
``` ```

View File

@ -34,18 +34,21 @@ Selects the MIDI channel to use. If not used, `.midi` will use channel 1 by defa
`midicmd` sends MIDI system real-time messages to control timing and transport on MIDI devices. `midicmd` sends MIDI system real-time messages to control timing and transport on MIDI devices.
It supports the following commands: It supports the following commands:
- `clock`/`midiClock` - Sends MIDI timing clock messages - `clock`/`midiClock` - Sends MIDI timing clock messages
- `start` - Sends MIDI start message - `start` - Sends MIDI start message
- `stop` - Sends MIDI stop message - `stop` - Sends MIDI stop message
- `continue` - Sends MIDI continue message - `continue` - Sends MIDI continue message
```javascript
// You can control the clock with a pattern and ensure it starts in sync when the repl begins. // You can control the clock with a pattern and ensure it starts in sync when the repl begins.
// Note: It might act unexpectedly if MIDI isn't set up initially. // Note: It might act unexpectedly if MIDI isn't set up initially.
stack(
midicmd("clock*24,<start stop>/2").midi('RHYTHM DESIGNER RD-6') //Trigger start and stop on Behringer RD-6 <MiniRepl
) client:idle
``` tune={`$:stack(
midicmd("clock*48,<start stop>/2").midi('IAC Driver')
)`}
/>
## ccn && ccv ## ccn && ccv
@ -169,12 +172,14 @@ The following example shows how to send a pattern to an MQTT broker:
Other software can then receive the messages. For example using the [mosquitto](https://mosquitto.org/) commandline client tools: Other software can then receive the messages. For example using the [mosquitto](https://mosquitto.org/) commandline client tools:
``` ```
> mosquitto_sub -h mqtt.eclipseprojects.io -p 1883 -t "/strudel-pattern"
hello > mosquitto_sub -h mqtt.eclipseprojects.io -p 1883 -t "/strudel-pattern"
world > hello
hello > world
world > hello
... > world
> ...
``` ```
Control patterns will be encoded as JSON, for example: Control patterns will be encoded as JSON, for example:
@ -194,11 +199,17 @@ Control patterns will be encoded as JSON, for example:
Will send messages like the following: Will send messages like the following:
``` ```
{"s":"sax","speed":2} {"s":"sax","speed":2}
{"s":"sax","speed":2} {"s":"sax","speed":2}
{"s":"sax","speed":3} {"s":"sax","speed":3}
{"s":"sax","speed":2} {"s":"sax","speed":2}
... ...
``` ```
Libraries for receiving MQTT are available for many programming languages. Libraries for receiving MQTT are available for many programming languages.
```
```