Tabula Sonora 0.1.0
A native C++20 implementation of the Roland Sound Canvas VA synth voice
Loading...
Searching...
No Matches
ts::EngineNoise Class Reference

The engine's shared pseudo-random generator. More...

#include <tabulasonora/engine_noise.hpp>

Public Member Functions

std::uint16_t next () noexcept
 Draws the next 16-bit value.
int next_pan () noexcept
 Draws a random pan position, 0 to 127, on the same scale as CC#10.
void reset () noexcept
 Returns the generator to the engine's reset state.

Detailed Description

The engine's shared pseudo-random generator.

The original keeps two 16-bit registers, seeded at engine reset to 0xEFA6 and 0x9C23. The first is a right-shifting Fibonacci LFSR whose new bit 15 is bit 5 XOR bit 15; the second shifts left and inserts bit 9 when bit 2 is clear, or the complement of bit 13 when bit 2 is set. A draw steps both and returns their XOR.

The sequence is therefore deterministic from engine reset; what polyphony changes is only the order in which voices consume draws. The generator is shared by the random LFO waveforms, the pitch start jitter, and the random detune redraw — so anything that consumes a draw it should not shifts every later one.

Member Function Documentation

◆ next()

std::uint16_t ts::EngineNoise::next ( )
inlinenodiscardnoexcept

Draws the next 16-bit value.

◆ next_pan()

int ts::EngineNoise::next_pan ( )
inlinenodiscardnoexcept

Draws a random pan position, 0 to 127, on the same scale as CC#10.

The engine takes the top seven bits of a draw. This is what GS random pan resolves to — a part whose CC#10 is zero, or a drum key whose pan NRPN is zero, is repositioned per note.

◆ reset()

void ts::EngineNoise::reset ( )
inlinenoexcept

Returns the generator to the engine's reset state.


The documentation for this class was generated from the following file: