Class CompositeMusicGenerator
- All Implemented Interfaces:
MusicGenerator
Delegation mechanism is configured via the RvToDelegateUnitMapper class.
This lets a base Rhythm instance use more than one MusicGenerator, for example :
- use an internal MusicGenerator for the bass RhythmVoice and another internal one for the rest of the RhythmVoices
- use 2 internal MusicGenerators for the bass RhythmVoice, depending on the SongPart's RP_SYS_Variation value
- use the percussion MusicGenerator from another Rhythm instance for our drums
- use the Main-C bass track from another Rhythm with note velocities lowered so it better fits the other tracks of the base rhythm
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA delegate unit for a base RhythmVoice in the songPart context.static interfaceMap a base RhythmVoice to a DelegateUnit for a given SongPart context. -
Constructor Summary
ConstructorsConstructorDescriptionCompositeMusicGenerator(Rhythm baseRhythm, CompositeMusicGenerator.RvToDelegateUnitMapper baseRvMapper) Create a CompositeMusicGenerator for a base Rhythm. -
Method Summary
Modifier and TypeMethodDescriptiongenerateMusic(SongContext sgContext, RhythmVoice... rvs) Generate the note Phrases which correspond to a musical accompaniment for a given rhythm.
-
Constructor Details
-
CompositeMusicGenerator
public CompositeMusicGenerator(Rhythm baseRhythm, CompositeMusicGenerator.RvToDelegateUnitMapper baseRvMapper) Create a CompositeMusicGenerator for a base Rhythm.- Parameters:
baseRhythm-baseRvMapper-
-
-
Method Details
-
getBaseRhythm
-
generateMusic
public Map<RhythmVoice,Phrase> generateMusic(SongContext sgContext, RhythmVoice... rvs) throws MusicGenerationException Description copied from interface:MusicGeneratorGenerate the note Phrases which correspond to a musical accompaniment for a given rhythm.The service provider must compute one Phrase per RhythmVoice/Midi channel. The MidiMix from
contextprovides the Midi channel associated to each RhythmVoice viaMidiMix.getChannel(RhythmVoice). Phrases must be provided for all RhythmVoices (though a Phrase can be empty), including for the possible RhythmVoiceDelegates used by the Rhythm.If the context song contains several rhythms, the method must add notes ONLY for bars which use this MusicGenerator's rhythm. For example, if context range is bars 3-4 with rhythm1 on bar3 and rhythm2 on bar4, then the rhythm1 generator must add notes for bar 3 only.
IMPORTANT: the following features are directly managed by the JJazzLab framework, notably by postprocessing the output of generateMusic():
- Midi Instrument selection and settings (Program changes, Midi controller messages such as bank select, volume, reverb, panoramic)
- RP_SYS_Mute rhythm parameter handling (muting a specific track for a specific SongPart)
- RP_SYS_DrumsMix rhythm parameter handling (adjusting some drums track instruments velocity)
- RP_SYS_CustomPhrase rhythm parameter handling (substitute a user-supplied phrase for a rhythm track)
- RP_STD_Fill rhythm parameter handling for the "fade_out" value (MusicGenerator must handle the other values)
- Handling of the channel's specific velocity shift
- Handling of the instrument's specific transposition
- Drums channel rerouting
- NC chord symbols (produce no sound)- Specified by:
generateMusicin interfaceMusicGenerator- Parameters:
sgContext- The information to be used for music generationrvs- Generate music only for these RhythmVoices, or for all RhythmVoices if nothing specified- Returns:
- One Phrase per rhythm voice/channel.
- Throws:
MusicGenerationException- If generator could not produce the expected music for some reason.
-