Discussion:
Adding a continuous drone to midi output
Sven Axelsson
2018-05-22 16:47:35 UTC
Permalink
I just tried the midi output to play back bagpipe music and was actually
surprised the complex grace notes work pretty well. However, I'm wondering
if there is some way to add the continuous drone to the music automatically
without having to actually write them in as separate voices? I need two
separate drone voices sounding the same note continuously during the entire
playback. Should be possible with a little Scheme magic, right?

Regards,
Sven Axelsson
--
++++++++++[>++++++++++>+++++++++++>++++++++++>++++++
++++<<<<<-]>++++.+.++++.>+++++.>+.<<-.>>+.>++++.<<.
+++.>-.<<++.>>----.<++.>>>++++++.<<<<.>>++++.<----.
Ben
2018-05-22 17:25:04 UTC
Permalink
Post by Sven Axelsson
I just tried the midi output to play back bagpipe music and was
actually surprised the complex grace notes work pretty well. However,
I'm wondering if there is some way to add the continuous drone to the
music automatically without having to actually write them in as
separate voices? I need two separate drone voices sounding the same
note continuously during the entire playback. Should be possible with
a little Scheme magic, right?
Regards,
Sven Axelsson
--
++++++++++[>++++++++++>+++++++++++>++++++++++>++++++
++++<<<<<-]>++++.+.++++.>+++++.>+.<<-.>>+.>++++.<<.
+++.>-.<<++.>>----.<++.>>>++++++.<<<<.>>++++.<----.
For just playback purposes? Does it have to be outputted in LilyPond and
the input file though?

I guess you could create a low synthesized drone pitch but I don't know
how you'd control it and manipulate it via playback as you are working
on a score.
LilyPond is primarily an engraving package. :)

Maybe you could use an audio player outside LilyPond and play back the
drone that way, then you'd have complete control of LilyPond as-is
without worrying - total control over each element. Assuming it's just
for playback purposes or composing tools.

Just an idea.
Karlin High
2018-05-22 18:01:05 UTC
Permalink
However, I'm wondering if there is some way to add the continuous drone
to the music automatically without having to actually write them in as
separate voices? I need two separate drone voices sounding the same note
continuously during the entire playback.
One option would be using a MIDI editor to add the drone tracks.
SpeedyMIDI is what I would use for this.
<http://speedymidi.sourceforge.net/>
Add new track, get the mouse-keyboard, set the drone notes, and mash the
spacebar until the duration's been recorded to desired length.

There might be a Scheme method, though. Things I've looked at here:

display-scheme-music
#(display (ly:music-length ...
\scaleDurations stuff
<https://lists.gnu.org/archive/html/lilypond-user/2017-10/msg00046.html>

I finally decided I was playing "sorcerer's apprentice" with those. But
in the past, I've been able to provoke a correct answer by posting an
incomplete or incorrect one. :)

% BEGIN LILYPOND CODE
\version "2.19.80"
% Pseudocode for generating continuous MIDI drone
% for instruments like bagpipes, hurdy-gurdy, etc

musicwithdrone = \repeat unfold 12 { c'4 e' g' c'' }

% Graphic output, no MIDI
\score {
\musicwithdrone

\layout { }
}

% MIDI output, no graphics
\score {
<<
\musicwithdrone
% Somehow, find length of \musicwithdrone
% and then play drone note for that duration
% c'*scaledtomusic
\midi { }
}
% END LILYPOND CODE
--
Karlin High
Missouri, USA
David Kastrup
2018-05-22 19:06:51 UTC
Permalink
Post by Karlin High
However, I'm wondering if there is some way to add the continuous
drone to the music automatically without having to actually write
them in as separate voices? I need two separate drone voices
sounding the same note continuously during the entire playback.
One option would be using a MIDI editor to add the drone
tracks. SpeedyMIDI is what I would use for this.
<http://speedymidi.sourceforge.net/>
Add new track, get the mouse-keyboard, set the drone notes, and mash
the spacebar until the duration's been recorded to desired length.
display-scheme-music
#(display (ly:music-length ...
\scaleDurations stuff
<https://lists.gnu.org/archive/html/lilypond-user/2017-10/msg00046.html>
I finally decided I was playing "sorcerer's apprentice" with
those. But in the past, I've been able to provoke a correct answer by
posting an incomplete or incorrect one. :)
% BEGIN LILYPOND CODE
\version "2.19.80"
% Pseudocode for generating continuous MIDI drone
% for instruments like bagpipes, hurdy-gurdy, etc
musicwithdrone = \repeat unfold 12 { c'4 e' g' c'' }
% Graphic output, no MIDI
\score {
\musicwithdrone
\layout { }
}
% MIDI output, no graphics
\score {
<<
\musicwithdrone
% Somehow, find length of \musicwithdrone
% and then play drone note for that duration
% c'*scaledtomusic
\midi { }
}
% END LILYPOND CODE
Ok, this is _too_ much of a temptation. So little to fill in
actually...
Sven Axelsson
2018-05-22 19:54:42 UTC
Permalink
Post by David Kastrup
Ok, this is _too_ much of a temptation. So little to fill in
actually...
Now it would be even nicer to be able to write
c'1*#(ly:music-length musicwithdrone)
and there is actually no compelling reason not to allow this I think.
I'll take a look to see what would be involved adding to the parser
here.
This really beats "LilyPond programmers are lazy jerks" solution-finding
approaches.
That would be absolutely brilliant, David! If you do it I will start
promoting the "Lilypond programmers are hard-working saints" meme. ☺

Another somewhat related question, would it be possible to automatically
wrap the music with `\unfoldRepeats` when generating MIDI output? Isn't
that what you always want anyways?

Thanks a lot,
Sven Axelsson
--
++++++++++[>++++++++++>+++++++++++>++++++++++>++++++
Post by David Kastrup
++++<<<<<-]>++++.+.++++.>+++++.>+.<<-.>>+.>++++.<<.
+++.>-.<<++.>>----.<++.>>>++++++.<<<<.>>++++.<----.
David Kastrup
2018-05-22 20:10:44 UTC
Permalink
Post by Sven Axelsson
Post by David Kastrup
Ok, this is _too_ much of a temptation. So little to fill in
actually...
Now it would be even nicer to be able to write
c'1*#(ly:music-length musicwithdrone)
and there is actually no compelling reason not to allow this I think.
I'll take a look to see what would be involved adding to the parser
here.
This really beats "LilyPond programmers are lazy jerks" solution-finding
approaches.
That would be absolutely brilliant, David! If you do it I will start
promoting the "Lilypond programmers are hard-working saints" meme. ☺
Another somewhat related question, would it be possible to automatically
wrap the music with `\unfoldRepeats` when generating MIDI output? Isn't
that what you always want anyways?
\score {
\repeat volta 2 { c4 d e f }
\layout { }
\midi { }
}

What now?
--
David Kastrup
Sven Axelsson
2018-05-22 20:25:41 UTC
Permalink
Post by Karlin High
Post by Sven Axelsson
Another somewhat related question, would it be possible to automatically
wrap the music with `\unfoldRepeats` when generating MIDI output? Isn't
that what you always want anyways?
\score {
\repeat volta 2 { c4 d e f }
\layout { }
\midi { }
}
What now?
That is ok, but try this:

\score {
\repeat volta 2 { c4 d e f } \alternative { {e4} {c4} }
\layout { }
\midi { }
}
--
Sven Axelsson
++++++++++[>++++++++++>+++++++++++>++++++++++>++++++
Post by Karlin High
++++<<<<<-]>++++.+.++++.>+++++.>+.<<-.>>+.>++++.<<.
+++.>-.<<++.>>----.<++.>>>++++++.<<<<.>>++++.<----.
David Kastrup
2018-05-22 20:50:01 UTC
Permalink
Post by Karlin High
Post by Karlin High
Post by Sven Axelsson
Another somewhat related question, would it be possible to automatically
wrap the music with `\unfoldRepeats` when generating MIDI output? Isn't
that what you always want anyways?
\score {
\repeat volta 2 { c4 d e f }
\layout { }
\midi { }
}
What now?
\score {
\repeat volta 2 { c4 d e f } \alternative { {e4} {c4} }
\layout { }
\midi { }
}
Your point being?
--
David Kastrup
David Kastrup
2018-05-22 20:57:28 UTC
Permalink
Post by Sven Axelsson
Post by David Kastrup
Ok, this is _too_ much of a temptation. So little to fill in
actually...
Now it would be even nicer to be able to write
c'1*#(ly:music-length musicwithdrone)
and there is actually no compelling reason not to allow this I think.
I'll take a look to see what would be involved adding to the parser
here.
This really beats "LilyPond programmers are lazy jerks" solution-finding
approaches.
That would be absolutely brilliant, David! If you do it I will start
promoting the "Lilypond programmers are hard-working saints" meme. ☺
Turns out that I don't have a good idea where to document this in the
manuals. At least I added a (half-stolen) regtest that at least
illustrates how this can be used for your usage case.

Current branch: issue5327
Tracker issue: 5327 (https://sourceforge.net/p/testlilyissues/issues/5327/)
Rietveld issue: 346810043 (https://codereview.appspot.com/346810043)
Issue description:
Allow Scheme/identifiers for duration multipliers Also contains
commit: Regtest for computed duration multipliers
--
David Kastrup
Karlin High
2018-05-22 21:06:36 UTC
Permalink
Post by David Kastrup
Turns out that I don't have a good idea where to document this in the
manuals.
You've already considered this one?

<http://lilypond.org/doc/v2.19/Documentation/notation/writing-rhythms#scaling-durations>
--
Karlin High
Missouri, USA
David Kastrup
2018-05-22 22:19:43 UTC
Permalink
Post by Karlin High
Post by David Kastrup
Turns out that I don't have a good idea where to document this in the
manuals.
You've already considered this one?
<http://lilypond.org/doc/v2.19/Documentation/notation/writing-rhythms#scaling-durations>
I've not considered _any_ part of the manuals yet. You are likely
right, but no fun: this section of the manual would rather suggest that
\scaleDurations should likely be made to accept the same kind of
multiplier, and that appears, like, really icky.

Do we then need a predicate factor? that will accept either a number
pair (in lieu of a fraction) or a (non-negative?) rational or a moment?

The predicate fraction? remains necessary for indicating "musical"
fractions (used for meters and tuplets) which are not adequately
represented with rational numbers because 3/2 and 6/4 need to be
differentiated.
--
David Kastrup
David Kastrup
2018-05-23 22:05:11 UTC
Permalink
Post by David Kastrup
Post by Karlin High
Post by David Kastrup
Turns out that I don't have a good idea where to document this in the
manuals.
You've already considered this one?
<http://lilypond.org/doc/v2.19/Documentation/notation/writing-rhythms#scaling-durations>
I've not considered _any_ part of the manuals yet. You are likely
right, but no fun: this section of the manual would rather suggest that
\scaleDurations should likely be made to accept the same kind of
multiplier, and that appears, like, really icky.
Do we then need a predicate factor? that will accept either a number
pair (in lieu of a fraction) or a (non-negative?) rational or a moment?
The predicate fraction? remains necessary for indicating "musical"
fractions (used for meters and tuplets) which are not adequately
represented with rational numbers because 3/2 and 6/4 need to be
differentiated.
Sigh. Added basic documentation and harmonized the functionality.

Current branch: issue5327
Tracker issue: 5327 (https://sourceforge.net/p/testlilyissues/issues/5327/)
Rietveld issue: 346810043 (https://codereview.appspot.com/346810043)
Issue description:
Allow Scheme/identifiers for duration multipliers Also contains
commit: Regtest for computed duration multipliers
--
David Kastrup
Karlin High
2018-05-23 22:40:08 UTC
Permalink
Post by David Kastrup
Sigh. Added basic documentation and harmonized the functionality.
(APPLAUSE)

Does this get a changes entry?
--
Karlin High
Missouri, USA
David Kastrup
2018-05-23 23:15:13 UTC
Permalink
Post by Karlin High
Post by David Kastrup
Sigh. Added basic documentation and harmonized the functionality.
(APPLAUSE)
Does this get a changes entry?
It might. It's not really Earth shaking functionality, to be honest.
--
David Kastrup
Mats Bengtsson
2018-05-22 21:26:13 UTC
Permalink
Post by Sven Axelsson
Another somewhat related question, would it be possible to
automatically wrap the music with `\unfoldRepeats` when generating
MIDI output? Isn't that what you always want anyways?
Not really, if you mainly use the MIDI for proof listening (which
corresponds to the level of ambition that the current MIDI output is
at), then unfolded repeats are just annoying, in my opinion.

   /Mats
Gilles
2018-05-22 21:53:14 UTC
Permalink
Hi.
Post by Sven Axelsson
I just tried the midi output to play back bagpipe music and was actually
surprised the complex grace notes work pretty well. However, I'm wondering
if there is some way to add the continuous drone to the music
automatically
without having to actually write them in as separate voices? I need two
separate drone voices sounding the same note continuously during the entire
playback. Should be possible with a little Scheme magic, right?
This
http://lsr.di.unimi.it/LSR/Item?id=997
answered the same question which I asked here a few years ago.

Regards,
Gilles

P.S. I've encountered an issue where the drone stops well before
the melody it is supposed to double; it occurs when there
are a lot of grace notes.
Post by Sven Axelsson
Regards,
Sven Axelsson
Loading...