Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Minimalistic music system.

Credits go to Johan Halmén, Tobias Dammers, and weapon_S for helping out!
This thread is locked; no one can reply to it. rss feed Print
Minimalistic music system.
Andrei Ellman
Member #3,434
April 2003

Hi,

I am thinking of adding an element to a game where if a sequence of non-player-characters (NPCs) pick up certain items in a certain order, they will be able to play a tune if the action of picking up an item plays a note. In order to economise on the number of items, I'm trying to think of a system where a level-designer can feel like they're free to compose their own tunes with the minimalistic number of parameters (and by 'minimalistic', I mean something more substantial than John Cage's interpretation of the concept of 'minimalism').

The easiest one to control would be the interval between notes - the NPCs just need to be timed to pick up the note-generating items at the right times. Of all the remaining parameters, pitch would be by far the most vital for creating melodies. Pitch will be determined by the colour of object that is picked up. I get the feeling that other parameters such as as instrument, timbre, note-duration, volume, panning, vibrato, etc. are not quite as vital.

So using only pitch and interval as parameters, that still leaves the following question - howmany notes of different pitch do I need. Would I need a full octave's worth? More? Less? Which note do I need to start my octave with (C?)? Would I need to use all the notes (including the sharps/flats etc.), or can I get away with just using notes that correspond to the white keys on a piano? A bit of research has led me to the C major scale (the notes that correspond to "Do Re Mi Fa So La Ti Do"). This is probably the same set of notes used on a toy xylophone, so the level-designer may think they have enough flexibility with just these 8 notes. However, I don't think they would be able to compose tunes in a minor scale (or any other major scale apart from C). Would this be too much of a restriction? As for the instrument, a xylophone would probably be the instrument of choice as it has a long release-part of the ADSR envelope which means that it might be able to give the illusion of variable note-length which may not be possible with an instrument with a long sustain-part (like a violin).

Would adding a second instrument at a lower octave so I can create a bass-line be overkill? I could however use the other events that generate sound as percussion instruments. Also, I can use position relative to the observer to create stereo panning effects, and distance from the observer would create volume.

Are there any other hacks/tricks I've missed out on for creating richly-composed music with minimal parameters? Would it be better for the picked up objects to play a short riff instead of a single note?

AE.

--
Don't let the illegitimates turn you into carbon.

l j
Member #10,584
January 2009
avatar

The A minor scale uses the same notes as the C major scale.

Johan Halmén
Member #1,550
September 2001

Anyone remember the name of a program/app/whatever, which had this grid that you could toggle each cell to either play or be mute. It had 16 columns and some 10 rows. The app continuously played all 16 columns, one column at a time as a block chord, kind of. Each row presented one pitch in the partial tone scale:
{"name":"osaaanet.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/3\/f3115b2621aa2733bba6a98d6ccc566f.gif","w":470,"h":151,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/3\/f3115b2621aa2733bba6a98d6ccc566f"}osaaanet.gif
Or you could choose which instrument sound you filled one cell with.

It all sounded very haunting and hypnotizing. I'd go for this in your case.

googlegoogle

I think it was this one: https://itunes.apple.com/us/app/elemental-musical-instrument/id496748658?mt=12

If it were implemented using midi instruments, each sound would have to be pitch adjusted to just intonation.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

weapon_S
Member #7,859
October 2006
avatar

Technically you get 8 scales (each starting on a different note), and you get some scales using less than 8 tones (most notably pentatonic). Because we're used to C-major, it might be an idea to start one note lower at B to get a little variation. If there's only one octave, it will be hard to suggest the other scales. There's one important scale you're missing out on: blues scale. If you have the room, add three[1] tones to accommodate it.
Might also be nice to have sounds with increasing and decreasing volume.
The problem is you want few input parameters with lots of different output. It's not a musical problem. You could have per-level "programmed" sounds, sounds depending on (other) game events, or pre-defined changes between sounds. You might end up with a system that is very hard to make music with, if that's what you want ;)

References

  1. I'm not sure you could do with less
Mark Oates
Member #1,146
March 2001
avatar

Anyone remember the name of a program/app/whatever, which had this grid that you could toggle each cell to either play or be mute. It had 16 columns and some 10 rows.

Yeaus, 8-) cause I wrote it biaaaaattttcchhhh!! :D:D8-)8-)

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Elias
Member #358
May 2000

Isn't one of the Allegro 5 examples quite similar to this app as well?

--
"Either help out or stop whining" - Evert

Johan Halmén
Member #1,550
September 2001

Ok, that was it. And the A5 example obviously is Mark's creation. And it's pentatonic, not partial tone based.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Tobias Dammers
Member #2,604
August 2002
avatar

I remember one quest in Black & White, where you had to collect tuned magical obelisks and arrange them in a circle so that they play a scale. They used a tinkerbell-like sound, which has a longish tail, but no sustain phase. I can imagine a similar but more elaborate setup for your idea - an area in your world where you can place objects, and once you do, they produce sounds.

As for what kind of sounds to use; I think you'll get the most impressive results with a selection of percussive sounds, and pentatonic scales for one or two melodic instruments (a melody and a bass line). A set of about 20-24 sounds should be plenty (10 notes for 2 octaves' worth of pentatonic scale for the melody, 5 notes for the bass, and 5 percussive sounds). "One-shot" sounds such as bells, xylophone-likes, or plucked strings with a fast decay, remove the need for controlled release, and you won't sacrifice a lot of expressivity at that level.

The nice thing about the pentatonic scale is that you can hardly go wrong; any combination of notes "works" in the sense that it doesn't cause one of those undesirable dissonances (minor 9th, tritone, etc.), only consonances and 'pleasant' dissonances, which makes it perfect as an entry point for people without a lot of musical education. Also, a pentatonic scale, even though it has only 5 notes, can suggest both major and minor harmony.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Andrei Ellman
Member #3,434
April 2003

taron said:

The A minor scale uses the same notes as the C major scale.

So would that mean I can use the same notes or would I have to start my scale 2 notes lower?

@Johan: Interesting. I may have seen something similar. But I'm curious as to why the bass notes are so separated when (nearly?) all treble notes are used.

I remember one quest in Black & White, where you had to collect tuned magical obelisks and arrange them in a circle so that they play a scale. They used a tinkerbell-like sound, which has a longish tail, but no sustain phase. I can imagine a similar but more elaborate setup for your idea - an area in your world where you can place objects, and once you do, they produce sounds.

Just out of interest, howmany objects/notes were there?

Tobias Dammers said:

As for what kind of sounds to use; I think you'll get the most impressive results with a selection of percussive sounds, and pentatonic scales for one or two melodic instruments (a melody and a bass line). A set of about 20-24 sounds should be plenty (10 notes for 2 octaves' worth of pentatonic scale for the melody, 5 notes for the bass, and 5 percussive sounds). "One-shot" sounds such as bells, xylophone-likes, or plucked strings with a fast decay, remove the need for controlled release, and you won't sacrifice a lot of expressivity at that level.

Interesting. I was thinking of just 8 notes but maybe I could have one instrument with 10 notes and another with 5. There are several gameplay-related events that each make a distinct sound - these could be used for percussion. So is two octaves' worth of a pentatonic scale generally a lot more flexible than one octave of a diatonic scale (apart from the fact the composer has more notes to play with)? Would the bass also be on a pentatonic scale and if so, would it be one octave lower than the lowest melody-octave?

Anyway, the system I had in mind is sort of like a toy music system - something that can be used to make a variety of simple tunes so it is not intended for serious music composition. This is simply to economise on the number of notes. But on the other hand, I want the composer to feel they're not too restricted. I'm thinking of distinguishing the note-objects by hue - hence my need to economise. 8 hues are easy to distinguish. 10 might be possible, but with more than 10, it might become too easy to confuse notes of different hues if they're not next to eachother (bear in mind that the quality of colour vision varies from person to person). As well as the hue, I could also vary the shape of the object if I wanted a different instrument, so I could have a different shape for the 'bassline instrument'. BTW chords will be possible - the sequence of events would have to be timed so that the notes of the chord are picked up at exactly the same time (although I might place restrictions on the number of notes in a chord or possibly even not allow chords).

One possible idea I had was that if using diatonic scales, I could have a per-level parameter that lets the composer choose which scale to use for the tunes. Am I right in guessing that simple tunes usually stay within a single octave of a diatonic scale? That is, as long as the composer gets to chose their scale, would they still feel restricted with just 8 notes?

I had a look at images of toy xylophones and compared to real xylophones, the most obvious difference is that the toy ones have fewer notes. Usually 8, but I also saw ones with 4, 5, 12 and 15 notes (couldn't find one with 10 notes).

So given the various restrictions (single diatonic scale, 2 octaves of pentatonic scale, single pentatonic scale), what sorts of restrictions would a composer feel they are bound by? The idea is to make the composer feel free to compose what they want with minimal restrictions while at the same time economising on notes and other parameters. Would having all 12 semitones of an octave (the chromatic scale) be overkill, or would it give the composer the flexibility to use any scale within the octave they liked within the same level?

AE.

--
Don't let the illegitimates turn you into carbon.

Johan Halmén
Member #1,550
September 2001

But I'm curious as to why the bass notes are so separated when (nearly?) all treble notes are used.

Musical tones and their frequencies, short course

What we perceive as a "musical tone" is a sound with a pitch. The pitch is determined by the frequency, say a string vibrating at 100 Hz, which would produce the tone G (approximately). When you double the frequency, you will hear the tone G again, one octave higher (200 Hz). Doubling again (400 Hz) gives you next G, and so on.
While vibrating at 100 Hz, a string usually produces vibrations at half string length (200 Hz), a third string length (300 Hz), a fourth, fifth, sixth string lengths and so on (400, 500, 600 Hz...), the so called partial tones. The amplitude of each of these super frequencies determine the timbre of the tone. But these frequencies also determine which tones form our musical tone system. The 4th, 5th and 6th partial tones form a perfect triad. The 8th, 9th and 10th tones form the three first tones of a major scale. Other tones in a major scale, and the accidentals (black keys), are more or less determined by same ideas. A major second interval is either 9/8 (frequency ratio between D and C) or 10/9 (ratio between E and D), a minor second is 16/15 (ratio between C and B).

Modern ways of tuning (especially electronic instruments) even out the differences between D/C and E/D so that each half step is <math>\sqrt[12]{2}</math>
{"name":"f3115b2621aa2733bba6a98d6ccc566f.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/3\/f3115b2621aa2733bba6a98d6ccc566f.gif","w":470,"h":151,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/3\/f3115b2621aa2733bba6a98d6ccc566f"}f3115b2621aa2733bba6a98d6ccc566f.gif
In this image, the blue numbers show how much off the partial tones are from the <math>\sqrt[12]{2}</math> based tones.
If you get the 100, 200, 400, 800... thing, you also get the 100, 200, 300, 400, 500... thing, where the tones are closer the higher up you get.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Andrei Ellman
Member #3,434
April 2003

Thanks for the suggestion, but for now, I'll stick to the C Major scale, as I don't want to make it too complicated ... yet.

--
Don't let the illegitimates turn you into carbon.

Go to: