[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do I extract individual voices from chords
From: |
Gilles THIBAULT |
Subject: |
Re: How do I extract individual voices from chords |
Date: |
Mon, 23 Mar 2015 00:09:11 +0100 |
User-agent: |
KMail/4.12.5 (Linux/3.14.32-desktop-1.mga4; KDE/4.12.5; x86_64; ; ) |
Le dimanche 22 mars 2015, 00:54:08 Johan Vromans a écrit :
> On Sat, 21 Mar 2015 23:47:35 +0100
>
> Kaj <address@hidden> wrote:
> > Or: How do I extract the first, second and third voice from the chord
> > score to use as input to the midi?
>
> I once wrote a small tool (perl module) to split a polyphone MIDI into
> separate voices.
>
> https://metacpan.org/pod/MIDI::Tweaks#MIDI::Track::split_hml
>
> It may be helpful.
>
> -- Johan
I have a solution in scheme but i use a function described here :
http://lsr.di.unimi.it/LSR/Item?id=761
So you have an \include file to download (see the following link).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.18.2"
\include "chord.ly"
%% Download chord.ly here :
%% http://gillesth.free.fr/Lilypond/chord/
\layout {
\override Score.RehearsalMark #'self-alignment-X = #LEFT
\override Score.RehearsalMark #'Y-offset = #4
}
All = {
<c' e' g'>8 <d' f' a'> <e' g'>
<f' a'>
g'8 a'<g' e' c'> <a' f' d'>
}
Soprano = { g'8 a' g' a' g' a' c' d' }
Alto = { e'8 f' g' a' g' a' e' f' }
Baritone = { c'8 d' e' f' g' a' g' a' }
% First score is to illustrate the chord version
\score {
\new Staff {
\mark "This is what I want..."
\new Voice { \All }
}
\layout {}
}
#(define (delete-doubled-notes music-with-chords)
(let ((chords (extract-named-music music-with-chords 'EventChord)))
(for-each
(lambda(chord)
(ly:music-set-property! chord 'elements
(delete-duplicates
(ly:music-property chord 'elements)
(lambda(note1 note2)
(equal? (ly:music-property note1 'pitch)
(ly:music-property note2 'pitch))))))
chords)
music-with-chords))
myScore = #(define-music-function (parser location musicA musicB musicC)
(ly:music? ly:music? ly:music?)
(delete-doubled-notes
(add-note musicC (add-note musicB musicA))))
% Second score illustrates the three voices separated
\score {
\new Staff {
\new Voice {
\myScore \Soprano \Alto \Baritone
}
}
\layout {}
}
%%%%%%%%%%%%%%%%%%%%%%%
--
Gilles
chord.png
Description: PNG image