diff --git a/README.md b/README.md index 494940e..8fd30db 100755 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ Please refer to original [docs](https://github.com/hundredrabbits/Orca#operators - `]` [**crow ii jf note**(*channel* octave note level)](#-crow-jf-ii-note): Just Friends over i2c in voice mode. - `}` [**crow ii jf voice**(octave note level)](#-crow-jf-ii-voice): Just Friends over i2c in note mode. - `` ` `` [**crow w/syn**(octave note level)](#-crow-wsyn): +- `)` [**crow ii er301**(*channel* octave note)](#-crow-er301): er301 over i2c - `>` [**g.write**(*x* *y* value)](#-gwrite): Sets Grid LED on bang. - `<` [**g.read**(*x* *y*)](#-gread): Reads specific coordinates. If value > 6 outputs bang. - `(` [**a.read**(*enc*)](#-aread): Reads Arc encoder value @@ -137,7 +138,7 @@ Please refer to original [docs](https://github.com/hundredrabbits/Orca#operators | Controller | Description | Values | | ------------ | ----------------- | --------- | -| `K1 + E1` | Select operator | `A`–`Z`, `$`, `?`, `/`, `\`, `|`, `-`, `:`, `%`, `!`, `&`, `^`, `~`, `]`, `}`, `` ` ``, `>`, `<`, `=`, `*`, `#` | +| `K1 + E1` | Select operator | `A`–`Z`, `$`, `?`, `/`, `\`, `|`, `-`, `:`, `%`, `!`, `&`, `^`, `~`, `]`, `}`, `)`, `` ` ``, `>`, `<`, `=`, `*`, `#` | | `K1 + E2` | Select value | `0`–`z` | | `K1 + E3` | Select note | `A`–`G` | | `K2` | Clear character | | @@ -517,6 +518,11 @@ The **CROW JF II VOICE** operator `]` takes up to 3 parameters (*`octave`* `note The **CROW JF W/SYN** operator `` ` `` takes up to 3 parameters (*`octave`* `note` `level`). +### `)` CROW ER301 + +The **CROW ER301** operator `)` takes up to 3 parameters (*`channel`* `octave` `note`). + + ### `>` G.WRITE The **G.WRITE** operator `>` takes up to 3 inputs (*`x`* *`y`* `value`) and activates Grid LED at given `x`, `y` coordinate. diff --git a/lib/library.lua b/lib/library.lua index e37573d..2f15708 100644 --- a/lib/library.lua +++ b/lib/library.lua @@ -19,6 +19,7 @@ ops["`"] = include("lib/library/_crow_wsyn") ops["<"] = include("lib/library/_grid_read") ops[">"] = include("lib/library/_grid_write") ops['('] = include("lib/library/_arc_read") +ops[')'] = include("lib/library/_crow_er301") ops["="] = include("lib/library/_osc_out") ops.A = include("lib/library/a") ops.B = include("lib/library/b") diff --git a/lib/library/_crow_er301.lua b/lib/library/_crow_er301.lua new file mode 100644 index 0000000..b438d87 --- /dev/null +++ b/lib/library/_crow_er301.lua @@ -0,0 +1,91 @@ +local crow_er301 = function(self, x, y) + self.y = y + self.x = x + self.name = "crow_ii_er301_voice" + self.ports = { {1, 0, "in-channel"}, {2, 0, "in-octave"}, {3, 0, "in-note"} } + self:spawn(self.ports) + + local transpose_tab = { + ["A"] = 9, + ["a"] = 10, + ["B"] = 11, + ["C"] = 0, + ["c"] = 1, + ["D"] = 2, + ["d"] = 3, + ["E"] = 4, + ["F"] = 5, + ["f"] = 6, + ["G"] = 7, + ["g"] = 8, + ["H"] = 9, + ["h"] = 10, + ["I"] = 11, + ["J"] = 12, + ["j"] = 13, + ["K"] = 14, + ["k"] = 15, + ["L"] = 16, + ["M"] = 17, + ["m"] = 18, + ["N"] = 19, + ["n"] = 20, + ["O"] = 21, + ["o"] = 22, + ["P"] = 23, + ["Q"] = 24, + ["q"] = 25, + ["R"] = 26, + ["r"] = 27, + ["S"] = 28, + ["T"] = 29, + ["t"] = 30, + ["U"] = 31, + ["u"] = 32, + ["V"] = 33, + ["v"] = 34, + ["W"] = 35, + ["X"] = 36, + ["x"] = 37, + ["Y"] = 38, + ["y"] = 39, + ["Z"] = 40, + ["e"] = 4, + ["l"] = 5, + ["s"] = 5, + ["z"] = 5, + ["b"] = 12, + ["i"] = 12, + ["p"] = 12, + ["w"] = 12, + ["0"] = 0, + ["1"] = 2, + ["2"] = 4, + ["3"] = 5, + ["4"] = 7, + ["5"] = 9, + ["6"] = 11, + ["7"] = 12, + ["8"] = 14, + ["9"] = 16, + } + + local channel = util.clamp(self:listen(self.x + 1, self.y) or 0, 0, 35) + 1 + local octave = (util.clamp(self:listen(self.x + 2, self.y) or 3, 0, 6) * 12) - 36 + local note = "C" + + if self:glyph_at(self.x + 3, self.y) == "." then + note = "C" + else + note = self:glyph_at(self.x + 3, self.y) + end + + local tot_note = transpose_tab[note] + octave + + if self:neighbor(self.x, self.y, "*") then + crow.ii.er301.cv(channel, tot_note /12) + crow.ii.er301.tr_pulse(channel) + end +end + +return crow_er301 diff --git a/lib/library/i.lua b/lib/library/i.lua index cd8c3e8..0e685c1 100755 --- a/lib/library/i.lua +++ b/lib/library/i.lua @@ -5,17 +5,12 @@ local I = function(self, x, y) self.ports = { {-1, 0 , "in-step" }, {1, 0, "in-mod" }, {0, 1, "i-out"} } self:spawn(self.ports) - local a = self:listen(self.x - 1, self.y) or 1 - local b = self:listen(self.x + 1, self.y) or 9 - local l = self:glyph_at(self.x + 1, self.y) + local step = self:listen(self.x - 1, self.y) or 1 + local mod = self:listen(self.x + 1, self.y) or 36 + local val = self:listen(self.x, self.y + 1) or 0 + val = ((val + step) % mod) - b = b ~= a and b or a + 1 if b < a then a, b = b, a end - val = (math.floor(a * self.frame) % b) + 1 - - local cap = l ~= "." and l == self.up(l) and true - local value = cap and self.up(self.chars[val]) or self.chars[val] - - self:write(0, 1, value) + self:write(0, 1, self.chars[val]) end -return I \ No newline at end of file +return I diff --git a/orca.lua b/orca.lua index 703d97d..be182d2 100644 --- a/orca.lua +++ b/orca.lua @@ -51,7 +51,7 @@ local keycodes = include("lib/keycodes") local library = include("lib/library") local transpose_table = include("lib/transpose") -local OPS_LIST = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "$", "?", "/", "\\", "|", "-", ":", "%", "!", "&", "^", "~", "]", "}", "`", ">", "<", "(", "=", "*", "#"} +local OPS_LIST = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "$", "?", "/", "\\", "|", "-", ":", "%", "!", "&", "^", "~", "]", "}", "`", ">", "<", "(", ")", "=", "*", "#"} local VAL_LIST = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"} local update_id