ExternalEntryPoint

class in Clatter.Core

A convenient entry point for external (non-C#) applications for generating single-event Clatter audio.

This class necessarily offers a subset of Clatter's full functionality. If you're programming in a C# and/or Unity context, don't use this class! Use the rest of the Clatter API instead.

Static Methods

GetAudio

public static byte[] GetAudio(byte primaryImpactMaterial, double primaryAmp, double primaryResonance, double primaryMass, byte secondaryImpactMaterial, double secondaryAmp, double secondaryResonance, double secondaryMass, double speed, byte audioEventType, byte scrapeMaterial, double duration, bool hasSeed, int seed, double simulationAmp, double scrapeMaxSpeed, bool preventDistortion, bool clampContactTime, int framerate)

Generate audio. Returns a byte array of int16 data.

Name Type Description
primaryImpactMaterial byte The primary object's impact material as a byte. Use the numerical values found in the ImpactMaterial document.
primaryAmp double The primary object's amp (0 to 1). This affects the overall loudness of audio generated by this object.
primaryResonance double The primary object's resonance. This affects the decay times of audio generated by this object. The value is clamped to be at least 0 and usually should be below 1.
primaryMass double The primary object's mass in kilograms.
secondaryImpactMaterial byte The secondary object's impact material as a byte. Use the numerical values found in the ImpactMaterial document.
secondaryAmp double The secondary object's amp (0 to 1). This affects the overall loudness of audio generated by this object.
secondaryResonance double The secondary object's resonance. This affects the decay times of audio generated by this object. The value is clamped to be at least 0 and usually should be below 1.
secondaryMass double The secondary object's mass in kilograms.
speed double The speed of the collision in meters per second.
audioEventType byte The audio event type. Use the numerical values found in the AudioEventType document.
scrapeMaterial byte The scrape material. This is used only if the audio event is a scrape. Use the numerical values found in the ScrapeMaterial document.
duration double The duration of the event is seconds. This is used only if the audio event is a scrape.
hasSeed bool If true, use the random seed below. If false, the random seed is random.
seed int The random seed. This is used only if hasSeed == true.
simulationAmp double The overall amplitude of the simulation. The amplitude of generated audio is scaled by this factor. Must be between 0 and 0.99. In most cases, set this to 0.9.
scrapeMaxSpeed double For the purposes of scrape audio generation, the collision speed is clamped to this maximum value in meters per second. In most cases, set this to 5.
preventDistortion bool If true, clamp an impact's audio amplitude values to less than or equal to 0.99, preventing distortion. In most cases, set this to true.
clampContactTime bool If true, clamp an impact's contact time to a plausible value. Set this to false if you want to generate impacts with unusually long contact times. In most cases, set this to true.
framerate int The audio samples framerate. In most cases, set this to 44100