Class SampleBasedProceduralEngineAudio
Generates engine sounds by layering short audio samples (cylinder fire, crankshaft rumble, intake whoosh, exhaust pops) and pitching them based on RPM.
Inheritance
Namespace: YACC.Audio
Assembly: .dll
Syntax
public class SampleBasedProceduralEngineAudio : MonoBehaviour
Remarks
⚠️ IMPORTANT:
Do NOT use this component together with EngineAudio or ProceduralEngineAudio on the same GameObject. Only one engine audio system should be active at a time.
HOW IT WORKS:
1. Cylinder fire rate is derived from RPM: fireFreq = (RPM / 60) * (cylinders / 2) for 4-stroke.
2. A pool of AudioSources (one per cylinder) plays the explosion clip in round-robin order.
3. A looping crankshaft clip provides low-end rumble, pitched proportionally to RPM.
4. A looping intake clip adds high-frequency whoosh modulated by throttle × RPM.
5. On deceleration, occasional exhaust backfire pops are played.
BEST FOR: When you have short recorded engine samples and want realistic, RPM-synced playback.