Home

2024

Worklog

LETSGO Game

Start implementing multi-note Instruments

Date
August 14, 2024
Hours
2
Tags
UnrealCodeC++LETSGO

Started, not yet finished:

I under-estimated how tricky this would be.

I have an Actor that maps each note of each octave to a sound cue:

image

This was a lot of work to manually setup- 12 notes multiplied by 4 octaves, but presents a straightforward approach to get each reference.

The tricky part is figuring out how to filter these properties to get the appropriate note- how do I get DSharp1_Music_Note reference given a function taking “Note: DSharp”, “Octave: 1”.

That is still an open question.

I decided to solve the other side of the question- assuming there is code that successfully returns the correct UMetaSoundSource, how do I get my Instrument actor to consume it?

Currently, I have a concept of a InstrumentSchedule

image

For 3 bars, the drum kick will hit on the first and third quarter note. On the fourth bar, it kicks every beat.

This is sufficient if the note being played- the kick sound- is static every time.

It gets more complicated if the note that can be played is variable.

My solution here is to add a new property to FPerBarSchedule:

image

BeatsInBar is the existing setup, indicating to play something on the first and third beat.

Our new property is NotesInBar

image

I then updated the function that triggers on each bar to consume this new object.

I still need to figure out how to filter the references, but I’ll have to research it. It feels like filtering by a sets properties must have an established pattern.