Commit 9580677a authored by jhammen's avatar jhammen
Browse files

use new regex object

parent d7a39247
......@@ -62,13 +62,13 @@ Call the base class constructor to create a valid Midi.Pattern:
Use a regular expression to parse the chord name into root + type:
local ex = regexp(@"^([A-G][#,b]?)([a-z,2-9]*)")
local res = ex.capture(name)
local ex = regex(@"^([A-G][#,b]?)([a-z,2-9]*)")
local res = ex.match(name)
if(!res) {
throw "chord not recognized: " + name
local root = name.slice(res[1].begin, res[1].end)
local type = name.slice(res[2].begin, res[2].end)
local root = res[1]
local type = res[2]
Find the pitch of the root note from the table above.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment