Home Artist Music Writing Library Gear Evidence Grung3zilla Contact
← False Infinity
Artwork for Prime Signal

False Infinity

Prime Signal

Clear-Host

$PrimeNumbers = @(2, 3, 5, 7, 11, 13, 17, 19, 23)
$Operators = @("divide", "multiply", "subtract", "add", "equal", "not equal")
$States = @("prime", "composite", "prime", "prime", "composite")

function Test-Prime {
param(
[Parameter(Mandatory = $true)]
[int]$Number
)

if ($Number -lt 2) {
    return $false
}

if ($Number -eq 2) {
    return $true
}

if (($Number % 2) -eq 0) {
    return $false
}

$Limit = [Math]::Floor([Math]::Sqrt($Number))

for ($Divisor = 3; $Divisor -le $Limit; $Divisor += 2) {
    if (($Number % $Divisor) -eq 0) {
        return $false
    }
}

return $true
}

function Get-FibonacciSequence {
param(
[int]$Length = 16
)

$Sequence = New-Object System.Collections.Generic.List[int]
$First = 0
$Second = 1

for ($Index = 0; $Index -lt $Length; $Index++) {
    $Sequence.Add($First)

    $Next = $First + $Second
    $First = $Second
    $Second = $Next
}

return $Sequence
}

function Invoke-Signal {
param(
[int]$Frequency,
[int]$Duration,
[string]$Message
)

Write-Output $Message

try {
    [Console]::Beep($Frequency, $Duration)
}
catch {
    Start-Sleep -Milliseconds $Duration
}
}

$Fibonacci = Get-FibonacciSequence -Length 16
$Pulse = 2 * 3 * 5 * 7
$Cycle = 0

Write-Output "initialize the signal"
Write-Output "open the sequence"
Write-Output "begin computation"
Write-Output "pulse equals $Pulse"
Write-Output ""

foreach ($Number in $PrimeNumbers) {
$Cycle
$Accent = $Number % 4
$Frequency = 180 + ($Number * 21)
$Duration = 90 + ($Accent * 70)

if (Test-Prime -Number $Number) {
    $State = "prime"
}
else {
    $State = "composite"
}

Write-Output "cycle $Cycle"
Write-Output "number $Number"
Write-Output "state $State"
Write-Output "accent $Accent"

Invoke-Signal `
    -Frequency $Frequency `
    -Duration $Duration `
    -Message "return when the number is prime"

if (($Cycle % 3) -eq 0) {
    Invoke-Signal `
        -Frequency ($Frequency + 120) `
        -Duration ($Duration * 2) `
        -Message "three signals converge"
}

if (($Cycle % 5) -eq 0) {
    Invoke-Signal `
        -Frequency ($Frequency - 40) `
        -Duration ($Duration * 3) `
        -Message "five signals divide"
}

Write-Output ""
}

for ($Index = 0; $Index -lt $Fibonacci.Count; $Index) {
$Value = $Fibonacci[$Index]
$Position = $Index + 1

if (Test-Prime -Number $Position) {
    $Instruction = "return"
}
else {
    $Instruction = "repeat"
}

Write-Output "$Instruction sequence $Position"
Write-Output "value $Value"

$Frequency = 220 + (($Value % 24) * 18)
$Duration = 100 + (($Position % 4) * 60)

Invoke-Signal `
    -Frequency $Frequency `
    -Duration $Duration `
    -Message "$Instruction the pattern"
}

for ($Index = 0; $Index -lt $Operators.Count; $Index++) {
$Operator = $Operators[$Index]
$State = $States[$Index % $States.Count]

Write-Output "$Operator"
Write-Output "$State"
}

$Left = 2
$Right = 3

while (($Left + $Right) -le 144) {
$Result = $Left + $Right

Write-Output "$Left plus $Right equals $Result"

$Left = $Right
$Right = $Result
}

Write-Output ""
Write-Output "divide"
Write-Output "multiply"
Write-Output "subtract"
Write-Output "add"
Write-Output "equal"
Write-Output "not equal"
Write-Output ""
Write-Output "prime"
Write-Output "composite"
Write-Output "prime"
Write-Output "prime"
Write-Output "composite"
Write-Output ""
Write-Output "cadence probability zero"
Write-Output "do not resolve"
Write-Output "repeat the final sequence"
Write-Output "end computation"
+ Style Box
from dataclasses import dataclass
from math import lcm

@dataclass
class Engine:
tempo: int = 113
pulse: int = lcm(2, 3, 5, 7)
density: float = 0.61
resolution: float = 0.0

def accent(self, n: int) -> int:
    return n % 4

def duration(self, n: int) -> int:
    return self.pulse // n

def render(self) -> list[dict]:
    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]
    return [
        {
            "section": n,
            "accent": self.accent(n),
            "duration": self.duration(n),
            "repeat": n not in (2, 3, 5, 7)
        }
        for n in primes
    ]
engine = Engine()
for event in engine.render():
print(event)

Say Something

No account needed. Just a name and, if you want, a link to your own work.