Skip to content

Instantly share code, notes, and snippets.

@ohAitch
Created March 6, 2020 22:22
Show Gist options
  • Save ohAitch/488472446324617b79c2bd618f7e0d9e to your computer and use it in GitHub Desktop.
Save ohAitch/488472446324617b79c2bd618f7e0d9e to your computer and use it in GitHub Desktop.
Playing around with osc
#!/usr/bin/env lsc
{stdin, stdout} = process
stdout.write "\x1b[?25l"
stdin.on \data -> stdout.write "\x1b[?25h"; process.exit 0
require! \osc-js
a = new oscJs plugin:new osc-js.DatagramPlugin
a.open port:2222 host:0
v = -> "█"*(it*8) + " ▏▎▍▌▋▊▉█"[0.^.(it*64%8)]
n=1
a.on "*" ({address:[...,a], args:[h]}) ->
if !h? => return
s="\n"*(0 >? a - n) + "\x1b[A"*(0 >? n - a)
process.stdout.write s + "#{" "*12}\r#{h.to-fixed 2} #{v h}\r"
n:=a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment