Skip to content

Instantly share code, notes, and snippets.

View lfnoise's full-sized avatar

James McCartney lfnoise

  • San Jose, CA
View GitHub Profile
@lfnoise
lfnoise / viable-heptatonic-scales
Created August 12, 2014 14:39
viable heptatonic scales
This is a chart of all 7 note pitch sets which have at least one mode which is a viable heptatonic scale.
A viable heptatonic scale is one where:
there are 7 distinct pitches.
the first degree is 0 semitones.
the second degree is 1, 2 or 3 semitones.
the third degree is 3 or 4 semitones.
the fourth degree is 5 or 6 semitones.
So how many cyclically and transpositionally unique three chord major or minor triad progressions are there? I wrote a program to find out. The answer is 296. If you allow for chord quality changes on the same root, then there are 340.
Transpose to all 12 keys:
0 C Db D
1 C Db D-
2 C Db Eb
3 C Db Eb-
4 C Db E
5 C Db E-
@lfnoise
lfnoise / 2018-07-03
Created July 4, 2018 19:55
2018-07-03. algorithmic rhythm, pitch, tuning.
\[
\i[
4 = bps
\ length attacks [attacks 1s length attacks - 0s $ muss] = randRhythm
6 rand2 78 + = root
7 0 12 nrandz sort 0 cons 12 add = scale
scale pr cr
bps 0 impulse = t
i 0 == i 6 > | = lite
[0 0 0 7 12] picks root 48 - + nnhz = bassFreqs
@lfnoise
lfnoise / virtual_arrays.nim
Last active January 17, 2022 05:42
[fixed version] my second day of trying out Nim.
import system
import math
type
VArray[T] = ref object of RootObj
len : int
VSeries[T] = ref object of VArray[T]
start, step: T
@lfnoise
lfnoise / fizzbuzz.c
Last active January 16, 2021 02:36
An implementation of fizzbuzz with only one modulo and one comparison per cycle.
//
// main.c
// fizzbuzz
//
// Created by James McCartney on 1/15/21.
//
#include <stdio.h>
void fizzbuzz(int n)
@lfnoise
lfnoise / mind_jewel_solver.cpp
Created October 14, 2021 18:33
A program for solving the Mind Jewel puzzle
// mind_jewel_solver.cpp
// mind_jewel_solver
//
// Created by James McCartney on 10/14/21.
//
// A program to solve the Mind Jewel puzzle.
#include <vector>
#include <stdio.h>
@lfnoise
lfnoise / proto_parser.rs
Last active July 18, 2022 04:06
A parser made using rust-peg.
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub struct Symbol {
name: String,
}
#[derive(Clone, Copy, Debug)]
pub struct SymbolID(usize);
@lfnoise
lfnoise / unit-test-output.txt
Last active April 23, 2024 04:47
unit tests for new audio-oriented scripting language.
RUN TESTS
>============================================================================
fn foo(x,y) {
"A" println
\a,b{ print(a,b,"; ") }(x@,y@)
"B" println
}
foo([2,3,4,5],[9,8,7,6])
"done" println