This document sketches out a basic domain-specific language (DSL) for converting text into values that can be used for music synthesis, etc.
This idea is connected to a project called regexpoetics developed by Jonathan Wohl and Andy Dayton, a simple tool for writing text live and using it to generate audio.
Video screen capture of a Regular Expressions performance.
The language itself would be implemented using JavaScript and either peg.js or ohm.
The semantics of this language are based on the final goal — using words to generate sounds. There are three main steps in that process.
- Finding patterns within a larger text
- Filtering those patterns or extracting information from them
- Sending the resulting information out to be interpretated
This is a very early draft of potential syntax, subject to quite a bit of change.
Expressions can be written in LISP-y syntax:
(/channel (~notes (pattern all /(.*)/)))
Or in arrow notation
-> all ~notes /channel
Or a combo
-> (pattern /(.*)/) ~notes /channel
Define a pattern
(pattern all /(.*)/)
Run a filter
-> all ~notes
Send to OSC channel
-> all ~notes /channel
- Define Patterns - use regular expressions to define patterns that can include groupings
- Output - output data to various channels. most likely will be sent to WebSocket which can then be sent via OSC
- Define Filters - define JavaScript functions that will filter incoming data and return modified data. filters can be synchronous or asynchronous.
- Notes Filter - parses data for "note" letters (A-G) and returns only the note data
- Word Distance Filter - given a set of two words, uses NLP to generate a numeric value based on word distance.
- Sentiment Analysis Filter - given a word or a set of words, run sentiment analysis and return a numeric value.