-
Notifications
You must be signed in to change notification settings - Fork 1
Home
All channels in the LSynth chip operate by an internal period, which increases in accordance to frequency and samplerate, looping around a range of 0 to 1. This period is consistent across all commands except for SetPhase.
All final samples are between -1.0 and 1.0, with any samples exceeding this number clipped down to this range.
Each channel contains some data about its current state, which can be affected by commands. Both the amplitude and and panning have volume ramping with their normal commands, which is tracked separately from their respective slides.
Command | Behavior |
---|---|
SetWaveform | Immediately changes the waveform of the channel. Can error if the index is not a valid waveform. |
SetFrequency | Immediately changes the frequency of the channel in hertz. |
SetAmplitude | Sets the amplitude of the channel. This will act like a very quick amplitude slide to prevent clicks in the audio. |
SetPanning | Sets the panning of the channel. This will act like a very quick panning slide to prevent clicks in the audio. |
SetCustomWaveform | Sets the channels custom waveform to the given array. This only has an effect if the channel's waveform is set to Custom. |
SetPhase | Immediately sets the current period of the channel to a specific phase of the active waveform. |
ForceSetAmplitude | Sets the amplitude of the channel immediately, without volume ramping. This can cause clicks in the audio. |
ForceSetPanning | Sets the panning of the channel immediately, with no sliding. This can cause clicks in the audio. |
FrequencySlide | Sets the target frequency of the channel and the speed at which it will approach that frequency in hertz per second. |
AmplitudeSlide | Sets the target amplitude of the channel and the speed at which it will approach that amplitude in units per second. |
PanningSlide | Sets the target panning of the channel and the speed at which it will approach that pan in units per second. |
While the Custom waveform is selected for a given channel, it will sample the internally stored array. One complete period is the entirety of the array, so that the frequency is accurate. There is no interpolation between samples, and each will be given equal time starting from period 0 up until period 1.
The noise waveform is brownian, adding a random number to the current sample once every time a looping period is completed. It is not interpolated. This should have a minimal effect on the sound quality. Noise will tend to need much higher frequencies than other waveforms, as the perceptual pitch is much lower.
The brownian noise will trend towards 0 automatically every time a new random sample is generated in order to prevent wandering. If wandering gets too excessive, noise will be clipped to the max/min of the channel's amplitude.