Skip to content
View in the app

A better way to browse. Learn more.

Learn more

pitch-demix function

Featured Replies

Currently pitch-demix function requires as the first parameter an integer (not a list) which defines the one voice to extract.

Is there a way to extract more than one voice from a chord at once (example: extract 3rd, 5th & 7th of chord at once), by applying a list of integers at once?

This would be great for orchestration to define which pitch of a chord goes into which strata..

;; Define chords
(setf chords (-<> 
              '((c4 maj7)
                (a3 m7)
                (d4 m7)
                (g3 7 ))
              (expand-chord <>)
              (make-omn :pitch <>
                        :length '(w)
                        :span :pitch)
              ))
; => (w c4e4g4b4 mf a3c4e4g4 d4f4a4c5 g3b3d4f4)
; works as expected :-)


;; Extract root
(setf bass (-<>
            chords
            (pitch-demix 1 <> :sort nil)
            (pitch-transpose -24 <>)
            ))
;=> (w c2 a1 d2 g1)
; works as expected :-)


;; Extract 3rd, 5th & 7th at once
(setf harmo (-<>
             chords
             (pitch-demix '(2 3 4) <> :sort nil)))
;=> (w e4 mf c4 f4 b3)
;
; not as expected:
; expected is: (w e4g4b4 mf c4e4g4 f4a4c5 b3d4f4)


; alternative try with nested list:
(setf harmo (-<>
             chords
             (pitch-demix '((2 3 4)) <> :sort nil)))
; error


; 2nd alternative try:
(setf harmo (-<>
             (list
              (pitch-demix 2 chords :sort nil)
              (pitch-demix 3 chords :sort nil)
              (pitch-demix 4 chords :sort nil)
              )
             (pitch-mix <>)
             ))

;=> (d. e4g4b4 c4e4g4 f4a4c5 b3d4f4)
; close but not correct, see length


; 3rd try:
(setf harmo (-<>
             (list
              (pitch-demix 2 chords :sort nil)
              (pitch-demix 3 chords :sort nil)
              (pitch-demix 4 chords :sort nil)
              )
             (pitch-mix <>)
             (length-diminution 3 <>)
             ))
;=> (w e4g4b4 c4e4g4 f4a4c5 b3d4f4)
; OK
; But very involved and fragile
; Can this be done easier by accepting chord-specific list inside pitch-demix function ?

  • Author

Thank you @JulioHerrlein : it works like a charm.

@opmo IMHO the functionality to demix multiple voices is highly valuable and deserves to be added to the OM standard library.

  • Author

Opusmodus version 4.0.31467:

;; Define chords
(setf chords (-<> 
              '((c4 maj7)
                (a3 m7)
                (d4 m7)
                (g3 7 ))
              (expand-chord <>)
              (make-omn :pitch <>
                        :length '(w)
                        :span :pitch)
              ))
; => (w c4e4g4b4 mf a3c4e4g4 d4f4a4c5 g3b3d4f4)

;; Extract 3rd, 5th & 7th at once
(setf harmo (-<>
             chords
             (pitch-demix '(2 3 4) <> :sort nil)
             ))
; => (w e4g4b4 c4e4g4 f4a4c5 b3d4f4)
; works as expected :-)

Create an account or sign in to comment

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.