Too many same sound spawns are allowed on selecting the ...
Moderator: Moderators
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Too many same sound spawns are allowed on selecting the ...
I already thought about some kind of priority parameter. Also, some of the others look quite usefull. This however cries for some kind of new sound-wrapping lua stuff.
Re: Too many same sound spawns are allowed on selecting the ...
+1 for lifting dow sound definitions to spring so the editor from dow works ;p
Re: Too many same sound spawns are allowed on selecting the ...
+1 to that, good idea, really, although making a simplistic text-editor shouldn't be too bad. I think the editor is freely available, although you couldn't distro it with Spring at all.
You can find a link here.
Any improvement is great, and yeah, I'd like to see a Lua-based solution.
Maybe not this fancy, but you get the idea. Lemme see if I can find one with echoes and stuff, they don't use it very often in DoW, because audio hardware was less-capable of handling it than it is now (EAX, etc., were fairly new then). You get the idea, though. Meh, I thought for a minute we were going to let this devolve into another stupid conversation about me not bothering to Wiki every time people want to throw acronyms around, I'm glad I took the time to look up what Relic did, it pretty much proves that I'm on-track here
[EDIT]Haven't found a sound using echo yet, and I've GTG, RL stuff. However, I found lots using pitch-shifts at random, though, to vary the sound. That would be awesome, all by itself.[/EDIT]
You can find a link here.
Any improvement is great, and yeah, I'd like to see a Lua-based solution.
Maybe not this fancy, but you get the idea. Lemme see if I can find one with echoes and stuff, they don't use it very often in DoW, because audio hardware was less-capable of handling it than it is now (EAX, etc., were fairly new then). You get the idea, though. Meh, I thought for a minute we were going to let this devolve into another stupid conversation about me not bothering to Wiki every time people want to throw acronyms around, I'm glad I took the time to look up what Relic did, it pretty much proves that I'm on-track here

[EDIT]Haven't found a sound using echo yet, and I've GTG, RL stuff. However, I found lots using pitch-shifts at random, though, to vary the sound. That would be awesome, all by itself.[/EDIT]
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Too many same sound spawns are allowed on selecting the ...
Yes, its freely available, but you need a copy of DOW to install/run it. And I don't have one.
Re: Too many same sound spawns are allowed on selecting the ...
Really? Meh, lemme see if the separate EXE works without a DoW install. I guess it wants a "project", but that's just a text-file and a directory, IIRC.
At any rate, I won't be able to look at that until I'm home again tomorrow evening. Meanwhile... worst comes to worst, it's a piece of text we have to edit manually... like we don't already have lots of tools to do that with
At any rate, I won't be able to look at that until I'm home again tomorrow evening. Meanwhile... worst comes to worst, it's a piece of text we have to edit manually... like we don't already have lots of tools to do that with

-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Too many same sound spawns are allowed on selecting the ...
Some rework
soundfiles can no longer be palyed, instead only SoundItems are played.
You can now specify SoundItems like this:
Priority has the following effect:
When there are not enought sources, then the sound with the lowest priority is stopped (if its 0 or below). This has the effect that sounds with positive priority are never stopped at all.
SoundItems are accessed like normal wav-files has been before. If you access a raw sound file now, a SoundItem with the defaults is created for you.
Additionally, multiple SoundItems can use on single file with different settings, this is very efficient, they only use 1 shared buffer.
Please note that here are also the previously introduced enginesounds. These are put into springcontent.sdz, and not having them in a mod will not fail. So without sounds.lua, you will have the exact behaviour as in 0.78.2.1 except the crash when those files are not present.
soundfiles can no longer be palyed, instead only SoundItems are played.
You can now specify SoundItems like this:
Code: Select all
--- Valid entries used by engine: IncomingChat, MultiSelect, MapPoint
--- other than that, you can give it any name and access it like before with filenames
local Sounds = {
SoundItems = {
IncomingChat = {
file = "sounds/beep4.wav",
},
MultiSelect = {
file = "sounds/button9.wav",
},
MapPoint = {
file = "sounds/beep6.wav",
},
MyAwesomeSouns = {
file = "sounds/booooom.wav",
gain = 2.0, --- for uber-loudness
pitch = 0.2, --- bass-test
priority = 15, --- very high
maxconcurrent = 1, ---only once
maxdist = 500, --- only when near
},
DefaultsForSounds = { -- this are default settings
file = "ThisEntryMustBePresent.wav",
gain = 1.0,
pitch = 1.0,
priority = 0,
maxconcurrent = 16, --- some reasonable limits
maxdist = FLT_MAX, --- no cutoff at all
},
},
}
return Sounds
When there are not enought sources, then the sound with the lowest priority is stopped (if its 0 or below). This has the effect that sounds with positive priority are never stopped at all.
SoundItems are accessed like normal wav-files has been before. If you access a raw sound file now, a SoundItem with the defaults is created for you.
Additionally, multiple SoundItems can use on single file with different settings, this is very efficient, they only use 1 shared buffer.
Please note that here are also the previously introduced enginesounds. These are put into springcontent.sdz, and not having them in a mod will not fail. So without sounds.lua, you will have the exact behaviour as in 0.78.2.1 except the crash when those files are not present.
Re: Too many same sound spawns are allowed on selecting the ...
First off, that's capital work!
I had no idea you'd get here this fast. Now I'm going to have to see if I can get a working EXE and start playing around!
May I ask a few questions before I do, though?
1. How does this affect the current COB call to play a sound? I.E., is that COB callout via GET going to be changed, or will it behave like it always has, but now it's referencing a SoundItem? Sorry in advance... I'm using that throughout P.U.R.E., I'd like to know if major problems are going to happen ASAP, obviously.
2. Name collisions. Does it matter, if the table entry is the same as the name of the file (other than .wav)?
3. From your answer, I'm guessing that old-skool backwards compatibility will be maintained, by building the table automatically, so that older games do not crash or lack functional sound.
How can we print that file out? That would provide an easy path to utilizing the advanced features for all of us lazy game designers... because I wouldn't have to type out the initial entries by hand. I have... meh, I have 235 sound files in P.U.R.E., a few more in World Builder... and I expect that to grow before RC4 is (finally) released. We're talking hours and hours of labor here, if I have to type it all out by hand.
Anything to help automate it would be... nice. If it's already building this table... just tell me how I'd print it back out with Echo.
Also... if we build a file... it will override the auto-build, correct? Or will that get appended? If so, what happens, when, say, a Weapon calls for a sound?
Do I need to make sure it's using the new entry, and if I get my initial list built by printing out the table that's auto-generated... if it's appending stuff, just to be safe, it'll be using some new name (i.e., "HugeBoom01" already exists in the game's tables, therefore name HugeBoom.wav with a new entry, "HugeBoom02")?
Sorry, I'm sure that the above won't be entirely clear, but basically I would like, ideally, to print out the sounds currently in the game... add any new ones manually... and I don't want the custom values to get overridden by Spring, if it auto-builds based on the contents (and sub-contents) of /Sounds.
Also, /Sounds has been supporting multiple directory levels for some time now, just FYI, I'm already using that for Unit replies, etc., so make sure the parser takes that into account, when building the file. You've probably already done all that, but I thought I'd just ask and make sure...
4. Can we have a Lua callout to PlaySoundItem(string name, {params})? Pretty please? Then you wouldn't have to hard-code doing stuff like random pitch-shifts... you're probably way ahead of me there, but I thought I'd go ahead and make that a formal request anyhow.
5. Can we pre-load sounds via a param? Certain things cause a fairly noticeable drive-hit, it'd be really nice to store them in RAM. Not everything, mind you, that would be crazy, just certain things that we want to have immediately available.
6. Looping? Pleeeeeeeease? Doing it in COB is fail, sounds cannot often be made to fit very precise framelengths, and doing it in Lua would get veeeeeery expensive and very time-consuming to maintain, because Lua can't read the length (in absolute time) of a soundfile. So we'd have to get that information manually from sound editors, hand-enter it, etc., which seems like a massive bother, when the engine can read that and store it for us. Just askin', man- you've already done more than I was hoping for anyhow, this is a major step up.
I had no idea you'd get here this fast. Now I'm going to have to see if I can get a working EXE and start playing around!
May I ask a few questions before I do, though?
1. How does this affect the current COB call to play a sound? I.E., is that COB callout via GET going to be changed, or will it behave like it always has, but now it's referencing a SoundItem? Sorry in advance... I'm using that throughout P.U.R.E., I'd like to know if major problems are going to happen ASAP, obviously.
2. Name collisions. Does it matter, if the table entry is the same as the name of the file (other than .wav)?
3. From your answer, I'm guessing that old-skool backwards compatibility will be maintained, by building the table automatically, so that older games do not crash or lack functional sound.
How can we print that file out? That would provide an easy path to utilizing the advanced features for all of us lazy game designers... because I wouldn't have to type out the initial entries by hand. I have... meh, I have 235 sound files in P.U.R.E., a few more in World Builder... and I expect that to grow before RC4 is (finally) released. We're talking hours and hours of labor here, if I have to type it all out by hand.
Anything to help automate it would be... nice. If it's already building this table... just tell me how I'd print it back out with Echo.
Also... if we build a file... it will override the auto-build, correct? Or will that get appended? If so, what happens, when, say, a Weapon calls for a sound?
Do I need to make sure it's using the new entry, and if I get my initial list built by printing out the table that's auto-generated... if it's appending stuff, just to be safe, it'll be using some new name (i.e., "HugeBoom01" already exists in the game's tables, therefore name HugeBoom.wav with a new entry, "HugeBoom02")?
Sorry, I'm sure that the above won't be entirely clear, but basically I would like, ideally, to print out the sounds currently in the game... add any new ones manually... and I don't want the custom values to get overridden by Spring, if it auto-builds based on the contents (and sub-contents) of /Sounds.
Also, /Sounds has been supporting multiple directory levels for some time now, just FYI, I'm already using that for Unit replies, etc., so make sure the parser takes that into account, when building the file. You've probably already done all that, but I thought I'd just ask and make sure...
4. Can we have a Lua callout to PlaySoundItem(string name, {params})? Pretty please? Then you wouldn't have to hard-code doing stuff like random pitch-shifts... you're probably way ahead of me there, but I thought I'd go ahead and make that a formal request anyhow.
5. Can we pre-load sounds via a param? Certain things cause a fairly noticeable drive-hit, it'd be really nice to store them in RAM. Not everything, mind you, that would be crazy, just certain things that we want to have immediately available.
6. Looping? Pleeeeeeeease? Doing it in COB is fail, sounds cannot often be made to fit very precise framelengths, and doing it in Lua would get veeeeeery expensive and very time-consuming to maintain, because Lua can't read the length (in absolute time) of a soundfile. So we'd have to get that information manually from sound editors, hand-enter it, etc., which seems like a massive bother, when the engine can read that and store it for us. Just askin', man- you've already done more than I was hoping for anyhow, this is a major step up.
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Too many same sound spawns are allowed on selecting the ...
When you make a COB sound call, it will:Argh wrote:1. How does this affect the current COB call to play a sound? I.E., is that COB callout via GET going to be changed, or will it behave like it always has, but now it's referencing a SoundItem? Sorry in advance... I'm using that throughout P.U.R.E., I'd like to know if major problems are going to happen ASAP, obviously.
1) check if you have specified a SoundItem with the exact name $x, if yes, play it
2) if no, behave like before (so play a wav, maybe with "sounds/$x.wav" appended)
You can do that, and spring will play the Item instead of the wav.Argh wrote:2. Name collisions. Does it matter, if the table entry is the same as the name of the file (other than .wav)?
Yes, when not doing anything, you get the same behaviour as before (with the little change that all sounds have Maxconcurrency=16)Argh wrote:3. From your answer, I'm guessing that old-skool backwards compatibility will be maintained, by building the table automatically, so that older games do not crash or lack functional sound.
I will definitely do something like this, so wait until you edit all by hand. (TODO1)Argh wrote:How can we print that file out? That would provide an easy path to utilizing the advanced features for all of us lazy game designers... because I wouldn't have to type out the initial entries by hand. I have... meh, I have 235 sound files in P.U.R.E., a few more in World Builder... and I expect that to grow before RC4 is (finally) released. We're talking hours and hours of labor here, if I have to type it all out by hand.
Anything to help automate it would be... nice. If it's already building this table... just tell me how I'd print it back out with Echo.
For clarification: there will be no auto-build table. If you call for a sound you don't have specified a SoundItem for, it will load the regular wav-file like it has been before, and simply assign default values. It does not matter if you have SoundItems for other sounds.Argh wrote:Also... if we build a file... it will override the auto-build, correct? Or will that get appended? If so, what happens, when, say, a Weapon calls for a sound?
To keep it simple, the auto-generated (and only spring-internal) names for the SoundItems are the same as their filenames. ANd names need to be unique, if you make another entry with the same name, the old one will be overwritten. (TODO2: print warning / done)Argh wrote:Do I need to make sure it's using the new entry, and if I get my initial list built by printing out the table that's auto-generated... if it's appending stuff, just to be safe, it'll be using some new name (i.e., "HugeBoom01" already exists in the game's tables, therefore name HugeBoom.wav with a new entry, "HugeBoom02")?
The parser is not interested in directory names. It will generate a SoundItem once you call for a sound from lua, cob, tdf, so it takes the name from you. It doesn't even matter if its in "sounds/", you can specify any place you want.Argh wrote:Also, /Sounds has been supporting multiple directory levels for some time now, just FYI, I'm already using that for Unit replies, etc., so make sure the parser takes that into account, when building the file. You've probably already done all that, but I thought I'd just ask and make sure...
First, lua can already play sounditems. Creating new sound items on the fly in mid-game is not good, because it need to invoke whole lua-parser-stuff. But it will be usefull to create a new SoundItem from a lua-callin (TODO3: lua callin SoundItem generation).Argh wrote:4. Can we have a Lua callout to PlaySoundItem(string name, {params})? Pretty please? Then you wouldn't have to hard-code doing stuff like random pitch-shifts... you're probably way ahead of me there, but I thought I'd go ahead and make that a formal request anyhow.
Agreed (TODO4 / done).Argh wrote:5. Can we pre-load sounds via a param? Certain things cause a fairly noticeable drive-hit, it'd be really nice to store them in RAM. Not everything, mind you, that would be crazy, just certain things that we want to have immediately available.
edit: some sounds are already preloaded. if you type "/debuginfo sound" ingame, you will see the number of SoundItems, SoundSources, SoundBuffers (1 buffer per wav-file) and the size of all buffers currently loaded.
Agreed (TODO5 / done).Argh wrote:6. Looping? Pleeeeeeeease? Doing it in COB is fail, sounds cannot often be made to fit very precise framelengths, and doing it in Lua would get veeeeeery expensive and very time-consuming to maintain, because Lua can't read the length (in absolute time) of a soundfile. So we'd have to get that information manually from sound editors, hand-enter it, etc., which seems like a massive bother, when the engine can read that and store it for us. Just askin', man- you've already done more than I was hoping for anyhow, this is a major step up.
Random thought 1: much todo, may take some time
Random thought 2: should make some propper documentation somewhere
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Too many same sound spawns are allowed on selecting the ...
Code: Select all
--- Valid entries: IncomingChat, MultiSelect, MapPoint
local Sounds = {
SoundItems = {
IncomingChat = {
file = "sounds/beep4.wav",
preload, --- you got it
looptime = "1000", --- in miliseconds, can / will be stopped like regular items
},
MultiSelect = {
file = "sounds/button9.wav",
},
MapPoint = {
file = "sounds/beep6.wav",
},
},
}
return Sounds
Re: Too many same sound spawns are allowed on selecting the ...
I'm writing a mod howto/guide atm. If you just put all your notes in this thread I'll combine it all into something coherent. My plan is to then include the mod guide in the spring source Documentation/ folder and also linked via the wiki so it can be easily found.Auswaschbar wrote: Random thought 2: should make some propper documentation somewhere
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Too many same sound spawns are allowed on selecting the ...
Just added ogg/vorbis support for Sounds, behaves just like regular wav files.
This includes:
edit: it is not meant to be used for music.
This includes:
- loadable from anywhere inside VFS (map, mod, or content archive
- can be called from anywhere, COB, LUA, sounds.lua
- respects all parameters from SoundItem-definition
edit: it is not meant to be used for music.
Re: Too many same sound spawns are allowed on selecting the ...
i tried to run ca-r3812 without otacontent on linux using spring-git latest and got the old beep9.wav missing error (spring aborts). I thought this update or a previous one had fixed the whole missing sounds issue for good? Maybe i misunderstand what was done but can't this be resolved via a patch and updated springcontent? A don't believe a missing beep really qualifies as a fatal error.
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Too many same sound spawns are allowed on selecting the ...
works for meSpliFF wrote:i tried to run ca-r3812 without otacontent on linux using spring-git latest and got the old beep9.wav missing error (spring aborts). I thought this update or a previous one had fixed the whole missing sounds issue for good? Maybe i misunderstand what was done but can't this be resolved via a patch and updated springcontent? A don't believe a missing beep really qualifies as a fatal error.
Re: Too many same sound spawns are allowed on selecting the ...
Wonderful! I'll test it when I have a working EXE, this is going to be great!
Re: Too many same sound spawns are allowed on selecting the ...
ive had such problem, but not by selecting unit...slogic wrote:You know, as much i select the same unit as much a new select sound will be spawned in the game. My soundcard blows up with distortions. Again, is this a feature or not? I think sound should be blocked until the previous one is finished playing. I would like to point: this issue is concerning a single unit selection only.
i fixed it by setting the "global sound volume" in game settings to 50, which was on 100 by default.
-
- Posts: 46
- Joined: 02 Jun 2008, 21:34
Re: Too many same sound spawns are allowed on selecting the ...
Hey everyone. I'm quite pleased that Argh and others are working on this audio problem.
I'm an Ubuntu Jaunty user and strangely the Spring engine (at least on the CA mod anyway) has performance issues with sound sources above 1! Quite sad, since this hasn't happened before with the previous engines of spring. I've thought long and hard if it is PulseAudio getting in the way, so I'm just going to see if there's a way to disable or remove it. Does anyone concur with this idea?
I'm an Ubuntu Jaunty user and strangely the Spring engine (at least on the CA mod anyway) has performance issues with sound sources above 1! Quite sad, since this hasn't happened before with the previous engines of spring. I've thought long and hard if it is PulseAudio getting in the way, so I'm just going to see if there's a way to disable or remove it. Does anyone concur with this idea?
Re: Too many same sound spawns are allowed on selecting the ...
Argh is whatnow? He did write a nice description of the new audio features, at least.
Re: Too many same sound spawns are allowed on selecting the ...
I certainly didn't code it- that was all Auswaschbar's brilliant work, not mine.
I merely proposed some specifications and did some testing while it was being built, and then documented the resulting work when I put it to use.
I merely proposed some specifications and did some testing while it was being built, and then documented the resulting work when I put it to use.
Re: Too many same sound spawns are allowed on selecting the
Is this still topical? It would actually be good to have a callin for playing a SoundItem from lua, since Spring.PlaySoundFile sometimes just plays the wav-sound and skips the other parameters defined in sounds.lua.Auswaschbar wrote:First, lua can already play sounditems. Creating new sound items on the fly in mid-game is not good, because it need to invoke whole lua-parser-stuff. But it will be usefull to create a new SoundItem from a lua-callin (TODO3: lua callin SoundItem generation).Argh wrote:4. Can we have a Lua callout to PlaySoundItem(string name, {params})? Pretty please? Then you wouldn't have to hard-code doing stuff like random pitch-shifts... you're probably way ahead of me there, but I thought I'd go ahead and make that a formal request anyhow.
How does /debuginfo sound work? I don't get any output.Auswaschbar wrote:Agreed (TODO4 / done).Argh wrote:5. Can we pre-load sounds via a param? Certain things cause a fairly noticeable drive-hit, it'd be really nice to store them in RAM. Not everything, mind you, that would be crazy, just certain things that we want to have immediately available.
edit: some sounds are already preloaded. if you type "/debuginfo sound" ingame, you will see the number of SoundItems, SoundSources, SoundBuffers (1 buffer per wav-file) and the size of all buffers currently loaded.