#šāaudio
1 messages Ā· Page 5 of 1
Your events should have a Steam Audio Spatializer though
How do I do that? Is there like a method to call?
Hmm not sure. It could be needed for reflections and occlusion and such
I have only used the HRTF/spatialization feature of steam audio
Which works with createinstance
(We want to use the Steam Audio so sounds take into account walls from rooms, as at the moment they ignore walls)
In FMOD, you need to replace the standard spatializer with SA spatializer
In the effects of the event you know
But theres a chance that you need steam audio source for occlusion
This is called occlusion btw
And possibly reflections
Oh, I'm not very familiar with the names of this effects, thanks
So for occlusion I can no longer use RuntimeManager.CreateInstance?
Not sure, you probably can, but you need to test/research yourself
Hi all. I am using TTS for voicing on of my game characters, who is an AI gone wrong, so it fits nicely. But I still wanna add some filters to the audio to make it real ominous sounding. Any advice on what free software I can use to get this done? Thanks!
So they are premade audio clips, not generated on the fly?
You could either use the audio effects included in unity, or apply some effects with Audacity (free) or Reaper (not free but has unlimited trial)
heyup, anyone know if there's way to get FMOD audio to scrub correctly in Timeline? It seems to always play audio from the start as you scrub past events
can you guys check out this part of the main menu music im working on? any feedback is appriciated! :)
Using FMOD + Steam Audio, how can I play a sound by code? If I do it like I would do with just FMOD, it doesn't works as Steam Audio spatialization requires and Steam Audio Source component.
Hey! I just ran into a bugg on 2022.3.32.
If you have multiple audiosources on a gameobject and call .stop() on one of them, it ends up muting all of the audiosources on that gameobject instead of only the targeted one
public AudioSource audio1;
public AudioSource audio2;
private void Start()
{
audio2.Stop(); // this will also stop audio2 if they are on the same gameobject
}```
double check audio1 and audio2 are not referencing the same AudioSource
Are you supposed to stop an AudioClip, or an AudioSource?
If you stop a source that's playing multiple clips, they are all expected to stop
"Stopping" a clip shouldn't really be a thing as far as I know
Oh I just realised that my post was incorrect, it is suppose to be AudioSource and not Audioclip
I'd hazard a guess you're playing audio with PlayOneShot
Individual clips played that way cannot be stopped so you should use multiple AudioSources
Iam using multiple AudiosSources, " audio1" and audio2" isnt audioclips but audiosources, I just named it wrong in my post
If so, there should be no reason that I know of why calling methd on one should be affecting the other
I'd triple check that you're calling the correct methods on correct classes and that the component references point to where you think they point to
@quasi hound Ive already checken all of that, and it got solved when I changed one of the audiosources to a child object instead.
Like I said in my first post, this is a bug.
I was mostly wondering if others were aware of it.
If you think its a bug you should report it https://support.unity.com/hc/en-us/articles/206336985-How-do-I-submit-a-bug-report. But from my checks in 22.3 you can call stop on one AudioSource and the other one keeps playing, they should not affect each other
Did you get it to work?
If not, show the settings of a "Steam audio spatializer" effect in your event in FMOD
Steam audio spatialized sounds work fine for me in Unity. I don't use SteamAudioSources, just regular FMODUnity.RuntimeManager.CreateInstance
Hi, I'm currently trying to set up playing multiple audio sources back to back seamlessly using dspTime and PlayScheduled. My current use case is:
- play an intro to a song
- loop the middle of a song
- detect when the audio source loops/changes and access the progress of the current source
The main questions I have about this are with scheduling the start time. I understand the need to schedule in the future by adding to the current dspTime, but all the examples I can find online use an arbitrary float value (Example from unity: https://docs.unity3d.com/ScriptReference/AudioSource.PlayScheduled.html). My questions are as follows: - Is there a better way to schedule audio than by adding a magic number to the current dspTime?
- If not, what's the typical range to play around in to play something as soon as possible without running into desync issues? Is it possible to completely prevent desync in high-lag situations?
- Should I be looking into something else entirely that better handles my use case?
Thanks!
What is your target build?
Unity currently uses 2 audio engines - Legacy FMOD for standalone apps and Web Audio API for WebGL build, so PlayScheduled behavior may differ.
I managed to kind of solve it by creating at runtime an gameobject with CustomStudioEventEmitter which inherits from StudioEventEmitter (and add some internal logic to set sounds) and SteamAudioSource instead of using FMODUnity.RuntimeManager.CreateInstance. But its quite annoying and complex.
My current intention is to make the Occlusion work, then I may add reflection and transmision.
Currently, I'm primarily aiming for a standalone app
Hey, is there a way to play audio at point in AudioSource component like if it was played by AudioSource.PlayClipAtPoint?
Not without moving it
Usually you'd use pooled audiosources
PlayClipAtPoint just creates a new one anyway
can i create audiorolloff presets or do i have to make new ones for every audiosource?
I have some understanding about PlayScheduled in Unity 2019.4, just sharing my observations:
- Technically on internal FMOD side it's a delay (something like
ChannelControl::setDelay), scheduled AudioSource will take 1 voice, soAudioSource.isPlayingwill returntrueeven if it doesn't make sound. - AudioSource.PlayScheduled works best with Decompress On Load and worst with Streaming Load Type. Decompress On Load increases RAM usage, but since audioclip is stored uncompressed, you can instantly run
AudioSource.PlayScheduled(dspTime)without latency. For Streaming type you need to add latency, i.e. 'magic number'. - AudioSource.PlayScheduled has sufficient accuracy for sample-by-sample sync, but in my standalone tests there were rare cases of time shifting by 1024 samples = 21ms @ 48000Hz samplerate.
- AudioSource.PlayScheduled can break timing in Unity Audio Filters - Reverb Filter, Echo Filter, Chorus Filter.
Despite the issues, you can still create music audio system. I recommend '140' by Jakob Schmid, it is first game on Unity 3.5 that actively uses scheduled AudioSources.
Any recommendations for reliable royalty free SFX? Iām usually bouncing between Pixabay and Freesound but Iām struggling to find some specific fx
I figured this would be related enough to this channel so hopefully Iām not being annoying 
Perhaps a little, but check out Sonniss GDC sample packs
Ultimately if you want something specific, or some accountability against stolen sounds, you'll have to buy some
So it says itās got a bunch of SFX but everything is labeled per year and I have no clue what content they actually offerā¦
Each bundle has a tracklist link under its downloads
Ohhh
Yo it even says it has grunts and battle cries, those are what Iāve been working on š thanks!!
Thanks so much for the pointers! The problem I was running into was in the load settings, I had Preload Audio Data enabled which I think caused the audio to not be done loading when I scheduled it. Disabling Preload Audio Data and loading it in the script fixed it!
Has anyone solved the problem that when playing audio in a loop in a webgl build, there is about 1 frame of silence (gap) every time it loops?
does anyone know how to loop an event if it uses a parameter?
Hi all. I have a live audiovisual project and about to write a way to define bpm with midi pad, for it to then loop a broadcast event based on the rhythm
What i'm wondering about is the 1st part
Note: this is not for a beat press rhythm game
So i guess i'll use FixedUpdate, and determine if this frame has passed the supposedly next beat, and then update the "lastBeat" time by offsetting the 1/bpm value
I think FixedUpdate is good enough for this
Or even update, bcoz the resulting broadcast is just for visual trigger
Since this is for live, i'll need to calibrate the bpm somehow with just the midi pad press interval
- Do you want to create Tap Tempo like in Ableton?
- How do you capture events from MIDI-device?
Perhaps it is better to do this on MIDI-library/middleware side for greater time accuracy.
DryWetMidi works well with Unity.
The midi input is sorted
Actually i'm already done implementing it
But since this is a custom audiovisual thing, i was asking others if they have experience building something like this, how they decide on the controls
Currently the midi pad is for manual trigger some fx
Ctrl pad and pressing it following a beat will start sampling the distances between beat, averages it, and sets it as the new beat length
It'll also add the pad to the list of pads to loop for each beat
Pressing the midi pad again without Ctrl, will trigger that fx then removes that pad from the registered list of pads that's being looped
Sorry, it's too complicated for me
Haha sry it's fine. Just writing out loud maybe someone have something to say. Else it helps me imagine the design
Doing audiovisual stuff is cool, it requires unusual approaches š
Question about Audio Source. I know the point of Occlusion it to block sound from moving through solid meshes... but is possible to have a sound source inside a mesh and ignore that mesh (its owner) in particular?
@severe eagle There's no promotion in learning channels. If you have a Unity project this is attached to you may post it in #1180170818983051344 . Be sure to read post guidelines.
Noted sorry about that
Can I have 1 audio source but 5 different audio positions?
I am try to make the 5 speakers in my scene all play the same audio clip and the position of the audio matters because I want spatial audio playing from each speaker.
I feel like duplicated 5 audio sources is bad for perf and writing a script sync them would be hacky
How many channels are in AudioClip? Is it 5.1 or just mono?
I think there are several ways:
- AudioSource.PlayScheduled: sync playing of all AudioSources
- OnAudioFilterRead(): copying AudioSource audio buffer to others
- AudioClip.PCMReaderCallback: create streamed AudioClip for all AudioSources
- Unity Native Audio Plugin SDK: see Speaker Routing Demo
In any case, you will have to create 5 sources.
No
No its not you could have 10000 audio sources and it would barly affect performance
Ok thats maybe a bit much audio sources, but you get what i mean
Unity's AudioSource component provides some overhead to CPU, which controls audio backend parameters, calculates attenuation, doppler effect, audilbity, etc.
A long time ago I tried to play all 256 real and 4096 virtual voices and got significant performance loss on empty scene.
If you really care about audio system performance on standalone platforms, you should use audio middleware like FMOD Studio or Wwise, there is much less of such overhead there.
True, but technically it like wont matter at 1 real and 1000 virtual devices
btw, Unity had an alternative called DOTS Audio, where it was really possible to play 10,000 audiosources, but project was abandoned.
DSPGraph; was is really abandoned
re # of AudioSources: original question was about 5 of them, which would be anywhere near to pose real problem i'd assume
those are android (i suppose) specific - you should post in more relevant android channels/outlets
mobile audio has its own.. specifics, which also in case of android depend more on your hw/phone
anyone know how I can add button SFX (like clicking sounds) to an audio mixer to manipulate them with an SFX slider/checkbox?
Im trying to add SteamAudio on Unity 6 but i have an infinite loop while importing the package
I have follow the documentation but that not work
Anyone know how to get the steam audio occlusion working ?
When i enable them, there is not difference.. I have followed the documentation but nothing happens
hai im trying to use Unity's timeline to do a quick intro scene, first time using it. I have an animation clip added that moves a GO from one spot to another, and Im trying to implement a sound effect to follow but I can't hear anything. The .wav does play a sound tho. Also the game is in VR, not sure if that changes anything although even when the game isnt playing and im in the editor, the sound doesnt play. I tried attaching the audio to an empty GO and attaching it to the (NONE, audio source) track of the screenshot but that also didnt work. Any tips ?
i have 3 audios but my 3th audio doesn't go of
private AudioSource audioBouncy;
private AudioSource audioHit;
private AudioSource audioExplosion;
private void Start()
{
// Get all AudioSource components attached to this GameObject
AudioSource[] audioSources = GetComponents<AudioSource>();
if (audioSources.Length > 2)
{
audioBouncy = audioSources[0];
audioHit = audioSources[1];
audioExplosion = audioSources[2];
}
else
{
Debug.LogError("Not enough AudioSource components found on this GameObject.");
}```
my debug log does go off
audioExplosion.Play();
Debug.Log("explosion played!");```
#1225882878831759430 message what do anyone think of this main menu music?
Anyone know how to use fmod
Does playoneshot bypass audio filters? I have an audio source referenced from another game object, and I have the filters under the same gameobject as the audio source, but I'm not getting any filters. Does anyone know how to perform playoneshot with filters? Or do I have to create an audio source for every sound effects?
I guess it depends what you mean by "stop", but an audio source is no longer processed only if Max Real Voice limit is exceeded and the audio is inaudible
https://gamedevbeginner.com/unity-audio-optimisation-tips/#pause_audio_sources
So is there tangible benefit to manually disabling out-of-range audio sources? I know that website says yes but as a beginner it's hard for me to evaluate the accuracy of that. For instance, I've been told distance calculations are extremely expensive, which is what the proposed solution on there is using.
As with all optimizations, you can't exactly know until you test
Is the number of out of range audio sources a tangible drain on resources to begin with?
Often if your game levels are sprawling, you'd be loading in the objects gradually by area anyway which makes this less of an issue in particular
Potentially - with my current approach every one of 50-100 units would have an object with an audio source attached. What that means in practice is a bit beyond me.
But like you said those units would come over time.
The Real Voice Limit already guarantees a certain threshold for audio culling
Your tests should reveal if that's enough or not
I'm also curious if Audio Sources "do" anything if they're not playing sound, do those take up resources just for being in the scene?
They take up memory, but little to no processing power as far as I know
I guess I'll have to sit down one on one with the profiler again properly and figure out how to properly use it.
Thank you for your help it's been really useful, I think I understand how it works now a bit better.
Also, it's bit of an old adage by now to say that distance checks are awful, from a time with much weaker hardware
Still, those can be optimized
Distance comparisons (using squared magnitude) are much cheaper than distance checks
Comparing to a squared distance tells you just as well if you're closer or further
Thank you, I'll look into those as I haven't used those before
Where do you guys source sound for your games ive been looking for weapon sounds but they are all either not what I need or they are asking for some stupid subscription fee for something they 100% stole from somewhere else anyway
Ive got a gunshot sound I recorded myself but I dont have access to an AK atm and wont for a while
Humble Bundle almost always has something on. For example, https://www.humblebundle.com/software/gamedev-market-best-2024-software has a bunch of sfx and music packs in it.
Thanks mate ill take a look
Donāt tell anyone but https://sonniss.com/gameaudiogdc
Is there a way to play audio via AudioSource in stereo like it's in AudioSource.PlayClipAtPoint?
Like you hear the sound from the point it's been played
You place the gameobject with that audiosource there when you want it played, and ensure it's 3D spatial
PlayClipAtPoint doesn't do anything fancier than to create a gameobject with an audiosource, play it, then destroy it
has anyone here used Steam Audio (https://valvesoftware.github.io/steam-audio/) and know if it works for Consoles?
Steam Audio supports Windows (32 bit and 64 bit), Linux (32 bit and 64 bit), macOS, Android (armv7, arm64, x86, x64), and iOS platforms.
rip thanks
im audio pooling in unity 2022.3.26f1 and i was wondering, how does audio pooling work with random pitch looping for things like footsteps? i know in 2023 and up there is an audio random container and that prob helps but im scared footsteps themselves will take up basically all 32 audio sources
from what I heard in unity 5 there are also custom limits for audio sources, but for this project updating is not an option (its a group uni project, so the version is the same as on the in-class computers)
If it's your own pooling system, it'll be responsible for setting/resetting pitch and other properties as needed
Hello. Something weird happened to my working setup. After I made a clean install of Xubuntu 24.04 and installed Unity Hub with Unity Engine and opened my working project I got errors from FMod plugin basically claiming it couldn't initialize audio (ERR_OUTPUT_INIT Error initializing audio device). Tried refreshing banks, rebuilding fmod project, reinstalling (with purge) alsa and pulseaudio packages, tried even installing another linux distro (Manjaro), but the error persists. The audio is actually seems to be working fine - I can listen to music or watching videos or playing games without any problem. The problem is only in this unity project. Unity version is 2022.3.52 (LTS). Any suggestions on where to dig?
P.S. On windows the project opens and works fine.
My question was poorly worded, I was more so concerned with grabbing the footsteps from the pool every time I want to play a different pitch of the sound and how much of the 32 audio sources that could take up, but I figured it out now.
I was wondering if anyone has any other ideas for what these don't cover: I have a "OnClickSound" script that handles sounds that play when something is clicked. I have a "PlayOnAwake" script which handles static objects like waterfalls, buildings etc that just need to play a sound either once or on loop. Are there any other uses that I haven't covered in these scripts that you can think of?
One is random pitch looped sounds, for example footsteps
Music will be a separate subsystem
yo anyone got an idea for a theme song its for a sad game
Is there any reason to use AudioSource.Play instead of AudioSource.PlayOneShot in a scenario where you don't care about stopping the sound as its playing ?
The only advantage I found is the ability to cut off the current clip, at the cost of making using the audio system really awkward (from what I understand)
Probably not
Thought this seemed like the best place to ask this,
but is anyone else having a Vorbis decoder failure when using Unity 6 (6000.0.23f) and Wwise 2024.1.0,
where for some reason all audio that's been converted to Vorbis in generation, cuts off with that error after pretty much exactly 2 minutes.
I don't use Zero Latency like Wwise mentions as a probable cause, and there isn't any errors that come up during the generation itself,
so Im pretty stumpted on what I could try here. Wwise 2023.1.7 works fine in comparison.
Hey, does anyone know how I can have music with an intro loop back to a certain part of the song, so that after the intro it loops the main part?
I cant find any good tutorials
{
int frequency = originalClip.frequency;
int startSample = (int)(startTime * frequency);
int samplesRequired = (int)(duration * frequency);
float[] data = new float[samplesRequired];
originalClip.GetData(data, startSample);
AudioClip newClip = AudioClip.Create("Section", samplesRequired, 1, frequency, false);
newClip.SetData(data, 0);
return newClip;
}
that help?
this will allow me to set the looping points in the editor?
oh I didnāt know unity had its own
thanks
{
public AudioSource musicSource;
void Start()
{
// Set the loop points
musicSource.loop = true;
musicSource.loopStart = 20f; // Start loop from 20 seconds
// Play from the beginning first time
musicSource.Play();
}
}```
my first answer is from jippity, second from claude. claude seems to know some tricks.
any idea why I can still hear the sound despite being over max distance away from it?
unity 2022.3.26f1
Spatial Blend is set to 1
also another issue - tabbing out of the editor while in playmode ends one of my sounds and puts them back into the pool, as if "isPlaying" gets set to false?
Logaritchmic rolloff reaches zero very slowly
That means if you decrease max distance it'll simply cut off earlier at a higher minimum volume, become easier to hear over distances rather than harder
So you'd grab the furthest right curve key and set it to zero at where you want the volume to be zero
So probably 200
that seems really weirdly implemented... how can I adjust max distance properly at runtime then? or is there no way
also in the screenshot it looks like it's at 0, it could be very close to 0 but not quite there, but I could still hear the sound clearly
Can't be quite 0 if you're hearing it
Logarithmic follows a specific curve so it's not very good for runtime adjustment, unless you also get the last curve key and set it to 0 in code
But that also causes issues if the range varies wildly
Linear works better, but there's not really obvious best solution
In what situation are you adjusting it
im using audio pooling and setting audio source attributes to what they need to be when they're pooled, so I'm setting rolloff mode at runtime, but if I want 2 different logarythmic rolloff sounds to behave differently, then I'd have to pass that with the other attributes
yeah most likely, is there any way to get that onto a scriptable object in a reasonable way or?
Probably, but one one that I know of off the top of my head
Could also keep a reference to the prefab, but I don't know if it's worse to keep those prefabs in memory rather than just arrays of properties
i don't know if that would work with how ive got it implemented but ill try exploring around see if i can find anything
is there a free audio software? i use free use youtube video sounds.
Audacity
Thanks!
Anyone know anyone good tutorial/guides and resources on where to start with making really nice sounds for your game? Currently need some nice footstep sounds, jumping sounds, and a dash whoosh sound.
Well I do not have tutorials but all good sounds start with recording actual sounds.
Or using pre-built libs
Are there any specific softwares I should be using?
Audacity is a nice one to learn
- Make sure your sound effects have a similar volume relative to eachother. You can amplify the sound effectās volume in post.
- Reverb makes things powerful.
- Make sure your Mic doesnāt clip.
How would u fix the constant audio crackling (krlrklrkrlrkrlrkrkrktrkrkrkrrrtk krkrr klkkktrrt kkrrr kr krr KRR so u know what i mean) because of a lot of 3d audio sources in the scene with the same priority. They all got a custom pretty short max distance tho so idk why that should be a problem. In the profiler the audio cpu usage seems very high like 150%, idk if thats why it happens.
I need some tips on trimming small short sfx. currently I'm separating footsteps sound into 8, the thing is when I cut it where I think it starts and ends, the exported audio didnt produce any sound even though it sounded fine in audacity. I have to add a "what i think is empty" leeway in the beginning, and determining how big it is annoys me
perhaps there is a setting in Audacity for editing small audio clips so what i heard in the editor is what i will get in exported audio ?
alright so apparently some video player buffer for a bit at the start while playing the media. so if a media is so short it ends before the buffer finishes, it doesnt get played.
they still works fine in unity, at least in my case.
Hi if anyone is familiar with Wwise need some help, we're adding an RTPC to control pitch in the following code
[Header("Sound Settings")]
public string engineSoundID = "Speed";
public float truckSpeed = 0;
public float maxTruckSpeed = 100;
public void UpdateSpeed(Component sender, object data)
{
if (data is not float speed) return;
truckSpeed = (speed / maxTruckSpeed) * 100;
Debug.Log(truckSpeed);
AkSoundEngine.SetRTPCValue(engineSoundID, truckSpeed, gameObject);
}```
we were using a single main bank and it worked properly
we have now switched to seperating the banks by category, so now a Vehicle Sound bank is attached to the truck where the AKAmbient components are as well, the sound plays but the RTPC no longer changes the sound and we don't know why
So to reiterate, the only thing we changed before it stopped working was making seperate banks and this one is dedicated to the Vehicle sounds
How do i get my audio soruce to play in the play mode? i have it to play one awake but it doesnt play in the actual play mode
Does it have an AudioClip assigned to it?
Yup
If I click the speaker on the edit mode it plays but still not the play mode
Game view has its own mute button, make sure thats not enabled
it isnt i already checked that a couple times
Do you have an audio listener in the scene
And what are your audio source's settings?
I recently spent like an hour trying to help someone with this and it turned out to be something really silly
but I don't remember what it was...
it might have been the game-view mute button
Someone here knows to I can emulate N64 reverb and delay?
And no,I can't just download and use GameVerb.
Not only I'm broken but the dollar is high as hell in my country
Hello1 Does anyone have any info on audio improvements included in Unity 6? I know they added a new way to randomize audio clips, but I was wondering if any changes on attenuation shapes and occlusion has been made.
Never mind... found my answer š¦ .... bad, bad, bad Unity.
Audio DSP should be something like 15% not 150% .. did you find the problem yet ?
Unity has a roadmap doc with some audio improvements planned
I solved it by adding a script to all 3d audio sources that constantly checks if the player is within its max audio distance, and disabling the source if theyre too far away
Kinda feels like a weird solution tho, feels weird id have to do this and idk how much it affects my performance, i will end up with probably more than 300 audiosources... so if u got any better ones or info about this let me know
Audio sources will still play even when you're past the max range (and still use a "real voice")
Unity supports 32 real voices by default, I believe? I know that's the number in VRChat
Anything past that will caues the lowest-priority, then quietest, audio source to be evirtualized
meaning that the audio is no longer processed, but the clip's time still increases
so when it becomes real again, it sounds like it was playing the whole time
Do you have any audio filter components in the scene?
Oh alright, well theres gotta be some good way to solve that tho , cuz i wouldnt say 32 audiosources in a scene is that much, and if u up the limit it starts krkrkekrkring right
I do yeah
That could significantly increase the amount of audio processing that's needed
guess u could maybe also change the priority in a script so it would keep playing from where it left off but there should be some inbuilt thing right
Would reverb zones solve it
I'm not sure what you mean by this. When you run out of real voices, the least important audio source (by priority, then by volume) gets virtualized -- it keeps playing, but it's not actually producing any audio
Are you asking if you can make it pause when virtualized?
Because you could certainly do that, although I don't know how you would correctly unpause it later
That'd help make sure you only have one reverb filter at a time, at least
I guess yeah? Or like when the player gets out of range from the audiosource, that source gets its priority set to low instead of disabling the audiosource
That's already roughly what happens. If every source has the same priority value, then the quietest one gets virtualized first
Shouldnt there be some in built thing for this tho cuz i feel oike this would be common
Hmm yeah ur right
It sounds like your problem is that, with 32 real voices playing, the audio system is getting overloaded
Mhm
Try disabling all of your filter components and looking at the audio cpu usage
You should be able to find all of them in the scene by searching the hierarchy
Alright ill try that soon
hm, that's annoying: there is no parent class for the audio filters
they're all just Behaviours
so you can't just search for t:audiofilter or whatever
Your problem is the reverb filter on your audio source
Apply reverb at the audio mixer or using reverb zones
That will fix your problem
Itās possible to use reverb filter on an audio source but that breaks down at scale exactly like you are describing your original problem with a lot of short sounds
In project settings, thereās a bool in the audio tab that will keep filter effects on the audio source active. The default is disabled false.
This audio engine feature shuts down an audio source when the clip is not playing. However, this behaviour conflicts directly with adding the Reverb filter because the Reverb filter is not complete. So you get the sound of the clip cutting off.
Aha.. yeah I tried it and im pretty sure u guys are right, turning off the filters seem to do the job
Thank you
experiment with removing that code you created to check if the audio source should play .. that's what the underlying audio system does for you in the background already .. that system is highly optimized and 'just works'
for now keep all your sound effects in the same priority setting in audio source .. you'll want music and other sustained 2D sounds to be a higher priority , the numbering is arbitrary .. so setting 2D and music to priority "10" works because it's higher than the default "128"
set to a higher number means your audio source will not be sent "virtual" once the playing voices reaches 32 which is the engine default limit
hope that makes sense
Yeah it makes sense nice info, and i did try to remove the code and it seemed to still work, prob gonna test it again when i get home to make sure tho
Has anyone been faced with a import error saying "Errors during import of AudioClip {path/to/file.mp3}: FSBTool ERROR: Internal error from FMOD sub-system." - my project does not use FMOD, I guess Unitys built-in importer does, and it happens every time I try to import 1 specific mp3 file, which is odd because it was exported out a DAW the same as every other mp3 file, I can load it in Audacy, play it in a browser, etc and the file itself is not corrupt, all its byte data is there, any ideas what the issue could be or how to fix it? I tried looking online which basically suggested "its a known problem and is already fixed" with many replies saying "its broken again in later versions" but the cause or solution isnt clear (as this is not a problem with any other 2K+ audio files), im using 2021.3.x LTS but I dont think the version should have an impact on this problem (as it seems to be a outlier from my investigation)
- unity uses fmod for audio (it's their own customized (and older) version)
- fmod itself (as in 'normal' !unity specific version) has issues decoding some mp3/mpeg files (*
- updating unity might help, but i'd rather
- reencode the file - use different bitrate/quality etc
- if the file is somewhat large, split it (but IIRC in that case the error could be different one)
(fsbtool is just editor time audio importer)
(* some mpeg files can't be properly played even w/ latest FMOD provided engine sample
it got properties of the format wrong and played it as twice as long, with 2nd part being silent; other audio players were able to play the same file normally
(i had a workaround in my asset to detect this, but it's BS heuristic to do anyway - i removed it since)
That helps a lot, thank you for that explanation!
Is there anything particularly interesting about the MP3? Is it very long?
Nothing really interesting about it, its < 3MB and about 2 mins long, just a looped audio track for background music, many other music files in the project are around the same 2 - 5 mins long, under 10 MB in worst case, and all work fine except this one file, all exported with the same settings in-DAW
Do you think this could work for some kind of castle?
@viscid fjord The expected workflow is importing asset audio clips into Unity as full resolution .wav then using the import settings to compress. If you import .mp3 you're loosing a lot of quality becuse the engine will compress a second time.
yea it does i forgot about this; depends on track character though - you gain very little for looping ambiences / background tracks except for several times larger assets
but it's probably the easiest way to avoid all the above issues with importing..
how should one approach complex runtime audio generation in an ecs/dots project? is there any guidance on interfacing between jobs and OnAudioFilterRead?
or is there perhaps some other means of outputting generated audio with ecs/dots than OnAudioFilterRead
tested out DSPGraph but unfortunately i'm running into domain reload getting stuck which seems to be similar to this https://discussions.unity.com/t/domain-reload-stuck-when-using-multiple-audio-apis-in-82349/1501927
yea it's probably far from being usable yet (..still)
if you search forums you should be able to find github project of someone who used the whole stack in their ECS framework can't recall how it was named now
if you mean this one then it's the same person as the above bug report thread https://discussions.unity.com/t/dspgraph-current-limitations/937491/5
i'm able to get audio playback to happen through DSPGraph but unfortunately after playing any audio through it, any code change will cause the editor's domain reload to get stuck
which makes it impossible to use in practice since i have to restart the editor for every code change i make
i'm perfectly happy to use OnAudioFilterRead as well but i don't know how to synchronize it with jobs since it's called on the "audio thread", i wonder if there's any documentation for that?
find out how to pass data from a job to main thread in ECS - this should be mentioned somewhere.. - you should be able to get it into audio cb identically (if not, i.e. job will complain/not work, you will have to use main thread as intermediary)
what i'm thinking of is if there's something that lets me schedule jobs in an optimal manner wrt latency
i can of course just output things from jobs into a large enough circular buffer, read from that same buffer in OnAudioFilterRead and hope for the best, but i'd like to understand the system better
though i suppose if i want to really go low latency then i'll have to just bypass unity and use platform interfaces
All that DOTS era audio stuff is abandoned
Really? Interesting, to my understanding, I had thought its best to have different formats depending on the usage in-engine because of the file type compression, where games usually use mp3 for music, and ogg/wav for sounds and voice files, I also thought the compression settings were mostly a engine advantage and get decompressed at runtime/in a build - is the standard having ALL audio files being wav regardless of how they will be used in-engine?
^ well yes if you care about quality (which might be non issue..) - when you import an audio asset unity recompresses it, depending on import setting
but note that some platform use hw decoder for some formats (iOS has AAC, possibly mp3 hw playback... ) but this should be in documentation ..
with some limits i.e. playback limited to one file/asset so it's suitable only for long running stuff such as background/ambience not general sound produces by app -- but i'm not entirely sure if unity uses this now tbh hah
/ but i'd say the likelihood unity doing absolutely nothing about hw supported playback on some platforms+formats is nearing 1oo% since it doesn't allow to indicate this anywhere in import settings so you can probably disregard the above
oh and one more thing: IIRC fmod can decide to use platform hw decoder automatically when playback is issued up to some limit - but im not entirely sure about this....
Yes @viscid fjord it doesn't say anywhere in the docs but the standard is to add all audio files as .wav to Unity engine and use the import settings to compress
there is no standard compression format for sfx or music in games . the import settings are critical to understand as they affect performance at runtime
for example in most cases you would set music to stream
Interesting, I havnt noticed any performance issues but I also have pretty good specs and we havnt added all our sound files to the project yet, ill keep that in mind when we have the files to profile, from previous games ive seen, I noticed a lot of their files were in ogg or mp3, (although some of them where early 2000s era games), im guessing in other engines this is likely not a problem and they may have chose for formats out of preference?
rest assured that .wav is the source and .mp3 or .ogg are compressed destination formats
if you choose the wrong unity import settings and you have 3000 audio clips then that's where you run into perf' issues .. really depends on the project scope
Ah I see, thanks for the insight
What's the right way to loop audio? Just checking the Loop in an audio source causes a small gap of silence to appear before the loop happens
Just putting it on loop is fine, my sounds loop super fast.
It's probably your sound itself. Can you show the sound wave graph of the thing your trying to loop.
As you said there's a short silence at the start and end, which is not there when I open the source file in audacity for example
Well at least we found the problem, now we need to find a solution
Do you know the solution? I don't know what to search for this
No, I usually just pay people for my sounds, never had this issue.
You can check if this is a Unity issue by just playing the sound outside of unity and see if it also has the 0-bands at the end and start
It does not
Well there doesn't seem to be some sort of Unity import setting for Audio that creates the 0-bands as far as I can see
Can you upload the sound here?
Here
There is a tiny fadeout at the end to minimize clicking on the loop
but still you don't hear the short silence when playing on loop anywhere
In VLC the sound waves really do move down at the end.
So it seems like an Audacity export setting then.
Anyhow, I don't know, perhaps someone else can figure it out, but the 0 bands at the end and start are your problem, don't know how to fix.
That's weird. I'll try some stuff later
Hey can someone help?, all my audio sources in my scene doesn't play/work I had this problem for a month and I couldn't solve it
You don't have the Game View audio muted,d o you?
my audio clip is just a bit too long for it to sound smooth (its a landing sound clip) can I somehow just remove the first few milliseconds?
Use something like Audacity to edit your audio
there has to be a other way, Unity internal
it would be so dumb, having to export multiple audio files until you get your desired length
unity is not a DAW, a photo editing suite, or a 3D modeling program
You can certainly fade the volume out on the audio source, I guess
I dont know if it was reported, but setting time longer than audio length in audio source, gives internal error instead of standard unity error.
its like there is no check inside the unity code and it tries to set it (mostly likely)
im not sure if it can break something at runtime/in build.
so my linear rolloff is broken in my audio source which i think makes the min and max distance broken, my audio sources dont work unless i put it on costum rolloff, still my min and max distance is broken can you please help
show the inspector for an audio source that's not working right
any idea how to fix it
This has a max distance of 2
im kinda talking abut my audio sources NOT EVEN PLAYING IN SCENE so yeah
yes, and the max distance is 2
if the audio listener is more than 2 units away from the audio source, the volume will be 0
Why multiple times? You could cut it to the right length the first time
Or pause/fade the clip in Unity if the playback length is not precisely known or varies
no its like
if i put it on like 10 or wtvr
so like the whole scene could here the audio
its snot evenplaying
like at all
hello, I'm trying to add a background music to my game and then a slider to control it. But when I hit play, I don't hear the music. Can you help me? I join a picture of my AudioSource. I tried to remove the output value (with wich i found that a sound was displayed), the music is good because I tried to play it inside the editor and it worked. Can you help me please
start by setting the spatial blend to 0
this shouldn't be a sound that's coming from a specific place
also consider clearing the "Output" property so that it isn't going through a mixer
you might have a problem with the mixer in the built game
im trying to make a game where the gameplay causes the tune to evolve, anyone got any idea how to do that? lol
not evolve as such but add more layers etc, ive been looking at rez as an example
!collab
:loudspeaker: Collaborating and Job Posting
We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
⢠Collaboration & Jobs
You'll need a whole procedural music system in that case
A middleware will help because from what I hear managing and syncing audio to that degree is kinda tough to do completely on your own
yes its difficult for me to even get the concept right in my head
Conceptually you'll need to play the instruments directly from scripted sequences that can be altered or rearranged
So you'd first have some kind of midi or tracker player, then implement a system that lets the player interact with it as per your game design
There's quite some demand for systems like that so I'm sure whole third party assets exist for that
yeh i dont know of any, fmod sort of looks relevant
Fmod and Wwise are the most common middlewares for precise audio control and effective management, but there are others also like Sonity
I assume none of them do the kind of music instrumentalization out of the box, but give you the tools to build that system
Thanks Spazi, u seem knowledgable about this š
Appearances can be deceiving!
Most of what I know about audio is from observing others, I've had no need for anything fancier than Unity's own audio sources and mixers
But it might be enough that now you have a better idea where to look for the information you need
@sly crystal what you're talking about is called "dynamic music" there's a bunch of info out there about how it can work. It's non trivial. It requires and advanced understanding of music production and audio design for games. You can however do simple layer cross fade in unity using the mixer but you would need the music created in separate tracks as .wav
So a very simple version of dynamic music is possible using native Unity audio. I would not recommend looking at FMOD or Wwise unless you already have a strong foundation in audio for games. Those tools are very advanced
my fault, collab would be sick but i guess i'll just focus on my own project
I feel like this is the best spot to ask this
Does anyone know what this sound effect is called (not the ticking sound) or where it comes from? I recorded this from a really old youtube video
Orchestral hit
I have the max distance of this audio source set to 1.01 yet I can still hear the audio from across the map. How do I fix this?
If you want to place a hard limit on the maximum audio distance, use linear or custom rolloff rather than logarithmic
^ the source is 2D
True that's the bigger problem
But still if you cut off the logarithmic curve with a low max distance, the volume at that distance will be above 0 which means it'll be played at that volume beyond the max range up to infinity
unity(fmod) will eventually virtualize the sound if it's not audible - at least it shouldn't be audible across the map, and problem seemingly solved - but it's still resources being used yes
Just to be sure we're talking about the same thing
A logarithmic rolloff audiosource with a very low max distance will never be inaudible
1.01 would play it at 99% volume everywhere in the scene
š lol i haven't even looked past that 2D blend on the source
And I didn't glance above the rolloff settings in turn ^^
This logarithmic curve quirk is just something I wish I had noticed earlier and see a lot of people trip up on
it should attenuate to 0 past max distance cutoff if source has full 3D blend set IMHO
do you happen to know if there is any opened/closed report / by design, for this ?
I think the logic is that regardless of min and max, the logarithmic option still gives you a real world accurate logarithmic rolloff
Since it's basically a physical constant
Using a custom curve instead with a similar ramp over a shorter distance is very simple alternatively
I haven't seen any official report about it though
There's no indication it's not working as intended, it's just an easy detail to miss that the tail end of the curve starts rising up from zero as distance is decreased
so you think min/max distance for logarithmic rollof curve defines it just partially and function is applied regardless of the distance ?
that looks at least slightly confusing to me tbh
it might be just some fmod quirk they didn't bother to fully implement/document but idk..; at least the names of parameters sound not entirely descriptive to me š¤·āāļø
I wouldn't say partially because the function is not separate from the curve
The actual rolloff follows the curve, but the curve's shape doesn't change
Rather it flatlines where it gets cut off
yea that's what partial def. is - i.e. defined only on some domain interval - but it's not 1 function, but two in this case ( "log" + constant past 'max distance' )
somebody should bother to file report for them at least to clear up the params names š
You best do that if you want to see it done ^^
i, too, wish so ]
that log curve behaves totally different than a custom attenuation or liner attenuation .. to see what I mean choose linear then adjust the min and max distance
custom curves cannot use min distance
it takes some experimenting to find a setting that works for your design needs
I use custom curves all the time because I have a different method for defining minimum size using simple colliders to define the minimum size area
Colliders? How does that work in your case
set to trigger , the audio source follows the player using the collider as the boundary , then as the player leaves the boundary audio source attenuation kicks in
I tried making a button that plays a click sound when clicked but it is not playing the sound on first click however on it works on second and later clicks. This issue remains after not clicking anything for a while. Should I optimize the audio file or use another method?
Setup:
audio listener to cam,
audio source to button itself
audioSource.Play() to button click
Some buttons sets game object and itself as inactive when click on which plays no sound š¦
well, yes, if you turn off a game object, an audio source on it will be disabled
don't do that
Perhaps you want to use a single audio source to play all of your UI sounds
hey guys, anyone here use wwise? would you say its tough to learn? I would like to incorporate it into my project, as i havent delved too deep into audio yet. i've heard wwise is free too. thanks!
š«°
@cobalt kraken There's no self promotion in help channels.
There's lots of free resources to learn it. It is not too hard.
No need to pay for the certs unless you really want them. Just go through the courses.
You need to offload the AudioSource to a different object so that it doesn't get deactivated.
You might try something like this. Might be more complicated than you need, but it's a pretty nice design like most content from git-amend.
https://www.youtube.com/watch?v=BgpqoRFCNOs&ab_channel=git-amend
Take control of the sounds in your game by pooling your Audio Sources! Reduce the number of real voices required to play a multitude of audio clips, manage their lifecycle, and enhance performance. Learn how to streamline your audio management and make your game sound fantastic with efficient audio source pooling!
Check the repository for impro...
Heya, where do ya'll get gun sounds beyond unity store? Looked through the variety, but it's kinda limited, i need gun sounds that fit older guns, 1940s era
That era should sound pretty similar. You've got a mixture of full-power rifles (that'll sound close to modern carbines) and submachineguns (matched by modern pistols)
I guess that's just the actual firing sounds, though
Are you looking for other sounds, like working the bolt?
Yes, and also sounds for certain japanese weapons such as Type 99 LMG, Type 14 pistol and Arisaka rifles
A lot of little gun-handling sounds can be made by something other than the actual firearm
i've gotten good use out of the sound of me putting the paper tray back into my printer, haha
I got a ton of use out of the Triune Hollywood Guns pack. It's nice that the sounds are already designed to be beefed up in case you don't want to spend a lot of time just using them as source to design a new sound.
The Hollywood Guns SFX Bundle comes with a selection of sounds from all of our guns, processed in four massive styles! 280 EPIC sounds included!- M249- M4- Suppressed M4- AR-15- Suppressed AR-15- H&K Mp5- Remington 700 Bolt Action Sniper- Winchester 1886- Mossberg 590 Pump Action Shotgun- Barrett .50 Cal Sniper- Gl
And as Fen mentioned for gun handling you can make custom stuff using household items.
Otherwise you can look for gun Foley packs. Triune has a nice one of those as well.
TheĀ Gun Foley SFX comes with all of our gun Foley sound effects! All 301 sounds are included! Includes Foley sounds for the following guns:- M249- M4- AR-15- H&K Mp5- Remington 700 Bolt Action Sniper- Winchester 1886- Mossberg 590 Pump Action Shotgun- Barrett .50 Cal Sniper- Glock- 1911 (These are the same Foley so
@pale timber Please remove referrals
Huh? Like delete the links?
referral id is for kickbacks etc on asset sale
Okay my bad. Thought this would be fine since the question is about gun sfx
You can edit it out from the link
Ohhh gotcha
I just copied the URL after doing a google search
I will see if I can get links without referrals
you usually just chop off everything after a ?
that's why amazon links are always 30 pages long
lots and lots of tracking tags for things like "how did they reach this page?"
Only the second link had one as well
did anyone here ever see a crash in UnityPlayer!FMOD::OutputWASAPI::recordUpdate+0x1ae? some of our players are having crashes and the dumps report memcpy on an invalid ptr there as the reason for them but google doesn't have any results for this and we don't have any reliable reproduction
(posting it here cause the place here is the unity audio engine)
you should be checking if the rec device you started on is still present, and stop/restart on different one possibly, if not
but this crash might not be completely avoidable since it might depend on user hw (+how the version of fmod unity uses accesses/uses it..)
i think it's the output device
cause of the output
and unity just called the method for playing more audio record for some reason
and the people that have this told me they weren't doing any unplugging or anything
you can record from 'output' on windows under special circumstances if it's configured to have its loopback available for recording
but regardless if it's available then the recording should just work - so it's specific hardware in this case most likely and w/o UT being able to repro this they probably won't be able to do anythign about it...
Hey, guys! I would like to know if there is a method to actually prevent a sound effect from passing through walls and obstacles like audio absorption or something, because I have an audio source and it has 3D spatial blend.
Is there anyone available to give me some suggestions or whatever?
nothing built in to unity really, 3rd party tools like steam audio has some occlusion stuff https://valvesoftware.github.io/steam-audio/doc/unity/source.html its been a while since I used it, I am not sure if you can make walls completely stop sound coming through
you could roll your own, simple thing like using Physics.Raycast, seeing if it hits an object tagged with "wall" or something before it hits the listener then turn down the volume on a source. This is pretty naive, only takes into account direct path sound. but maybe its enough to do what you want.
That is roughly what I've done
along with using a navmesh to figure out the length of the path between the audio source and the listener
(I need to try out Steam Audio -- pretty sure it supports ARM now...)
Thereās a paid package called AudioBounce that does this. You could take a look at their demo and see if itās something worth investing in.
Steam audio simulates occlusion as well https://github.com/ValveSoftware/steam-audio
thank you
does anyone have general advice on how to get started making music/SFX for games? im completely new to making audio in general and have a very very basic understanding of music theory. if anyone has any apps to recommend/resources to learn to get started, that would be awesome. Thanks!
Do you have an understanding of common implementation approaches? If so itāll help you know how to best prepare your assets.
For example itās fairly common to have layered music, so if you render out your music not only as a master mix but also with separated-out stems, it would make your asset pack more valuable with only a small amount of extra effort
Also for music, including the meter, tempo and key in the files name is nice
I'm not entirely sure. I get what layered music is (mostly based on the name lol). Idk what other "common implementation approaches" would be though
A simple example of layered music would be if you have a main melody/harmony layer and a percussion layer. During exploration gameplay you only play the first layer. Then the percussion layer gets faded in and out as the player enters or exits combat
The percussion layer then adds to emotional excitement to enhance the sense of being in combat/danger
While keeping the loops and transitions seamless
that makes sense
If youāre totally new to all this you can try an online school I did years ago when I was getting started.
Otherwise you can learn a lot through YouTube for free
thanks!
when ever i play a sound many times in a row, the bass gets randomly boosted
how can i fix this
Are you sure it isnt just played multiple times at once?
like using the same audio source component
ok i changed it to make a new audio source foreach audio played and that worked
is it possible to add a sound to a an output event on die in vfx graph?
You can use the otput event for sound but this can not be added to a trigger "on die" event
I have fireworks and when they die it starts the event trigger of explosion.
If i joint the output event to the fireworks trail(main event) the sound stras at the beginning.
VFX graph does not allow to join the output event to the GPU Event (trigger event)
I have no idea how VFX Graph works, but I saw only one way to get callback from GPU using AsyncGPUReadback
Check this: https://youtu.be/e-hTTVr_pDI?t=426
Support development on Patreon
ā¤ļø https://patreon.com/kylebanks
Wishlist Farewell North on Steam
š https://farewell-north.com/steam
Join the Discord
š https://farewell-north.com/discord
Source Code
š https://github.com/KyleBanks/shader-pong
I love working on shaders, it's my favourite part of developing Farewell North, but there's so much m...
Im pissed off⦠how do I get audio to not desync when using Unity recorder package with Timeline? Sound effects too near the start of the TL are playing desynced. I already set the sounds in import settings to preload
anyone know why when I press the search icon, the event option does not have a dropdown indicating my events created in fmod? i'm using the EventReference field but I cannot locate the events I created in fmod. anyone know why?
Was it working before? Are you sure you have your FMOD integration set up correctly?
This indicates that it has no data from banks to display
Do any errors show up in the console when you try to browse for an event?
nothing at all, the integration and all was all correct but somehow it still didn't work. I switched to wwise and got that to work though lol
Okay. Note that Wwise does not support web builds
Iām actually working on a package for Unity to handle a lot of the common inconveniences that Iāve run into with FMOD. Hoping to have it on the asset store in the next couple months. A big part of it is it parses the FMOD projectās xml data to auto-generate scriptableobjects for events, banks, parameters and snapshots, so you donāt need to fiddle with the EventRef browsers and use string fields for so many things
Makes it more similar to working with the Wwise integration
Iāll post it here when itās up on the store. Hopefully people can find it helpful.
nice! I might buy it because I really like the fmod interface compared to wwise and is probably more suitable for my project
i also wound up writing a sort of "adapter" class
mostly for my bootleg spatial audio system
Curious, when you say āspatial audioā are you referring to ambisonics/HRTFs, or are you referring to propagation like Wwiseās rooms and portals?
Oh nice. That was gonna be the next thing I was gonna try to tackle for FMOD/Unity
Kinda tricky when I imagine it though because I donāt know how to programmatically just apply things like HPF/LPF and reverb send per event instance like Wwise does under the hood
I would've started with Steam Audio, but I'm pretty sure it didn't work on ARM for a while
but I believe it does now?
@pale timber that's an extremely complex task as I am sure you are aware
I would caution you against that because it's better to just use the tool that already exists = Wwise. The effort required to write an effective Unity implementation for FMOD that would get similar results is not a one person job š
Haha. I mean, I use the Wwise Spatial Audio tools all the time at work. Trying to make a similar framework for FMOD is more about personal challenge and potentially making some side money
But yeah Iām aware it is not an easy task
Thatās part of what makes it exciting and interesting though
Sure it's about the challenge being interesting I get it
The other thing is I would like to have at least a simplified version of propagation like that for FMOD because I use FMOD for game jams since it supports web
But think about how little exists in the current Unity / FMOD implementation. And also how events are instanced. You would need to do so much.
Thatās what got me started on making my own framework thatās led to this scriptableobject generation stuff
I mean that's a really valuable and effective effort . We use scriptable objects here as well.
The theory behind it doesnāt seem too complex ā move the room emitter to a gate/portal and recalculate its attenuation to simulate diffraction , but yeah Iām sure it is quite a challenge, especially to do it with good performance
Right.
Anyway yeah it seems like there a huge gap in Unity native and even in FMOD where spatial is not considered at all.
Yeah it is a really premium feature to have just bundled with Wwise
I should look at the integration code Wwise uses :3
I have looked at it somewhat out of necessity on the UE side but not Unity
I'm currently comparing the different spatial options from different sources and really Wwise is coming out way beyond the rest of the options
Yeah they really have done a great job with it
And once you get used to that system it really reveals how primitive more traditional positioning is
yes that's exactly my point
Which is why I want that for my FMOD š
FMOD and Unity are using tech that's 25 years old
My main concern before really starting it is that doing enough ray casting to make it work will be too much of a hit to do in C#
its too simple now to support how sophisticated game are looking and how much we know about acoustics etc
But Iāll find out when I get there
Yeah Owen I think you will find there's a reason Steam and others have aren't using C#
Have you tried doing a room/portal system with native Unity audio (or FMOD) at your studio?
If so Iām curious to hear what sort of issues you guys may have run into so I know what to look out for
Yeah we have been working on if for about 5 years in very small steps
We can set something up if you want just DM me
I'm in EST Canada
Owen I think we've talked on game audio slack a few times
Yeah we have
I saw your video about grouping together audio sources. Looked pretty cool
Cool. I will take a rain check on this and hit you up when I finish the current package and get it up on the store. Then the bigger challenge will begin š
Thanks Joel
fmod uses/supports/has google resonance for full 3D
unity itself should consume google resonance properly as well as its spatialization plugin
in both cases it's just positional source, i.e. w/o 'sound materials' / geometry
Yeah Iām less interested in ambisonics and ERs. Itās the geometry and propagation that Iām interested in having. Things like ambisonics and ER acoustic surfaces are cool and all but aside from VR IMO it doesnāt really have much impact on the experience. Simulation of occlusion and diffraction on the other hand does make a big difference regardless of the perspective of the listener
oh resonance has sound volumes
these are driven from C#/Update since it uses Unity physic colliders/triggers, i think this was limited to box colliders (+ it has 'room properties' i.e. different filters) that's all IIRC
are BBC sound effects good?
hey guys, I have this pouring coins sfx, but when I build and install the game on my phone, it sounds like an empty can.
My BGM sounds okay.
Do I need to change something here?
Hey everyone!
Iāve been exploring an app called Emergenyc Sirens And Horns and noticed a really cool feature that Iād love to implement in a similar app Iām working on. Specifically, Iām curious about how the manual siren mode works.
Does anyone have any insight into how this functionality is achieved? Could it be handled through a specific plugin?
I also noticed the app uses MonoBleedingEdge along with the following DLLs:
mono-2.0-bdwgc.dll
MonoPosixHelper.dll
Any guidance or pointers would be greatly appreciated! Thanks in advance.
Seems like you might need to synthesize the sound⦠although in Unity you can also give the pitch a negative number and it will play in reverse. Not sure which approach they took here
Using synthesis would probably be a better/more flexible overall implementation.
You talking about speaker difference or does it sound different between the two platforms when listening through headphones? Looks like youāre not really compressing the sound much so there shouldnāt be a reason for audio itself to be different
all of the "mono" stuff is just part of the Unity runtime
so that's a red herring
If anybody could help me with this, it'd be much appreciated š #š»āunity-talk message
How do I set up a 3D audio zone in Unity so that a sound gets louder as I approach a floating plane and fades as I move away?
Distance attenuation
I guess in Unity they call it āVolume Rolloffā
Expand the 3D Sound Settings on your AudioSource.
Might not be exactly what youāre looking for since you specify that youāre trying to learn implementation, but still could be worth seeing what PowerUp Audio did on the FMOD side and playing around with your own audio. They released the Celeste FMOD project publicly a few years ago and you can generate your own banks and LiveUpdate connect to the game to do redesigns.
https://www.fmod.com/docs/2.00/studio/appendix-a-celeste.html
I havenāt really looked at it myself, but Iām guessing you need to keep the names of existing events, banks and parameters (possibly some other things like VCAs depending on how they did things) the same since those references are in the Unity project. But I imagine that aside from that you can redo the events themselves pretty much however you see fit.
Otherwise Iād say just get any Unity example project or any free projects that YouTubers put onto GitHub.
Or do a game jam
Thanks for the leads! I had heard of Celeste some time back but completely forgot about it... Could be a decent option.
I'll have to scavenge around the YouTubes and Reddits a bit more to find some 3D oriented projects as that's been more so my focus. I found a Unity community driven project that was discontinued called Chop-Chop which looked lovely art-wise, but will have to figure how to get it updated and running on current Unity versions.
I'd for sure love to participate in game jams but I've just always found it so daunting on how to find a team...
Hey!
Iām experiencing an issue where the sound on my audio source is popping and glitching. However, as soon as I remove the rigidbody from the same prefab, everything works perfectly fine. Since these two things seem unrelated, this is very strange.
I donāt think Iāve ever encountered that. Is the object moving? What does the āpopping and glitchingā sound like? Could you provide a video?
It seems from this post Iām not the only one having this issue happening:
https://discussions.unity.com/t/audio-cracking-popping-regardless-of-everything/911742
Wether itās moving or not the issue happens, but even moving without the rigidbody fixes it
Iāll make a video once I get home
In provided link it doesn't sound like āpopping and glitchingā, it's more like pitch changes.
It seems rigidbody quickly moves game object which triggers doppler effect in attached AudioSource. "Doppler Level" controls the pitch speed.
Try to disable it in project settings or set it to "0" in AudioSource settings.
How to do audio and sounds? What's the good and recommended way to produce sounds like for movements and axe throwing and breaking objects in a 3D game?
Hi, I have 360 video with four-channel audio. It's ambisonic video. What is the 2025 path to ensuring the directional video plays accurately in Unity? Google resonance is often mentioned in old 2017-19 articles. Surely there is something newer?
A quick glance at the docs suggests you can also use the oculus spatializer. Maybe try importing the meta sdk so that you can use the plugin. From there you should be able to add the spatializer plugin to the Unity mixer and reference that from an audio source
Hello all! Been trying to build the essentials project to WEBGL but having issues with audio building
Basically everything is fine with the 3d audio in the play zone but when built to webgl it goes 2d and fixed volume
I have tried using some spatializer plugins like Resonance Audio without success, also haven't found the solution online
is it a known issue? I'm using 6000.0.41f1 version for the project
There's some limitation on audio when importing to web. I don't know the exact details, but I know some Unity audio features much like the mixer do not work at all, so perhaps that's related to your problem.
1st order ambisonics is a super basic format, I wouldn't worry about playback accuracy.
Old articles are still relevant, there have been no significant audio changes since Unity 2017.1
It's not an issue, WebGL audio system is based on Web Audio API, so only basic functions are supported.
I see!
I've seen some games using some kind of 3d audio in unity play, is there a workaround or does it mean the game was not necessarily built with unity?
Thank you, Iāll try that. I did find the Meta decoders, and pointing the VideoPlayer at an audiosources. Iāve attached Meta plugins to it. Next Iāll look for the audio mixer Spatializer plugin.
Thank you. Iām not yet knowledgeable about Ambisonic formats. If that sector of audio hasnāt changed much for a while, Iāll try Googleās Resonance plugin as well as testing Metaās components.
My clientās original files have third order ambisonic with up to 16 channels.
In Unity I must research if I need to set those 16 up manually to multiple audio sources placed around the scene as ātracks the user can controlā, or just one track pointed at one audio source, and the decoder works out what the sound should be at any vantage point. These are 360 videos so the viewing location is immovable in any case.
Clearly I have reading to do. š¤
Either way all you should really have to do is enable a couple settings when you import one of the plugins
Heyho,
I've been experiencing troubles with audio synchronization in WebGL builds and now I want to include a system to show the subtitles for a dialogue, as soon as the connected audio file is loaded, how would I do that?
I only know of clip.LoadAudioData(); but that isnt like a async function that I could use in a coroutine, how would I do that?
Basically I expect to load audio data and exit a waiting loop as soon as loaded = true or smth like that.
Thanks for your help!
Hi Everyone, we are using Unity and Meta XR Audio SDK and Wwise and have issues getting it to run, does anybody have experience with this? It seems like a conflict with the Meta XR Audio SDK. Thanks a lot.
hi, for sounds, known as SFX, it's good to start with Free Sound Library. Recording, editing, mixing sounds is a skill in itself and takes time. I'd recommend you to get good foundations of sound library that fits your game feels, and learn to implement one-shots.
This seems more like what youāre looking for https://docs.unity3d.com/6000.0/Documentation/ScriptReference/AudioClip-loadInBackground.html
You can write your own Coroutine to check on the AudioDataLoadState.Loading value and only proceed if/when thatās false
Something else must be happening that isnāt supported in WebGL. If by ā3D audioā you just mean it pans left and right based on position relative to the listener and it gets louder/quieter based on distance from the listener, that should work fine, along with the mixer AFAIK
On the other hand something like Resonance or ambisonics decoding for āspatial audioā probably is not supported for web. Canāt say for sure because I havenāt tried it.
Dunno why youād really want to have that level of detail for a web build anyway. Those technologiesā best use cases currently are for VR and itās unlikely youād really want to be running a VR game from WebGL
Im making a game on webgl, and im facing an issue where when i try to mute a audiosource when the game is paused using the audiomixer or doing it directly it just does not work, and it has to wait until the game gets unpaused to get muted, anyone know a fix?
Well this implies that the audio mixer is dependent on Time
I donāt know that for sure but for example if you used this same pause method (by actually stopping time) then you wouldnāt be able to animate something while the game is paused
This looks like that type of scenario
But hmm in that thread it sounds like itās just the fade that was dependent on time, which would make sense. But yours is just setting a value directly.
that's the weird part, it seems to be a webgl quirk or something, even muting is tied up to timescale, im honestly lost on what to do here
It might be that WebGL generally runs single-threaded. Not sure if thatās the cause but it might be. You may need to pause in a more sophisticated way if thatās the case
can i post as audio file or does it have to be unityassets
Maybe this is what you need:
https://docs.unity3d.com/ScriptReference/Audio.AudioMixer-updateMode.html
yeah tried this before it no workie ;-;
Has anyone here messed around with Steam Audio? It's a bit confusing and I can't seem to make it work properly. + I can't find any actual tutorial, there only seems to be people showcasing their projects and the only tutorial out there is from 8 years ago and everything is now different.
audio + its interfaces haven't changed (almost literally) in 8 years
im wondering why I dont have the AudioSource option in my Boolean? This is my uni assignment and its too late in the night to ask my lecturer
im following my lecturer's video 1 to 1
you have to assign gameobject/component in scene to the receiver, not an asset
Ohh thank you so much, works now
Hello! I have a few questions regarding sound. If anyone has a little bit of time, it would be super nice!
Iāve just started mixing audio in Unity, and I want to understand a few basics. Is it true that your sound should never go above 0dB, or else it could cause distortion and unwanted crunching sounds?
Also, one of my problems is that when I keep my sounds at 0dB, some of them sound really low. So, should I boost them but avoid going above 0dB and use effects like a compressor or EQ filter to add more dynamics and improve the overall sound ?
You want the overall mix to stay below 0 dB to avoid clipping distortion (and destroying peoplesā ears). That of course means any one sound should be well below that and in order to control the mix and guarantee it wonāt actually clip at the output you can have a limiter on the master mix, but generally speaking that should only be catching occasional extreme jumps in dynamics and you shouldnāt rely on it to keep your mix at an acceptable level.
To keep mixing simple, you should either render your sounds all normalized and then subtractively mix them in engine, or try to render them at an appropriate loudness level before importing so you only need to make minor changes in volume in engine. Up to you which is preferable.
Either way you standardize something to simplify the process. What you donāt want is for everything to be random and have a big mess to deal with
I'm a Japanese school student and not good at English. If you detect any unnatural phrases, please inform me of them! I want to improve my skill of both English and unity.
I want to make a music game. In this kind of games, it is really important not to delay the audio, because players will feel uncomfortable if they tap notes and effect sounds at the just same time. However, in my experiences, it have been difficult to prevend sound delay. Please teach me the way I can do it. I wonder how many music games do it. I'm sorry if my English is not good.
use best latency audio settings and make sure the clips being played are preloaded and uncompressed in memory (in AudioClip settings, no vorbis/adpcm codec to avoid decompression at runtime..)
there is also PlayScheduled for sequences (if there are any)
but note that unity might not be the best tool for this overall..
Thanks! I'll try it.
I actually saw a stream from some developers of a rhythm game in Unity and they had explained how they got minimal delay I think. Iāll see if I can find it.
Why did my message @ them?
My fault.
Steam doesnāt save past broadcasts it seems.
Yeah! I did. Thanks
I need to implement a system involving 10 parallel bandpass filters which are modified by the player's movement. What tools might be able to aid with this? I've been looking at FMOD but it would really difficult to have to create a set of parameters for each individual filter. I bet I could do it in RNBO or Pure Data but I'd prefer a traditional code based solution. I'd also like to avoid writing native code if possible...
You could use an audio mixer and a custom DSP using OnAudioFilterRead and write your own filter logic. Itās quite minimal. I donāt think thereās a way to do it without writing some code though.
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/MonoBehaviour.OnAudioFilterRead.html
This is fine actually! It's not native code
Oh, I missed the word native lol. Glad that works though
This will give you low level control over the audio system though which is a lot easier and more direct than using FMOD
Yessss thank you! Kinda shocked it's this easy to break into the DSP chain
What is the best practice for implementing audio? Should each audio-emitting entity have its own "audio controller" script component, or should it all be centralised into an "audio manager" gameobject?
(or both)
Try using the same audio source if you can for objects and have a culling system for looping spatial audios that culls the component so the audio isnāt running in memory when in an inaudible distance, which consumes CPU
How do you turn all current audio off, and then play new audio.
Say a voiceline is being said, and you reach a new area, a new voice line is said.
How do I turn the old one off, so the new voiceline doesn't overlap the old one.
Thanks
you could use two audio sources and disable the old voice line or you can run audioSource.Stop() before playing the new one
How do I do a command which stops all audio
@raw ridge ā¤ļø
This code doesn't work for me, the voices still play and overlap
Ignore the bracket I deleted that XD
All audio? You can just disable the listener
The unsatisfying answer is: it depends
In most cases Iād say both. You have the audio manager handle global things while the individual things can handle their own audio behaviors
Basically the larger in scope the project is, the less centralized youāll want the audio behavior to be, as with most other code.
The other point to remember is that any positional sound will need itās own emitter (AudioSource), but how you handle that is up to you. A common method is have a global audio manager which can provide a prefab instance with an AudioSource. The individual behaviors then request an emitter instance and pass in the configuration they want (clip, pitch, volume, bus, etc.) and the instance gets attached to the requesting object (or placed at a specified point in the world) and either destroys when itās done (okay) or returns to a pool (better).
On the other hand if your game is simple enough that it doesnāt really benefit from positional sounds, you could do everything through the audiomanager and just have it cycle through a collection AudioSources on itself so there can be multiple voices but everything plays from one place.
What happens if I try to import FMOD to an existing project... with hundreds of audio sources?
Is there a way to **not **have to redo all the audiosources?
Write a script to automate it. Thatās about all you can do other than doing it manually.
I need a way that when the charecter takes damage it plays a random voice line -
Idk the best way to ask for this except ask really nicely of anyone can call and go through it with me, and I'll show u what I got and what I wanna try and do.
I'd rlly appreciate some help and idk if this is more of #archived-code-general thing.
Please let me know
While I'm yet to do audio in a Unity project, here's how I'd go about this in any game project:
I would separate logic for playing sounds so that I can call it from wherever
It should have a method implemented that would take in the sound to play and the position where it should be "rendered" if applicable
This is where it would make instances of AudioSource
Does positional need much more extra than the position of where the sound would originate in?
Have the random voicelines all predefined in a list or array and then just generate a random number between 0 (start index) and list/array length - 1 (since index is 0 we want to subtract the 1 to avoid an outofrange exception)
Then simply when triggering the sound to play you get that random number and get the element with index of random number from that list/array of voicelines
It should be pretty simple
I've done it now, thanks for your assistance
Nice
Whether positional or not youāll usually want to pass in at least volume and pitch and have some sort of way to slightly randomize pitch and ideally also randomize clips (select from a collection of similar assets so it sounds more random and natural)
But yes you potentially could pass in a lot of data
Yeah of course
Thereās also less obvious things like reverb send level and volume roll off
One could use something like this but along with clip identifiers there could be various weights for parameter randomization
Hey yall, I need some help regarding implementing player footstep sounds
So I'm currently going with a method that just plays a loop of a long sound clip for footsteps (which of course can be easily stopped when needed)
However I can't figure out how to make this sound good, I'm thinking i should crossfade the sounds so it goes from walking > running or vice versa more smoothly. (Currently, the sounds transition instantly, which causes some unpleasant 'pop' sound on each transition)
Implementing this crossfade though is another story, I can't figure out how to make it work for me - I'm using a soundmanager system, so I call the soundmanager functions on the object that I want to play the sounds on.
What's a good way to handle this situation? I have a soundmanager script, and a functioning audiomixer
I've tried looking it up, but a lot of the scripts seem to be overly complicated (and cause more issues), or it's some other kind of implementation that isn't intended for crossfading
The unfortunate reality is that using Unityās native audio means any AudioSource can only own one clip at a time. Therefore to do any cross fade you need to fade one source out at the same time another fades in. A common approach for this is to make a cross fade coroutine.
That said though with your current setup, you would want the cross-fade to be extremely short, basically just to prevent the pop. Otherwise youāll get weird flubbing from overlapping the different loops thatāll make it sound like your player has more than two legs during the cross fade
Itād be better to loop via retrigger on single footsteps and select them randomly from an array, rather than running a long loop of footsteps. Then you donāt need to worry about the weirdness caused by a crossfade between different speeds. Instead just increase the trigger rate based on speed.
And also then you more effectively reduce sense of repetition. With running one long loop if the player runs in a straight line long enough theyāll hear the loop⦠unless of course itās ridiculously long like 1 minute +
Ohh aha i see, i wanted to avoid that because my teacher mentioned that it could become grating, but randomly selected sounds would prevent that in a way
And i could rework the cinemachine camera I have, as it currently works with a continuous loop of noise, simulating footsteps
Could have the same functionality in the cinemachine camera with the impulse function, thanks!
Just to clarify, what i mean by this is:
My current implementation, I have the camera doing a bobbing motion using a continuous noise function
- so I thought of implementing the footstep sounds in a similar way for consistency (so looping a long sound)
But with the sound retriggers, I could make the camera also "bob" with each footstep sound effect, instead of the long loop method - which would make the camera and footsteps align easier as well
Ahh gotcha
Many thanks though, I'm very curious how this will turn out
does anybody know how to adjust an entire FMOD's bus's pitch via unity?
anybody...?
you obtain masterchannel group of system and set pitch on it
that is, supposedly , for FMOD being used directly since that is not how it's done in Unity itself and we don't have crystal ball to read your mind about what you're doing
Slightly rude for some reason. But if that's how I can adjust the global pitch in a unity script then yeah that's what I need.
Slightly rude for some reason
no
Couldnāt you also just add a parameter to the Pitch property of the bus in FMOD, then set that parameter value in Unity?
Their idea worked, with some tweaking. I don't know if your idea would necessarily be global tho.
Parameters can be global or local, and busses are global, no?
I mean I'm VERY new to FMOD, so I'm probably wrong lol
Dunno what youāre trying to achieve but the benefit of using a parameter is it simplifies things in Unity
Like in FMOD you can give it a curve and interpolation without needing any math
I was using it to adjust all audio pitch to the timescale
Most things in FMOD can be controlled/modulated with parameters
This code worked btw: just use masterGroup.setPitch
had to find this online lol
I'm searching for ak, m4, fn fal, pistol, knife audio files. Any idea where i can find some quality ones?
Can i have your opinion on how this sounds?
First one sounds okay but it sounds suppressed and it sounds like youāre just repeating the exact same audio clip and without any volume or pitch variation
Ah looks like it is suppressed. That one sounds alright then. Ideally you should have some slight variation though to avoid typewriter effect
Second one (unsupressed) is kinda shit
Sounds like a recording from inside a firing range
Okay thanks for the feedback, yeah i need a better soundtrack for all of my weapons. But i can't find a good website for it.
For a shooter game you should use a layered approach for gunshots
That way you get a lot of variation so the sounds donāt get stale
Had some people ask how I design gunshots so I thought I'd throw together a little video on my process. Hope you find it helpful!
00:00 - Intro
00:49 - Prep & Resources
03:05 - Gunshot Breakdown
07:38 - Foley Breakdown
09:46 - Closing Thoughts
GDC PACKS - https://sonniss.com/gameaudiogdc
Soundly - https://getsoundly.com/
BOOM Library - htt...
In shooters the player will hear gunshots more than any other sounds in the game, so you should put in extra detail and effort on those sounds so they donāt get tiring and hopefully are satisfying
The typical approach (like youāll see in those videos) is to have things layered out as:
- Transient/body (midrange, tight, characteristic of weapon)
- Punch (bass/sub-bass range, very tight and quick, more āfeltā than heard)
- Mech (sounds of mechanisms moving on the weapon when firing)
- Tail (delayed long reflection tail following the shot, changes depending on environment)
- Bullet/shell casings hitting the floor (changes depending on surface)
When the player fires a round, all of those get layered together to make one āsoundā
Within each layer you have several audio clip variations and also can subtly randomize pitch and volume to get even more variation
When you do that then the amount of variation grows exponentially, so it masks any sense of repetition
But for the gunshot sounds coming from enemies you can reduce the layers and detail
And also should change the clips being used, especially as they change distance so you can simulate the way gunshots sound very different when far away vs. close.
In general for good sound libraries you should check out https://www.asoundeffect.com/
Nice thanks š
I'm going to work now, will watch all of it after the shift. Thanks, i send you a dm too. @pale timber
With an Audio Source Component, if I play a oneshot clip on that audio source, does the clip that plays respect 3D Sound Settings (specifically volume rolloff based on distance)
i did an experiement. and it seems it does.
is there something that im missing about max distance? it seems that even when my listener is beyond the max distance, i can still hear the audio playing.
i tried gradually lowering the max distance value but it had no effect on the percieved volume of the audio that was playing
all other audio source component settings seem to work as expected, though. the only things that don't seem to be working properly are min and max distances
Itās because you are using a logarithmic rolloff which has a very long decay. If you want audio to fade when the listener is farther than the max distance iād use linear rolloff
The logarithmic curve is predefined, so changing min or max cuts off the curve at whichever value rather than resizing it to the new range
You can manually change the curve points to keep it similar to a logarithmic curve while ensuring specific values at start and end
"FSBTool ERROR: Encoder for chosen format is not supported on this platform."
"im having this error while trying to import a sound, please help
I'm on 2017.1.2p3, building for the Wii U platform
Is there any reason a car models audio file being choppy for when you give it gas? Iām not sure if itās a script, or audio issues or what
my audio isn't quite working, the audio isn't playing after i implemented the out of breath stuff, i attached the inspector and the script, can someone lmk what's wrong?
i have already made sure the audio sources are properly linked and have a good sound file playing
show the PlayAndFadeOutStaminaSound() method
I see two potential issues. you should be using one audio source for your player and use PlayOneShot instead. Play() returns one audio clip per audio source at a time
https://www.youtube.com/watch?v=xu7SsP0znm4
Recently made this soundtrack for a short film contest, it's supposed to be dark, ambient, suspenseful and anxious.
Also, I wonder if the visual is the right fit for the music. I am not good at artwork. What do you think?
#dark #ambient #suspense
Dark Neighborhood Soundscape is a soundtrack I wrote for the short-film Binocular Trick created by Spencer Zimmerman and provided by Airwiggles during the Film Audio Face-off 2025: a short film audio redesign contest.
Want to watch our team's entry?
Link here: youtu.be/3subBhoWeos
Dark Neighborhood Soundscape was made...
IMO the mini piano doesnāt work well. Makes me think of things like this:
Complete Playlist: https://www.youtube.com/playlist?list=PLjyLjyXJQJUMcgcCDT0Mrbq6pBRSIhZij
Visit our awesome Video Game Music Radio here!
https://www.youtube.com/c/ViviVGM/live
Considering to support my work? Check out my Patreon!
https://www.patreon.com/Vivi_Gaming
Leaving a like and subscribing will also help alot!
Visit our community her...
Otherwise yeah it reads as āsomething bad might happen soonā
I see your point. Using a minipiano/toy can evoke a sense of childish feel.
Also, I did not know what instrument to use to fill the midrange and the highs in a suspenseful context. What would you use ? So I may think of it for the future
Iām not really a composer. I would just keep trying different samples/VSTi plugins until I found something cool. The mini piano might even work if it was more washed out with DSP ā e.g. reverb/LPF/wobbly pitch, etc.
Itās just the (mostly) clean mini piano has a strong emotional tie to child play. Maybe the game is a horror game that somehow involves that theme and in that case it would fit fine.
Ah I see, I will think about it next time I will write music in that genre, thank you!
Hello! I have a go kart, when I start driving it plays an engine sound but itās very stuttery and sounds bad quality , how can I fix that?
this code is good quality, though advanced and rather invasive esp. when used as an ad-hoc solution..
you should look into how things are being done in FMOD studio/projects and be using that as OwenCooper mentioned - that is if you need to be using FMOD Studio at all for some stuff it is good at, like dynamic audio changes at runtime - otherwise Unity audio is not as capable, but it works often well (and it OOTB)
I did originally look at the FMOD studio and project but nothing had a **global **pitch as far as I could tell. Also I'm just tryna learn FMOD in general, first time use, I'll get better lol
Need to see code to help
public void UpdateVolume(float amount) {
musicVolume = amount;
musicMixer.SetFloat(StringConstants.VOLUME, Mathf.Log10(amount) * 20f);
}
Guys I have this function that runs for OnSceneLoaded. However, on the first scene, it doesn't change the volume of the audio mixer? Only when I change to another scene
oh you didn't say anything about OnSceneLoaded before. did you check to see if that event is triggered in general? and shouldn't this be updated whenever volume is changed rather than on scene loaded anyways?
depends when you are doing it, this might be related : https://discussions.unity.com/t/audiomixer-setfloat-doesnt-work-on-awake/579429
hello everyone! im trying to smooth out this audio, sometimes it is ear piercing like when trying to apply the gas again when driving it sometimes gives a loud screetch and the audio is choppy.
Well, test it out at different values and see what combo of values produces that effect. Then just adjust the max values for this not to happen. Assuming this is just the parameters issue.
thank you very much again @cedar pagoda
for anyone else, ive actually added in an idle and running sound and then lowered the max engine sound
and its phenominally better.
Guys, I need help. What would cause an AudioSource's time to get stuck at 0? The clip plays the first time, but when trying to play it again, it gets stuck at 0. I can see isPlaying becomes true, after calling Play() again, but time remains at 0 during Update() test.
Nevermind, I found the problem. My script was setting pitch to a defaultPitch property in OnDisable() but missing defaultPitch = pitch; in Awake().
No
The files you import should be uncompressed (or losslessly compressed) because Unity's internal formats don't support their compression methods
Any compression artifacts you introduce by compression will be preserved and take space just as much as the original clear audio
i'll compose for free š¢
A bit of an odd question, but is there a less tedious way of handling long audio files? I have voice lines in my game where the actor recorded several takes in 1 file with a bit of "air" between some lines, so ive setup code to play at certain timestamps in the audio files, the tedious part is going through and marking each start/end timestamp for every take of every line, I was thinking I could maybe write code that will look for the "air" moments but some lines intentionally have emotional pauses in it or the actor put their own style on it where the pauses are inconsistent (but sound good) - is the only real option here to go through the tedious process of timestamping every part of these files or is there maybe some faster way I could do this?
What I mean with the "air" is for example, the first 2 waveforms on the left side of the white line are 2 different takes with "air" - and the 2 wavefroms on the other side are 1 line with a intentional pause - the long "air" in the middle is actually just air, with the other 4 smaller ones being 2 different takes with intentional pauses - so I cant think of a way I could tell code "look for air but not intentional pauses" to automate this process a bit and I dont really have any other ideas
Why not trim them and make them into separate assets?
Are the āseveral takesā literally different takes? Like different performances of the same line? Or are they different lines?
I guess either way, trimming these up into different assets in a DAW would probably be quicker than trying to timestamp everything. Also would be far less brittle if you decide to replace assets.
Like letās say you do another VO session for Exerts. Well, your new exerts assets have totally different time stamps than the ones you painstakingly made for the previous iteration, unless you place them into the same spots in the long file
Whereas if you had Grizzly_Exert_01, _02, _03, etc. you can just render out the new assets and replace them and change nothing over in Unity (other than those assets being replaced)
Additionally then with this approach if you decide you want to exclude one of the takes, you just remove it from whatever array is storing the clips, rather than needing to know the timestamps of the particular take you want to remove
As for automating where to trim it, any decent audio-editing software will have a tool for doing a ādynamic splitā, where you can set parameters for the signal to detect whether or not to place a split on the audio region, so this also would remove the need for you trying to code this functionality yourself.
Youāll still need to manually confirm and correct the splits, but it can take care of a majority of the work.
Thanks for the detailed response - the several takes are both different performances for the same line and different lines related to the same game event (ex: "group up", "over here", "on me", and however many takes they decide to record for those 3 lines, sometimes they only do 1 or 2 takes, sometimes they might do 7+ takes)
I was considering chopping them in Audacity (as thats the only DAW I have), but I feel like it would be equally as tedious and time consuming going through the waveforms to chop, name and export each part myself - ill look into "dynamic splitting" though, maybe thatll help for this project - we are getting ready to release this month so we are kinda in "pencils down" mode, though you mentioned a lot of good points, and I think for our next project with VOs it would probably be better having them split and name each take for all their lines when they record and maybe send everything as a large zip
If really you need to stick to long files with time codes, you might look into something like this https://discussions.unity.com/t/solved-how-to-read-wav-markers-in-unity/784051/10
So you could embed the markers in a DAW and then read them in Unity
!collab
:loudspeaker: Collaborating and Job Posting
We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
⢠Collaboration & Jobs
Audacity has "automatic labeling" by sound volume
You can then export them as separate clips with "export multiple" option
There's no system that can tell the difference between pause between takes and an artistic pause, but creating and modifying labels by hand takes about a second per take because you only need to click and drag basically
Trying to play raw recordings by timeskipping sounds like a nightmare
It's inviting playback problems, and file storage problems since you'd be storing all the background noise between takes, not just the takes
Coding a system that analyzes audio does not sound like a good use of limited time, even if such a tool didn't already exist
But then you'd also have to code your own meta data for audio labels, and name and tweak those labels by hand using a text editor I'd assume
Even if Audacity didn't already have the exact kind of tools you need, designing, developing and debugging such tools would not be guaranteed to be faster than copypasting the clips out of the recordings
Raw recordings usually need to be mastered and cleaned up anyway, the splitting part is not the biggest timesink
Yeah Iām of the same opinion that trying to make the existing timecode setup robust would take just as long or longer and would still have more cons than just splitting up the assets.
From a quick search it looks like the dynamic split option in Audacity is āBeat Finderā
Dunno about the next step of actually splitting
But also Audacity is to audio what MS paint is to images. You should use something better
Reaper has a perpetual trial license as a fully-featured and highly customizable DAW. The only downside to the trial license is seeing a pop up asking you to buy a paid license every time you start the software
And even a paid license is very cheap
I paid $60 for it once, 15 years ago, and my license is still active for the most recent versions
But even if you did it by hand it is still better than relying on manually-entered time codes.
I just learned this pitchshifting technique I have overlooked (or didn't know).
Take one sound, pitchshift it, negatively in this case, and it gives you different wonderful results
It might be useful for those who didn't know as myself
#sounddesign #gameaudio
I just learned this awesome pitchshifting technique used in sound design within the Wwise 101 lesson (course).
One Sound, Pitchshifting, 5 Different Use
It's "automatic labeling" as mentioned
Under "analysis" where you also find beat finder
"Labels" are a data track that runs parallel with an audio track and contains labels in the form of start, stop and name
You can select a part of an audio track and hit ctrl + b to create a label for that range
Using automatic labeling automatically creates a label track, which you can then modify as needed
Good points - at the time, this approach was the simplest for both the VOs and editing 1 file with filters sounded easier than applying filter settings to multiple files, and didnt think timestamping would be much of a roadblock, fast-forward a year later and maybe that wasnt the best idea lol - though the screenshot above is a editor I made (roughly over 2 days of work, mostly doing Editor API research), my strongest skills are in programming so I figured coding a "quick and dirty" solution might be fastest for me, but I think Audacitys "automatic labelling" approach sounds like itll be my best bet for this project with minimal manual work, so ill give that a shot - thanks again to both you and Owen for all the insight
I certainly learned a lot from working on this project and with hindsight, if I had the time to basically nuke it and start over, I totally would (theres a lot, not just time splitting, that "if I knew then what I know now", would have done things differently lol) - and thats a good comparison with Audacity, an audio engineer had told me "Audacity is for destructive audio" as in, when you apply filters, it modifies the waveform (destructively), where most DAWs treat filters like Photoshop treats layers, I just dont have the money or experience with DAWs, though I might look into Reaper, it sounds like a good suggestion
Also, even if Audacity falls short in professional use it's plenty capable
Most people don't realise how many tools it has
It does have a lot for free, which is very nice
No
Unity cannot play typical audio file formats, they always must be decoded, then encoded into internal formats
Just the same way image formats must be converted into textures
What is the absolute need?
There may be other solutions that serve the same goal, whichever it is
You can specify a compressed audio format for an audio clip in unity and lower the quality, which is what you're doing anyway on the outside of it
https://docs.unity3d.com/Manual/class-AudioClip.html
I guess then it's worth a try to get the file externally
It'll still be decoded and re-encoded so you lose the compression ultimately, but you have the benefit of being able to unload them too
WebGL is different and awkward in a lot of ways, I don't have any technical insight on its audio
@stuck frost I guess it supports Resources.Load which would be simpler than WebRequests?
@quasi hound is correct . You must import full resolution source files ( .aiff or .wav ) into Unity first. Then you can use the Import settings to make the asset (clip) take as little RAM as possible. See this example the compressed file is 1.6% of the original size.
Use this method if you are NOT streaming. With streaming you can get much higher quality because you're not loading anything up front.
Here's a streaming example
You still have to include the music in your build. As another option I'm pretty sure there are asset store solutions for streaming music in from a URL so you don't have to include it in your build.
the UnityWebRequest is for 'streaming from an URL'
depending in its current non/buggy state of its 'streaming' flag for AudioClips, that is (it used to vary between versions, often)
but i'm not sure about its usefullness here, since it's WebGL --- might be as well as useless for this
compared to other asset types audio is actually rather well supported as 'external asset' at runtime, also because the mp3 spec is freely available also on standalones now, (not only on mobiles like previously...)
proper integration w/ AudioSources/Unity audio takes bit of effort - for asset preprocessing/fixed sets of AudioClips, preparation in Editor is better, for sure
What do you think of the plan to try to save as much disk space as possible by loading in an externally compressed audio file, in this case when the tracks are very long and quality isn't the priority (nor RAM)
In my test I can compress a 170 MB raw audio into 3.5 MB with Unity's heaviest vorbis compression
3.0 MB with quality 0 ogg in audacity
1.0 MB with 48-85 kbs mp3
So if there's a lot of those tracks and you need only one in memory at a time, it seems to be reasonable to import them at runtime
Streaming audio directly from the server that also hosts the webgl application would likely be a much better solution though
Mp3 may have a better compression ratio than that 2.06%, but it also looks like decoding it leads to some pretty bad audio artifacts
Better be a pretty bad radio for it to be worth it
Also mp3 notoriously do not seamlessly loop
So if theyāre meant to loop, then ogg should be preferred
In theory it sounds like you could have the files in the StreamingAssets folder, compressed externally however is needed and load them in as needed at runtime. I know Iāve done that with video on WebGL.
Havenāt tried it with audio clips and audio sources though
if VideoPlayer does indeed work with filesystem like StreamingAssets folder in WebGL then AudioSources will work / it's almost the same media handler of UWR and VideoPlayer needs audio decoding almost always /
can unity use vsts?
no
btw can unreal/does something exist for it which can ?
Getting an error on WebGL build:
Trying to get length of sound which is not loaded
I have preload checkbox checked in the clip properties.
And I play it with:
AudioSource.clip = MyClip;
AudioSource.Play();
The clip is chosen in the editor.
The audio plays but I think it throws on WebGL build and the function after that doesn't run.
i think it might be decoder failing - try uncompressed audio to see if everything works first
It depends.
Actually seamless loop is supported in LAME Project encoder, it adds additional metadata for sample-accurate playback (MP3_ACCURATE_LENGTH, ENC_DELAY, ENC_PADDING). But other legacy decoders (non-LAME) will ignore this metadata and play with gaps as a regular MP3 file.
wait, but you researched VST support?
#šāaudio message
btw, web-browsers support this LAME metadata (at least Chrome and Firefox), this can be useful in Unity WebGL for seamless looping.
REAPER DAW uses a LAME codec, so it can export and import MP3 files with this metadata.
with what FMOD provides only, but it was hit and miss - i managed to load some VST2 plugins, but overall compatibility and stability was not good
this needs something more robust and stable, and VST3 support at least (FMOD doesn't - or didn't at the time but i doubt anything changed - support anything but v2)
(chances of revisiting this are not very high so i think this is left for the next generation of researchers for the moment .))
How do you get the mp3 to not have the pop when looping in Unity then?
I use Reaper and render mp3 with LAME. Iām pretty sure last I checked it still has the pop
Sorry I'm confused, what FMOD are you talking about?) FMOD as Unity's internal audio-backend or external FMOD Studio?
[https://fmod.com/docs/2.03/api/core-guide.html] it can load a VST(2) as "" plugin, this is part of Studio ( which it itself uses it )
unity fmod is heavily embedded in engine i don't think there's a way to access its normal API easily
This server is not for self promotion
!collab
:loudspeaker: Collaborating and Job Posting
We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
⢠Collaboration & Jobs
oh sry
How to properly play and wait for the audio clip to finish playing?
Like when it's in WebGL when I do AudioSource.Play(); clip might not even be loaded yet.
And if I try to check AudioSource.clip.isPlaying, it throws an error
Trying to get length of sound which is not loaded
because clip isn't even downloaded yet.
So what is the proper way of playing the sounds and waiting for it to finish?
Sounds like you need a callback for when the asset is loaded, not when the AudioSource is done playing
How are you loading the asset?
It's a list in a MonoBehavior:
public List<AudioClip> AudioClips;
And then I just play them by name:
public void Play(string ClipName) {
if(AudioClipDictionary.ContainsKey(ClipName)) {
AudioClip AudioClip = AudioClipDictionary[ClipName];
if(AudioClip.loadState != AudioDataLoadState.Loaded) {
Debug.Log($"Trying to play not loaded audio clip {ClipName}");
return;
}
AudioSource.clip = AudioClip;
AudioSource.Play();
}
else
Debug.Log($"Trying to play non-existing audio clip {ClipName}");
}
Well I also pre-load them on Awake:
foreach(AudioClip AudioClip in AudioClips) {
AudioClip.LoadAudioData();
}
Add a null check to your function
I assume youād get a NRE on the line checking loadState is the clip is null, but I donāt know exactly how that function works.
But before you check loadState, you should make sure the clip isnāt null
And for sanity after you confirm itās not null you can print info about the clip retrieved
This is all just to make sure that you even have a clip being assigned to your AudioSource. Because your current error seems to be saying that thereās no clip
Also you should not name your local AudioClip variable āAudioClipā because then itās unclear whether youāre using static functions/properties from the class or functions/properties on the instance.
Unity Editor/Standalone Platform can't play LAME-encoded mp3s without gaps because it uses internal FMOD backend that doesn't support LAME extra metadata.
However, seamless looping is technically possible in Web(WebGL) Platform, where Unity uses Web Audio API as audio backend (but still requires LAME support from browser-side).
This is example of loading local mp3-file from StreamingAssets folder
void Start()
{
StartCoroutine(GetAndPlayAudioClip());
}
IEnumerator GetAndPlayAudioClip()
{
var url = Application.streamingAssetsPath + "/FILENAME.mp3";
using UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG);
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.ConnectionError)
{
Debug.Log(www.error);
}
else
{
audioClip = DownloadHandlerAudioClip.GetContent(www);
audioSource.clip = audioClip;
audioSource.loop = true;
audioSource.Play();
}
}
I seem to have missed disclaimer - this is a technical possibility, not a call to use this format.
For the WebGL platform, I recommend using Vorbis(OGG) format, it is finally supported by all modern browsers, including Safari.
How does everyone handle volume levels per audio asset?
When sourcing audio from various sources it's difficult to get them to be the right levels.
Do you hard set levels from the bounce via Audacity or Logic etc? I feel like with the iterative nature of tuning levels it's not a great approach.
Unfortunately, Unity 6.x does not yet allow you to choose a compression format other than AAC, but you can use a same solution with StreamingAssets folder for Vorbis.
private AudioType audioType;
void Start()
{
if (Application.platform == RuntimePlatform.WebGLPlayer)
audioType = AudioType.AUDIOQUEUE;
else
audioType = AudioType.OGGVORBIS;
audioSource = GetComponent<AudioSource>();
StartCoroutine(GetAndPlayAudioClip());
}
IEnumerator GetAndPlayAudioClip()
{
var url = Application.streamingAssetsPath + "/FILENAME.ogg";
using UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, audioType);
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.ConnectionError)
{
Debug.Log(www.error);
}
else
{
audioSource.clip = DownloadHandlerAudioClip.GetContent(www);
audioSource.loop = true;
audioSource.Play();
}
}
From a technical point of view, normalized audio source (I mean lossless WAV-file) will give higher quality when converted to a lossy codec than silent audio source. Volume levels should be adjusted in game engine or audio middleware, not in the audio asset.
Audio should be mastered for the correct perceptual loudness after recording / during authoring, before it's exported into an engine / into a format where the data for doing that accurately is lost
In engine there's no limit to how much quieter you can make a sound, but you can't make it any louder than the original loudness without causing issues
Also better for quality to use all the available headroom
From what you and @kindred thicket are describing it's both. You just said 'during authoring', but using all the headroom is best quality & mixing during runtime.
Currently I've made an SO that handles mixing levels with a simple float 0-1 and an audio clip. One of the sr devs said the 'correct' way is to master them all to be the desired levels. However we're sourcing these assets from anywhere and everywhere, and there are hundreds of them. I've come into this project relatively late and the backlog of trying to retroactively master all of these assets seems like a waste of time compared to the method I've implemented, but they absolutely need some mixing.
The other problem is it's an iterative & destructive process - reducing the volume of an audio file means there needs to be version control, saving the original full volume version incase the levels ever need to be raised again.
Also a simple normalization does not always mean equal loudness across assets, it just means the peaks are set to whatever db you normalized.
This is an interesting point that I hadnāt really considered before, and I would definitely agree if implementing directly into Unity that normalized is better since you canāt easily add gain to audio assets. However Iāve heard the case made commonly from industry professionals lately at least when using middleware that itās good practice to render assets at their intended loudness (LUFS or RMS reading, not peak) so that the amount of gain correction in middleware is minimal and the game can be closer to an appropriate mix faster because of it.
That is something Iāve been trying lately, as opposed to in the past just rendering at a normalized peak (e.g. -1 dB) and subtracting gain as needed in middleware. But the point about quieter assets likely having a greater amount of artifacts after conversion is one worth considering
In Wwise or FMOD itās of course very easy to add gain to a signal and without any noticeable artifacting as a result, but yeah if the quieter sound is compressed and becomes more lossy than if it were rendered louder, then that gain boost will also boost those artifacts
So then is mixing for desired loudness, even if quiet, better than mixing for maximum lossless loudness and reducing volume at runtime?
That seems to be the $$$ question.
I can't say I know the best answer, but I'm implementing the latter - good quality mix/master full volume level assets that get mixed at runtime, with a default level modifier set by a scriptable object.
Making sure I'm not completely making a fool of myself by doing so š
Did anyone ever encounter a problem like this? Audio being really really choppy progressive with time at the point where I can't even hear the sound anymore
Also here are the project settings and audio source settings
Tried a lot of things but can't figure out why this happens
@rich mirage Sound designer here with over 10 years experience working in Unity native audio. Also many other engines and middleware. The "best" way to do this depends on what works for you in this particular case.
Most of the time you'll want a sound description like your SO that can pass settings down the the audio source playing the clip. The down side to this is you will have to create a SO for each clip. As motioned before you cannot turn audio source up pst 0 attenuation, so there is no making a sound louder from Unity audio source. As an option you can turn mixer groups up +20.
In the example you gave where a SR dev told you "the 'correct' way is to master them all to be the desired levels" is misleading and not good advice. You cannot know how loud an asset needs to be out of context and you cannot set the volume correctly when you are creating it. There are generally accepted guidelines audio professionals use when they deliver source. That's typically done at relative levels where ambience is quiet and explosions are loud.
Because I create all my own source I typically have used that relative approach. This works fine for me because I am constantly updating the source clips as I work , changing the content or tone or volume to suit the game better.
There is another approach which is to send all assets into the game loud then turn them down in engine. This approach works better with Unity built in audio source priority system which in games where max voices is important is a very powerful tool.
Unity audio source priority system makes quiet sounds go virtual when max voices is reached. This system doesn't function correctly if you feed it clips set to relative levels because priority looks at the volume , attenuation and mixer group to determine "Audibility" . This is undocumented but you can see it here in the profiler
Basically you have to mix the game in engine becuase you cannot control the source. Your scriptable object idea is good but this means you'll need an SO for each clip .. yikes !
If you want to take full advantage of the priority system you'll need to batch process your audio source to hit a loud peak target. I suggest something like -3 dBuFs . There are lot's of audio batch processing tools out there.
The downside to this "make everything loud before you import" approach is that auditioning clips in the Unity preview is EXTREMELY LOUD
the audio in this video capture is too quiet I cannot hear the problem .. if you repost I can listen to it and see if I can help
Thank you for the very informative response.
To continue what you were saying about the realVoices I do have concerns about reaching that number as I'm planning on implementing an ambience biome of sorts that dynamically plays based on game state - terrain etc. Is it really as bad as some forums mention to increase that number? I wouldn't need to max it out by possibly double it (~64). Of course I wouldn't really know until I profile it - but testing only goes reveals so much until the actual systems are built.
I have editor code to automatically assign and name the AudioAsssetScriptableObjects so adding one to a folder & at one click of a button it's all assigned. This is also good for collections of sounds with slight variation like foot falls, weapon attacks, etc. Those are generally cut from the same cloth and get the same treatments as far as levels are concerned. One nice thing I just made is a shuffle for an asset collection that's static across instances, no random streaks of the same clip firing even when there are multiple of the same entity calling the same audio. Most importantly is the context that allows me to filter them to the correct channels and adds some security & convenience in the editor that a musical asset has to be assigned as a musical asset - you can't accidentally assign the wrong type, and the search box is less cluttered.
Yes, this is not a fun experience.
Rather than increasing your max voices to 64 I suggest to keep it at 32 and learn to use the priority system thatās literally whatās itās there for
Again itās making voices virtual based on audibility
Priority system can work very well to solve the common problem of ātoo many sounds are playingā
Here are some tips
- priority ā0ā was bugged so t use that number just use 1 instead. Set only critical long loops to this high priority . Like music or other looping sounds that cannot be stopped.
- use the default priority 128 for all medium priority this should be a very large group of sounds like most of your sfx
- for detail sounds you want to be dropped set them to low priority like 256
Consider adding priority to your scriptable object.
Is your game 3D ?
No it's 2D
That is something I have been considering. There's also some inherent priority built in that I could utilize, music for instance should not cut in and out, takes priority over ambience type audio.
Lots to consider with this new information.
OK, so in a 2-D game my approach would be to use even less than 32 max voices. This is because you want the priority system shutting down sounds that are not important. I also recommend to increase the size of your third bucket the low priority 256 groupso less sounds are in the middle priority of 128.
Try 16 Max voices once you have the priorities assigned into high medium and low
As a musician I'm all about using limitations as creative guidelines. Haha, this however... I see the value in what you're saying, but it's definitely a challenge.
What causes the audioSource to add a tick sound at the end of playing the sound? This doesn't happen with my other sounds, but this one in particular (which is seemingly no different as it is just another sound from the same collection of sounds I purchased).
Could be the format or compression youāre using. I know .wav should overall have better re-playability if you are looping the audio clip but if you are already using .wav iād try a different compression or uncompressed just to see if that resolves it. Could also be a specific sound in the audio recording too so iād play it outside unity to see if it reproduces that issue
Okay, I solved it. It was the wav file, because it works when I switch to a different sound. So, I edited this broken one and added a 0.0001s fade-in at the start, and 0.0001s fade-out at the end. Also changed pitch from 100 to 99.
Were you using .mp3 before?
No, it is WAV.
hi, sometimes when i switch back to the main menu of my game (separate scene) no music and sound can be heard (happens in editor and build). when loading again the scene music and sound can be heard. Any idea what might cause this? Unity 2021.3.45f1 thank you very much
Either you donāt have a proper state management set up or a script is disabling your audio source/audio mixer group (if using one)
thank you very much: audio sources and my audio mixer group are active. What do you mean by state management? Is this a specific setting?
No, meaning that your audio source is destroyed when switching scenes because you arenāt persisting it across
Or the object that plays your audio source (if any) is destroyed
no everything is there. as said, this happens only sometime. most of the time the main main is loaded and everything work. I try to get better insights
Then iād really check if they arenāt being disabled/destroyed/losing reference in the hierarchy. Run your game and keep testing with the hierarchy open
Hi, I have this sound and I'm trying my best to make it loop but I can't seem to remove that click sound every time it restarts. I really don't have any audio knowledge, does someone know a good way to easily loop sound because I can't find anything.
Also, why is it so hard to find looping audio online?? Don't all games need this kinda stuff? Like sounds that loop continuously? I want this so I can change the pitch with code.
Youāre better off using .wav for looping clips and probably using a PCM compression. Though it still wonāt be 100% perfect so you can try using a script to crossfade the volume and pitch towards the ending (lerping out) then lerp in the values as the clip starts. That should provide a smoother loop
Thanks I converted it to .wav and now the click is gone, I also happened to cut it in the right spot with another software so it loops better.
Sadly higher file size tho. I guess it doesn't need to be 30sec if it's looping
Yeah .wav is a lot bigger than .mp3. You should only be using it for looping audio and shorter clips
what are some good sound libaries?
Pixabay has a decent selection for free!
You can use .ogg It compresses to almost as small as mp3 and can seamlessly loop.
MP3s notoriously have a click at the loop point.
You also can just import to Unity as the full quality WAV and use Unity to compress it to Vorbis (ogg).
So audibility is based on variables only and ignores the waveform itself?
A lot of good tips!
Any tips for implementing stereo clips that also have distance attenuation?
It seems normally to get distance attenuation even without directionality the clip must be 3D which forces it to mono
And doing distance attenuation by controlling volume with a script feels tedious when the audio engine is already doing distance calculations and then volume variable may need to be set from multiple sources at once
Spatial blend set to 3D makes a stereo source mono. You have to create your own distance attenuation for the audio source or the mixer group using parameters. Attenuation should be based on distance from listener.
Why would you set volume variable based on multiple sources .. that sounds backwards to me .. ??
Yeah audibility doesnāt know how loud the data inside the clip is so thatās not part of the calculation
Does full spread not make the source become stereo with SpatialBlend set to 3D? I donāt work with native Unity audio enough to know off hand, but that was my assumption.
Like, full 3D spatial blend + full spread would essentially make it have distance attenuation without positioning
Spread is super weird
Itās hard to describe
Basically spread 1 inverts the clip channels
I might have to do a quick video explainer on it if I have time this week
Actually hereās a great breakdown on spread but it doesnāt directly answer what happens with stereo source or.. but worth reading
Johns tutorials are great Iāve gone back to these over the years because they are so thorough
Hmm interesting. Iāll have to play around with it some time.
By sources I mean anything that could want to control a variable
So the script that handles volume by distance has to accomodate another script trying to change volume of that specific audio source by a gameplay event
Ok @quasi hound I see what you mean . Sorry I donāt have an easy answer for that. I donāt write code at all. One way to approach conflicts with volume is to use a mixer group volume with parameters to do the distance attenuation then your other scripts can set volume on the audio source
All audio files located in Assets folder (except for StreamingAssets folder and tracker music formats) are upconverted to internal uncompressed format (like PCM), then again re-encoded using selected AudioClip Compression Format (Vorbis, ADPCM, PCM).
So is always better to use WAV (uncompressed PCM) files to avoid quality loss due to double conversion.
This how I understand the engine to work as well
.ogg is vorbis and is no different than unity compressing wave to vorbis, no?
I believe oggs get re-compressed on import
But difficult to know how or if that actually happens
If you import a quality 100 ogg and compress as quality 100 vorbis, the compression ratio is still like 88%
If you import a very low quality ogg and compress as very low quality vorbis, the compression ratio is above 100% so the file actually gets bigger
Whether that's lossy kind of double conversion or not I can't tell
Also, importing the super low quality ogg and compressing as very high quality vorbis will get almost the same ratio as if compressing as very low quality vorbis
So at least it's smart enough to not re-compress everything naively
You can easily check this using tools for extracting assets from Unity build. (tldr; imported and exported Vorbis files will not be the same).
Vorbis does still compress .ogg files. I am seeing this >100% in some files, though it doesn't have to do with the original quality.
whats the best way to make music for game
any fmod users
how do i control the speed of a clip using a parameter i looked everywhere online i cant find
Do you mean pitch ? What is speed ?
Depending on how fast my character moves I want the clip to loop faster to sound like heās going faster
I couldnāt find a way to control the loop
You probably donāt want to loop using a loop region if thatās the behavior you want. Iāll circle back in a bit after opening up FMOD to provide you an alternative suggestion
Thank you Iām a total beginner and Iāve been trying to find an alternative. I saw people mention to not loop footsteps but instead call them per x time in unity?
Yes that would be better
But if you were constrained to looping in FMOD, one alternative would be to use a Scatterer instrument rather than a Multi instrument. Then place a sustain point somewhere along the instrumentās region in the timeline. You actually could still use a loop region if you like how that looks more (I prefer the sustain point for something like this). It should behave the same way. You can automate the Spawn Rate with a parameter.
Youāll just then want to make sure to set the min/max scatter distance to the minimum value. For the min/max spawn interval youāll want to make those the same value (unless you want some trigger rate variance) set to some value which feels appropriate. If you have it all the way at minimum youāll be able to trigger the sound way faster than youād ever need, so youāll just want to find a decent value.
But IMO you should retrigger it in Unity rather than doing something like this. I have a placeholder MonoBehaviour that I use for looping footsteps when setting up new Unity projects with FMOD. You can just make a simple timer and have it play the event each time the timer completes, and make the interval a public value that can be controlled by the game.
Feel free to use
Wow thanks for the in-depth explanation! Iām not gonna lie itās my first day using fmod so what you just said made almost no sense to me ššššš
I will do more extensive research & probably go with what you mentioned with recalling the footsteps in my scripts
(Actually the video you provided makes sense) and the script is pretty simple will def use!
What is the best way to make all soundeffects (< 2 seconds) the same "loudness" ? I tried LUFS, Momentary LUFS, RMS, Peak volume in Audacity. None seem to do the job perfectly well.
I'm trying to add a footstep sound to my character using a third-person controller, and I don't know why the audio plays when I walk, but then when I'm still without moving, it keeps playing. I'm using the onFootstep function in the script, and in the inspector, I've passed the MP3 audio of my footsteps, which is 1 minute long
In my game I'm using a general audio manager that handles background music and other sound effects like attacks, I've tried using that to add the walking sound effect by activating the sound in the move() function but the same thing happens to me
Do you have something that stops the audio when the player stops moving?
No, I think.
The function is an animation event:
private void OnFootstep(AnimationEvent animationEvent)
{
if (animationEvent.animatorClipInfo.weight > 0.5f)
{
if (FootstepAudioClips.Length > 0)
{
var index = Random.Range(0, FootstepAudioClips.Length);
AudioSource.PlayClipAtPoint(FootstepAudioClips[index], transform.TransformPoint(_controller.center), FootstepAudioVolume);
}
}
}
Shouldn't be a surprise then that it keeps playing
Typically you wouldn't have a one minute footsteps clip, you'd have a clip of one footstep and a system that makes sure there's a delay between playing the clip
The best way is to have a collection of oneshot footsteps that are randomly selected and one is played each time the event fires, and like Nitku mentioned, some way to enforce a minimum duration between sounds to prevent spamming (e.g. during animation blends).
If you want to use a 1 minute clip as a loop as a sort of lazy way of implementing footsteps, you do not want it to come from an animation event. Youād want to look at velocity or animation state
With your current script youāre constantly saying āstart this one minute clip every time I take a stepā
Yea, its true, So the easiest thing is to find a one footstep audio, to be able to use the animation event correctly right?
I've been trying to use that audio too by looking at the speed and animation state, with a condition in Move function, but it didn't work for me either
Split the one minute clip up into individual steps and put them into your AudioClip array. Itās already an array with random selection, but you donāt have the right asset(s) for that functionality
Okey, I will try this, thanks
Is there another way to implement a proximity voice chat in my game rather than vivox ?
in FMOD I know if you want to loop a 3d sound you need a StudioEventEmitter Component but if I want to play like a button sound in 3d, cant I just add a spatializer and just Play One Shot and it works? Any downsides?
The only downside is PlayOneShot doesnāt cache a reference to the event instance, which means you canāt do anything to it other than play it.
The StudioEventEmitter just also holds a reference to the event instance, so that allows you to set parameters, stop, etc.
PlayOneShot also is technically less efficient, but not in a very substantial way. What it does under the hood is it plays an instance of the event and then immediately marks it for release once itās done
a lot of my sounds like levers are just like a one shot sound but i guess other more complex soundds with parameters ill need an emitter right?
Yeah you need a cached reference to the event instance that you want to act on. You can also do it manually by using the RuntimeManager to create and play the instance, and at the point cache it for acting on later. The StudioEventEmitter just packages that functionality for you to make things convenient
The way I like to work most of the time is to do it manually so I can have more custom control of everything, but the StudioEventEmitter component is just fine for quick setups.
Okay thanks!
Technically you can PlayOneShot for loops but itās not a good idea because you donāt have any (easy) way to stop it once itās started.
Am I doing something wrong, or can you not use the Audio Random Container with PlayOneShot? If so, is there any reason why?
How do I make the assessment if I want to use FMOD in my project or not?
I know nothing about FMOD beyond that many unity games use it.
I am not developing a "music game" and ive never used FMOD before, will it be overhead/overkill for a 'regular' projects needs, or is it indispensable?
I'm lacking the data to make a judgement call and dont know if I should implement it now or try to implement it later if somehow I discover my sound needs to be robust
Will it cost me financially as well? The package is free so I assume releasing a game using it isn't
I am not a sound engineer and the idea of having to do a lot of set up work in a totally separate piece of software is daunting
I think I have talked myself out of using it, the scope of what it does seems way above my project, even if my project did go commercial audio isnt really its main focus
but I feel like I cannot make that assessment because ive never done an audio heavy proj so I am torn up inside about making the right move and not fucking myself over in the long run by making the wrong choice now
Middleware makes a lot of thing easier with audio. It also makes it easier if you have other people contributing who canāt code or who canāt code very much
You can just use native audio but if you want any more complex behaviors for the audio you will need to build them yourself
Really the only way to make the assessment with certainty is to study its features compared to unity's audio and to try it
It's very project-dependent and dev-dependent as well
Though I haven't used it, as I understand the main appeal is to reduce coding that would be required for things like dynamic audio, audio zones, layering, and to speed up audio implementation in general
Iirc it has some type of DAW included too
But if you do code and don't use a lot of audio, I think you can do fine just by what Unity gives you
It's not free though, similar business model to Unity where you start paying as you gain revenue
FMOD licensing is very generous though
I think itās free below 200k revenue
Need to double check that number
Under 600k āFree or $2000ā Iām not sure what condition makes it 2k
IMO thereās way more pros than there are cons to using audio middleware, but I am biased as an audio person. But I am also a competent game programmer and still feel that way about it.
Chances are you use and need audio more than average, and it makes the choice easier to be familiar with the tools already
One big thing that is often overlooked is it makes debugging audio stuff way easier
And optimizing per platform
I'd assume the biggest hurdle is to have to learn and deal with a whole another system, rather than anything technical
Hmm okay thats a lot to consider.
Yeah the fact there is an external FMOD studio tool I have to learn is the biggest hurdle I see right now.
Currently I don't have many sound use cases beyond playing X sound at Y location for SFX and cross-fading music tracks
If the music tracks don't have to stay synced when crossfading, it should be a very simple thing
Syncing is the kind of challenge I'd look for middleware for
Yeah anything beyond just single music file on loop -> fade to next single music file on loop is way easier with middleware.
But if thatās all you need your game to do with the music and you only need simple āplay this clip at this locationā for sounds then introducing middleware might not be worth it
Even then, if you want to define a custom curve for how the fade should happen, its way more of a PITA to do it with native than with middleware (where it's a built-in ready to use feature). Lots of small things like that add up.
But yeah ultimately you should try to define, maybe on paper, what functionality you think your game might need from the audio. IMO anything beyond just bare bones you should go with middleware. The time spent learning how to use FMOD is likely a lot less than the time you'd need to spend on cooking your own solutions for things the software already provides.
Anyone have any ideas with a c000005 virtual memory access privelidges error
Last in call stack is unityplayer.dll!audiomixer::getsnapshotindex(class audiomixersnapshot const &)
Fmod is in project
what're some good ways, or the best way, to handle numerous of the same sound effect playing at the same time, or maybe very close together...causing amplified volume and a harsh sound?
You need to enforce some sort of instance limiting ā how you do that best is going to really depends on your needs
In any case you will need some condition, a way to track that condition, and a behavior for what should happen when that condition is met
E.g. three sounds of the same type cannot play simultaneously within a radius of 2 units of each other.
You could get really fancy and track how close certain sound-emitter types are together and if theyāre within a certain range they share a single audio source
Alternatively you could use an AudioSource pool and enforce just a global limit (via the object managing the pool) where only a certain number of them with a particular clip are allowed to be used at once. Then define the limit behavior ā I.e. should new ones steal old ones or should they be prevented until the old ones are done?
Again thereās a lot of possible ways to approach it and itāll vary on whatās best for your project
@pale timber You have experience with audio middlewares, do you know if they have features to support those three techniques or make them easier to implement?
FMOD and Wwise both make it very easy to limit concurrent sounds. They give you a lot of flexibility for how you want to do it too. For the other features (like pooling/clustering) you'd probably have to write the logic in Unity yourself.
Yeah like Toby said, Wwise and FMOD both come with easy to use instance limiting. They do things a little differently though. FMOD only has a global limit per event, while Wwise has a global or per-object voice limit per event. The per-object limiting can be extremely useful. FMOD has a cooldown setting per event, while Wwise does not. IMO the Wwise concurrency features, like most other part of the software, scale better with larger projects than FMOD. But FMODās GUI is nicer to use and the software allows for a lot more creativity in how you execute things.
Because of FMODās lack of per-object concurrency limit I may try to make that a feature in an add-on/framework Iāve been developing.
People here very likely understands audio better than me. Working on a voice chat system which is going quite well, and working on implementing "filters" to the audio, allowing you to modify it was wanted. Wanted my first filter to be a low pass filter, as I thought that'd be an "easy" task. Damn was I wrong.
I got a sound now that i like from it, and it's working mostly as intended, however, as the cutoff goes lower (effect gets more agressive) I start hearing a horrible crackling sound. I believe the audio visualization shows it as well as these sudden walls, but i'm not entirely sure what i'm doing that's causing this. Any input is much appreciated!
public override void Process(ref ArraySegment<float> samples, int frequency, float strength)
{
float cutoff = Mathf.Max(_def.cutoff, 300f);
int taps = Mathf.Clamp(frequency / Mathf.RoundToInt(cutoff), 1, 64);
var buffer = samples.Array;
int offset = samples.Offset;
int count = samples.Count;
for (int i = 0; i < count; i++)
{
float sample = buffer[offset + i];
_history.Enqueue(sample);
if (_history.Count > taps)
_history.Dequeue();
float sum = 0f;
foreach (var s in _history)
sum += s;
float smoothed = sum / _history.Count;
float mix = strength * 0.9f;
buffer[offset + i] = sample * (1f - mix) + smoothed * mix;
}
AudioDebugWaveform.SetSamples(samples);
}
Hello guys. Can someone tell me what is this technique called? I want to trim the songs that i like, to add my game. I tried to search triming the notes of a song but i couldn't find any answers.
Can you describe what "technique" you mean? In the video samples are played in sequence, nothing that looks like trimming a song
so basically, i want to take a song and i want to have every note as a different .mp3 file.
You will need to do that manually
That's not something Unity can do, and not something any external tool really can do well either
At least not if the sounds overlap at all
Audio bug. How can I fix it?
3D Render pipeline URP
6000.0.43f1
Spacial Blend - 3D
Volume Rolloff - Linear
I'm trying to speed up a timeline that includes an audio track. I want the audio to play faster, but without increasing the pitch.
Whatās the correct way to do that?
I tried routing the audio source through an audio mixer and applying a pitch shifter effect, but the output sounded really bad.
I have signal tracks that go with audio so I would like to see the waveform in timeline
Sounds like itās pitched up. Could be due to Doppler because I donāt see a pitch value higher than 1 in the Inspector in the video
Ah yeah you have Doppler set to 1 so just to rule that out try setting it to 0
Could be a sample rate mismatch
Augh..... this is deceptive.... it does NOT play on Awake() like the label says, it actually plays in OnEnable(). Why you do this to me Unity? I just wasted time assuming I couldn't replay a sound by turning an object on and off because of how they labelled this š
Could report it as a bug and see if they change the label after all these years
...Or explain why it's actually meant to be that way
the label is correct
Awake is not called on disabled GameObjects (it is called on disabled component, if its GO is active though)
Weird. How come it runs everytime an object enables too? That is not Awake behaviour
Heh, ah doubt it would be a priority
wdym "runs" ?
not sure if weird but Awake runs when GameObject is enabled, if it was disabled at instantiation, yes
I mean that if you toggle a GameObject's Active state from false to true, the AudioSource will play its sound, then if you toggle it to false and then true again, it plays a second time
from Unity's docs on Awake(): "Unity calls Awake only once during the lifetime of the script instance. A script's lifetime lasts until the Scene that contains it is unloaded"
So this would lead me to think that I would not be able to toggle a GameObject's Active state repeatedly in order to replay the source, yet I can
But their documentation for AudioSource.playOnAwake: "Enable this property to automatically play the audio source when the component or GameObject becomes active.". That's not how Awake() works though