[CM] Parsing symbolic note names

Iain Duncan iainduncanlists at gmail.com
Sun Jun 21 09:45:31 PDT 2026


Hi Schemers, before I go doing this in a possibly silly (or overly
involved) way, I thought i'd check how others would do it.

I want to parse note names to a list of  ({oct as number} {letter-name}
{one or moreinflections})
So
'C5 ->  (list 5 #\C)
'Dbb-2 -> (list -2 #\D #\b #\b)

I got this working without the octaves and was about to tackle octaves. I'm
going to stick the results in a hash-table as an in memory cache so I'm not
too concerned on speed. My thought was to convert the incoming symbol to a
list of chars, recursively consume chars until hitting a minus sign or
digit, consume to end, convert to string, then symbol, then get the number.
But maybe there is something in s7 or Scheme I don't know about that would
be easier?

thanks!
iain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20260621/e53cd3e0/attachment.html>


More information about the Cmdist mailing list