Audio - UQdeco2800/2022-studio-3 GitHub Wiki

Introduction

Audio, e.g. Sounds and music files, can be easily added into the game using libgdx Sound and Music. There is no single audio service, instead audio can be played when and where needed once loaded by the ResourceService.

Music Inspiration

When it comes to music and sound used in the game industry, the possibilities are endless. From games like God of War to The Witcher which have included different themes of music in their games, we looked at several other possibilites which we could incorporate into our game. For sound effects, audio can be created using simple everyday tasks. The sound of pouring water and several other actions can be used in incorporating water based sound effects into the game.

Tools for composing and editing music

Chrome Music Lab

Google has added a new instrument to its Chrome Music Lab: Song Maker. As the name implies, Song Maker is all about making songs. It’s essentially an easy to use sequencer that lets you draw melodies in the browser (though it doesn’t feature some of the automation in the Music Lab’s Melody Maker tool).

It’s no FL Studio, but it’s fun and you get to choose between a few instruments like a piano, strings, woodwinds, a synth and a marimba. There’s also a small rhythm section that lets you add drums to your songs. Some of the more nifty features include the ability to attach a Midi keyboard to your computer to play the instruments and a recording feature that will translate your singing into notes.

Brief explanation of Song Maker Interface

image image Notes can represent the pitch and duration of a sound in musical notation. The default interface provides 2 sequences of notes as follow: do–re–mi–fa–sol–la–si in major tone. You can choose the type of instruments and drum kits. Also all the notes will be played in C major chord at defaults.

When you press play button, all colored notes will be played and then the subsequent notes will be played left to right. You can save your project anytime by hitting the save button at the bottom of the screen. You can adjust the tempo measure to make the song become fast or slow.

If you check the settings, you can change the length of your composition up to 16 bars long. You can have as many as seven beats per bar, or as little as two, so that's pretty much changing the time signature of your peace. You can also divide the measures into different subdivisions by pick which scale you want.

Furthermore usages of Chrome Music Lab can be found here

Final Draft of Sprint 1

Intro Song Making

image I'm using the default setting of the app to compose the idea with woodwind and conga. The color of the sound would be rich, even, bright. The kick drum will go in at 3,4 and 7,8 to create a a little depth of the song. Woodwind can deliver the music theme to be more gloomy to suit the game theme.

LMMS

LMMS is a digital audio workstation application program. It allows music to be produced by arranging samples, synthesizing sounds, playing on a MIDI keyboard, and combining the features of trackers and sequencers.

LMMS accepts soundfonts and GUS patches. It can import Musical Instrument Digital Interface (MIDI) and Hydrogen files. It can read and write customized presets and themes. Audio can be exported in the Ogg, FLAC, MP3, and WAV file formats, and the projects can be saved in the compressed MMPZ file format or the uncompressed MMP file format. It can use VST plug-ins on Win32, Win64, or Wine32, though currently the macOS port doesn't support them.

Editors of LMMS Song Editor – for arranging instruments, samples, groups of notes, automation, and more Beat+Bassline Editor – for quickly sequencing rhythms FX mixer – for sending multiple audio inputs through groups of effects and sending them to other mixer channels, infinite channels are supported Piano Roll – patterns and melodies Automation Editor – move almost any knob or widget over the course of the song

Samplers

  • AudioFileProcessor (AFP) – sampler with trimming and looping abilities

Final Draft of Sprint 2

In-game inspiration

I get inspired the most from this audio youtube

In-game Song making

The sample audio for default preset is made by ZynAddSubFx in the Instrument Plugin with the below effect chains.
image image

The sample audio for vibe preset is also made by Vibe in the Instrument Plugin with the below effect chains.
image image

The bassline/beat of the audio go in every 4 and 6 beat to help creating the tense of audio.

With 3 default preset, the first preset will create the main melody including with melody preset, they all combined together to create the intense melody.

The second default preset will boost the melody with note running help gamer notice the game becoming more intense.

The final default preset add a base to the overall feeling of track.

That pretty it for the in-game song.

I will demonstrate it through video for the overall convenient at here.

Sword attack effect

The sample audio word recorded by scrape 2 metal knives to each other to create the splash sound. The swing sound was recorded by swing a rope in the air. And a bass to create a hit sound. Demonstrating can be watched by a video here

Usage

Example: Sound Effect

  1. Load sound: Ensure the sound file has been loaded in an active resource batch by the Resource Service using loadSounds().
private static final String[] soundsToLoad = {"sounds/sound.ogg"};
resourceService.loadSounds(soundsToLoad);
  1. Play sound: Retrieve the sound from the Resource Service using getAsset(). Configure the playback settings, then use play() to play the file.
Sound sound = ServiceLocator.getResourceService().getAsset("sounds/sound.ogg", Sound.class);
sound.play();

Example: Background Music

  1. Load music: Ensure the music file has been loaded in an active resource batch by the Resource Service using loadMusic().
private static final String[] musicToLoad = {"sounds/music.mp3"};
resourceService.loadMusic(musicToLoad );
  1. Play music: Retrieve the music from the Resource Service using getAsset(). Configure the playback settings, then use play() to play the music. The following example is set to loop, and to play with volume at 30%.
Music music = ServiceLocator.getResourceService().getAsset("sounds/music.mp3", Music.class);
music.setLooping(true);
music.setVolume(0.3f);
music.play();
  1. Streaming music: For any sound that’s longer than a few seconds it is preferable to stream it from disk instead of fully loading it into RAM. libGDX provides a Music interface that lets you do that.
Music music = Gdx.audio.newMusic(Gdx.files.internal("data/mymusic.mp3"));
music.setVolume(0.5f);                 // sets the volume to half the maximum volume
music.setLooping(true);                // will repeat playback until music.stop() is called
music.stop();                          // stops the playback
music.pause();                         // pauses the playback
music.play();                          // resumes the playback
boolean isPlaying = music.isPlaying(); // obvious :)
boolean isLooping = music.isLooping(); // obvious as well :)
float position = music.getPosition();  // returns the playback position in seconds