fmsynth_note   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/instruments/fmsynth.xtm

Implementation

;; You can push I higher than 1.0
;; But only when H is low
;;
(bind-func fmsynth_note
  (lambda ()
    (let ((amp_env:|4,float| (array 10.0:f 50.0 0.6 200.0)))
      (lambda (data:NoteData* nargs:i64 dargs:SAMPLE*)
        (let (;; (gate:SAMPLE 1.0)
              (starttime (note_starttime data))
              (frequency (note_frequency data))
              (amplitude (note_amplitude data))
              (duration (note_duration data))
              (a (aref amp_env 0))
              (d (aref amp_env 1))
              (s (aref amp_env 2))
              (r (aref amp_env 3))
              (release (convert (* SRs (convert (/ (aref amp_env 3) 1000.0))) i64))
              (o1 (osc_c 0.0))
              (o2 (osc_c 0.0))
              (env (adsr_c))
              (eamp 0.0:f)
              (I (if (> nargs 0) (pref dargs 0) 0.1)) ;; modulation index (generally 0.0-1.0)
              (H (if (> nargs 1) (pref dargs 1) 10.0)) ;; harmonicity ratio (whole numbers 1.0 - 20.0)
              (out:SAMPLE 0.0))
          (lambda (time:i64 chan:i64) ; infreq:SAMPLE inamp:SAMPLE)
            (if (= chan 0)
                (begin
                  (if (> (- time starttime) duration) (note_gate data 0.0))
                  (set! eamp (env chan (note_gate data) a d s r))
                  (if (> (- time starttime) (+ duration release)) (note_active data #f))
                  (set! out (o1 (* (/ 5.0 (log frequency)) (* eamp amplitude))
                                (+ frequency
                                   (o2 (* (* H frequency) I)
                                       (* H frequency)))))))
            (* 1.0 out)))))))


Back to Index

Similar Entries

  • LFO_OPT_NOTEDUR    scheme    /digego/extempore/tree/v0.8.9/examples/sharedsystem/audiosetup.xtm
  • PmEvent_note_off_p    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • PmEvent_note_on_p    xtlang    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • active_notes    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/instrument_params.xtm
  • active_notes    xtlang    /digego/extempore/tree/v0.8.9/examples/sharedsystem/audiosetup.xtm
  • analogueVec_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/analogue.xtm
  • analogue_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/analogue.xtm
  • basic_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/basicsynth.xtm
  • cerberus_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/cerberus.xtm
  • cl:notevery    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • close-note-gate    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments-scm.xtm
  • dlogue_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments/dlogue.xtm
  • fmsynth    scheme    /digego/extempore/tree/v0.8.9/examples/core/mtaudio.xtm
  • fmsynth    scheme    /digego/extempore/tree/v0.8.9/examples/core/scheduler.xtm
  • fmsynth    scheme    /digego/extempore/tree/v0.8.9/examples/external/spectrogram.xtm
  • homo-play-midi-note    scheme    /digego/extempore/tree/v0.8.9/libs/contrib/rtmidi-scm.xtm
  • homo-play-midi-note    scheme    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • instrument_find_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments.xtm
  • midi-note-off    scheme    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi-note-on    scheme    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_note_off    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_note_off    xtlang    /digego/extempore/tree/v0.8.9/examples/core/midi_synth.xtm
  • midi_note_off    xtlang    /digego/extempore/tree/v0.8.9/examples/sharedsystem/midisetup.xtm
  • midi_note_on    xtlang    /digego/extempore/tree/v0.8.9/libs/external/midi.xtm
  • midi_note_on    xtlang    /digego/extempore/tree/v0.8.9/examples/core/midi_synth.xtm
  • midi_note_on    xtlang    /digego/extempore/tree/v0.8.9/examples/sharedsystem/midisetup.xtm
  • note-active    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • note-activity    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • note-grad    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • note-pitch    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_fire.xtm
  • play-midi-note    scheme    /digego/extempore/tree/v0.8.9/libs/contrib/rtmidi-scm.xtm
  • play-midi-note    scheme    /digego/extempore/tree/v0.8.9/libs/external/portmidi.xtm
  • play-note    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments-scm.xtm
  • sampler-parse-midinote-filename    scheme    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext-scm.xtm
  • sampler_note    xtlang    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext.xtm
  • sampler_note_linear    xtlang    /digego/extempore/tree/v0.8.9/libs/external/instruments_ext.xtm
  • saw_synth_note_c    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/polysynth.xtm
  • saw_synth_note_c    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/polysynth.xtm
  • start-note    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments-scm.xtm
  • stop-note    scheme    /digego/extempore/tree/v0.8.9/libs/core/instruments-scm.xtm
  • xtm_notequal    xtlang    /digego/extempore/tree/v0.8.9/libs/core/rational.xtm
  • xtm_notequal    xtlang    /digego/extempore/tree/v0.8.9/libs/core/rational.xtm
  • xtm_notequal    xtlang    /digego/extempore/tree/v0.8.9/libs/core/rational.xtm
  • xtm_notequal    xtlang    /digego/extempore/tree/v0.8.9/libs/core/rational.xtm
  • xtm_notequal    xtlang    /digego/extempore/tree/v0.8.9/libs/core/rational.xtm
  • xtm_notequal    xtlang    /digego/extempore/tree/v0.8.9/libs/core/rational.xtm
  • xtm_notequal    xtlang    /digego/extempore/tree/v0.8.9/libs/core/rational.xtm
  • xtm_notequal    xtlang    /digego/extempore/tree/v0.8.9/libs/core/rational.xtm
  • xtm_notequal    xtlang    /digego/extempore/tree/v0.8.9/libs/core/rational.xtm
  • xtm_play_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments.xtm
  • xtm_release_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments.xtm
  • xtm_start_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments.xtm
  • xtm_stop_note    xtlang    /digego/extempore/tree/v0.8.9/libs/core/instruments.xtm