Hello! I'm creating a procedural engine sound generator, inspired by AngeTheGreat's engine simulator which uses a simplified physics-based simulation. He uses physics bodies to simulate the crankshaft and pistons physics, I'm going for a more simplified approach by assuming that the pistons and the crankshaft are the same thing in the system, with different timing to apply forces directly into crankshaft, using pure trigonometry maths. The idea is to have a free software that can export engine sound at variable rpms to use in any racing game, simillar to AngeTheGreat's simulator but more simple so anyone with old hardware can run it.
I succeeded to create the crankshaft and piston movement, so I moved on to create the piston movement audio signal generation, I'm trying two approaches:
- Using piston position, as it moves in a sine-wave simillar pattern, it generates a sine-wave audio signal, I assume is correct as I didn't add any kind of noise in the system yet, but there is a problem: If the piston stops at a position different than zero, the audio signal will be a constant non-zero value, which isn't correct, it should be zero as the piston isn't moving, so what's the correct way to generate the signal from the piston position?
- Using piston velocity, the velocity varies more closely to a square-wave, by slowing down fast on top and bottom positions and mantaining the same velocity magnitude while the piston slides along the cylinder. It gets really loud at higher rpms, as the velocity increases in magnitude, it increases the audio signal magnitude too.
It seens that AngeTheGreat uses a pre-recorded audio sample for the piston movement, that is just played back with frequency relative to the motor rpm, I'm going for a more realtime physics-based approach.
I ain't a sound engineer or expert at audio signal processing, so I'm trying to guess how the audio should sound like based on some knowledge on how sound propagates in the air. I guess the correct way is by using the piston position, but what's the correct way that doesn't generate a constant non-zero signal when the piston isn't moving? I should feed the piston position to another generator that uses the position variation? I'm having a bit of issues in this part.