I'll hug thehen if I ever see him.

Post your completed addons to share with the community

Post » Tue Jan 29, 2013 3:43 pm

I want an audio emitter behavior, you assign it to a sprite and in the behavior properties you assign it an audio file from the list of imported sounds, from there you select a range which attenuates volume based on its distance from an assigned game object (listener).

Also in the properties should be a checkbox to stop playing the audio file when object is out of range.

---

If the game object with the audio emitter is copied then the game should play multiple instances of that same audio file, each instance with its own distance attenuation.

Also there should be a parameter to adjust pitch. And maybe even pitch attenuation based on speed of motion.

Anyone up for this? I can only afford 50 :(CrudeMik2013-01-30 08:16:56
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Tue Jan 29, 2013 3:55 pm

@CrudeMik I don't understand why you can't just set volume based on an objects distance, from another. For pitch shifting based on motion you can just change the pitch based on velocity.

Any reason why you want this explicitly as a plugin?
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Tue Jan 29, 2013 4:11 pm

I am dong it in code at the moment and it's a lot of code for each sound object and I can't copy the emitters to create multiple instances of the same sound.

This is how I currently do it:


Problem is that for each doesn't work, it messes up when I copy the emitter object.

So mostly it's for convenience the game I'm working on has a lot of audio.CrudeMik2013-01-29 16:13:11
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Tue Jan 29, 2013 8:11 pm

The trick is to use families for this sort of thing. If you can set up a simple .capx with what you're doing, I'll put together a workable solution.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Tue Jan 29, 2013 8:28 pm

Thanks for having a look, I've got a testcap from my project here https://dl.dropbox.com/u/3317708/testarea.capx

I've removed all the levels this is just a layout I use to play with things, the audio emitters are on the debug layer, press tab to turn on the debug ui while running the game.

Arrows move.

I took out all the for each commands.


It would be super useful to get a solution for this but I also still thing the plugin would be a massive time saver for me considering just how much audio I want to implement.

B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Wed Jan 30, 2013 1:39 am

Right @CrudeMik, there's a lot of stuff you're approaching from a wrong angle that will quickly make this project unmaintainable.

Here's an example .capx that shows one way you could be handling audio:

https://www.dropbox.com/s/lqfx4qwifiku39c/audioemitters.capx

You may want to add more control over the emitters, such as sharper falloff, greater cut off distance etc. These should always be defined as instance variables! This way you reuse the same code for every emitter.

You don't need so many footstep sfx either. Look at the 'set playback rate' audio action to add subtle pitch variation using Random().
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Wed Jan 30, 2013 8:15 am

That's a brilliant way of doing it, so much simpler than all my code! haha thanks for having a look at it.

I modified the code to say emitter.soundFile = "sound" set volume to volume -10db as a way of mixing. This doesn't work with ranges though. So I'm not sure of the best way to set individual volumes and ranges.

One last thing I can't seem to do is use the same sound file in different emitters, it confuses the system and doesn't work. - This is quite important to me as I would like to re-use many smaller spot SFX multiple times across a level. As part of this I also don't know how to stop playing the audio file when out of range to free up resources. In my messy code I used system compare distance to start / stop the files.

I think it's still good to have more variety in repeated sounds even with random variation, but yeah I will be adding that too!

Thanks again for having a look man.CrudeMik2013-01-30 09:20:17
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Wed Jan 30, 2013 1:01 pm

@CrudeMik I better get that hug!

So yeah, you're right. Using the same sound multiple times won't work with that method. The best way to approach this is to still have it as the same sound that plays, but to base the volume on the nearest emitter to the player.

Here's an example: https://www.dropbox.com/s/lqfx4qwifiku39c/audioemitters.capx

I'm not sure I understand your mixing question though.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Wed Jan 30, 2013 3:01 pm

I've worked out a mixing solution, I have one line of code for each sound which lets me mix the levels it's fine.

This is nearly perfect the only other thing I'd like to do (within the current limitations of the engine) - is to adjust the ranges for each sound independently. Is this possible within this fantastic solution?

If you're ever in Cambridge I'll buy you a pint!
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Wed Jan 30, 2013 4:44 pm

@CrudeMik Haha, my hometown is Norwich so not far ;)

I'm not sure what you mean by adjusting the ranges independently? You can change the pitch with playback rate, but anything more advanced than that is limited by the web audio API I'm afraid.

Awesome music showreel btw, amazing stuff.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest