PiBoSo Official Forum

GP Bikes => Mods => Bikes => Topic started by: Warlock on January 02, 2014, 05:17:23 AM

Title: Engine SCL (sound editing)
Post by: Warlock on January 02, 2014, 05:17:23 AM
Piboso, can you explain a bit these parameters in engine.scl?
-Value (in each point)
-RefPitch

Title: Re: Engine SCL (sound editing)
Post by: Warlock on January 03, 2014, 02:25:41 AM
Please Piboso can you throw some light on this
I'm going nuts trying to understand this file, doing changes and restarting the game each time to see what happens .
It's also possible to add or remove samples from the file?.... is mandatory to have 11 samples?

Im able to deal with programing, but thats not the problem, is the goal for each variable what i want to understand.

thank you
Title: Re: Engine SCL (sound editing)
Post by: Stout Johnson on January 03, 2014, 05:04:16 PM
Quote from: Warlock on January 02, 2014, 05:17:23 AM
Piboso, can you explain a bit these parameters in engine.scl?
-Value (in each point)
-RefPitch

I can tell you what I remember these things were:
*Value (in each point) refers to the rpm-point that each point represents (that rpm-point can be calculated via "Value x MaxValue" (multiplication that is) - with those value and volume combinations you can change where sound kicks in or fade them in and out....
*RefPitch is the rpm-point each sample represents (can be calculated via "RefPitch x MaxValue" say idle sound RefPitch=0.15 and MaxValue=15.000rpm then the sample will represent an idle engine sound at 2250rpm - just an example)

maybe Piboso can confirm/correct and add things that might be helpful to know...
Title: Re: Engine SCL (sound editing)
Post by: HornetMaX on January 03, 2014, 11:11:42 PM
My understanding of it (not 100% sure, as it's all reverse engineering):

For the Murasama (just a part of the file):
MaxValue = 17000.000000
AutoPitch = 1
Layer0
{
NumSamples = 5
sample0
{
wav = sb2_onidle.wav
NumPoints = 3
point0
{
Value = 0.000000
Volume = 1.000000
}
point1
{
Value = 0.177647
Volume = 1.000000
}
point2
{
Value = 0.224706
Volume = 0.000000
}
RefPitch = 0.176471
MinPitch = 0.000000
MaxPitch = 1.273335
}
sample1
{
wav = sb2_onverylow.wav
NumPoints = 4
point0
{
Value = 0.175294
Volume = 0.000000
}
point1
{
Value = 0.222353
Volume = 1.000000
}
point2
{
Value = 0.260000
Volume = 1.000000
}
point3
{
Value = 0.307059
Volume = 0.000000
}
RefPitch = 0.235294
MinPitch = 0.745000
MaxPitch = 1.304998
}
sample2
{
wav = sb2_onlow.wav
NumPoints = 4
point0
{
Value = 0.262353
Volume = 0.000000
}
point1
{
Value = 0.303529
Volume = 1.000000
}
point2
{
Value = 0.396470
Volume = 1.000000
}
point3
{
Value = 0.455294
Volume = 0.000000
}
RefPitch = 0.323530
MinPitch = 0.810907
MaxPitch = 1.407271
}
sample3
{
wav = sb2_onmid.wav
NumPoints = 4
point0
{
Value = 0.395294
Volume = 0.000000
}
point1
{
Value = 0.450589
Volume = 1.000000
}
point2
{
Value = 0.536471
Volume = 1.000000
}
point3
{
Value = 0.602353
Volume = 0.000000
}
RefPitch = 0.500000
MinPitch = 0.790588
MaxPitch = 1.204706
}
sample4
{
wav = sb2_onhigh.wav
NumPoints = 3
point0
{
Value = 0.536471
Volume = 0.000000
}
point1
{
Value = 0.598824
Volume = 1.000000
}
point2
{
Value = 1.000000
Volume = 1.000000
}
RefPitch = 0.676471
MinPitch = 0.793043
MaxPitch = 1.478260
}
}



The basics: within a layer (e.g. layer0 for throttle ON), you want to "play" one specific sample (e.g. sample0) only over a given range of RPM.
Of course GPB will "modulate" (alter the pitch, in fact) of that sample depending on the RPMs in the range. This is done this way:Now, when RPM gets above 3,820 you  want to switch to the next sample. But doing it naively would be terrible. Here's how it's done:
You can check the rest of Layer0 and, of course, do the same for Layer1.

The final thing is that Layer0 (throttle ON) and Layer1 (throttle OFF) are blended in an undocumented manner by GPB, but maybe we shouldn't care.

You can easily build a small spreadsheet to help understanding and tuning.

MaX.
Title: Re: Engine SCL (sound editing)
Post by: Warlock on January 03, 2014, 11:57:39 PM
Hey Max, thank you man !!   for such a good explanation, really apreciated

I already did thought about how it worked, fading points , volume , on off throttle, etc.
Maxvalue was what i was missing to calculate everythig.

So based on this i can remove samples if i want, if the range of rpms is full covered by the existing samples (even with only one sample, it will sound like crap for sure , but should be possible)
Thanks !!
Title: Re: Engine SCL (sound editing)
Post by: Warlock on January 28, 2014, 04:01:39 AM
I calculated all the RPM values of the engine.scl from the Murasama (only onthrottle without idles or pitches to make it easier) , just to try to understand it.
Used formula : Maxvalue(17000) X points value.
And i discovered weird values that dont match with what i thought it should be.
For example fading margins, i thought they should be all the same , so all the samples will connect smoothly without overlapping

         fade in  ---> fade in starts |
                                                  | fading margin
         in          --->fade in ends   |


         out      ---> fade out starts |
                                                    |  fading margin
         fade out --->fade out ends |


onverylow:
-----------
         fade in  ---> 2980 |
                            | 800
         in       ---> 3780 |


         out      ---> 4420 |
                            | 800
         fade out ---> 5220 |

onlow:
-------
         fade in  ---> 4460 |
                            | 700
         in       ---> 5160 |


         out      ---> 6740 |
                            | 1000
         fade out ---> 7740 |


onmid:
-------
         fade in  ---> 6720 |
                            | 940
         in       ---> 7660 |


         out      ---> 9120 |
                            | 1120
         fade out --->10240 |


onhigh: 
----------
        fade in --->  9120  |
                            | 1060
        in      --->  10180 |


        top     --->  17000



Other thing i ask myself is what method is used to divide the full RPM range into sections
Full rpm  range divisions (values took from point 1 of each section, where the fading in finish , where volume =1)
3020 (idle)
3780 (Verylow)     
5160 (low)
7660 (mid)
10180 (high)

onhigh is the longer one:  from 10180rpm  to 17000(maxvalue) , almost half of the full range for one sample


Sorry if something here doesn't makes sense, i'm just trying to understand
Title: Re: Engine SCL (sound editing)
Post by: HornetMaX on January 28, 2014, 12:16:17 PM
Quote from: Warlock on January 28, 2014, 04:01:39 AM
I calculated all the RPM values of the engine.scl from the Murasama (only onthrottle without idles or pitches to make it easier) , just to try to understand it.
Spreadsheet comes handy: https://docs.google.com/spreadsheet/ccc?key=0AjmU7Qoo77i1dGZUMDJFalRUeXVZZXhOX01TRkFaNVE&usp=sharing (https://docs.google.com/spreadsheet/ccc?key=0AjmU7Qoo77i1dGZUMDJFalRUeXVZZXhOX01TRkFaNVE&usp=sharing)

Quote from: Warlock on January 28, 2014, 04:01:39 AM
And i discovered weird values that dont match with what i thought it should be.
For example fading margins, i thought they should be all the same , so all the samples will connect smoothly without overlapping
They don not need to be all the same but typically the 2 fade-out points (fade-out start, fade-out finish) of sample N must be the same of the two fade-in points (start, finish) of sample N+1.
On the 990 the points are not exactly identical (they seem to be off by 20, 40 or 60 RPM depending on the sample).
I think I recall saying this to Piboso and he said it was a "bug".

Quote from: Warlock on January 28, 2014, 04:01:39 AM
Other thing i ask myself is what method is used to divide the full RPM range into sections
Full rpm  range divisions (values took from point 1 of each section, where the fading in finish , where volume =1)
3020 (idle)
3780 (Verylow)     
5160 (low)
7660 (mid)
10180 (high)

onhigh is the longer one:  from 10180rpm  to 17000(maxvalue) , almost half of the full range for one sample
I think here there's no specific method. I haven't tried yet but I guess that a sample taken at, let's say, 4000 RPM cannot be stretched (i.e. varied in pitch) too much, otherwise a single sample for the whole range (except idle and limiter) would do it. Hence single sample is good only over a certain range of RPMs (e.g. between 6000 and 10000), That should be what drives the partitioning (plus the fact that you need one sample for idle).

MaX.
Title: Re: Engine SCL (sound editing)
Post by: Warlock on January 28, 2014, 02:11:51 PM
Quote from: HornetMaX on January 28, 2014, 12:16:17 PM
Spreadsheet comes handy: https://docs.google.com/spreadsheet/ccc?key=0AjmU7Qoo77i1dGZUMDJFalRUeXVZZXhOX01TRkFaNVE&usp=sharing (https://docs.google.com/spreadsheet/ccc?key=0AjmU7Qoo77i1dGZUMDJFalRUeXVZZXhOX01TRkFaNVE&usp=sharing)

Thank you ;) , i'm an artist , not familiar with this kind of tools lol  ;D

Quote from: HornetMaX on January 28, 2014, 12:16:17 PM
They don not need to be all the same but typically the 2 fade-out points (fade-out start, fade-out finish) of sample N must be the same of the two fade-in points (start, finish) of sample N+1.

Yes exactly, that's what i wanted to say but didn't know how  :P

Quote from: HornetMaX on January 28, 2014, 12:16:17 PM
On the 990 the points are not exactly identical (they seem to be off by 20, 40 or 60 RPM depending on the sample).
I think I recall saying this to Piboso and he said it was a "bug".

I did try to use same sample for onmid and onhigh with 1000rpm range for fading between them. Refpitch were the same for both as both samples are identical, but still a jump in the sound ingame.....maybe i did a mistake calculating max and min pitches.... ???
Ill try again tonight.

Thx for help
Title: Re: Engine SCL (sound editing)
Post by: HornetMaX on January 28, 2014, 02:57:28 PM
Quote from: Warlock on January 28, 2014, 02:11:51 PM
I did try to use same sample for onmid and onhigh with 1000rpm range for fading between them. Refpitch were the same for both as both samples are identical, but still a jump in the sound ingame.....maybe i did a mistake calculating max and min pitches.... ???
Ill try again tonight.
Let's say you want to use the same sample twice. You have two samples (onmid and onhigh) and they are identical.
This means that their RefPitch is the same: it should correspond to the RPMs at which the sample has been captured.
Let's say the bike has maxRPM 17,000 and your sample was taken at 8,500RPM, then the RefPitch is 0.500.

Now let's imagine that you want:
You should have something like this (I've detailed the computations):
MaxValue = 17000.000000
AutoPitch = 1
Layer0
{
NumSamples = 2
sample0
{
wav = onmid.wav
NumPoints = 3
point0
{
Value = 0.000000
Volume = 1.000000
}
point1
{
Value = 5000 / 17000 = 0.294
Volume = 1.000000
}
point2
{
Value = 6000 / 17000 = 0.353
Volume = 0.000000
}
RefPitch = 8500/17000 = 0.500
MinPitch = 0.000000
MaxPitch = 6000 / 8500 = 0.706 (this is unusual as typically RefPitch is not outside the range, hence usually minpitch is <1  and maxpitch is >1)
}
sample1
{
wav = onhigh.wav
NumPoints = 3
point0
{
Value = 5000 / 17000 = 0.294
Volume = 0.000000
}
point1
{
Value = 6000 / 17000 = 0.353
Volume = 1.000000
}
point2
{
Value = 1.0000     <--- this goes all the way up top 17000
Volume = 1.000000
}
RefPitch = 8500/17000 = 0.500
MinPitch = 5000 / 8500 = 0.588
MaxPitch = 17000 / 8500 = 2.000
}

... ... ...


Now with the above, if you take one sample from the murasama and use it as your two samples, I don't expect to hear any overlapping between 5000 and 6000.
Actually, even if you use one of your samples and you use it twice as above you should not hear any overlapping.

The problem is when you use two different samples. The murasama ones do not generate any (audible) overlapping, all the others I've come across yes.
Could be due to many things: samples not cut at the right place and/or not loopable correctly, or samples with wrong refpitches ...

MaX.
Title: Re: Engine SCL (sound editing)
Post by: Warlock on January 29, 2014, 02:14:34 AM
Ok, i did try this.
Used the example you posted here (without calculations of course  :P) and one of the murasama samples.
Result : still a small but noticeably jump  ??? , same jump as my loop did last night.
I did use few samples from the murasama, same results.
So i'm starting to think that "bug" you said its just some manual adjusting?  :-X

Can anyone else try this to really confirm i'm not doing something wrong?   (i don't think so, it's easy enough to copy your code, delete calculations and add 'sb2_' to the wave names)

Anyway thanks for your time explaining those calculations, helped me a lot understanding the file. Hope we can find a solution for this also the trick to 'hide' that 2 layers sound effect so we can start making good sounds.
Title: Re: Engine SCL (sound editing)
Post by: Warlock on January 29, 2014, 02:40:52 PM
I will try tonight increasing and reducing the fading range to see what happen
Title: Re: Engine SCL (sound editing)
Post by: Warlock on January 29, 2014, 02:48:50 PM
wav = onmid.wav
NumPoints = 3
point0
{
Value = 0.000000
Volume = 1.000000
}
point1
{
Value = 5000 / 17000 = 0.294
Volume = 1.000000
}
point2
{
Value = 6000 / 17000 = 0.353
Volume = 0.000000
}
RefPitch = 8500/17000 = 0.500
MinPitch = 0.000000
MaxPitch = 5000 / 8500 = 0.588 (this is unusual as typically RefPitch is not outside the range, hence usually minpitch is <1  and maxpitch is >1)



Maybe 'MaxPitch = 5000 / 8500 ='   should be  'MaxPitch = 6000 / 8500 ='  ?  as it still sounding untill it completely fades off ?
Title: Re: Engine SCL (sound editing)
Post by: HornetMaX on January 29, 2014, 02:51:37 PM
Quote from: Warlock on January 29, 2014, 02:48:50 PM
Maybe 'MaxPitch = 5000 / 8500 ='   should be  'MaxPitch = 6000 / 8500 ='  ?  as it still sounding untill it completely fades off ?
Yep, my bad. I've fixed it above.

MaX.
Title: Re: Engine SCL (sound editing)
Post by: Warlock on January 30, 2014, 04:05:56 AM
Great, it worked now, perfectly smooth, also with my sample  :). Now i have to discover what is the refpitch of my sample lol  ;D
Thank you.
Title: Re: Engine SCL (sound editing)
Post by: HornetMaX on January 30, 2014, 09:27:08 AM
Quote from: Warlock on January 30, 2014, 04:05:56 AM
Great, it worked now, perfectly smooth, also with my sample  :). Now i have to discover what is the refpitch of my sample lol  ;D
Thank you.
I can probably tell you that. Which are the samples you are working on ?

MaX.
Title: Re: Engine SCL (sound editing)
Post by: HornetMaX on February 04, 2014, 10:00:25 PM
Anybody knowing what "AutoPitch = 1" does in engine.scl ?

MaX.
Title: Re: Engine SCL (sound editing)
Post by: Stout Johnson on February 04, 2014, 10:14:47 PM
Quote from: HornetMaX on February 04, 2014, 10:00:25 PM
Anybody knowing what "AutoPitch = 1" does in engine.scl ?

MaX.

it never changed anything for me... whether it was =0 or =1 ... dunno
Title: Re: Engine SCL (sound editing)
Post by: Warlock on February 04, 2014, 11:55:58 PM
Quote from: HornetMaX on February 04, 2014, 10:00:25 PM
Anybody knowing what "AutoPitch = 1" does in engine.scl ?

MaX.

No sorry, didn't even try yet.
Was enough to understand the rest of the file   :o  :)
Title: Re: Engine SCL (sound editing)
Post by: Hawk on April 25, 2014, 05:06:29 PM
Very nice job indeed Max! ;D

I will find this very handy when I try to recreate the 1982 Yamaha YZR OW60 500cc bikes engine sounds. Will definitely take a lot of testing redoing and testing over and over to get the hang of it all before I settle on the final sound file... Not sure if I'll be able to achieve a good result as I haven't got the engine sound at constant revs for many seconds over the whole rev range, but I'll give it go when I finally get to that stage. :)

It's great that we have guys like you in the community that take the time and effort to figure these things out and let us know and explain your findings to us all. Your work is very much appreciate Max!

Great piece of work mate!;) ;D 8)
Title: Re: Engine SCL (sound editing)
Post by: Hawk on February 01, 2017, 12:31:53 PM
Quote from: HornetMaX on January 28, 2014, 12:16:17 PM
Quote from: Warlock on January 28, 2014, 04:01:39 AM
I calculated all the RPM values of the engine.scl from the Murasama (only onthrottle without idles or pitches to make it easier) , just to try to understand it.
Spreadsheet comes handy: https://docs.google.com/spreadsheet/ccc?key=0AjmU7Qoo77i1dGZUMDJFalRUeXVZZXhOX01TRkFaNVE&usp=sharing (https://docs.google.com/spreadsheet/ccc?key=0AjmU7Qoo77i1dGZUMDJFalRUeXVZZXhOX01TRkFaNVE&usp=sharing)

MaX.

Hi Max.

Any chance you can re-establish this handy spreadsheet that you created? I'm trying to create a really good 2 stroke engine sound and I really need this to make life easier. Thanks mate.  ;) 8)

Hawk.
Title: Re: Engine SCL (sound editing)
Post by: HornetMaX on February 01, 2017, 12:41:47 PM
Quote from: Hawk on February 01, 2017, 12:31:53 PM
Hi Max.

Any chance you can re-establish this handy spreadsheet that you created? I'm trying to create a really good 2 stroke engine sound and I really need this to make life easier. Thanks mate.  ;) 8)
Can't even remember what was in it.
If you tell me what it did, it's probably faster for me to recreate it than to figure out where it has gone (likely it has been binned).

What do you need exactly ?
Title: Re: Engine SCL (sound editing)
Post by: Hawk on February 01, 2017, 12:48:01 PM
It was a spread sheet to calculate for this:

The basics: within a layer (e.g. layer0 for throttle ON), you want to "play" one specific sample (e.g. sample0) only over a given range of RPM.
Of course GPB will "modulate" (alter the pitch, in fact) of that sample depending on the RPMs in the range. This is done this way:•RefPitch is 0.176471: if you multiply it by MaxValue (17000) you get 3,000 RPM. This is probably the RPMs at which the sample was captured/generated.
•MinPitch is 0.000000: you multiply that by RefPitch and by MaXValue and you get ...well, 0,000 RPM.
•MaxPitch is 1.273335: you multiply that by RefPitch and by MaXValue and you get ...well, 3,820 RPM.
•This means that this specific sample will be used for RPMS between 0 and 3,820. The pitch of the .wav will be varied according to the RPMs.


Hawk.
Title: Re: Engine SCL (sound editing)
Post by: HornetMaX on February 01, 2017, 12:55:24 PM
You can see RPMs in MaxCSL (Main/Sound file/Show RPM): look at the text file within MaxSCL, you have the RPMs of each sample in comment (and highlighted in red).
Title: Re: Engine SCL (sound editing)
Post by: Hawk on February 01, 2017, 12:59:22 PM
Quote from: HornetMaX on February 01, 2017, 12:55:24 PM
You can see RPMs in MaxCSL (Main/Sound file/Show RPM): look at the text file within MaxSCL, you have the RPMs of each sample in comment (and highlighted in red).

Oh... Okay Max, I didn't realise that... First time for me to finally get around to using your MaxSCL Tool.....

Thanks mate, I'll let you know how I get on with it.  ;) 8)

Hawk.
Title: Re: Engine SCL (sound editing)
Post by: HornetMaX on February 01, 2017, 03:39:31 PM
I just checked in v1.2: clicking on the "RPMs" icon will show you the RPMs (instead of the normalized values), so that should be good enough for you.

One thing I noticed: the sample engine.scl I provide with v1.2 (a GP15 sound from beta8) has the comments wrong (RPMs infos, in red after ";;").
If you right click on the text "editor" (where the content of the engine.scl is shown just like a normal text editor) you get a pop-up menu with Sound file (.scl)/Beautify (Ctrl+B): this will re-sync the comments and they will appear correctly, as in the interface

Example: the 1st point of the 1st layer has a "value" of 0.117647 which, shown as RPMs is 2000, but in the file (comment) appear as ";; 2588".
A Ctrl+B followed by a "Save" will fix that. Notice it has no functional impact, as the number is only in as a comment.
Title: Re: Engine SCL (sound editing)
Post by: Hawk on February 01, 2017, 05:05:11 PM
Thanks for that Max.  ;) 8)

Hawk.