YACC YACC
YACC YACC
Made with ❤️ for Unity

Search Results for

    Class EngineAudio

    Plays realistic engine sounds based on RPM and throttle position.

    Inheritance
    object
    EngineAudio
    Namespace: YACC.Audio
    Assembly: .dll
    Syntax
    public class EngineAudio : MonoBehaviour
    Remarks

    This refactored audio system provides more realistic engine sound behavior with proper RPM-to-pitch mapping.

    BEST PRACTICES FOR ENGINE AUDIO:

    1. Audio Sample Recording: Record your engine loops at a constant RPM (e.g., 1000 RPM, 3000 RPM, 5000 RPM). Set the sampleRecordedAtRPM parameter to match your recording.

    2. Pitch Calculation: Unity will automatically calculate the correct pitch multiplier: pitch = (currentRPM / sampleRecordedAtRPM) * basePitch

    3. Multi-Layer Approach: Use 2-3 audio layers for best results: - Low RPM loop (idle-3000 RPM) - Mid RPM loop (2000-5000 RPM) - High RPM loop (4000-7000+ RPM) Crossfade between them based on RPM.

    4. Throttle Blending: Record both on-throttle and off-throttle loops, blend with throttle position.

    5. Procedural Audio (Advanced): You CAN generate engine sounds without files using: - AudioSource.OnAudioFilterRead() for DSP - Additive synthesis (multiple sine waves) - Granular synthesis - See ProceduralEngineAudio.cs for implementation example

    Fields

    Name Description
    audioResponseSpeed

    How quickly audio responds to RPM changes.

    basePitchMultiplier

    Base pitch multiplier (use to tune overall engine sound).

    crossfadeWidth

    Width of crossfade (in RPM).

    highRPMClip

    High RPM engine loop (4000+ RPM).

    highRPMSampleRecordedAt

    The RPM at which the high RPM clip was recorded.

    lowRPMClip
    lowRPMSampleRecordedAt

    The RPM at which the low RPM clip was recorded.

    lowToMidCrossfadeRPM
    masterVolume
    maxPitch

    Maximum pitch allowed (prevents unrealistic squealing).

    maximumDistance

    Maximum distance for 3D audio.

    midRPMClip

    Mid RPM engine loop (2000-5000 RPM).

    midRPMSampleRecordedAt

    The RPM at which the mid RPM clip was recorded.

    midToHighCrossfadeRPM

    RPM range for crossfading from mid to high layer.

    offThrottleClip

    Off-throttle/deceleration sound.

    startingSoundClip

    Engine start/ignition sound.

    Methods

    Name Description
    StartEngine()

    Starts the engine with ignition sound.

    © Deimos Industries. All rights reserved.