How do I fade sound out (without plugin)

Get help using Construct 2

Post » Mon May 22, 2017 8:22 am

@Laurent

I've updated the capx; now the speakers switch themselves off if the sprite is more than 300px away:

https://www.dropbox.com/s/kwh2ci35iikao ... .capx?dl=0

I changed the audio tags so that they reference the UID of their speaker object instead of the tile - this prevents speakers playing the same sound from turning each other off.

I added a distance parameter and on/off boolean to the speaker objects to control their state - this updates only every 0.1 sec to stop the checks eating up resources.

If you run the capx in debug and click on the audio object you can follow the loops turning on and off as move towards/away from them.
B
16
S
7
G
3
Posts: 395
Reputation: 3,693

Post » Mon May 22, 2017 11:24 am

@mekonbekon
You are amazing and so reactive ! .
I discovered that Speaker objet part of the code is sufficient to make the soundscape engine to run. Tile map part of the code can be switched of. You achieved to create something wonderful with very few lines. I'm impressed
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Mon May 22, 2017 12:17 pm

@Laurent - you could still use the tilemap system for one-shot and non-fading loop effects, e.g. different environmental footstep sounds, rustling bushes as you pass through them etc - a combination of the two systems should create quite an immersive audioscape :)
B
16
S
7
G
3
Posts: 395
Reputation: 3,693

Post » Mon May 22, 2017 2:01 pm

@mekonbekon
Indeed !
Sound scape is something I wanted to try for a long time.
Thanks again for your kind help !
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Tue May 23, 2017 6:26 am

@mekonbekon
I was wondering about another way to design soundscape that could be an alteration of your first proposition. What about a hero sprite that is a listener surrounded by 4 speakers attached to it, moving close to it and emitting sound from the tiles they are on. That could help recreate panoramic sound. What do you think ?
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Tue May 23, 2017 9:12 am

@Laurent
Maybe that would work. My concern, if I'm understanding you correctly, is that it might be hard to get the fading in and out working nicely as you would have to be constantly switching the speaker positions in and out. You may also end up skipping over sounds from narrow bands of tiles e.g. a river, because the speaker ends up on the far side of the narrow band.
B
16
S
7
G
3
Posts: 395
Reputation: 3,693

Post » Tue May 23, 2017 10:38 am

@mekonbekon
You may be right about that. I'll give it a try adapting your code.
Thanks anyway, you've been of a great help.
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Mon Jun 05, 2017 5:49 pm

Hi @mekonbekon !
Using your last caps, I did found out that when I disable the Speaker object part of the code, the Tilemap part was not working. Do I miss something ?
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Mon Jun 05, 2017 10:30 pm

Hi @Laurent

Have you set the Tilemap group to active? Right-click on the group bar, select edit and tick the "active on start" box, and it should work fine. You can disable the Speaker object group by unticking its box.
B
16
S
7
G
3
Posts: 395
Reputation: 3,693

Post » Mon Jun 05, 2017 10:54 pm

Hi, I did. It works, with some hiccups between the two sounds systems because sound tags are sometimes the same between Tilemap and Speaker Objet routines.
Thanks !
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Previous

Return to How do I....?

Who is online

Users browsing this forum: Clark Thy Lord and 1 guest