Class FnSound

java.lang.Object
eu.bandm.music.applications.harm.FnSound

class FnSound extends Object
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.
  • Field Details

    • SAMPLINGRATE

      static final double SAMPLINGRATE
      Overall sampling rate for sound synthesis. Control rate will be derived by division.
      See Also:
    • TABLE_SIZE

      static final int TABLE_SIZE
      Wavetable size for the function generator.
      See Also:
    • gui

      final FnGui gui
      Owning GUI; used to access rows and controls.
    • hertzPost

      final DoublePost hertzPost
      Base frequency shared by all synthesis lines.
    • soundSelect

      final EnumPost<FnSound.sound> soundSelect
      Synthesis algorithm selector.
    • volumePost

      final IntPost volumePost
      Master output volume level (0–100).
    • realtimeContext

      final ConstantRealtimeContext realtimeContext
      Overall realtime context for sound synthesis. Control rate will be derived by division.
    • envPizzicato

      final DoubleEnvelope envPizzicato
      Envelope curve for the function generator output.
    • WAVE_SINE

      Wavetable for pure-sine synthesis.
    • WAVE_SQUARE

      Wavetable for square-wave synthesis.
    • WAVE_TRIANGLE

      final DoubleHarmonicSpectrum.DiffTable WAVE_TRIANGLE
      Wavetable for triangle-wave synthesis.
    • WAVE_SAW

      Wavetable for saw-wave synthesis.
    • allLinesSteps

      Process allLinesSteps
      Chain of per-line step processes; null until first line added.
    • allLinesValues

      DoubleSignalSource allLinesValues
      Summed signal of all lines; null until first line is added.
    • phases

      final BitSet phases
      Union of phase bits from all rows; drives button enables.
    • phaseCount

      int phaseCount
      Cardinality of phases; cached for efficiency.
    • phase

      int phase
      Index of the currently playing sequencer phase.
    • inPause

      boolean inPause
      Whether a pause is currently played.
    • selectedPhases

      final BitSet 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 frame
      hertzPost - base frequency post
      soundSelect - synthesis-mode selector
      volumePost - master volume post
  • Method Details

    • addSoundLine

      FnSound.SoundLine addSoundLine()
      Creates and registers a new synthesis voice.
      Returns:
      the newly created FnSound.SoundLine
    • buildOutput

      void buildOutput(BooleanSignalSource muted)
      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 of phase.