TomTolleson Posted September 21, 2024 Posted September 21, 2024 Hello, I have a lisp function called convert-chord-symbols-to-notes which works but is outputting backslashes. The function for D#/Eb is as follows (defun convert-chord-symbol-to-notes (chord-symbol) (cond ;; D# / Eb chords ((or (equal chord-symbol 'd#sus2) (equal chord-symbol 'ebsus2)) '(d#4 f4 a#4)) ((or (equal chord-symbol 'd#maj) (equal chord-symbol 'ebmaj)) '(d#4 g4 a#4)) ((or (equal chord-symbol 'd#m) (equal chord-symbol 'ebm)) '(d#4 f#4 a#4)) ((or (equal chord-symbol 'd#7) (equal chord-symbol 'eb7)) '(d#4 g4 a#4 c#5)) ((or (equal chord-symbol 'd#m7) (equal chord-symbol 'ebm7)) '(d#4 f#4 a#4 c#5)) ((or (equal chord-symbol 'd#maj7) (equal chord-symbol 'ebmaj7)) '(d#4 g4 a#4 d5)) ((or (equal chord-symbol 'd#9) (equal chord-symbol 'eb9)) '(d#4 g4 a#4 c#5 f5)) ;; Error handling for unrecognized chords (t (error "Chord symbol not recognized")))) If I use the function, I would expect the follwing: (setf notes (convert-chord-symbol-to-notes 'ebmaj7)) >(d#4 g4 a#4 d5) However, what I'm getting is: (setf notes (convert-chord-symbol-to-notes 'ebmaj7)) >(d\#4 g4 a\#4 d5) I've added another function: (defun remove-backslashes (string) (remove #\\ string)) And used that on the output as a new variable. There were no errors and the code evaluated fine but the output still had backslashes. I also added the remove-backlslashes function into the convert-chord-symbols-to-notes. Again, it evaluated without errors but the backslashes were still there. Any ideas what's causing this or, more importantly, how to fix it? Thanks! Tom Tolleson Quote
jesele Posted September 21, 2024 Posted September 21, 2024 OM don't use # but s for sharps. Jesper (defun convert-chord-symbol-to-notes (chord-symbol) (cond ;; D# / Eb chords ((or (equal chord-symbol 'd#sus2) (equal chord-symbol 'ebsus2)) '(ds4 f4 as4)) ((or (equal chord-symbol 'd#maj) (equal chord-symbol 'ebmaj)) '(ds4 g4 as4)) ((or (equal chord-symbol 'd#m) (equal chord-symbol 'ebm)) '(ds4 fs4 as4)) ((or (equal chord-symbol 'd#7) (equal chord-symbol 'eb7)) '(ds4 g4 as4 cs5)) ((or (equal chord-symbol 'd#m7) (equal chord-symbol 'ebm7)) '(ds4 fs4 as4 cs5)) ((or (equal chord-symbol 'd#maj7) (equal chord-symbol 'ebmaj7)) '(ds4 g4 as4 d5)) ((or (equal chord-symbol 'd#9) (equal chord-symbol 'eb9)) '(ds4 g4 as4 cs5 f5)) ;; Error handling for unrecognized chords (t (error "Chord symbol not recognized")))) (setf notes (convert-chord-symbol-to-notes 'ebmaj7)) (setf notes (convert-chord-symbol-to-notes 'd#maj7)) Or (defun convert-chord-symbol-to-notes (chord-symbol) (cond ;; D# / Eb chords ((or (equal chord-symbol 'dssus2) (equal chord-symbol 'ebsus2)) '(ds4 f4 as4)) ((or (equal chord-symbol 'dsmaj) (equal chord-symbol 'ebmaj)) '(ds4 g4 as4)) ((or (equal chord-symbol 'dsm) (equal chord-symbol 'ebm)) '(ds4 fs4 as4)) ((or (equal chord-symbol 'ds7) (equal chord-symbol 'eb7)) '(ds4 g4 as4 cs5)) ((or (equal chord-symbol 'dsm7) (equal chord-symbol 'ebm7)) '(ds4 fs4 as4 cs5)) ((or (equal chord-symbol 'dsmaj7) (equal chord-symbol 'ebmaj7)) '(ds4 g4 as4 d5)) ((or (equal chord-symbol 'ds9) (equal chord-symbol 'eb9)) '(ds4 g4 as4 cs5 f5)) ;; Error handling for unrecognized chords (t (error "Chord symbol not recognized")))) (setf notes (convert-chord-symbol-to-notes 'ebmaj7)) (setf notes (convert-chord-symbol-to-notes 'dsmaj7)) TomTolleson 1 Quote
TomTolleson Posted September 21, 2024 Author Posted September 21, 2024 Ah! Of course. I generated this with the LLM and lost my ability to recognize basic OMN! LOL Thanks Jesele! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.