lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing and playing a different instrument in MIDI


From: David Wright
Subject: Re: Changing and playing a different instrument in MIDI
Date: Fri, 22 Jul 2016 08:11:23 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri 22 Jul 2016 at 08:51:52 (+0200), Mojca Miklavec wrote:
> I don't have much experience with MIDI. I just tried all the media
> players on OS X and realized than only QuickTime Player 7 had some
> very very basic support for playing MIDI files (I cannot even make it
> play loud enough, let alone do anything else with it). None of the
> others I have installed worked (VLC, MPlayerX, QuickTime Player,
> RealPlayer, ...)
> 
> So I went on and made a package for TiMidity++ and freepats.
> 
> The problem is: I'm still unable to figure out how to change the
> instrument to anything but Piano.
> 
> Here's a minimal example:
[...]
> But this doesn't help me in any way.
> 
> Freepats contains
>     Tone_000/021_Accordion.pat
> so I tried to set the instrument to "021_Accordion", but that one
> didn't help either.
> 
> It's not neccessarily a LilyPond's fault. It could be that I simply
> misconfigured TiMidity++. I would be grateful for any hints about
> where to look next.

You can move the performer from Staff to Voice level. Here's your example:

\score {
  \new PianoStaff
  <<
    \new Voice = "melody" \fixed c'
    {
      \set midiInstrument = #"accordion"
      \time 3/4
      f4 g a
    }
  >>
  \midi{
    \tempo 4 = 100
    \context {
      \Staff
      \remove Staff_performer
    }
    \context {
      \Voice
      \consists Staff_performer
    }
  }
}

I do this as a matter of course because I set a lot of SATB music
on the conventional two staves but need to generate midi teaching
files with the individual parts highlighted. So I keep an ily file
with a few definitions in it:

%% a selection of instruments:
midioboe = {
  \set midiInstrument = #"oboe"
  \set midiMinimumVolume = #0.0
  \set midiMaximumVolume = #1.0
} % with dynamics
midisoloclarinet = {
  \set midiInstrument = #"clarinet"
  \set midiMinimumVolume = #0.9
  \set midiMaximumVolume = #1.0
}
midibackingbassoon = {
  \set midiInstrument = #"bassoon"
  \set midiMinimumVolume = #0.3
  \set midiMaximumVolume = #0.4
}
midiclick = {
  \set midiInstrument = #"woodblock"
  \set midiMinimumVolume = #1.0
  \set midiMaximumVolume = #1.0
}

miditempo = "" % default in case I forget to set it specifically

mididyn = \midi {
  \context {
    \Staff
    \remove Staff_performer
  }
  \context {
    \Voice
    \consists Staff_performer
  }
}

midinodyn = \midi {
  \mididyn
  \context {
    \Voice
    \remove Dynamic_performer
  }
}

%% example of its use. This would also be in an ily file with each
%% part being highlighted in turn. (click is for syncopated jazzy music)
\score {
  \unfoldRepeats
  \new Staff <<
    \global
    \new Voice { \midiclick \click }
    \new Voice { \midibackingbassoon \soprano }
    \new Voice { \midibackingbassoon \alto }
    \new Voice { \midisoloclarinet \tenor }
    \new Voice { \midibackingbassoon \bass }
  >>
  \midi {
    \midinodyn % uses midinodyn for teaching parts, mididyn for tutti
    \miditempo
  }
}

And that way I can add three lines and get a full set of midi teaching
files for tutti and each and every part.

\include "Midi-bits.ily"
%% define the parts' notes here
miditempo = { \tempo 4=72 }
\include "Midi-csatb.ily"

Cheers,
David.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]