43 votes
Accepted

Any downsides to exporting an audio file at double-speed then have the game engine playback at half-speed?

By authoring an audio clip with high BPM, then playing back at half speed you are effectively halving the sample rate. You can achieve a similar reduction in asset size without changing your workflow ...
Kelly Thomas's user avatar
  • 3,882
12 votes
Accepted

Determining how loud an AudioClip is

A manual way to do that is to use AudioClip.GetData to get the sample data in an array. Then loop through the data and find the Root Mean Square to find the "loudness" of the audio clip. You can also ...
Lasse's user avatar
  • 3,241
12 votes

How can I do something after an audio has finished

you need wait until audiosource.isPlaying == false Suspends the coroutine execution until the supplied delegate evaluates to true. WaitUntil can only be used ...
Seyed Morteza Kamali's user avatar
11 votes
Accepted

HTML5 games: play() failed because the user didn't interact with the document first

There is a good reason for this precaution: Users usually don't expect audio from websites. They get really angry when they load a website, and an audio advertisement blares at them at full volume. ...
Philipp's user avatar
  • 119k
8 votes
Accepted

How to get current Microphone Frequency in Godot

Getting Microphone Input To have microphone audio input in Godot: Go to Project -> Project Settings -> General -> Application -> Audio and make sure "Enable Audio Input" is On. ...
Theraot's user avatar
  • 26.6k
6 votes

Can I legally use movie sounds for game production?

Using stock sound effects is actually very common in the film industry (like the infamous Wilhelm Scream). But movie studios actually pay for the rights to these sound effects, usually in form of ...
Philipp's user avatar
  • 119k
5 votes

Maximum audio delay before the player notices?

The accepted answer here mainly discusses perception of audio synchronization in passively watching video. In these cases, the audience can't easily pin down exactly when the audio should play except ...
DMGregory's user avatar
  • 134k
5 votes

Maximum audio delay before the player notices?

Any situation where a player causes the sound (music games, guns in FPS) will need very low delay as the player has sent an impulse to make it happen at that moment, so as with a musician hearing ...
SamB's user avatar
  • 51
5 votes
Accepted

What direction does directional audio come from for a 2D view?

The spatial audio should be relative to the camera. If you consider it, even in a 3D game, the audio is relative to the camera. Sounds that come from the right side of the screen are heard from the ...
House's user avatar
  • 73.2k
4 votes

Unity, how do I pause the Audio in the Level?

Call AudioListener.pause = true in function pause and then AudioListener.pause = false in ...
Philipp's user avatar
  • 119k
4 votes

How do I setup positional audio in Unity?

Unity has a full-fledged system for 3d audio. Take a look at the components AudioListener and AudioSource. When the game object with the AudioSource is right from the game object with the ...
Philipp's user avatar
  • 119k
4 votes
Accepted

How to change music from room to room?

If you want to play non-diegetic music (background music which just plays without a positional source), then a simple solution is to add the audio source which plays that music directly to the camera. ...
Philipp's user avatar
  • 119k
4 votes

Can I legally use movie sounds for game production?

I'm not a lawyer and this is not legal advice. However our studio recently had to deal with a bunch of sound copyright issues and I can tell you that it is taken very seriously. We bought a bunch of ...
Uri Popov's user avatar
  • 3,007
4 votes
Accepted

Is it a bad idea to have several audio sources on the same object in unity?

As I was taught on anything about software development: it depends. Back in the days, memory and CPU were limited resources, and devs had to be extremely careful about data and cycles used by their ...
liggiorgio's user avatar
  • 4,646
4 votes
Accepted

Having an Audio Atlas?

Why would you write individual lines of code for loading each texture/sound? That sounds like something you should load from a manifest file, so that adding/changing assets is just a data change, not ...
DMGregory's user avatar
  • 134k
3 votes

What is the term for collectibles which enhance storytelling (i.e. audio logs, bestiary entries, etc.)?

In general, when these are not necessarily collectibles, they’re called the environmental storytelling. Specifically for collectibles, I have seen “narrative collectibles” used here and there. Other ...
sam hocevar's user avatar
  • 23.8k
3 votes
Accepted

What is the default audio bitrate in Unreal 4?

Unreal Engine 4 currently supports importing uncompressed little endian 16 bit wave files at any sample rate (see the chart below). For best results, it is recommended that sample rates of 44100 Hz or ...
CKLucifel's user avatar
3 votes
Accepted

Unity3d - AudioSource is not playing if gameObject is removed after play was started

When disabling a gameobject, all the attached components are disabled too. Documentation states the following : Making a GameObject inactive will disable every component, turning off any attached ...
Hellium's user avatar
  • 2,949
3 votes
Accepted

How to add the sound effect of a ball rolling, based on his velocity?

I've solved. If I move up/down the audio.Pitch based on rigidbody.velocity.magnitude, i obtain what i was looking for Example: _audio.pitch = rb.velocity.magnitude / AudioSpeedAdjuster;
stighy's user avatar
  • 427
3 votes
Accepted

Serialization/Deserialization Solutions for Loading & Playing Audio Files

Unity internally uses ogg vorbis for audio - whenever you drop an mp3 into your Unity project, the editor converts it to vorbis and uses that. Importantly, this means Unity can natively decode ogg ...
Luke Briggs's user avatar
3 votes

How to improve load times of audio files without loosing too much quality for HTML5 game?

When you take an audio clip which is already encoded in a lossy compression format and then re-encode it again with a different lossy compression, then any compression artifacts will accumulate and ...
Philipp's user avatar
  • 119k
3 votes
Accepted

Efficient way to detect when audio clip ends

isPlaying will also return false if the song gets paused via. Pause. Therefore I'd recommend waiting for the ...
IndieGameDev's user avatar
3 votes

Public domain piece found on You Tube but recorded by someone else

Yes, you need permission. Only the pattern of notes themselves is in the public domain. Any arrangement, performance, or recording of the piece is its own creative work - and this recording sounds ...
DMGregory's user avatar
  • 134k
3 votes
Accepted

Why does the volume not decrease when I move away from the AudioSource?

Be sure that you have set Spatial Blend to "3D". The slider is two entries above the 3D Sound Settings collapsible section (in my version of Unity). You can also enter a value from 0 to 1, with 1 for ...
Tashus's user avatar
  • 421
3 votes
Accepted

3D audio performance cost in Unity

I have optimised and shipped 6 mobile games in Unity and have never had to do any audio optimisations. (Except changing music tracks to be streaming instead of decompress on load, and tweaking audio ...
Benjamin Sims's user avatar
3 votes
Accepted

Audio won't pause in coroutine

Okay, I figured out the issue. It is pausing the audio, but since I left soundFX.UnPause(); inside the if (!pausing) block ...
Michael's user avatar
  • 41
2 votes
Accepted

Playing multiple sounds in Unity5

Big edit: From chatting and working with Robert on this, to resolve this issue, the solution seems to be: Remove the ...
Chris McFarland's user avatar
2 votes

How do you use SoundManager for multiple player games over the network?

This turned out to be much easier than I imagined. Don't know if this is a best practice, but you can just attach the sound manager to an empty game object and get a client instance of it via ...
lingz's user avatar
  • 151
2 votes
Accepted

Unity Wwise. No audio in my game build

You need to copy the GeneratedSoundbanks folder in your Wwise project, and paste it into the Assets/StreamingAssets/Audio/ ...
Kam's user avatar
  • 36
2 votes
Accepted

Audio Source object reference not set to instance of an object in Unity.

The error "object not set to an instance of an object" means that you're trying to use an object that is null (NullReferenceException). When you get that error, the first thing to do is to isolate ...
Vaillancourt's user avatar
  • 16.3k

Only top scored, non community-wiki answers of a minimum length are eligible