Package eu.bandm.music.applications.harm
Class FnSound
java.lang.Object
eu.bandm.music.applications.harm.FnSound
Audio back-end for the harmonic frequency calculator.
Manages one
FnSound.SoundLine per FnGui.NumberPanel
and a sequencer that steps through the phases on a tempo
clock.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classRealises the stepping through the phases.static enumSelects between different sound methods.(package private) classOne synthesis voice, driven by aFnGui.NumberPanel. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) ProcessChain of per-line step processes; null until first line added.(package private) DoubleSignalSourceSummed signal of all lines; null until first line is added.(package private) final DoubleEnvelopeEnvelope curve for the function generator output.(package private) final FnGuiOwning GUI; used to access rows and controls.(package private) final DoublePostBase frequency shared by all synthesis lines.(package private) booleanWhether a pause is currently played.(package private) intIndex of the currently playing sequencer phase.(package private) intCardinality ofphases; cached for efficiency.(package private) final BitSetUnion of phase bits from all rows; drives button enables.(package private) final ConstantRealtimeContextOverall realtime context for sound synthesis.(package private) static final doubleOverall sampling rate for sound synthesis.(package private) final BitSetPhases selected by the user via the footer buttons.(package private) final EnumPost<FnSound.sound> Synthesis algorithm selector.(package private) static final intWavetable size for the function generator.(package private) final IntPostMaster output volume level (0–100).(package private) final DoubleHarmonicSpectrum.DiffTableWavetable for saw-wave synthesis.(package private) final DoubleHarmonicSpectrum.DiffTableWavetable for pure-sine synthesis.(package private) final DoubleHarmonicSpectrum.DiffTableWavetable for square-wave synthesis.(package private) final DoubleHarmonicSpectrum.DiffTableWavetable for triangle-wave synthesis. -
Constructor Summary
ConstructorsConstructorDescriptionFnSound(FnGui gui, DoublePost hertzPost, EnumPost<FnSound.sound> soundSelect, IntPost volumePost) Wires the audio back-end to the GUI. -
Method Summary
Modifier and TypeMethodDescription(package private) FnSound.SoundLineCreates and registers a new synthesis voice.(package private) voidbuildOutput(BooleanSignalSource muted) Builds the audio output pipeline and opens the sound device.(package private) voidAdvances phase, restarts the envelope, notifies all rows.(package private) voidstart()Starts the audio output thread.
-
Field Details
-
SAMPLINGRATE
static final double SAMPLINGRATEOverall sampling rate for sound synthesis. Control rate will be derived by division.- See Also:
-
TABLE_SIZE
static final int TABLE_SIZEWavetable size for the function generator.- See Also:
-
gui
Owning GUI; used to access rows and controls. -
hertzPost
Base frequency shared by all synthesis lines. -
soundSelect
Synthesis algorithm selector. -
volumePost
Master output volume level (0–100). -
realtimeContext
Overall realtime context for sound synthesis. Control rate will be derived by division. -
envPizzicato
Envelope curve for the function generator output. -
WAVE_SINE
Wavetable for pure-sine synthesis. -
WAVE_SQUARE
Wavetable for square-wave synthesis. -
WAVE_TRIANGLE
Wavetable for triangle-wave synthesis. -
WAVE_SAW
Wavetable for saw-wave synthesis. -
allLinesSteps
Process allLinesStepsChain of per-line step processes; null until first line added. -
allLinesValues
DoubleSignalSource allLinesValuesSummed signal of all lines; null until first line is added. -
phases
Union of phase bits from all rows; drives button enables. -
phaseCount
int phaseCountCardinality ofphases; cached for efficiency. -
phase
int phaseIndex of the currently playing sequencer phase. -
inPause
boolean inPauseWhether a pause is currently played. -
selectedPhases
Phases selected by the user via the footer buttons.
-
-
Constructor Details
-
FnSound
FnSound(FnGui gui, DoublePost hertzPost, EnumPost<FnSound.sound> soundSelect, IntPost volumePost) Wires the audio back-end to the GUI.- Parameters:
gui- owning GUI framehertzPost- base frequency postsoundSelect- synthesis-mode selectorvolumePost- master volume post
-
-
Method Details
-
addSoundLine
FnSound.SoundLine addSoundLine()Creates and registers a new synthesis voice.- Returns:
- the newly created
FnSound.SoundLine
-
buildOutput
Builds the audio output pipeline and opens the sound device.- Parameters:
muted- replaces output with silence when selected
-
start
void start()Starts the audio output thread. -
nextPhase
void nextPhase()Advances phase, restarts the envelope, notifies all rows. FIMXE radiobuttons ? : The current state of the phases may be an arbitrary set due to manual switching, and is cleared to the cyclic successor ofphase.
-