Hanami Original Soundtrack

I wrapped up the Hanami soundtrack this morning by adding the finishing touches to the last two tracks, and adding a bonus end track which was pretty unplanned. I noticed that the game needed something to calm itself back down after the boss fight at the end, so I made a simple Final Fantasy inspired epilogue track which is just pretty. The famous “prelude” from the Final Fantasy series appears in almost all of the series’ titles (from one to ten atleast), and sums up the games when played at either the beginning or the end.

I’ve compiled each track into this video, in the order the tracks appear in the game.

Five Petals

A couple of the new tracks I’ve been working on are sounding pretty close to being finished, although at the moment there is a definite drop in quality from the first track. The “bamboo” track I’ve been trying to make has been taking the longest to finish, as it’s the most different. I’ve also started working on the boss theme, which has been fun. For this piece of music, I’m ignoring most of the rules I’ve read about pentatonic scales and traditional Japanese percussion, and simply tried to keep the themes running through the instruments I’m using and the way I’m using them. The Boss Theme is a little homage to Final Fantasy in a lot of ways, as I’ve taken inspiration from multiple Final Fantasy battle themes for the intro and from the Shinra theme from FFVII for the main drum rhythm.

As the pieces are coming together, I’ve made myself a system in Game Maker to describe which background music to play in which room. Instead of stating the music that should be playing in every single individual room (as I have done for other things…) I’ve started the music playing in each main part of the level, and simply made sure it keeps playing even if buildings and caves are entered. To do this, I’ve made a basic script which is called when the player enters the main stage of each level called soundInit:

This states that if the music is not already playing, the music should play on a continual loop. This script also sets the global variable music from true to false, meaning that the music cannot be changed. When the player leaves the level, I’ve reset the variable to true so that a new piece of music can be played after the previous one has stopped! When this script is called in the level’s creation code, both of the arguments are defined. For example, in the first level the arguments are defined as:

The other thing I’ve been working on today is the game’s petal system. I came up with this idea before I had any idea how to program it, so I’ve left it out until now. I’ve learned a lot from making the game’s menus and inventory systems, and this is basically an addition to the inventory system I’ve made so far. The idea is that each of the game’s characters gives you a petal that they have found, and five petals makes a whole blossom, which is added to the game score. I’ve had a space in the inventory for this for ages, which I’ve recently revamped to make it nicer:

To test the system, I started using the Priest character, as he was the first character I made. I’ve renamed him Bura-san in the GDD. I’ve created two different variables that depict whether or not the character can give the player a petal, shown either as flower_give = true or flower_give = false. If the character’s petal hasn’t yet been added to the itemList DS list, then flower_give is true.

When the player talks to the character by pressing the X button, this activates the petal given by the character and changes the variable to false:

The petal given appears at the top of the screen, and can be seen in the petals section of the inventory.

I’ve created three new global variables called “petalscore” 1, 2 and 3 – one for each level that the player can receive petals. When a petal is received, the petalscore value will increase by one depending on which room the player is in.

This is then drawn into the inventory, so the player will only be able to see their petal progress for the level they are currently in. When the petalscore reaches 5, one blossom will be added to that level’s gamescore, so in order for the player to collect all 30 blossoms, they will also have to collect all five petals in each level. However, the system still needs a lot of work, as my NPC characters currently don’t do very much. Ultimately, I would like to slow the whole process down so that when each character is spoken to, an animation plays where the character takes out a petal and holds it until the player takes it. This way the whole system seems a lot more obvious, as at the moment a petal simply pops up at the top of the screen without any explanation. I’m still working on the AI for most of my current characters too. Bura-san doesn’t move about, so he was easy to try out the system on. “Kaze” who I’ve renamed “Kyo” constantly moves away from the character, but currently gets stuck to walls…

The Panda character that I recently put in runs about frantically, but again sometimes seems to get stuck on uneven terrain. I like this character because there is no way of catching up with him, you have to chance running into him and pressing X at the right moment!

My latest character is called Koto, and is the game’s instrumentalist. She appears in the first three levels, and sits by her koto playing each level’s music. This character was originally going to be male and called Camui after the Japanese singer Camui Gackt, but when I checked on the internet for a character basis it seemed that koto players were generally women. I found a lot of images of koto players dressed in traditional Japanese kimonos, so my koto player is also dressed very traditionally.

And in her pixel form:

All of these characters are placed in all three levels, but I’m hoping to create one unique character for each level to make up for the fifth petal.

More Music Inspiration

It’s been a busy (and long) Easter weekend, so I’ve only managed to get little bits done here and there. When I’ve had the chance I’ve been working on some new tracks so that each level can have its own background music, and I’ve now got the beginnings of two more tracks on the way. The more I think about it, the more I hear similar tracks in my head that I can take inspiration from, some from existing video games and some just from the general world of music:

Chrono Trigger: Corridor of Time by Yasunori Mitsuda

This is one of my favourite tracks from the SNES game Chrono Trigger, the tone is so mystic and relaxing, I’ve had a difficult time stopping myself from simply just ripping this off. The instruments and the tone of the piece are exactly what I’m looking to create with my tracks.

Spryo 3 Year of the Dragon: Bamboo Terrace by Stewart Copeland

This track is much more fast-paced, resulting in something much less calm and relaxed. What I like about this piece is its constant change in tone and layering of instruments. For level two of Hanami which uses bamboo in its background throughout, I want to create a similar rhythmic style with a subtle bamboo flute layered in patches!

Aqueous Transmissions by Incubus

This track consists of almost all traditional Japanese instruments, and sets a VERY relaxed scene. The backing track (and the vocals, to a large extent) are very repetitive, especially the Pipa riff which repeats throughout the track. This underlying repetition is something I’ve been doing without really thinking about it, as it provides a solid base for all other instruments to follow.

As well as being inspired by the relaxing tones of the tracks above, I’ve been trying to think of ways of making a much harsher sound for the final Boss theme. I can’t seem to think of any games that use traditional Japanese instruments in their boss theme music, so it will be interesting to take a generic sounding boss theme tune and replace the normal instruments with those similar to the tracks above!

In the BRILLIANT video below, you can hear a collection of all the boss themes from the Final Fantasy series. Composer Nobuo Uematsu really knows how to capture the tension of the moment with epic battle music…

Sound Effects

In contrast with the synthy background music track I created, I’ve actually been experimenting with 8-bit NES style noises as sound effects elsewhere in the game. These started off as placeholder sounds so that I could work out what type of noises to include, but they all seem to fit really well.

I’ve been making the majority of my sound effects using a browser-based software called as3SFXR, which generates random 8-bit sounds that you can adapt and customise in your web browser before saving and downloading your generated sound. You can see from the image above that its possible to customise all settings of any sound created, generate sounds based on category or create completely random sounds using the randomise button. You can export sounds as good quality .wav files!

Sound effects I’ve currently created in as3SFXR are:

  • jump & double jump
  • hurt sound
  • door sound
  • “flower squash”
  • “flower unsquash”
  • blossom collection
  • sushi box collection

As luck would have it, a couple of days ago an article came up on TIGsource about a lesser known piece of software that could be used to generate multi-channel sound effects called LabChirp.

This works very similarly, you can generate random sounds or create your own very easily. The main difference about LabChirp is that you can use the 8 channels listed down the right hand side of the first window to create complex sounds which utilise up to 8 instruments playing at once. You can see here that I’ve set the category to footstep, which is a category not covered by as3SFXR! I’ve made myself a very simple footstep sound based on a random generation which I customised to be softer and quieter. This only uses one channel, but was much easier to make from the starting point presented by the program. I’ve also made a “death” sound which uses two channels, and plays when the player runs out of health. You can also export sounds created in LabChirp as .wav files.

As I’ve mentioned before, I’m trying to avoid using Game Maker’s built in sound functions because there are much better ways of implementing sound effects and music. I had a go at using the Caster extension for Game Maker, which supports .ogg playback. Ogg Vorbis files are a great alternative to mp3s, especially with the restrictions on mp3 files and as Game Maker support for mp3s is temperamental at best. Game Maker plays .wav files fairly well, but using many .wav files can result in an unnecessarily large game file. Caster uses many of the same sound calling functions as the built in GM functions, but allows better customisation of things like volume and panning. In the end though, I’ve decided to use the SuperSound.dll because it seems to have much more support on the internet. This .dll still support the use of Ogg Vorbis files, and many of the same functions as Caster, but works much differently as it is a .dll rather than an extension.

The Super Sound System comes with several scripts for GM. This example is a script called SS_Init, which is called in any instance where a sound is played. There are several other scripts (you can see some of them in the browser on the left hand side) including scripts to play and stop sound, and change various settings. In order for an external sound to be played, it must first be loaded. This can be done individually within each instance, but to save memory I’ve created an instance which loads all sounds as globals. This is created once, meaning that all sounds are only loaded once but can be played several times.

Here are all the sounds I currently have loaded (this list really needs some sorting out and arranging-it’s a bit messy!) I start off by initialising the Super Sound System, then use the SS_LoadSound function to load sounds from their location in the “Sound” folder. I’ve given each sound a handle, which acts as a unique ID for each sound. for example:

is the background track which is continuously looped;

is the sound that the footsteps make.

You can see I’ve also used the SS_SetSoundVol function, which allows you to change the volume of individual sounds. Because my sounds files have been brought in from various places, volume levels are a little erratic! This is only there temporarily, as eventually I’m planning to change the volume of the actual files to decrease the amount of functions called. I’ve been using Audacity to convert my files from .wavs to .oggs, and changing the volume is no problem.

Here’s a really simple example of how a sound is played. This script runs when the Z button is pressed (making the player jump). The Super Sound System is initialised with SS_Init();. If the player is on the ground when the Z button is pressed, the SS_PlaySound(global.sndjump) function is called. The second section of code applies to when Z is pressed and the player is in the air performing a double jump. This plays the global.snddoublejump handle, which is a higher pitched version of the jump sound.

Most of the sound effects have been fairly simple to implement, based on various parameters like the ones above. The most complex so far has been the step sound, which uses a timer between plays that I had to time perfectly to the point when each foot touches the floor! You’ll be able to hear some of these sounds in my next devlog video!

Hanami Theme Tune

For the Hanami main theme I’ve started off with a repeated pentatonic scale played on my “koto” instrument (which is actually just the higher notes of a piano sampler instrument). I’ve harmonised (most of) this scale, using notes 5 semitones below the melodic line. Instead of playing the scale in order or pitch, I’ve rearranged the scale.

I added in a percussion track made of simple wood-block and bell sounds below the koto tracks. This track comes in a couple of bars after the music begins.

The third layer comes in at the same point of the percussion. I’ve used an “aaah chorus” sample for this layer, which is similar to the one used in Hisaishi’s Kaze no Toorimichi. This comes in two parts, which alternate every two bars, unlike the other tracks which repeat every one bar so far.

My top layer holds the track’s melody, which is played by a flute sampler instrument. This comes in gradually, as I’ve noticed it’s fairly infrequent in the tracks I’ve listened to. It starts off in small chunks, before eventually becoming the main emphasis of the track towards the end.

To add a little more emphasis to the end of the track where the melody is played, I’ve added in a new instrument playing a variation on the pentatonic scale. At times this mimics the flute melody.

The resulting track loops seamlessly, and constantly changes in depth and instrument type so hopefully won’t seem too repetitive, despite only being a minute and a half long. It may still need some refinement to make some of the instruments sound nice, but I’m happy with the overall sound of the track.

Music Creation for Games

I’ve tried a couple of programs in the run up to trying to make some good game music, mostly software designed for making great chiptune pieces. In previous projects, I’ve used a program called Famitracker, which produces 8-bit music based on the sounds of the Famicom or Nintendo Entertainment System.

The difficulty with Famitracker is creating the “instruments” or the sounds that the blips make. The image above shows the various settings which can be changed to create unique instruments, and a handy little virtual piano to preview your created sounds. This is where I’ve struggled before. You can just import instruments from other sources, but it is then implementing other people’s instruments into your track that proves difficult.

It would be nice if the virtual piano could be used to lay down the track, but it’s not the end of the world using the keyboard keys instead. In the main window of this image you can see the track visually. It is made up of beats which align horizontally, and channels which are displayed in columns and allow different instrument types to be played at once. The letters and numbers in each space depict the notes or sounds being played, and correlate to a specific instrument. This track is a chiptune version of Welcome Home by Coheed & Cambria which I started to write. In the Square 1 channel I’ve put the main melody. I would usually use Square 2 for harmonies, but haven’t placed any here. The Triangle channel plays a much softer note, and I’ve used this for my base line. The Noise channel plays white noise-like tones which can make a drum beat if programmed well, and I’ve attempted to make one here (although it’s not perfect just yet!) The letters obviously refer to notes, and the number refer to the octave that the note is played it. When you play the track back, it plays from top to bottom. You can hear a little tune I wrote in Famitracker here. This was a piece I used for some motion graphics a while ago.

Another program that I was really excited to acquire was PXTone by Daisuke “Pixel” Amaya, creator of Cave Story. I’ve mentioned this before, because it creates the music that Amaya uses in his games, and everything he makes is just exceptional quality.

This is where you customise the instruments you wish to use. While it’s possible to add effects to instruments, most of the instruments the software uses come in a file with the program. Most of them are short blips and electronic sounds, which aren’t based on the sounds of any specific console but have a chiptune feel to them!

This is a visual representation of when each instrument makes a sound. The beats are spaced vertically this time, with the track playing from left to right. Here I’ve made a melody and a harmony using a similar blip instrument, and a simple drum beat using a drum sample. Most of the programming in PXTone is done visually rather than using letters and numbers, which takes a while to get used to but is nice for those who aren’t familiar with music theory.

Each horizontal line in the image above can be expanded to see the tones that are played. For reference, keyboard keys are displayed on the left hand side of the screen. These correlate to the orange blocks, which represent the tone and timing of the note being played. This track is an experimental track which I worked on for a while to get myself into the software. I originally tried to create something using a pentatonic scale, but found myself making something that sounded like a piece from a Daisuke Amaya game! The best examples of PXTone tracks have to be from Cave Story, so here’s the Cave Story theme to help you get an idea of the type of sound produced:

The software I’ve had most success with so far is one that I’ve only recently discovered. SunVox was recommended to me as a great chiptune creation program, but is also just a very user-friendly sequencer that can be used to create tracks using any sound or sample.

To get familiar with the program, I start to create my own synthesised version of Joe Hisaishi’s Kaze no Toorimichi from My Neighbour Totoro (although it still needs alot of work because the timing is really weird). At the top you have a similar layout to Famitracker, where rows represent beats and columns represent layers of instruments. The tones are similarly represented by letters for notes and numbers for octaves, although in this case notes can be added using the virtual piano in the row below. This just makes life so much easier! I often find myself making mistakes whilst trying to remember which note belongs to which keyboard key, although this input method is still available.

The “02” next to each note shows which instrument is being played. The instruments are shown visually here. You can see that “02” is a sampler instrument, in this case a midi piano sound. By experimenting with the program I noticed that the high notes of this particular instrument sound a little like a Japanese plucked string instrument, with a little imagination! Most of my instruments are samples, although the generator is what really makes the chiptune-like elements of the track. In this example, each instrument is connected directly to the output, but filter and effect modules can easily be placed between the two to change the sound of the instrument.

This makes a very weird sound! You can see the levels here in each instrument and the output as the track is playing. The track plays from left to right in the bottom window, where the little patterned blocks are aligned. Each block represents a segment of the music which can be layered, copied and pasted and changed by moving blocks around. I haven’t done it here, but you can customise the patterns to have more meaning! Repeated patterns show places where I have repeated parts of the track, which is very useful for creating drum tracks and base lines.

I had a go at using some of the Japanese music theory I’d learned to create a track in SunVox which used a broken pentatonic scale as a basis. I’ve carried on using the suspicious piano instrument and a flute sample to create a melody. This is written in E flat major, but has quite a dark, serious tone to it. I didn’t take it much further as I hoped to create something a little lighter. I have screencap issues so please forgive the audio only!

Traditional Japanese Music

So far throughout this project I’ve had a pretty good idea of what I wanted Hanami’s music to sound like, so it was about time that I actually gave the game some sound.
The music has really been inspired by two things:

Traditional Japanese Music

This is very typical of the sort of thing that comes to mind when you mention traditional Japanese music. The music is held together by hand-beaten percussion, accompanied by the plucked strings of instruments such as a koto and a woodwind melody. The music is then layered with additions of extra percussion from bells and wooden blocks or clappers. There are a couple of things that really stand out from the examples above. The second piece from Traditional Japanese Music 2 shows a very steady drum beat, unlike a lot of the examples I’ve listened to in research. This has resulted in a very “full” sounding tune throughout, in contrast to other tracks that use minimal percussion. I liked Flower because although it probably isn’t the best example of “traditional” music, it uses the same instruments and elements. This is a lot thinner, but often uses a harp sound as a base, rather than percussion.

Studio Ghibli Soundtracks

A lot of the Studio Ghibli films are set in or based on locations in Japan, and as a result have ended up with traditionally Japanese-sounding OSTs. One of the most obvious examples is the soundtrack from Pom Poko. The film itself is about a struggle against a modern way of life which destroys tradition, and this trailer showcases about three of the different types of music that the film captures. My Neighbour Totoro also shows a very traditional way of life, set in rural Japan. The track I found most inspirational from Totoro is Kaze no Toorimichi, “Path of the Wind”. The composer Joe Hisaishi, who also wrote the soundtracks to many Ghibli films including Spirited Away, Princess Mononoke and Ponyo, manages to balance traditional Japanese instruments with a modern orchestra brilliantly. This is an orchestral version of Kaze no Toorimichi, which is just as good as the original but unfortunately without the sound of traditional Japanese instruments.

It’s very difficult to find examples of Ghibli OSTs online that haven’t been met with copyright restrictions, so there’s not a lot more I can show! You can listen to some of Hisaishi’s music here.

Traditionally, Japanese instruments were tuned to pentatonic scales which consist of five notes per octave. This is why if you punch out a tune using only the black keys of a piano it can often sound very Eastern! The Western piano is tuned in C major, which uses seven notes per octave. Most traditional Western music is played in a major and minor heptatonic scale key signature, which is partly why traditional Western and Eastern music sound so different even on similar instruments.

There are various types of pentatonic scales which have specific names in Japanese. One example is the In Sen scale, which is often used as the tuning for wind chimes. In the key of C, In Sen plays:
C Db F G Bb (repeat C…)

For Hanami, I’ve chosen to use the E flat major pentatonic scale. I’m not sure if this was a scale that would have been used in traditional Japanese music, but when I was trying to work out the key signature for Hisaishi’s Kaze no Toorimichi it was the one that seemed to fit best (I’ve tried to work this out from the video, but can’t really be sure…) The scale of E flat major consists of Eb, Ab and Bb, and the pentatonic scale looks like this:
Eb F G Bb C (repeat Eb…)

Because it’s a major scale, it can have a very “happy” feeling. When I’ve asked other people what they think the music should sound like, they’ve mostly all agreed that the music should be calm and create a light atmosphere, rather than being too dark or energetic. Some of the examples in the first video Traditional Japanese Music 2 sound very serious, but Flower definitely shows a more relaxed and carefree musical experience.