Marlon Schumacher
28.03.25 8a52b9b9c6aab04076883a3a674cbf513b8b49cd
feat: adding resources for OM library
4 files added
2 files renamed
96 ■■■■ changed files
OM-SRR.lisp 64 ●●●●● patch | view | raw | blame | history
resources/Max-OSC-test.maxpat patch | view | raw | blame | history
resources/icons/987.jpg patch | view | raw | blame | history
resources/icons/988.jpg patch | view | raw | blame | history
resources/pict/Logo OM-SRR.png patch | view | raw | blame | history
sources/SRR.lisp 32 ●●●● patch | view | raw | blame | history
OM-SRR.lisp
New file
@@ -0,0 +1,64 @@
; ****************************************************************
; | OM-SRR, 2023-2025 M.Schumacher                               |
; |                                                              |
; | Library for spectral rhythm modeling via integer time ratios |
; | (partials) as phase-aligned amplitude modulations.           |
; |                                                              |
; | See https://steffenkrebber.de/research/sinusoidal-run-rhythm/|
; ****************************************************************
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either version 2
;of the License, or (at your option) any later version.
;
;See file LICENSE for further informations on licensing terms.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,10 USA.
;
;Authors: M. Schumacher
;--------------------------------------------------
;Variable definiton with files to load
;--------------------------------------------------
(defvar *initfile* *load-pathname*)
(defun lib-src-file (name)
  (make-pathname :directory (append (pathname-directory *initfile*) (list "sources"))
                 :name name))
(defvar *OM-SRR_files* nil)
(setf *OM-SRR_files* '("srr"))
;--------------------------------------------------
;Loading files
;--------------------------------------------------
(mapc #'(lambda (filename)
          (om::compile&load (namestring (lib-src-file filename))))
      *OM-SRR_files*)
;--------------------------------------------------
; OM subpackages initialization
; ("sub-pack-name" subpacke-lists class-list function-list class-alias-list)
;--------------------------------------------------
(defvar *subpackages-list* nil)
(setf *subpackages-list*
      '((Nil Nil Nil (gen-partial gen-srr polar-plot farey-sequence) Nil)))
;--------------------------------------------------
;filling packages
;--------------------------------------------------
(om::fill-library *subpackages-list*)
resources/Max-OSC-test.maxpat
resources/icons/987.jpg
resources/icons/988.jpg
resources/pict/Logo OM-SRR.png
sources/SRR.lisp
File was renamed from SRR.lisp
@@ -1,8 +1,9 @@
; ****************************************************************
; | OM-SRR, 2023                                                 |
; | OM-SRR, 2023-2025 M.Schumacher                               |
; |                                                              |
; | Library for spectral rhythm model via integer time ratios    |
; | Library for spectral rhythm modeling via integer time ratios |
; | (partials) as phase-alilgned amplitude modulations.          |
; |                                                              |
; | See https://steffenkrebber.de/research/sinusoidal-run-rhythm/|
; ****************************************************************
;
@@ -26,22 +27,21 @@
(in-package :om)
; main function
; gen-wave
; GEN-PARTIAL
(defmethod! gen-partial (subdivision &key (precision 0.01) (decimals 5))
            ;:icon 141
            ;:initvals '(0 0.1 5)
            ;:indoc '("subdivision" "precision" "decimals")
            :icon 988
            :initvals '(2 0.01 5)
            :indoc '("subdivision" "precision" "decimals")
            :numouts 2
  (let* ((sampled-function (multiple-value-list   
                            (om-sample #'cos (* subdivision precision) 0 (* subdivision (* 2 pi)) decimals)))
         (x-points (second sampled-function))
         (y-points (third sampled-function)))
    (values (om/ x-points subdivision) y-points)
    )
@@ -119,7 +119,7 @@
  "Compute the Farey sequence of order n."
  (let ((fractions '()))
    (loop for denominator from 1 to n
          do (loop for numerator from 0 to denominator
          do (loop for numerator from 1 to denominator
                   when (and (>= numerator 0) (<= numerator denominator)
                             (= 1 (gcd numerator denominator)))
                   do (push (cons numerator denominator) fractions)))
@@ -127,23 +127,9 @@
                      (let ((num-a (car a)) (den-a (cdr a))
                            (num-b (car b)) (den-b (cdr b)))
                        (< (* num-a (float den-b)) (* num-b (float den-a))))))
    (loop for (a . b) in fractions collect
          (/ a b)
          )
    ))
(defparameter *farey-seq* '(0 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1))
(loop for item in *farey-seq*
        collect (unless (zerop item)
                  (/ 1 item)))
;; Example usage
(print (farey-sequence 5))
(farey-sequence 5)
(let ((conspair '(1 . 5)))
 (/ (car conspair)
    (cdr conspair))
)