ID:1326512
 
This is a two-part post, which will hopefully result in proving there's a need for some attention towards the real-time reverb of the sound system.

First, I'll explain the current situation, and then ask for a bit of your help.

For the entirety of this post, I am speaking about sounds, and not "mod" or "midi" which are different than sounds.

To sum up the sound system in byond, you have a /sound datum that takes a sound file, and some settings via variables, and is sent to a client to be played via the << operator. All settings of the sound are supported on all clients except for one little setting, and that's the echo variable. The echo variable is used to give the sound its own unique real-time "space" and ambience, just like a reverb effect. The problem is echo isn't compatible with all sound cards. Alternatively, we are given sound.environment which works on all of my machines, and I'm willing to bet all of your machines too, but unfortunately sound.environment is global. That means you can't play an .ogg song unaffected by reverb while sound effects which are affected by .environment are playing. In other words, if your footsteps echo in a stone room, your song also echo's in the stone room. Same thing goes for GUI noises and menu sound effects which is actually pretty strange feeling. .echo was provided to allow you to make the footsteps echo and the music play unaffected, but its all for not as .echo hardly works on most machines.

This brings me to the next part of the post, where you come in. I need someone, for whom this .echo variable actually works to mess about with some settings to get a very OBVIOUS echo setting to work on your machine and post it here. My plan is to then take this echo setting and pop it into a project that anyone can run. I will then ask if people can hear the difference between the dry and wet sound and record the results in a poll. I'm hoping there's enough people that won't hear the echo results (just like me) so that we can convince the developers its worth their time to do something about this.

Here's the project for setting up an echo structure and getting it to play back in game (includes a sound)

http://files.byondhome.com/FIREking/sound_test_src.zip

Your goal for now is to get the echo structure to return a very obvious sounding echo and reply back here with the values / code. Then I'll package that up and put it in a new post where we can have people download the project and click on the verb. If they don't hear an echo, they give a no vote. If there's enough no votes, we have a data pool that shows we need a fix.

TL;DR


Thanks!

P.s. this post has an end-tag bug</<>
Something probably not related.

Setting dry.environment to 1 - 25 seems to crash the client upon closing it.
I fixed a bug in the code.

Also, you should update to the most recent BYOND version: http://www.byond.com/download/. That's an old bug that Lummox JR has fixed already.
The echo variable not working is a limitation of the sound card (and FMOD in the end). I'm not sure if there's anything the developers could do about that, gotta remember, these things are controlled by FMOD, not BYOND.

If I recall correctly, when I was fiddling with FMOD myself the environmental stuff was forced on all sounds played within that instance of FMOD, so I'm doubting this is a limitation imposed by BYOND.
I personally do not care if .echo is changed, improved, tweaked, or removed or whatever. Although my desired outcome in this situation is out of the scope of this post (this post is here to find echo settings that are obvious because I can't hear them), I will share with you my desired outcome...

I would like one of the following:
1. another built-in instance of fmod for playing music
2. the ability to create instances of fmod period
3. a fixed channel in which music can play unaffected by environments

Other games that use FMOD can do what I wish to accomplish, so I am tired of hearing the blame put on FMOD.
I never said it wasn't possible to alter how it works to allow these changes, but you have to remember that the implementation of /sound was done in a way to be as friendly to the end-user as possible, this meant holding their hand pretty heavily.

I'm not sure what the license BYOND has with FMOD allows and disallows but I do recall it being a specialized version of their usual license, so some of this stuff might fall outside of what the license allows (multiple instances of the FMOD library running etc). We were lucky we got it at all, it wasn't free.
Hmm, well the hand holding is pretty appreciated, considering a lot of the sound code design and implementation is still left to the developer and I'm not too keen to know what more would be involved beyond what we already have to do...

That said, I'm still not willing to accept that this current implementation is good enough for high quality games that want to have a high quality sound track, and use the actual features of real-time in-game ambience effects. It's simply not the same when the ambience is baked into the sounds, and you'd need multiple versions of the baked in sounds for each environment. Also, a really busy song sounds really bad running through a reverb.

Its a bit disappointing to read articles like this http://www.byond.com/forum/?post=46984 (I know its old) only to realize its not entirely true.

In that article, he says:
Lummox JR wrote:
Now one consideration here is that you might not want all sounds to be considered 3D. Music, for example, shouldn't sound as if it's in the room; it should be in the background. You might also want to use sounds for your game interface, like a little blip when you choose an item in your inventory. For those sounds, all you need to do is set environment back to -1, and don't give them any 3D coordinates. In that case BYOND will assume the sound is not meant to seem three-dimensional. You can take a shortcut by creating a special datum for these cases.
music
parent_type = /sound
environment = -1
repeat = 1
volume = 50 // 50% volume

New(file)
src.file = file

Well that was easy. Presets are pretty simple to use: Just set environment to a number and that's it. Suppose, though, you want an environment slightly different than any of the ones provided. Then it's time to use a list. The environment var can take a list which is 23 items long. Each item can be null if you want to stay with the default value, or a number that sets that parameter. (In versions up through 3.5 beta 5 however, null doesn't work, so use the actual default setting unless the server is definitely a later version.) These are all documented in the Dream Maker help file and the DM reference, so there's no need to go into them in detail. Instead, let's play with the values.

Which really leads you to believe its possible, yet it isn't.

I suppose I can see where the developers are coming from with a limited implementation. I've also looked into the pricing of FMOD and it is quite steep for just a single game. I'm just hoping there's a simply way to play .ogg music and still use .environment for .ogg sound effects.
I don't really have experience when it comes to altering sound programmatically, but from what I can tell, the echo var seems incapable of producing an echo effect on its own, at least not without setting the environment var. BYOND's sound implementation is a whole lot more complex than I thought it was. I didn't really look that far into it, since sound hasn't really been a priority for me.

After reading about it and testing, the environment var seems to set properties that affect all sounds, and the echo var seems to set properties of a particular sound that will determine exactly how the environment affects it.

Anyway, I find all of these properties to be very confusing and vague. I can't even seem to really figure out what terminology is being used. It's like you have to have some kind of specialized sound engineering knowledge to even understand this. Either way, all I can really do is experiment through trial and error.

In my testing, I got the most noticeable results with .echo by changing the very first element (Direct). I think I would translate that in normal human terms as something like "fade". Since the "Direct" element seems to act like the first faded iteration of an actual echo, I decided to try and make a proc using it to simulate an actual full echo. This could be done with a simple for() loop and sleep().

This is just to demonstrate the idea, so it's not perfect:
proc/fade(amount)
var/list/echo[18]
echo[1] = 0 - amount
return echo

mob/proc/echo(file, delay, decay)
var
sound/S = sound(file)
maxfade = 10000
currentdecay
if(decay > maxfade) return
for(null, currentdecay <= maxfade, currentdecay += decay)
S.echo = fade(currentdecay)
src << S
sleep(delay)

mob/verb/Test_Echo()
echo('clap.ogg', 3, 500)

You should be able to adjust the delay and decay arguments to get a wide variety of echos. The delay would be in 1/10th seconds and the decay is a range from 0 to 10,000. Setting this to 0 would create an infinite loop, and the higher the number, the shorter the echo will become.

There is some kind of strange bug that comes up the first time the proc is executed, but every execution after that works as expected. What happens is the first few sleep() calls seem to be ignored for some reason, and it jumps through the first couple iterations faster than normal. I really don't know why it would start working correctly after the first execution though. Am I doing something wrong, or could this be an actual BYOND bug? The first call shouldn't be any different from the second, third, etc..
In response to Multiverse7
I see what you did there. Your code answered the question more specifically and accurately than what I was asking for, which is understandable; but unfortunately its not what I was really talking about! The .echo variable is more so meant to emulate "reverb" and not "delay", which is what you have shown here with your code.

That leaves us here: we still need someone to create a .echo struct that actually sounds like reverb (I can't because .echo doesn't work at all on my machine) so that I can post the project for everyone to try. If I understood LummoxJR correctly when we talked in private and I expressed my delima, his solution was to "use the .echo feature when you want a specific sound to have reverb without affecting other sounds playing without reverb" in place of the .environment feature.
BUMP