Skip to content

Instantly share code, notes, and snippets.

@robinsloan
Last active February 3, 2020 19:39
Show Gist options
  • Save robinsloan/e19bb6c0c5ea3664b7eb87d1a2520875 to your computer and use it in GitHub Desktop.
Save robinsloan/e19bb6c0c5ea3664b7eb87d1a2520875 to your computer and use it in GitHub Desktop.
-- note: 256 numbers in table
local notes = { 4.8, 4.0, 4.1, 4.4, 4.8, 5.0, 5.1, 5.4, 5.8, 6.0, 6.1, 6.4, 6.8, 7.0, 7.1, 7.4, 7.8, 7.4, 7.1, 7.0, 6.8, 6.4, 6.1, 6.0, 5.8, 5.4, 5.1, 5.0, 4.8, 4.4, 4.1, 4.0, 4.5, 4.7, 4.8, 4.1, 4.5, 4.7, 4.8, 5.1, 5.5, 5.7, 5.8, 6.1, 6.5, 6.7, 6.8, 7.1, 7.5, 7.1, 6.8, 6.7, 6.5, 6.1, 5.8, 5.7, 5.5, 5.1, 4.8, 4.7, 4.5, 4.1, 4.8, 4.7, 4.8, 4.0, 4.1, 4.4, 4.8, 5.0, 5.1, 5.4, 5.8, 6.0, 6.1, 6.4, 6.8, 7.0, 7.1, 7.4, 7.8, 7.4, 7.1, 7.0, 6.8, 6.4, 6.1, 6.0, 5.8, 5.4, 5.1, 5.0, 4.8, 4.4, 4.1, 4.0, 4.5, 4.7, 4.8, 4.1, 4.5, 4.7, 4.8, 5.1, 5.5, 5.7, 5.8, 6.1, 6.5, 6.7, 6.8, 7.1, 7.5, 7.1, 6.8, 6.7, 6.5, 6.1, 5.8, 5.7, 5.5, 5.1, 4.8, 4.7, 4.5, 4.1, 4.8, 4.7, 4.5, 4.8, 4.2, 4.4, 4.5, 4.8, 5.2, 5.4, 5.5, 5.8, 6.2, 6.4, 6.5, 6.8, 7.2, 7.4, 7.5, 7.4, 7.2, 6.8, 6.5, 6.4, 6.2, 5.8, 5.5, 5.4, 5.2, 4.8, 4.5, 4.4, 4.2, 4.8, 4.7, 4.0, 4.4, 4.5, 4.7, 5.0, 5.4, 5.5, 5.7, 6.0, 6.4, 6.5, 6.7, 7.0, 7.4, 7.5, 7.7, 7.5, 7.4, 7.0, 6.7, 6.5, 6.4, 6.0, 5.7, 5.5, 5.4, 5.0, 4.7, 4.5, 4.4, 4.0, 4.5, 4.8, 4.0, 4.4, 4.5, 4.8, 5.0, 5.4, 5.5, 5.8, 6.0, 6.4, 6.5, 6.8, 7.0, 7.4, 7.5, 7.4, 7.0, 6.8, 6.5, 6.4, 6.0, 5.8, 5.5, 5.4, 5.0, 4.8, 4.5, 4.4, 4.0, 4.8, 4.6, 4.0, 4.2, 4.5, 4.6, 5.0, 5.2, 5.5, 5.6, 6.0, 6.2, 6.5, 6.6, 7.0, 7.2, 7.5, 7.6, 7.5, 7.2, 7.0, 6.6, 6.5, 6.2, 6.0, 5.6, 5.5, 5.2, 5.0, 4.6, 4.5, 4.2, 4.0 }
local noteIndex = 1
function init()
print("woo")
input[1].mode('change', 1, 0.1, 'rising')
end
input[1].change = function(state)
print("got trigger!")
noteIndex = noteIndex + 1
if (noteIndex >= #notes) then
noteIndex = 1
end
output[1].volts = notes[noteIndex]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment