Sound effect OXPs

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

Fritz
---- E L I T E ----
---- E L I T E ----
Posts: 591
Joined: Sun Jul 12, 2015 2:30 pm
Location: Bavaria, Germany
Contact:

Re: Sound effects

Post by Fritz »

I've never worked with timers, but the BGS OXP seems to call it every 0.6 seconds, that's 100 times per minute. It could check if the speed has changed since the last call and change the volume (it probably does this already somehow for playing the accelerating or decelerating sounds).

Norby, please don't tell me that you did this including the wiki page in the last few minutes! :shock: I'll download it immediately!
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16060
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Sound effects

Post by Cody »

Fritz wrote:
Norby, please don't tell me that you did this including the wiki page in the last few minutes!
<chortles> He's good at that, is Norby!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Sound effects

Post by Norby »

Fritz wrote:
please don't tell me that you did this including the wiki page in the last few minutes! :shock:
No, it was about an hour. :) It needed 25 sound files and a script with about 30 lines. A dual-timer which make 8 changes/second seems enough to emulate a continuous sound.
Fritz
---- E L I T E ----
---- E L I T E ----
Posts: 591
Joined: Sun Jul 12, 2015 2:30 pm
Location: Bavaria, Germany
Contact:

Re: Sound effects

Post by Fritz »

I know people who would need around 50 edits to create a wiki page like this... :lol:

What you did is a very good start! Strangely the effect is even better when I play the different files with Winamp, because in Oolite there is a slight "switching" sound with each change, but perhaps this can be eliminated somehow by changing the timing of starting and stopping a sound. And I'm still trying to figure out why you use two timers.

There seems to be an issue with torus speed (the sound changes in a strange way and then stops completely) but that should be easy to find. One approach would be to not use the speed value directly but a percentage of max speed, so that there is no sudden change from, let's say, sound 17 to sound 25. And slower ships could use the whole set of files in this case.

Btw, what software did you use for changing the speed of the sound files?
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Sound effects

Post by Norby »

Fritz wrote:
there is a slight "switching" sound with each change
I am afraid I can not fix this. I tried more ways but none helped.
Fritz wrote:
why you use two timers.
Because the minimal allowed interval of a Timer is 0.25s which is not enough seamless.
Fritz wrote:
to not use the speed value directly but a percentage of max speed
I use the speed value willfully, in this way the sound at max. speed in an Anaconda will be much lower than in a Cobra. A check of torusEngaged solved the problem in Engine Sound v1.1, thanks for spotting.
Fritz wrote:
what software did you use for changing the speed of the sound files?
Audacity. I created this table to determine the steps of conversion:

Code: Select all

tone	%     	file ship.speed
-24	-75    	1 	1
-23	-73,513	2 	20
-22	-71,938	3 	40
-21	-70,27 	4 	60
-20	-68,502	5 	80
-19	-66,629	6 	100
-18	-64,645	7 	120
-17	-62,542	8 	140
-16	-60,315	9 	160
-15	-57,955	10	180
-14	-55,455	11	200
-13	-52,806	12	220
-12	-50    	13	240
-11	-47,027	14	260
-10	-43,877	15	280
-9 	-40,54 	16	300
-8 	-37,004	17	320
-7 	-33,258	18	340
-6 	-29,289	19	360
-5 	-25,085	20	380
-4 	-20,63 	21	400
-3 	-15,91 	22	420
-2 	-10,91 	23	440
-1 	-5,613 	24	460
 0  	0     	25	480 <-- this is the original file from BGS.
Last edited by Norby on Sat Dec 05, 2015 12:53 am, edited 1 time in total.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16060
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Sound effects

Post by Cody »

Audacity is good stuff.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
Fritz
---- E L I T E ----
---- E L I T E ----
Posts: 591
Joined: Sun Jul 12, 2015 2:30 pm
Location: Bavaria, Germany
Contact:

Re: Sound effects

Post by Fritz »

Meanwhile I've learned from the wiki that the timer limit is 0.25. I wonder, why. I tried it with this value but as you said, it isn't seamless enough. And I too tried several ways to prevent the switching sound (e.g. reducing volume to 0 before changing anything). But it isn't really bad, just imagine the thrust lever making some scraping sound... :roll:

I'm playing around with a version that uses sound #1 as a standby sound (with reduced volume) and the sounds #2 to #25 for normal speeds. For torus driving and injector use I keep the sound at #25, so there is no "step", but I've added the accelerating and decelerating sounds from the BGS OXP for engaging and disengaging torus drive. It's not sounding bad in my opinion, but I'll try to use torusEngaged because the sound effects are a little bit too late the way I did it (by just checking speed > 8*maxSpeed).
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
User avatar
Amah
---- E L I T E ----
---- E L I T E ----
Posts: 485
Joined: Tue Aug 28, 2012 8:05 pm
Location: aboard the Laenina Crowne - Yasen-N class space freighter
Contact:

Re: Sound effects

Post by Amah »

interesting discussion.

@norby nice oxp. I'll keep it :-)
Amah
Fritz
---- E L I T E ----
---- E L I T E ----
Posts: 591
Joined: Sun Jul 12, 2015 2:30 pm
Location: Bavaria, Germany
Contact:

Re: Sound effects

Post by Fritz »

I have no idea anymore how to solve the switching sound problem...

I have tried almost everything, including playing two or even three SoundSource objects alternately and/or delaying the stopping of the old sound by one timer cycle (1/8 s), so for a short time two sounds were playing together. So it seemed that the switching sound is caused simply by starting a sound and not by starting the new sound immediately after stopping the old one.

So I tried a completely different approach, probably not very good from a resource management perspective, but on my computer it didn't affect performance in any measurable way: I created an array of 25 SoundSource objects and initialised and play them all (with volume 0) during startup. Speed changes now only change the volume, so there is no starting and stopping of sounds anymore. But even now, the switching sound effect is (almost?) identical to the original one.

Btw, you can create interesting sound effects by playing two or more of the sounds together, like two engines or other equipment running at slightly different rpm!
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Sound effects

Post by Norby »

Yes, I tried these also, plus some other tricks like using FCB instead of timer for smoother volume changes and totally silent sound files but the scraping remains.
Maybe interesting that there is scraping in my machine when I use the mouse wheel to make fast up-down changes on the master volume tool in my taskbar while either Oolite make a constant engine noise or I play these sound files with a media player, but nothing similar if I play anything else.
Last edited by Norby on Sat Dec 05, 2015 2:16 pm, edited 1 time in total.
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: Sound effects

Post by ocz »

Kudos to norby.

@fritz: Define soundswitching problem further. I know it isn't simple but please try.

- Do you mean a light crackle (knistern) when changing speed? Like a slide clack, as If you plugged in a connector, when you start the soundfile? I found that fading-in and fading-out at the beginning and end of a soundfile, even if only the first and last few ms, help to get rid of that clack. It might reduce the crackle to. But I fear one has to edit the oggs and not fase them in and out via OXP script.

- Or do you mean gaps in between the sounds? Well, you already did let them overlap. That's what I would have suggested to do.
Fritz
---- E L I T E ----
---- E L I T E ----
Posts: 591
Joined: Sun Jul 12, 2015 2:30 pm
Location: Bavaria, Germany
Contact:

Re: Sound effects

Post by Fritz »

It is a slight crackling (Knacken in German) like changing volume on an old radio. No gaps.

The first thing I tried yesterday was actually to keep the volume unchanged and use only .play() and .stop(), because I remember that changing volume caused a crackling problem on the C-64 SID sound chip. But it doesn't help here. I also tried to use volume = 0.01 instead of volume = 0, but it doesn't help either.

The starting or ending milliseconds of the sound files can't be the problem because they were playing continuously on my 25-object-array version and each one has a different length. As far as I can hear it there is no or almost no noise when the sound files loop.

So I really have run out of ideas...


Edit: One more idea: Perhaps is using the keyboard for changing thrust causing the problem... perhaps I'll try to somehow change speed by code.
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: Sound effects

Post by ocz »

If that keyboard idea shouldn't work out, could you upload your OXP (without the keyboard modifications if not necessary)?
Fritz
---- E L I T E ----
---- E L I T E ----
Posts: 591
Joined: Sun Jul 12, 2015 2:30 pm
Location: Bavaria, Germany
Contact:

Re: Sound effects

Post by Fritz »

Which one? I've tried many things, and I haven't kept every version. I'm currently working on a version that uses only one SoundObject, like Norby's original version, but I should still have one of the array versions too.
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
ocz
Deadly
Deadly
Posts: 175
Joined: Tue Nov 10, 2015 1:59 pm

Re: Sound effects

Post by ocz »

The array version one sounds interesting and still has that problem, so that one. :D
Post Reply