implemented chord recognition algorithm