Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: generate realistic audio using engine-sim #7

Open
RichardScharf opened this issue Aug 30, 2023 · 7 comments
Open

Enhancement: generate realistic audio using engine-sim #7

RichardScharf opened this issue Aug 30, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@RichardScharf
Copy link

Since there's no discussions page for enhancements I thought I'd create an Issue.

I'd like to suggest integrating the Engine Simulator from ange-yaghi to generate more realistic engine sounds for the game https://github.com/ange-yaghi/engine-sim.

It is written in C++ and currently under the MIT license.

@Calinou
Copy link

Calinou commented Aug 30, 2023

I don't think it's worth spending processing time on generating engine sounds in real-time (especially in split-screen scenarios). Instead, we can prerecord a few of them using the program you linked then blend these sounds together depending on RPM and gear (forward/neutral or reverse).

Most games use a setup like that:

  • Idle
  • Forward, low RPM
  • Forward, medium RPM
  • Forward, high RPM
  • Backward, low RPM
  • Backward, high RPM

@cryham
Copy link
Member

cryham commented Aug 30, 2023

Thanks for the link. Amazing application. I was even looking for such on github and didn't find it.
Yes. I mean to record sounds from it at e.g. 4 different rpm values and interpolate, this could work already in SR IIRC.
Pity it's not for Linux, and testing on Windows I got that no sound problem. Both seem to be know issues. Also crashed in Wine.
Either way it's not a quick task. Also the program doesn't have a record and save to wav function etc.

@RichardScharf
Copy link
Author

RichardScharf commented Aug 30, 2023

That's unfortunate, I wasn't aware that open source projects could have such OS dependency problems.

Glad you found my suggestion useful though.

I've discovered it on YouTube, he has a channel named AngeTheGreat where he showcased it.

BeamNG drive even sponsored him, I think he would be willing to help with these issues if requested.
(RigsOfRods is the open source alternative to BeamNG drive as far as I'm aware).

For recording and saving to .wav I'd suggest just using Audacity or something alike.
I doubt that quickly generating some new sfx with it should be too complicated.

@cryham
Copy link
Member

cryham commented Aug 30, 2023

Okay that newer version (without sources)
https://github.com/Engine-Simulator/engine-sim-community-edition
worked on Windows. Starts on Wine but probably too much CPU use makes it jitter.

Well it would be best to have some way to set throttle to like 4 rpm amounts eg. 1000 2000 3000 4000 etc
or anyhow setting it with mouse not with the freaking Q,W,E,R keys, because it's otherwise impossible to target constant rpm. So for that I'd probably have to build it from old sources on Windows. Meh.
It may be somewhat useful, at least at 3 random rpm values from sim at full throttle, little throttle and idle.

@RichardScharf
Copy link
Author

The community edition works flawlessly for me using Bottles as Flatpak with default settings:
(Wine default for Gaming: Win64, Soda-7.0-9 container)

The CPU Usage maxes out for me at 80% for a single core (of 16 total)
my specs are:

OS: Linux Mint 21.2 x86_64
DE: Cinnamon 5.8.4
Kernel: 5.15.0-82-generic

CPU: Intel i9-9900K (16) @ 5.000GHz
GPU: NVIDIA GeForce GTX 1080
Memory: 3547MiB / 32018MiB

As for the RPM values
The instruction (readme) on the github page of the community edition says:

H Enable RPM hold (see below for instructions)
G + Scroll Change hold speed
Space + Scroll Fine throttle adjustment
1, 2, 3, 4, 5 Simulation time warp

Pressing H, then D and then holding G while scrolling the mouse wheel lets me precisely fix rpm in place.

another way is to hold down space and scroll the mouse wheel which is more natural I guess.

@cryham
Copy link
Member

cryham commented Sep 4, 2023

Great. I didn't realize that was all possible.
I can record with Audacity too. So will do it someday.

@cryham cryham added the enhancement New feature or request label Oct 5, 2023
@cryham
Copy link
Member

cryham commented Dec 15, 2024

Okay I did record sounds back then. Got stuck for a while since engine-sim doesn't simulate an exhaust muffler, and it's a notable difference in sound.
Now I did progress lately.
I was searching and found many graphs
https://duckduckgo.com/?q=muffler+transmission+loss+db&t=ftsa&atb=v395-1&iax=images&ia=images
like here
https://reference.wolfram.com/language/PDEModels/tutorial/Acoustics/ModelCollection/AcousticMuffler.html
https://www.researchgate.net/publication/309571299_On_the_retrofitted_design_of_a_truck_muffler_with_cascaded_sub-chambers
https://community.cadence.com/cadence_blogs_8/b/cfd/posts/creacoustic-transmission-loss-simulation-of-reactive-and-dissipative-creacoustic-mufflers

which when done in Audacity by Curve EQ, get better results.
There are still limits in engine-sim, high frequency or the explosion sound is just basically noise and it's bad. Surely worse when compared to real sounds.
But I think I'll have new sounds made and definitely will replace that old VDrift sound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants