1
0
Fork 0
baconscript/README.md

116 lines
3.5 KiB
Markdown
Raw Normal View History

2018-10-17 20:56:59 -04:00
# Bacon Script
2018-10-25 12:06:40 -04:00
A theoretical exercise to control a Hog 4 via OSC, with comment macros.
2018-10-21 01:27:18 -04:00
The comment macro grammar described in `CommentMacro.g4` is based upon the Hog 3.9 manual, Chapter 22.4. The python3 implementation in `OscCommentMacroListener.py` is based on Chapter 24.2 in the same manual.
2018-10-21 01:27:18 -04:00
2018-10-25 12:06:40 -04:00
Some macros are unsupported/unsupportable with this method. Some macro features, like timing, are not yet implemented. Refer to the **Features** table for specific notes.
2018-10-17 20:56:59 -04:00
## Installing
2018-10-25 12:06:40 -04:00
Install Antlr4 for input and Python-OSC for output.
2018-10-21 01:32:53 -04:00
```bash
2018-10-25 12:06:40 -04:00
$ pip3 install antlr4-python3-runtime python-osc
2018-10-21 01:27:18 -04:00
```
2018-10-17 21:09:16 -04:00
2018-10-21 01:32:53 -04:00
Use git to retrieve a copy of the code.
```bash
$ git clone http://company235.com/git/kevin/baconscript.git
$ cd baconscript
```
2018-10-21 01:27:18 -04:00
## Testing
2018-10-20 18:27:10 -04:00
2018-10-21 01:27:18 -04:00
Edit `server.cfg` to the correct values for your Hog4.
2018-10-17 21:09:16 -04:00
2018-10-25 12:06:40 -04:00
`comment.py` will accept macros on the command line, or will run an interactive prompt. Use the builtin command `exit` to quit the interactive prompt.
2018-10-17 21:09:16 -04:00
2018-10-21 01:32:53 -04:00
```bash
2018-10-21 01:27:18 -04:00
$ ./comment.py
2018-10-25 12:06:40 -04:00
Adding Hog device at net# 1
comment# GL1
Go on List 1
comment# exit
```
Run a baconscript file by passing the script file to `comment.py` as standard input.
```bash
$ ./comment.py < example.bs
2018-10-21 01:27:18 -04:00
```
2018-10-17 20:56:59 -04:00
2018-10-21 01:27:18 -04:00
## Developing
2018-10-17 20:56:59 -04:00
2018-10-21 01:27:18 -04:00
You must also install the ANTLR tool. On a mac with homebrew, do:
2018-10-21 01:32:53 -04:00
```bash
2018-10-21 01:27:18 -04:00
$ brew install antlr
```
2018-10-17 20:56:59 -04:00
2018-10-21 01:27:18 -04:00
Update the lexer and parser for Python3
2018-10-21 01:32:53 -04:00
```bash
2018-10-21 01:27:18 -04:00
$ antlr -Dlanguage=Python3 CommentMacro.g4
```
## Features
2018-10-25 12:06:40 -04:00
Only features that are supported in both OSC and Comment Macros are able to be
implemented in baconscript. This table lists all comment macros (as of 3.9)
that are implimented in python.
2018-10-21 01:27:18 -04:00
| Grammar Feature | eg. | Supported |
| ----------------|-----|-----------|
| fade times | t5 | no |
| multiple targets | 1,2 | Yes |
2018-10-25 12:06:40 -04:00
| ranges | 1>4 | Yes, integers only |
2018-10-21 01:27:18 -04:00
| multiple macros | GM1:GL3 | Yes |
2018-10-25 12:06:40 -04:00
| network devices | h4 | Yes, H devices only |
Benefiting from the LL(*) parser provided by ANTLR, `multiple targets` and
`ranges` may be combined ad infinitum. This is a known deviation from the
Comment Macro syntax.
2018-10-21 01:27:18 -04:00
| Macro | Function | Supported | Notes |
|-------|----------|-----------|-------|
| GM | Go Master | Yes | |
| HM | Halt Master | Yes | |
2018-10-22 18:16:08 -04:00
| AM | Assert Master | Partial | on current master only |
| RM | Release Master | Partial | on current master only |
2018-10-25 12:06:40 -04:00
| RA | Release All | Yes | |
2018-10-21 01:27:18 -04:00
| RO | Release Others | no | |
2018-10-22 18:16:08 -04:00
| FM | Fade Master | Partial | no times, no * |
| FGM | Fade Grand Master | Partial | no times |
2018-10-21 01:27:18 -04:00
| CM | Choose Master | Yes | |
| GL | Go List | Yes | |
| HL | Halt List | Yes | |
| AL | Assert List | no | |
| RL | Release List | Yes | |
| GB | Go Batch | no | |
| HB | Halt Batch | no | |
| AB | Assert Batch | no | |
| RB | Release Batch | no | |
| GS | Go Scene | Yes | |
| HS | Halt Scene | Yes | |
| AS | Assert Scene | no | |
| RS | Release Scene | Yes | |
2018-10-22 18:16:08 -04:00
| CP | Change Page | Partial | only CP+ and CP- |
2018-10-21 01:27:18 -04:00
| RV | Recall View | no | |
| ET | Enable Timecode | no | |
| DT | Disable Timecode | no | |
| OT | Open Timecode Toolbar | no | |
| MS | Midi String | no | possible? |
| MN | Midi Note | no | |
| RN | Reset Node | no | |
2018-10-22 17:55:44 -04:00
| GK | Go Keystroke Macro | Yes | |
| HK | Pause Keystroke Macro | Yes | |
| RK | Stop Keystroke Macro | Yes | . |
2018-10-17 20:56:59 -04:00
## Future Work
Pleas feel welcome to submit pull requests or patches that enable support for:
2018-10-25 12:06:40 -04:00
* Sending target ranges as OSC arguments
* Hog4 does not support multiple agruments to a single path.
2018-10-21 01:27:18 -04:00
* Send multi-macro line as an OSC batch
2018-10-25 12:06:40 -04:00
* HogOS 3.9 has a bug involving batches. Whereby only every-other member of the batch will be interpreted.
2018-10-17 20:56:59 -04:00
* Timing on master fades