Jump to content

opmo

Administrators
  • Posts

    2,903
  • Joined

  • Last visited

Posts posted by opmo

  1. ver. 3.0.28933

     

    New functions:

     

    Probability->Distribution

    BETA-DISTRIBUTION

    The function returns a list of values generated from the Beta distribution using the given alpha and beta parameters. The Beta distribution is a continuous probability distribution defined on the interval [0, 1]. It is commonly used to model random variables that have values between zero and one, such as proportions, probabilities, or parameters that are constrained to a specific range.


    BILATERAL-EXPONENTIAL

    The bilateral exponential distribution is a probability distribution that models random variables with values in a symmetric interval around zero. It is often used to describe quantities that exhibit both positive and negative values, such as the differences between two related measurements or errors in scientific experiments. The function returns a list of values generated from the bilateral exponential distribution using the given lower limits a and upper limits b.


    CAUCHY-DISTRIBUTION

    The Cauchy distribution is a probability distribution that is characterized by its symmetric bell-shaped curve. The function returns a list of values generated from the Cauchy distribution using the given location parameters x0 and scale parameters gamma. It is also known as the Cauchy-Lorentz distribution and is named after mathematicians Augustin Cauchy and Hendrik Lorentz. Applications of the Cauchy distribution include modeling extreme events, analyzing data with outliers, and in physics, where it arises naturally in certain physical phenomena, such as quantum mechanics and resonant systems.


    GAUSSIAN-DISTRIBUTION

    The function returns a list of pairs (x, y), where x and y are random numbers generated from a Gaussian distribution with the given means and standard deviations. The Gaussian distribution, also known as the normal distribution or bell curve, is one of the most widely used probability distributions in statistics. It is named after mathematician Carl Friedrich Gauss.


    WEIBULL-DISTRIBUTION

    The Weibull distribution is a probability distribution that is commonly used to model the failure times or lifetimes of various types of systems or phenomena. It was introduced by Wallodi Weibull, a Swedish engineer and mathematician. The function returns a list of values generated from the Weibull distribution using the given scale parameters lambda and shape parameters k.

     

    Mathematics->Interpolation

    SEGMENT-INTERPOLATION

    This function interpolates over segments defined by time, value, and an exponent using either linear or cosine interpolation. It creates a segment for each time point with the corresponding value and exponent. It then generates a sequence of points, for each of which it determines the appropriate segment. For a point, it finds the two segments it falls between and applies the appropriate interpolation based on the exponent of the first segment. If there is no subsequent segment, the function simply returns the value of the first segment. If the point falls exactly on the time of a segment, no interpolation is necessary and the function directly returns the corresponding value.

     

    Best wishes,

    Janusz

  2. I quickly change the names of the 2 new functions:

     

    FTT-W -> FTTW

    FTT-H -> FTTH

     

    I too added few more options into the FFTW function:

    coefficients and scale-factor

     

    Please make change to your code if you are already played with the FFT functions.

     

    Best wishes,

    Janusz

  3. New function: FFTH, FFTW
    Brownian motion functions are rewritten. If you used them before please check the documents.

    Improvement to probability functions.

    FFTH

    num-of-harmonics step-resolution points &key type quantize coeff ambitus

     

    The function FFTH calculates the Fast Fourier Transform (FFT) of a given list of points. The FFT is a mathematical algorithm that transforms a function of time (a signal) into a function of frequency. In the context of digital signal processing, the FFT algorithm is used to identify the frequencies present in a discrete signal.

     

    The computation involves the following steps:

    Initialization: Arrays for amplitude, phase, harmonics-matrix, and fftx are initialized.

     

    Coefficient calculation: The function then calculates coefficients for the FFT, looping over the input data points. This is done using a complex number, where amplitude corresponds to the real part and phase to the imaginary part.

     

    FFT curve computation: After the coefficients have been calculated, the function uses them to calculate the FFT curve by looping over a set of x-values and summing up the contributions from each coefficient.

     

    Transformation of the results based on the type of output specified: If type is 'integer, the function rounds the FFT output to the nearest integer. If it's 'pitch, it converts the FFT output to pitches, quantizes them, and limits them to the specified ambitus. If no type is specified, the raw data points of the FFT curve are returned.

     

    Examples:

     

    (ffth 8 0.05 '(44 52 22 68 6 22 9 73 28 68))

      image.png

     

    (ffth 8 0.05 '(44 52 22 68 6 22 9 73 28 68)
           :type 'pitch :ambitus '(c3 c5))

    image.png

     

    (ffth 3 0.05 '(44 52 22 68 6 22 9 73 28 68)
           :type 'pitch :coeff 1.0 :ambitus '(c3 c5))

    image.png

     

    (ffth 8 0.05 '(44 52 22 68 6 22 9 73 28 68)
           :type 'pitch :ambitus '(c3 c5) :quantize 1/4)

    image.png

     

     

    FFTW

    data &key window normalize coefficients scale-factor phase

     

    This function performs a Fast Fourier Transform (FFT) on the input data. The FFT is a widely-used algorithm for computing the Discrete Fourier Transform, which decomposes a sequence of numbers into components of different frequencies.

     

    If a windowing function is provided via the window keyword parameter, this function is used to create a "window" that is applied to the input data before performing the FFT. Windowing can help to reduce "leakage" and "picket fence" effects (artifacts caused by the finite length of the input data).

     

    If the normalize keyword parameter is true (the default), the FFT results are normalized by dividing each component by the length of the input data. This makes the results independent of the length of the input data and can make them easier to interpret.

     

    The coefficient parameter in the FFTW function serves to modify the amplitude of the output data. Each output value of the FFT is multiplied by this coefficient, effectively scaling the amplitude of the frequency components.

     

    The implementation of this FFT function is recursive, meaning it repeatedly breaks down the problem into smaller parts until it reaches a base case where the FFT can be computed directly. This makes it efficient for large datasets.

     

    Note that this function requires the length of the input data to be a power of 2. If the length of the input data is not a power of 2, it is padded with zeros up to the next power of 2. This is because the FFT algorithm is most efficient when the length of the input data is a power of 2.

     

    If you only care about the magnitudes of the frequency components, you can take the absolute value of each number in the result:

     

    (setf data '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))

    image.png

     

    If you also care about the phase information, you can use the phase option to extract the phase of each number:

     

    (fftw data :phase t)

    image.png

     

    Examples:

    In this example, a Blackman-Harris window is applied to the input data:

     

    (fftw data :window 'blackman-harris-window)

    image.png

     

    No normalization is performed:

     

    (fftw data :window 'blackman-harris-window :normalize nil)

    image.png

     

    Compute FFT with Gaussian window:

     

    (fftw data :window 'gaussian-window)

    image.png

     

    Compute FFT with Ultraspherical window:

     

    (fftw data :window 'ultraspherical-window)

    image.png

     

    Examples with all available window functions:

    (fftw data :window 'bartlett-hann-window)
    (fftw data :window 'bartlett-window)
    (fftw data :window 'blackman-harris-window)
    (fftw data :window 'blackman-nuttall-window)
    (fftw data :window 'blackman-window)
    (fftw data :window 'bohman-window)
    (fftw data :window 'cauchy-window)
    (fftw data :window 'connes-window)
    (fftw data :window 'cosine-window)
    (fftw data :window 'exponential-window)
    (fftw data :window 'flat-top-window)
    (fftw data :window 'gaussian-window)
    (fftw data :window 'hamming-window)
    (fftw data :window 'hann-poisson-window)
    (fftw data :window 'hanning-window)
    (fftw data :window 'kaiser-window)
    (fftw data :window 'nuttall-window)
    (fftw data :window 'parzen-window)
    (fftw data :window 'planck-taper-window)
    (fftw data :window 'rectangular-window)
    (fftw data :window 'riemann-window)
    (fftw data :window 'triangular-window)
    (fftw data :window 'tukey-window)
    (fftw data :window 'ultraspherical-window)
    (fftw data :window 'welch-window)

     

    Best wishes,

    Janusz

  4. The new function UNIFY-RHYTHMS will solve your problem - 3.0.28916
     

    Examples:

     

    (setf l1 '(q e e 3q 3q 3q -e. s))
    (setf l2 '(e e e. s -e e s -s s -s))

     

    (list l1 l2) ; select and press cmd-2
    
    

     image.png

     

    (unify-rhythms l1 l2)

    image.png

     

    (setf r1 (rhythm-series 6 5 3/8 :length '(q. e. e s 3q)))
    (setf r2 (rhythm-series 6 4 1/2 :length '(q. e. e s 3q)))
    (setf r3 (rhythm-series 6 3 1/2 :length '(q. e. e s 3q)))

     

    (list r1 r2 r3) ; select and press cmd-2

     

    image.png

     

    Now we merge all three voices to form a single entity:

     

    (unify-rhythms r1 r2 r3)

     

    image.png

     

     

     

  5. New function in 3.0.28902

     

    rhythm-series num number-of-notes span &key length prob seed

     

    This function returns a list of successive rhythmic series derived from a span (overall duration), length values, and a number of length-notes per bar. The length- notes within each bar are positioned at random.

     

    Simple examples:

     

    (rhythm-series 4 3 3/8)
    => ((-1/16 1/8 -1/16 1/16 1/16) (1/16 3/16 1/8)
        (1/8 3/16 1/16) (3/16 1/16 1/8))
        
    (rhythm-series 4 5 3/8)
    => ((1/16 1/16 1/16 1/8 1/16) (-1/16 1/16 1/16 1/16 1/16 1/16)
        (1/16 1/16 1/16 -1/16 1/16 1/16) (1/16 1/16 1/16 1/16 -1/16 1/16))
        
    (rhythm-series 4 3 1/4)
    => ((1/16 1/8 1/16) (1/16 1/16 1/8)
        (1/16 1/8 1/16) (1/16 1/8 1/16))

     

    Examples with given length values:

     

    (rhythm-series 4 3 1 :length '(q. e. s))
    => ((-1/4 1/16 1/16 1/16 -9/16) (1/8 3/16 -5/16 3/8)
        (1/16 3/16 -3/8 3/8) (3/16 -1/16 3/8 3/8))
    
    (rhythm-series 6 5 3/8 :length '(q. e. e s 3q) :prob 0.1)
    => ((1/16 1/16 1/16 1/16 1/8) (1/8 1/16 1/16 1/16 1/16)
        (1/16 1/8 1/16 1/16 1/16) (1/16 1/8 1/16 1/16 1/16)
        (1/16 1/16 1/16 1/16 1/16 -1/16) (1/16 1/16 1/16 1/8 1/16))
        
    (rhythm-series 6 5 3/8 :length '(q. e. e s 3q) :prob 0.9)
    => ((1/12 1/12 1/12 1/12 1/24) (1/24 1/12 1/12 1/12 1/12)
        (1/16 1/16 1/16 1/16 1/16 -1/16) (1/16 1/16 -1/16 1/16 1/16 1/16)
        (1/16 1/16 1/16 -1/16 1/16 1/16) (1/16 1/16 1/16 1/16 -1/16 1/16))    

     

    Example with list of unique values for each generated series:

     

    (rhythm-series '(1 4 3 2)
                   '(7 5 7 7)
                   '(3/8 3/8 1/2 3/4)
                   :prob '(.4 .6 .7 .1)
                   :length '(q. e. e s 5q 3q)
                   :seed 34)
    => ((1/20 1/20 1/20 1/20 1/20 1/20 1/40 -1/20)
        (1/24 1/12 1/12 1/12 1/12)
        (1/20 -1/20 1/20 -1/20 1/20 1/20 1/40 -1/20)
        (1/16 1/16 1/16 1/16 1/8)
        (1/16 1/16 1/8 1/16 1/16)
        (1/20 1/20 1/20 1/20 1/20 -1/20 1/20 -1/20 1/20 -1/20)
        (-1/20 -1/20 1/20 1/20 -1/20 1/20 1/20 1/20 1/20 1/20)
        (-1/20 1/20 -1/20 1/20 1/20 1/20 1/20 1/20 -1/20 1/20)
        (-1/16 1/16 1/16 1/16 -1/8 1/16 -1/16 1/16 1/16 1/16 -1/16)
        (1/12 -1/12 -1/12 1/12 1/12 1/12 1/12 1/12 1/12))

     

    OMN example:

     

    (make-omn :length (rhythm-series '(1 4 3 2)
                                     '(7 5 7 7) 1/2
                                     :prob '(.4 .6 .7 .1)
                                     :length '(q. e. e s)
                                     :seed 34)
     :pitch (gen-chord3 '((cs4 g4 a5) (c4 gs3 a4)
                          (b5 f5 gs5) (b4 fs4 bb5)
                          (cs5 c6 gs4) (e5 g3 a5))
                        '((6 8 11) (3 5 13) (2 7 11))))
    Best wishes,
    Janusz
  6. There is no documentation for :merge-ties as it simply refers to the type of tie utilized and does not have any impact on notation.

     

    (setf omn
          '(h c7 p eb6 mp p - c7 q e6 - h_e g6 e mf
            bb5 mp -h.. q bb6 p -h. q. d6 e c4 -h..
            q bb3 mf e g6 mp h_e e6 -h e g5 h a6
            -e = h bb4 e6 p q bb6 mp e6 e g3 g6 p
            q. g3 e bb3 bb6 mp q g6 pp e c7 mp eb4 p))
    
    (omn-to-time-signature omn '(4 4) :merge-ties t)
    (omn-to-time-signature omn '(4 4) :merge-ties nil)

     

  7. One possibility:

    (setf times 100)
    (setf my-root -24)
    (setf my-intervals '(0 1 4 7))
    (setf my-pitches (pitch-transpose my-root (integer-to-pitch my-intervals)))
    (setf my-lengths (gen-loop times (rnd-pick '((q s) (q q)))))
    
    (setf my-sequence (make-omn
                       :length my-lengths
                       :pitch my-pitches))
    
    (setf gts (get-time-signature my-sequence))
    
    (def-score my-score
        (:title "my-score"
         :key-signature 'chromatic
         :time-signature gts
         :tempo 161)
      
      (instrument-1
       :omn my-sequence
       :port 0
       :channel 1
       :volume 100
       )
      
      (instrument-2
       :omn my-sequence
       :port 0
       :channel 2
       :volume 60)
      )

     

    With rnd-sample:

     

    (setf my-lengths (gen-loop times (first (rnd-sample 1 '((q s) (q q))))))

     

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy