Re: Detecting double accidentals
Thank you David, that works perfectly. I would have probably never found this way, even if I understand what it does. Sorry for the late response, didn't expect an answer that fast. If anyone is interested in this project, the full code as well as a quick-and-dirty documentation is available as a gist on GitHub: https://gist.github.com/TheNothingMan/6f5daf540d55b4ad9138e3ff5d3ffbd0 Thank you, kind regards! Am Di., 21. Jan. 2020 um 21:50 Uhr schrieb David Kastrup : > SK writes: > > > Hello, > > > > I wrote a script for generating music theory worksheets for school. One > > feature is the generation of chords that should be named by the students. > > The way this function works is by simply transposing some predefined > chords > > to a new randomly generated root. To keep the difficulty controllable, I > > would like to filter out double accidentals in some cases, e.g. to not > > produce an augmented F# chord. > > Does anybody know about a way to check in scheme if music has double > > accidentals, or can think of another smart way of doing this? > > > > I would not want to define all possible chords manually, and I think that > > filtering out certain root notes is quite complex, too, if you just want > to > > avoid double accidentals. > > > > Kind regards! > > #(define (has-doubles mus) >(any (lambda (p) (not (< -1 (ly:pitch-alteration p) 1))) > (music-pitches mus))) > > #(display (map has-doubles > (list #{ c'4 d' e' fis' g' a' b' #} > #{ cisis'4 d' e' #}))) > > -- > David Kastrup >
Re: Detecting double accidentals
SK writes: > Hello, > > I wrote a script for generating music theory worksheets for school. One > feature is the generation of chords that should be named by the students. > The way this function works is by simply transposing some predefined chords > to a new randomly generated root. To keep the difficulty controllable, I > would like to filter out double accidentals in some cases, e.g. to not > produce an augmented F# chord. > Does anybody know about a way to check in scheme if music has double > accidentals, or can think of another smart way of doing this? > > I would not want to define all possible chords manually, and I think that > filtering out certain root notes is quite complex, too, if you just want to > avoid double accidentals. > > Kind regards! #(define (has-doubles mus) (any (lambda (p) (not (< -1 (ly:pitch-alteration p) 1))) (music-pitches mus))) #(display (map has-doubles (list #{ c'4 d' e' fis' g' a' b' #} #{ cisis'4 d' e' #}))) -- David Kastrup
Detecting double accidentals
Hello, I wrote a script for generating music theory worksheets for school. One feature is the generation of chords that should be named by the students. The way this function works is by simply transposing some predefined chords to a new randomly generated root. To keep the difficulty controllable, I would like to filter out double accidentals in some cases, e.g. to not produce an augmented F# chord. Does anybody know about a way to check in scheme if music has double accidentals, or can think of another smart way of doing this? I would not want to define all possible chords manually, and I think that filtering out certain root notes is quite complex, too, if you just want to avoid double accidentals. Kind regards!