func bresenhamEuclidean(onsets: Int, pulses: Int) -> [Int] {
let slope = Double(onsets) / Double(pulses)
var result = [Int]()
var previous: Int? = nil
for i in 0..<pulses {
let current = Int(floor(Double(i) * slope))
result.append(current != previous ? 1 : 0)
previous = current
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setcps 0.53 | |
do | |
let p1 = lpf (range 50 6000 (slow 4 sine)) # lpq 0.3 | |
let p2 = lpf (range 50 6000 (slow 4 sine)) # lpq 0.6 | |
let p3 = lpf (range 50 6000 (slow 3 saw)) # lpq (range 0.3 0.7 (slow 3.5 saw)) | |
let shift = (|+ up "<0!4 -3!4>") | |
let d10_0 = superimpose (hurry "t") | |
$ inside 8 (every 7 (jux ("h" <~))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setcps 0.53 | |
do | |
let p1 = lpfq (range 50 6000 (slow 4 sine)) 0.3 | |
let p2 = lpfq (range 50 6000 (slow 4 sine)) 0.6 | |
let p3 = lpfq (range 50 6000 (slow 3 saw)) (range 0.3 0.7 (slow 3.5 saw)) | |
let shift = (|+ up "<0!4 -3!4>") | |
let d10_0 = si (hurry "t") | |
$ inevery 8 7 (jux press) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ABLLinkManager.swift | |
// | |
// Created by Cem Olcay on 5.03.2018. | |
// Copyright © 2018 cemolcay. All rights reserved. | |
// | |
import Foundation | |
import AVFoundation |
func generateEuclidean(onsets: Int, pulses: Int) -> [Int] {
let front:[[Int]] = Array(repeating: [1], count: onsets)
let back:[[Int]] = Array(repeating: [0], count: pulses - onsets)
return euclidRecursive(front: front, back: back).flatMap {$0}
}
private func euclidRecursive (front: [[Int]], back: [[Int]]) -> [[Int]] {
var back = back