public ChiSTMAudioClip( double duration, double lowestFrequency, double componentBandwidth, double frequencySpacing, double modulationDepth, double spectralModulationRate, double temporalModulationRate, double maxTemporalVelocity, RippleDirection rippleDirection, ComponentSpacing componentSpacing, Random randomizer = null) { if (randomizer == null) { randomizer = new Random(CustomRandom.Next()); } this.randomizer = randomizer; this.lowestFrequency = lowestFrequency; this.componentBandwidth = componentBandwidth; this.frequencySpacing = frequencySpacing; this.componentSpacing = componentSpacing; this.modulationDepth = modulationDepth; this.temporalModulationRate = temporalModulationRate; switch (rippleDirection) { case RippleDirection.Up: this.spectralModulationRate = -spectralModulationRate; break; case RippleDirection.Down: this.spectralModulationRate = spectralModulationRate; break; default: UnityEngine.Debug.LogError($"Unexpected RippleDirection: {rippleDirection}"); break; } this.maxTemporalVelocity = maxTemporalVelocity; _channelSamples = (int)Math.Ceiling(duration * SamplingRate); }
public STMAudioClip( double duration, double freqLB, double freqUB, int frequencyCount, double modulationDepth, double spectralModulationRate, double temporalModulationRate, RippleDirection rippleDirection, AmplitudeDistribution distribution, Random randomizer = null) { if (randomizer == null) { randomizer = new Random(CustomRandom.Next()); } this.randomizer = randomizer; carrierToneGenerator = CreateSideBands(freqLB, freqUB, frequencyCount, distribution); sideBandGenerator = ExpCarrierToneSideBands; this.modulationDepth = modulationDepth; this.temporalModulationRate = temporalModulationRate; switch (rippleDirection) { case RippleDirection.Up: this.spectralModulationRate = spectralModulationRate; break; case RippleDirection.Down: this.spectralModulationRate = -spectralModulationRate; break; default: Debug.LogError($"Unexpected RippleDirection: {rippleDirection}"); break; } _channelSamples = (int)Math.Ceiling(duration * SamplingRate); }