Skip to content
View in the app

A better way to browse. Learn more.

Learn more

Infinity series from binary numbers

Featured Replies

You can create the infinity series from binary numbers. ones are added, zeros reverse sign.

Jesper

(defun inf-ser (n &optional (offset 0) &aux tmp)

(loop for i to (1- n) do

(setf tmp 0)

(loop for bin in (decimal-to-binary i)

do

(setf tmp (if (zerop bin) (- tmp) (+ tmp bin))))

;(format t "~B = ~D~%" i tmp)

collect (+ tmp offset)))

(integer-to-pitch (inf-ser 128))

(integer-to-pitch (inf-ser 128 12))

  • Author

Fractal properties

;; added step

(defun inf-ser (n &key (offset 0) (step 1) &aux tmp)

(loop for i to (* (1- n) step) by step do

(setf tmp 0)

(loop for bin in (decimal-to-binary i)

do

(setf tmp (if (zerop bin) (- tmp) (+ tmp bin))))

;(format t "~B = ~D~%" i tmp)

collect (+ tmp offset)))

(setf orig (integer-to-pitch (inf-ser 128 :offset 12 :step 1)))

;;every second number = inverted series

(setf sec (integer-to-pitch (inf-ser 128 :offset 12 :step 2)))

(setf inv-sec (pitch-invert sec))

(equal orig inv-sec)

;;every 4, 16, 64… = original series

(setf fourth (integer-to-pitch (inf-ser 128 :offset 12 :step 4)))

(equal fourth orig)

Jesper

Create an account or sign in to comment

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.