oof
This commit is contained in:
@ -32,7 +32,8 @@
|
||||
"@codemirror/search": "^6.5.11",
|
||||
"@codemirror/state": "^6.5.2",
|
||||
"@codemirror/view": "^6.38.6",
|
||||
"@csound/browser": "7.0.0-beta11",
|
||||
"@csound/browser": "^6.18.7",
|
||||
"csound7": "npm:@csound/browser@7.0.0-beta11",
|
||||
"@hlolli/codemirror-lang-csound": "1.0.0-alpha10",
|
||||
"@lezer/highlight": "^1.2.1",
|
||||
"@replit/codemirror-vim": "^6.3.0",
|
||||
|
||||
721
pnpm-lock.yaml
generated
721
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
27
project.csd
Normal file
27
project.csd
Normal file
@ -0,0 +1,27 @@
|
||||
<CsoundSynthesizer>
|
||||
<CsOptions>
|
||||
-m0
|
||||
</CsOptions>
|
||||
<CsInstruments>
|
||||
0dbfs=1
|
||||
nchnls=2
|
||||
ksmps = 64
|
||||
sr = 44100
|
||||
seed 0
|
||||
#include "globals.orc"
|
||||
#include "lib.orc"
|
||||
#include "synth.orc"
|
||||
#include "scale.orc"
|
||||
#include "livecode.orc"
|
||||
|
||||
</CsInstruments>
|
||||
<CsScore>
|
||||
f 0 z
|
||||
f 1 0 2049 -16 0 204 -5.6072 1 1843 -10 0 ; kind of karplustrong
|
||||
|
||||
|
||||
</CsScore>
|
||||
</CsoundSynthesizer>
|
||||
|
||||
|
||||
|
||||
477
public/system-files/Documentation.orc.bak
Normal file
477
public/system-files/Documentation.orc.bak
Normal file
@ -0,0 +1,477 @@
|
||||
|
||||
|
||||
|
||||
_ _ _ _ _____ _____ _ _ _____ _
|
||||
| | (_) | (_) / __ \/ __ \| \ | | / __ \ | |
|
||||
| | ___ _____ ___ ___ __| |_ _ __ __ _ | / \/| / \/| \| | | / \/ ___ __| | ___
|
||||
| | | \ \ / / _ \ / __/ _ \ / _` | | '_ \ / _` | | | | | | . ` | | | / _ \ / _` |/ _ \
|
||||
| |___| |\ V / __/ | (_| (_) | (_| | | | | | (_| | | \__/\| \__/\| |\ | | \__/\ (_) | (_| | __/
|
||||
\_____/_| \_/ \___| \___\___/ \__,_|_|_| |_|\__, | \____/ \____/\_| \_/ \____/\___/ \__,_|\___|
|
||||
__/ |
|
||||
|___/
|
||||
|
||||
|
||||
; Ce document contient toutes les informations sur les fonctions (mots) utilisables
|
||||
; dans la plateforme de livecoding.
|
||||
; Vous pouvez copier-coller les exemples dans le fichier "livecode.orc".
|
||||
|
||||
|
||||
_
|
||||
| |
|
||||
| |_ ___ _ __ ___ _ __ ___
|
||||
| __/ _ \ '_ ` _ \| '_ \ / _ \
|
||||
| || __/ | | | | | |_) | (_) |
|
||||
\__\___|_| |_| |_| .__/ \___/
|
||||
| |
|
||||
|_|
|
||||
|
||||
|
||||
; Pour modifier le tempo, il faut utiliser la fonction de tempo
|
||||
; Par défaut, le tempo est de 1, ce qui signifie 1 pulsation par seconde
|
||||
; Si on met 2, la pulsation est donc de ... 2 pulsations par secondes
|
||||
tempo(2) ; [0.001 - 10]
|
||||
; La modification du tempo modifiera la vitesse du rythme de TOUS les sons en train d'être joués
|
||||
|
||||
; Un attracteur chaotique gère d'autres paramètres du temps, on peut changer sa vitesse en écrivant
|
||||
; Il influence notamment la vitesse d'évolution des modes "sauvages" (voir les Sons)
|
||||
chaos_speed(4) ; [0.1 - 100]
|
||||
|
||||
; Pour entendre le tempo, on peut utiliser le metronome (sans accent ici pour éviter l'erreur)
|
||||
metronome
|
||||
|
||||
|
||||
_____
|
||||
/ ___|
|
||||
\ `--. ___ _ __ ___
|
||||
`--. \/ _ \| '_ \/ __|
|
||||
/\__/ / (_) | | | \__ \
|
||||
\____/ \___/|_| |_|___/
|
||||
|
||||
; "ping" - son artificiel percussif brillant
|
||||
; Paramètres :
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note) [0-100]
|
||||
; - Durée [>0]
|
||||
ping(beat(4), 0.3, 50, 1/4)
|
||||
|
||||
; "buzzy" - Un son plus doux que Ping et dont le rythme interne peut être imprévisible
|
||||
; Paramètres :
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note de base de l'accord) [0-100]
|
||||
; - Durée [>0]
|
||||
buzzy(beat(1/4), 0.5, 50, 4)
|
||||
|
||||
; "glidy" - un son qui glisse vers la note choisie
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note de base de l'accord) [0-100]
|
||||
; - Durée [>0]
|
||||
glidy(beat(1), 0.5, 60, 1)
|
||||
|
||||
; "darkwave" - une vague sombre, qui gronde quand elle devient forte
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note de base de l'accord) [0-100]
|
||||
; - Durée [>0]
|
||||
darkwave(beat(1/4), 0.6, 30, 4)
|
||||
|
||||
; "brightwave" - une vague brillante et lumineuse
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note de base de l'accord) [0-100]
|
||||
; - Durée [>0]
|
||||
brightwave(beat(1/4), 0.6, 30, 4)
|
||||
|
||||
; "buzzwave" - une vague qui fait bzzz
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note de base de l'accord) [0-100]
|
||||
; - Durée [>0]
|
||||
buzzwave(beat(1/4), 0.6, 30, 4)
|
||||
|
||||
; "noisywave" - une vague avec un bruit de fond, comme l'écume de la mer
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note de base de l'accord) [0-100]
|
||||
; - Durée [>0]
|
||||
noisywave(beat(1/4), 0.6, 30, 4)
|
||||
|
||||
; "crunchy" - un son percussif qui croustille
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note de base de l'accord) [0-100]
|
||||
; - Durée [>0]
|
||||
crunchy(beat(4), 0.6, 20, 1/4)
|
||||
|
||||
; Strike : un son percussif et très saturé (distordu, sauvage)
|
||||
; Paramètres :
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note) [0-100]
|
||||
; - Durée [>0]
|
||||
strike(beat(1), 0.9, 8, 1)
|
||||
|
||||
; Smooth : un son doux, assez rond
|
||||
; Paramètres :
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note) [0-100]
|
||||
; - Durée [>0]
|
||||
smooth(beat(1/3), 0.5, 20, 4)
|
||||
|
||||
; Bounce : un son qui rebondit et qui brille !
|
||||
; Paramètres :
|
||||
; - Rythme
|
||||
; - Volume [0-1]
|
||||
; - Hauteur (note) [0-100]
|
||||
; - Durée [>0]
|
||||
bounce(beat(1/2), 0.5, 30, 3)
|
||||
|
||||
______ _ _ _ _ _
|
||||
| ___| | | (_) | | | | | |
|
||||
| |_ ___ _ __ ___| |_ _ ___ _ __ ___ __| | ___ _ __ _ _| |_| |__ _ __ ___ ___
|
||||
| _/ _ \| '_ \ / __| __| |/ _ \| '_ \/ __| / _` |/ _ \ | '__| | | | __| '_ \| '_ ` _ \ / _ \
|
||||
| || (_) | | | | (__| |_| | (_) | | | \__ \ | (_| | __/ | | | |_| | |_| | | | | | | | | __/
|
||||
\_| \___/|_| |_|\___|\__|_|\___/|_| |_|___/ \__,_|\___| |_| \__, |\__|_| |_|_| |_| |_|\___|
|
||||
__/ |
|
||||
|___/
|
||||
|
||||
|
||||
; "beat" - pulsation régulière
|
||||
;Paramètres :
|
||||
; - Vitesse (par rapport au tempo) [> 0]
|
||||
beat(2) // 2 pulsations par temps
|
||||
|
||||
; "swing" - pulsation régulière + une pulsation swing
|
||||
; Paramètres :
|
||||
; - Vitesse (par rapport au tempo) [> 0]
|
||||
; - Swing [0 - 1]
|
||||
swing(2, 0.75)
|
||||
swing(2, 3/4)
|
||||
|
||||
; "rhythm" - rythme écrit sous la forme d'une liste
|
||||
; Paramètres :
|
||||
; - liste de 1 et 0 sous forme d'un "array"
|
||||
; - Vitesse (par rapport au tempo) [> 0]
|
||||
rhythm(array(1, 0, 0, 1, 0, 0, 1, 1 ), 1)
|
||||
; Peut aussi s'écrire
|
||||
rhythm(
|
||||
array(1, 0, 0, 1),
|
||||
1)
|
||||
|
||||
; "drunk" - rythme aléatoire mais quand même lié au tempo
|
||||
; Paramètres :
|
||||
; - Vitesse (par rapport au tempo) [> 0]
|
||||
; - Taux d'aléatoire [0 - 1]
|
||||
drunk(2, 0.8)
|
||||
|
||||
; "euclidian" - rythmes basés sur la division euclidienne
|
||||
; (voir https://dbkaplun.github.io/euclidean-rhythm/)
|
||||
; Paramètres :
|
||||
; - Vitesse [> 0]
|
||||
; - Nombre de "steps" [> 0]
|
||||
; - Division du cercle [> 0]
|
||||
; - Rotation [0 - 1]
|
||||
euclidian(2, 3, 7, 0)
|
||||
|
||||
; "chaos_rhythm" - rythmes basés sur l'horloge chaotique principale
|
||||
; Paramètres
|
||||
; - Choix de l'horloge [1, 2 ou 3]
|
||||
; - Seuil de détection [0 - 1]
|
||||
chaos_rhythm(1, 0.6)
|
||||
|
||||
|
||||
______ _ _ _ _ _
|
||||
| ___| | | (_) | | | | | |
|
||||
| |_ ___ _ __ ___| |_ _ ___ _ __ ___ __| | ___ ___ ___ _ __ | |_ _ __ ___ | | ___
|
||||
| _/ _ \| '_ \ / __| __| |/ _ \| '_ \/ __| / _` |/ _ \ / __/ _ \| '_ \| __| '__/ _ \| |/ _ \
|
||||
| || (_) | | | | (__| |_| | (_) | | | \__ \ | (_| | __/ | (_| (_) | | | | |_| | | (_) | | __/
|
||||
\_| \___/|_| |_|\___|\__|_|\___/|_| |_|___/ \__,_|\___| \___\___/|_| |_|\__|_| \___/|_|\___|
|
||||
|
||||
|
||||
|
||||
; "chance" - fait évoluer un paramètre aléatoirement - comme un lancer de dé
|
||||
; Paramètres :
|
||||
; - Minimum - valeur minimum possible [< Maximum]
|
||||
; - Maximum - valeur maximum possible [> Minimum]
|
||||
chance(1, 5) // Donnera à chaque fois un nombre (décimal) entre 1 et 5 différent
|
||||
|
||||
; "trajectory" - part d'une valeur et évolue progressivement vers une autre
|
||||
; Paramètres :
|
||||
; - Départ - valeur de départ
|
||||
; - Durée - Durée totale de l'évolution (en nombre de temps) [> 0]
|
||||
; - Arrivée - Valeur finale
|
||||
trajectory(0, 10, 1) // évolue de 0 à 1 progressivement en 10 temps
|
||||
|
||||
; "oscillation" - va et vient entre deux valeurs
|
||||
; Paramètres :
|
||||
; - Minimum : valeur minimum [< Maximum]
|
||||
; - Maximum : valeur maximum [> Minimum]
|
||||
; - Vitesse (par rapport au tempo) [> 0]
|
||||
oscillation(10, 30, 1/2) // évolue progressivement entre 10 et 30 avec un cycle de 2 temps
|
||||
|
||||
; "alternate" - alterne entre deux valeurs à une certaine vitesse et avec une proportion
|
||||
; Paramètres :
|
||||
; - Valeur 1
|
||||
; - Valeur 2
|
||||
; - Vitesse (par rapport au tempo) [> 0]
|
||||
; - Proportion de la valeur 1 [0 - 1] -
|
||||
; par exemple une proportion de 0.75 fait qu'on restera 3/4 du temps sur la valeur 1, et 1/4 du temps sur la valeur 2
|
||||
alternate(50, 55, 1, 0.75) // alterne entre 50 et 55 tous les temps (75% du temps sur valeur 1)
|
||||
|
||||
; "sequence" - lit une suite de valeurs (utile pour les notes et mélodies)
|
||||
; Paramètres :
|
||||
; - liste de valeurs
|
||||
; - Vitesse (par rapport au tempo) [> 0]
|
||||
sequence(array(30, 33, 35), 1)
|
||||
|
||||
; "chaos_control" - génère une valeur qui change en permanence en fonction de l'attracteur
|
||||
; chaotique principal
|
||||
; Paramètres :
|
||||
; - Choix de l'attracteur [1, 2 ou 3]
|
||||
; - Valeur minimum
|
||||
; - Valeur maximum
|
||||
chaos_control(1, 0.5, 1) ; Pour du volume
|
||||
chaos_control(2, 40, 60) ; Pour une note
|
||||
|
||||
|
||||
_
|
||||
| |
|
||||
_____ _____ _ __ ___ _ __ | | ___ ___
|
||||
/ _ \ \/ / _ \ '_ ` _ \| '_ \| |/ _ \/ __|
|
||||
| __/> < __/ | | | | | |_) | | __/\__ \
|
||||
\___/_/\_\___|_| |_| |_| .__/|_|\___||___/
|
||||
| |
|
||||
|_|
|
||||
|
||||
crunchy(beat(4), 0.5, 10, 1)
|
||||
tempo(0.5)
|
||||
darkwave(beat(1/2), 0.5, 30, 2)
|
||||
darkwave(beat(1/2), 0.5, 33, 2)
|
||||
darkwave(beat(1/4), 0.5, 40, 4)
|
||||
|
||||
chaos_speed(1)
|
||||
|
||||
noisywave(beat(1/4), 0.5, 50, 4)
|
||||
noisywave(beat(1/4), 0.5, 55, 4)
|
||||
|
||||
brightwave(beat(1/2), 0.7, 70, 1)
|
||||
buzzwave(beat(1/2), 0.8, 60, 2, 2)
|
||||
_ _ _ _ _ _ _
|
||||
/\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\
|
||||
\ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' /
|
||||
|_ _|_ _|_ _|_ _|_ _|_ _|_ _|
|
||||
/ , . \ / , . \ / , . \ / , . \ / , . \ / , . \ / , . \
|
||||
\/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/
|
||||
|
||||
/*
|
||||
crunchy(beat(4), 0.6, 10, 1, 2)
|
||||
crunchy(beat(8), 0.6, 50, 1, 2)
|
||||
crunchy(beat(8), 0.6, 55, 1)
|
||||
*/
|
||||
;crunchy(beat(8), 0.8, sequence(array(60, 57, 57, 63, 58), 8), 1)
|
||||
|
||||
tempo(.5)
|
||||
chaos_speed(7)
|
||||
/*
|
||||
brightwave(beat(1/8), 0.5, 50, 3, 3)
|
||||
brightwave(beat(1/8), 0.5, 53, 3)
|
||||
brightwave(beat(1/8), 0.5, 57, 3, 3)
|
||||
*/
|
||||
|
||||
/*
|
||||
glidy(beat(1/2), 0.7, 60, 2)
|
||||
glidy(beat(1/3), 0.7, 64, 2)
|
||||
glidy(beat(1/4), 0.7, 65, 2)
|
||||
*/
|
||||
|
||||
/*
|
||||
darkwave(beat(1/4), 0.6, 30, 5, 1)
|
||||
darkwave(beat(1/4), 0.6, 32, 5, 1)
|
||||
darkwave(beat(1/4), 0.6, 27, 5)
|
||||
darkwave(beat(1/4), 0.6, 20, 5)
|
||||
*/
|
||||
|
||||
_ _ _ _ _ _ _
|
||||
/\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\
|
||||
\ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' /
|
||||
|_ _|_ _|_ _|_ _|_ _|_ _|_ _|
|
||||
/ , . \ / , . \ / , . \ / , . \ / , . \ / , . \ / , . \
|
||||
\/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/
|
||||
|
||||
/*
|
||||
darkwave(beat(1/4), .7, 60, 4)
|
||||
darkwave(beat(1/6), .7, 42, 4)
|
||||
darkwave(beat(1/4), .7, 67, 4)
|
||||
darkwave(beat(1/6), .7, 10, 4)
|
||||
|
||||
|
||||
crunchy(beat(4), 0.9, 10, 1, 2)
|
||||
crunchy(beat(8), 0.7, 50, 1, 2)
|
||||
crunchy(beat(8), 0.7, 55, 1)
|
||||
|
||||
crunchy(beat(8), 0.7, sequence(array(60, 57, 57, 63, 58), 8), 1)
|
||||
|
||||
tempo(.125)
|
||||
chaos_speed(8)
|
||||
|
||||
ping(beat(4), 1, sequence(array(50, 55, 50, 57, 50, 58), 1), 1)
|
||||
*/
|
||||
/*
|
||||
brightwave(beat(1/8), 0.5, 50, 3, 3)
|
||||
brightwave(beat(1/8), 0.5, 53, 3)
|
||||
brightwave(beat(1/8), 0.5, 57, 3, 3)
|
||||
*/
|
||||
/*
|
||||
brightwave(beat(1/8), 0.5, 50, 3, 3)
|
||||
brightwave(beat(1/8), 0.5, 53, 3)
|
||||
brightwave(beat(1/8), 0.5, 57, 3, 3)
|
||||
*/
|
||||
/*
|
||||
tempo(1)
|
||||
glidy(beat(1/2), 0.3, 60, 2)
|
||||
glidy(beat(1/3), 0.3, 64, 3)
|
||||
glidy(beat(1/4), 0.4, 65, 4)
|
||||
glidy(beat(1/7), 0.5, 40, 5)
|
||||
glidy(beat(1/5), 0.4, 44, 6)
|
||||
glidy(beat(1/6), 0.5, 45, 7)
|
||||
*/
|
||||
/*
|
||||
noisywave(beat(1/4), 0.9, 20, 6)
|
||||
noisywave(beat(1/4), 0.9, 48, 6)
|
||||
noisywave(beat(1/8), 0.9, 34, 6)
|
||||
noisywave(beat(1/8), 0.9, 39, 6)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_ _ _ _ _ _ _
|
||||
/\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\
|
||||
\ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' /
|
||||
|_ _|_ _|_ _|_ _|_ _|_ _|_ _|
|
||||
/ , . \ / , . \ / , . \ / , . \ / , . \ / , . \ / , . \
|
||||
\/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/
|
||||
|
||||
|
||||
|
||||
tempo(1)
|
||||
chaos_speed(1)
|
||||
darkwave(beat(1/4), .5, 60, 4)
|
||||
darkwave(beat(1/6), .65, 36, 6)
|
||||
darkwave(beat(1/8), .65, 38, 8)
|
||||
darkwave(beat(1/4), .65, 67, 4)
|
||||
darkwave(beat(1/6), .65, 24, 6)
|
||||
darkwave(beat(1/3), .65, 40, 4)
|
||||
darkwave(beat(1/5), .65, 31, 5)
|
||||
|
||||
crunchy(beat(4), 1, 12, 1/2, 2)
|
||||
crunchy(beat(1), 1, 22, 1)
|
||||
crunchy(beat(8), 0.6, 50, 1/2, 2)
|
||||
crunchy(beat(8), 0.6, 55, 1/2)
|
||||
|
||||
crunchy(beat(8), 0.7, sequence(array(60, 57, 57, 63, 58), 8), 1/2)
|
||||
crunchy(beat(8), 0.8, sequence(array(72, 48, 74, 75, 46, 50, 78), 8), 1/2)
|
||||
|
||||
|
||||
/*
|
||||
tempo(.125)
|
||||
chaos_speed(8)
|
||||
|
||||
ping(beat(4), 1, sequence(array(50, 55, 50, 57, 50, 58), 1), 1)
|
||||
*/
|
||||
/*
|
||||
brightwave(beat(1/8), 0.5, 50, 3, 3)
|
||||
brightwave(beat(1/8), 0.5, 53, 3)
|
||||
brightwave(beat(1/8), 0.5, 57, 3, 3)
|
||||
*/
|
||||
/*
|
||||
brightwave(beat(1/8), 0.5, 50, 3, 3)
|
||||
brightwave(beat(1/8), 0.5, 53, 3)
|
||||
brightwave(beat(1/8), 0.5, 57, 3, 3)
|
||||
*/
|
||||
/*
|
||||
tempo(1)
|
||||
glidy(beat(1/2), 0.3, 60, 2)
|
||||
glidy(beat(1/3), 0.3, 64, 3)
|
||||
glidy(beat(1/4), 0.4, 65, 4)
|
||||
glidy(beat(1/7), 0.5, 40, 5)
|
||||
glidy(beat(1/5), 0.4, 44, 6)
|
||||
glidy(beat(1/6), 0.5, 45, 7)
|
||||
*/
|
||||
/*
|
||||
noisywave(beat(1/4), 0.9, 20, 6)
|
||||
noisywave(beat(1/4), 0.9, 48, 6)
|
||||
noisywave(beat(1/8), 0.9, 34, 6)
|
||||
noisywave(beat(1/8), 0.9, 39, 6)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Exemple réalisé en première séance à l'école du Centre
|
||||
crunchy(beat(2), 0.9, chance(15, 80), 0.5)
|
||||
buzzy(beat(1/4), 0.8, 10, 4)
|
||||
tempo(4)
|
||||
glidy(beat(1), 0.6, 60, 1)
|
||||
darkwave(beat(1/4), 0.9, 30, 4)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
ping(beat(8), 1, 10, 1/8)
|
||||
ping(beat(8), 1, sequence(array(20, 22), 1/4), 1/8)
|
||||
crunchy(beat(4), 0.9, chance(30, 80), 1/6)
|
||||
crunchy(beat(4), 0.8, chance(30, 80), 1/6)
|
||||
kick(beat(2), 0.5)
|
||||
snare(beat(1), 0.8, 100, 1/10)
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
noisywave(beat(1/4), 0.6, 80, 4)
|
||||
noisywave(beat(1/8), 0.6, 60, 8)
|
||||
noisywave(beat(1/6), 0.6, 40, 6)
|
||||
snare(rhythm(array(1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1), 8), 0.5)
|
||||
kick(rhythm(array(0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0), 8), 0.7)
|
||||
*/
|
||||
|
||||
/*
|
||||
; MELODY
|
||||
ping(beat(2), oscillation(.5, 1, 1/2), sequence(array(52, 55, 50, 48, 50)+sequence(array(2, 0), 2), 2), oscillation(.5, 2, 1/2))
|
||||
|
||||
; CHORD
|
||||
buzzwave(beat(4), oscillation(0, .5, 1/6), sequence(array(52, 55, 50, 48, 50)-24, 1/2), 1)
|
||||
buzzwave(beat(4), oscillation(0, .5, 1/3), sequence(array(52, 55, 50, 48, 50)-7, 1/2), 2)
|
||||
|
||||
; BUZZ
|
||||
noisywave(beat(1/4), .5, sequence(array(52, 55), 2), 8)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
_ _ _ _ _ _ _
|
||||
/\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\ /\| |/\
|
||||
\ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' / \ ` ' /
|
||||
|_ _|_ _|_ _|_ _|_ _|_ _|_ _|
|
||||
/ , . \ / , . \ / , . \ / , . \ / , . \ / , . \ / , . \
|
||||
\/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/ \/|_|\/
|
||||
|
||||
; Rythme 1
|
||||
kick(swing(1, 0.75), 0.5)
|
||||
snare(swing(0.5, 0.25), 0.7)
|
||||
hihat( rhythm(array(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1), 4), 0.5, 95, 0.1)
|
||||
|
||||
|
||||
|
||||
|
||||
; Ping à corriger
|
||||
; Noisywave avec mode sauvage ou son grave avec mode sauvage aussi
|
||||
@ -140,14 +140,14 @@
|
||||
kmet = drunk(0.125, 0.25)
|
||||
ktog init 0
|
||||
krhythm_mult init 1
|
||||
if(kmet == 1 ) then
|
||||
if (kmet == 1 ) then
|
||||
ktog = 1 - ktog
|
||||
if(rint:k(1, 6) == 1) then
|
||||
if (rint:k(1, 6) == 1) then
|
||||
krhythm_mult = rint:k(1, 3)
|
||||
endif
|
||||
endif
|
||||
|
||||
if(ktog == 1) then
|
||||
if (ktog == 1) then
|
||||
strike( rhythm(array(1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1), 4 * krhythm_mult),
|
||||
oscillation(0.1, 0.6, 10),
|
||||
sequence(array(60, 64, 66, 67, 69), 8) +
|
||||
|
||||
162
public/system-files/archives.orc.bak
Normal file
162
public/system-files/archives.orc.bak
Normal file
@ -0,0 +1,162 @@
|
||||
|
||||
kick(swing(1, 0.75), 0.5)
|
||||
snare(swing(0.5, 0.25), 0.7)
|
||||
hihat( rhythm(array(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1), 4), 0.3, 95, 0.05)
|
||||
|
||||
tempo(0.5)
|
||||
chaos_speed(0.5)
|
||||
; Base rythmique
|
||||
crunchy(beat(8), 1, 8, 1/4)
|
||||
crunchy(beat(2), 1, 20, 1/2)
|
||||
crunchy(beat(8), 1, trajectory(60, 15, 30), 1/4)
|
||||
crunchy(beat(4), 1, 23, 1/4)
|
||||
|
||||
; Mélodie aléatoire
|
||||
buzzy(beat(8), 0.8, chance(60, 90), 1/16)
|
||||
buzzy(beat(8), 0.8, chance(70, 80), 1/16)
|
||||
buzzy(beat(4), 0.8, trajectory(80, 10, 60), 1/8)
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
ping(beat(1), 0.8, 50,1)
|
||||
ping(beat(1/2), 0.2, 90,2)
|
||||
ping(beat(4), 0.9, 41, 1/3)
|
||||
ping(beat(4), 0.9, 46, 1/4)
|
||||
ping(beat(1/2), 0.8, 37,3)
|
||||
ping(beat(1/4), 0.8, 60,4)
|
||||
ping(beat(1/2), 0.8, 62,2)
|
||||
ping(beat(1/6), 0.8, 67,6)
|
||||
|
||||
buzzwave(beat(1/3), 0.8, sequence(array(20, 25), 1), 3)
|
||||
|
||||
tempo(1)
|
||||
snare(swing(2, 0.25), 0.9)
|
||||
kick(swing(0.5, 0.75), 0.5)
|
||||
hihat( swing(4, 0.25), 0.6, chance(80, 100), 0.1)
|
||||
hihat( beat(8), 0.8, 100, 0.05)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Lunégroove
|
||||
noisywave(beat(1/4), 0.9, sequence(array(20, 30, 23, 27), 1/4), 4)
|
||||
noisywave(beat(1/8), 0.9, sequence(array(60, 60, 65, 53), 1/8), 8)
|
||||
noisywave(beat(1/6), 0.9, sequence(array(40, 43, 46), 1/6), 6)
|
||||
glidy(rhythm(array(1, 1, 1, 0, 0, 1), 2), 0.5, sequence(array(70, 75, 53, 51), 3), 1/4)
|
||||
glidy(rhythm(array(0, 1, 0, 1, 1, 1), 2), 0.5, sequence(array(73, 65, 60), 3), 1/2)
|
||||
brightwave(beat(1/4), 1, sequence(array(15, 18, 23), 1/4), 7)
|
||||
|
||||
snare(rhythm(array(1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1), 4), 0.5)
|
||||
kick(rhythm(array(0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0), 2), 0.7)
|
||||
tempo(1)
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; LA VOITURE EN PANNE !!!!!!
|
||||
|
||||
tempo(1.5)
|
||||
kick(rhythm(array(1, 0, 0, 0, 0, 1, 0, 0), 2), 0.45)
|
||||
snare(rhythm(array(0, 0, 1, 0, 0, 0, 1, 0), 2), 0.25)
|
||||
hihat(beat(4), 0.15, 95, 1/12)
|
||||
|
||||
ping(beat(2), 0.45, sequence(array(20, 21), 1/8), .5)
|
||||
ping(beat(1/4), .95, sequence(array(20, 21)-12, 1/8), 4)
|
||||
|
||||
crunchy(beat(1), .95, sequence(array(20, 18, 28, 21), 1/7)+12*sequence(array(1, 2, 3), 1), 1+sequence(array(1, 2, 3), 1))
|
||||
|
||||
brightwave(swing(1/8, .95), 0.55, sequence(array(21, 20, 25, 30)+24, 1/8), 6)
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; on va faire fortune dans le reggae
|
||||
|
||||
tempo(1)
|
||||
crunchy(rhythm(array(1, 1, 1, 1, 1, 1, 0, 0), 8), 0.8, sequence(array(11, 17), 1/2), 1/4)
|
||||
|
||||
ping(rhythm(array(0, 1), 2), 0.9, sequence(array(43, 41), 1/2), 0.25 )
|
||||
ping(rhythm(array(0, 1), 2), 0.9, sequence(array(47, 45), 1/2), 0.25)
|
||||
ping(rhythm(array(0, 1), 2), 0.9, sequence(array(50, 48), 1/2), 0.25)
|
||||
|
||||
glidy(beat(1/4), 0.2, sequence(array(49, 55, 52, 67, 46, 70), 1/4), 6)
|
||||
|
||||
kick(rhythm(array(1, 0), 2), 0.8)
|
||||
snare(beat(1), 0.6)
|
||||
hihat(rhythm(array(1, 1, 1, 0, 1, 0), 6), 0.7, 90, 0.1)
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Ardoise
|
||||
tempo(1.25)
|
||||
kick(rhythm(array(1, 1, 0, 0, 0, 1), 4), .5)
|
||||
snare(beat(1/2), .5)
|
||||
hihat(rhythm(array(0, 1, 1, 0, 1, 1, 1), 4), .25, 95-4*swing(1, .25), 1/8)
|
||||
|
||||
ping(beat(6), .35, sequence(array(48, 51, 55, 60, 48, 51, 55, 60, 47, 51, 55, 60, 44, 51, 55, 60), oscillation(6, 12, 1/32)), oscillation(.25, 3, 1/8))
|
||||
ping(beat(6), .35, sequence(array(48, 51, 55, 60, 48, 51, 55, 60, 47, 51, 55, 60, 44, 51, 55, 60), oscillation(2, 16, 1/24)), oscillation(.25, 3, 1/3))
|
||||
darkwave(beat(3), .85, sequence(array(48, 51, 55, 60, 47, 51, 55, 60, 44, 51, 55, 60)-24, oscillation(3, 9, 1/48)), oscillation(1, 3, 1/3))
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;KS
|
||||
chaos_speed(1)
|
||||
$tempo = .5
|
||||
;ks(beat(1), 0.8, 44, .5)
|
||||
ks(beat(.25), 0.8, 16, .5)
|
||||
ks(beat(1), 0.9, 52, .5)
|
||||
ks(beat(3), 0.9, 64, 1)
|
||||
ks(beat(4), 0.9, 83, 2)
|
||||
;ks(beat(8), 0.5, sequence(array(75, 83, 80, 85, 83), 1), .25)
|
||||
;ks(beat( alternate(.5, 2, .5, 0.5) ), 0.8, 30, 1)
|
||||
|
||||
;ping(beat(4), 0.8, 72, .8)
|
||||
;crunchy(beat(16), 0.6, trajectory(16, 4, 32), .5)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;MOBILE 1
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
$tempo = 0.25
|
||||
klf = abs(lfo:k(1, 0.05))
|
||||
kilf = 1 - klf
|
||||
strike(beat(1/16), 0.9 * klf , alternate(40, 28, 1/4, 0.5), 16)
|
||||
strike(beat(1/16), 0.9 * klf , alternate(6, 18, 1/4, 0.5), 16)
|
||||
strike(beat(1/12), 0.9 * kilf , alternate(30, 18, 1/8, 0.5), 12)
|
||||
|
||||
kmet = drunk(0.125, 0.25)
|
||||
ktog init 0
|
||||
krhythm_mult init 1
|
||||
if(kmet == 1 ) then
|
||||
ktog = 1 - ktog
|
||||
if(rint:k(1, 6) == 1) then
|
||||
krhythm_mult = rint:k(1, 3)
|
||||
endif
|
||||
endif
|
||||
|
||||
if(ktog == 1) then
|
||||
strike( rhythm(array(1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1), 4 * krhythm_mult),
|
||||
oscillation(0.1, 0.6, 10),
|
||||
sequence(array(60, 64, 66, 67, 69), 8) +
|
||||
sequence(array(2, 3, 8, 1, 5, 10), 3.3), 1/2)
|
||||
else
|
||||
buzzy(beat(krhythm_mult * 2), 0.9, oscillation(40, 70, 10), 1)
|
||||
buzzy(beat(1/2), 0.8 * klf , alternate(44, 33, 1/4, 0.5), 2)
|
||||
buzzy(beat(1/3), 0.8 * kilf , alternate(24, 21, 1/8, 0.5), 2)
|
||||
endif
|
||||
|
||||
smooth(drunk(1/10, 0.3), 0.5, sequence(array(60, 30, 64, 67), 1), 8)
|
||||
smooth(drunk(1/9, 0.3), 0.5, sequence(array(48, 18, 66, 70, 65), 1/2), 8)
|
||||
9
public/system-files/examples.orc.bak
Normal file
9
public/system-files/examples.orc.bak
Normal file
@ -0,0 +1,9 @@
|
||||
░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░░▒▓██████████████▓▒░░▒▓███████▓▒░░▒▓█▓▒░ ░▒▓████████▓▒░░▒▓███████▓▒░
|
||||
░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░
|
||||
░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░
|
||||
░▒▓██████▓▒░ ░▒▓██████▓▒░░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░░▒▓█▓▒░ ░▒▓██████▓▒░ ░▒▓██████▓▒░
|
||||
░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░
|
||||
░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░
|
||||
░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓████████▓▒░▒▓████████▓▒░▒▓███████▓▒░
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ endin
|
||||
|
||||
opcode metronome, 0, 0
|
||||
kmet = gkbeat
|
||||
if(kmet == 1) then
|
||||
if (kmet == 1) then
|
||||
schedulek("metronome_instr", 0, 0.1)
|
||||
endif
|
||||
endop
|
||||
@ -101,15 +101,15 @@ schedule("lorenz_sched", 0, $LORENZ_TIME)
|
||||
ifq mtof inote
|
||||
|
||||
ksavage init 0
|
||||
if(isavage_mode == 1) then
|
||||
if (isavage_mode == 1) then
|
||||
ksavage = savage_1()
|
||||
elseif(isavage_mode == 2) then
|
||||
elseif (isavage_mode == 2) then
|
||||
ksavage = savage_2()
|
||||
elseif(isavage_mode == 3) then
|
||||
elseif (isavage_mode == 3) then
|
||||
ksavage = savage_3()
|
||||
elseif(isavage_mode == 4) then
|
||||
elseif (isavage_mode == 4) then
|
||||
ksavage = savage_4()
|
||||
elseif(isavage_mode == 5) then
|
||||
elseif (isavage_mode == 5) then
|
||||
ksavage = savage_5()
|
||||
endif
|
||||
|
||||
@ -119,30 +119,30 @@ schedule("lorenz_sched", 0, $LORENZ_TIME)
|
||||
#define FQPERC #
|
||||
isavage_mode = rint:i(1, 5)
|
||||
ksavage init 0
|
||||
if(isavage_mode == 1) then
|
||||
if (isavage_mode == 1) then
|
||||
ksavage = savage_1()
|
||||
elseif(isavage_mode == 2) then
|
||||
elseif (isavage_mode == 2) then
|
||||
ksavage = savage_2()
|
||||
elseif(isavage_mode == 3) then
|
||||
elseif (isavage_mode == 3) then
|
||||
ksavage = savage_3()
|
||||
elseif(isavage_mode == 4) then
|
||||
elseif (isavage_mode == 4) then
|
||||
ksavage = savage_4()
|
||||
elseif(isavage_mode == 5) then
|
||||
elseif (isavage_mode == 5) then
|
||||
ksavage = savage_5()
|
||||
endif
|
||||
#
|
||||
|
||||
#define SAVAGE(isavage_mode') #
|
||||
ksavage init 0
|
||||
if(isavage_mode == 1) then
|
||||
if (isavage_mode == 1) then
|
||||
ksavage = savage_1()
|
||||
elseif(isavage_mode == 2) then
|
||||
elseif (isavage_mode == 2) then
|
||||
ksavage = savage_2()
|
||||
elseif(isavage_mode == 3) then
|
||||
elseif (isavage_mode == 3) then
|
||||
ksavage = savage_3()
|
||||
elseif(isavage_mode == 4) then
|
||||
elseif (isavage_mode == 4) then
|
||||
ksavage = savage_4()
|
||||
elseif(isavage_mode == 5) then
|
||||
elseif (isavage_mode == 5) then
|
||||
ksavage = savage_5()
|
||||
endif
|
||||
#
|
||||
|
||||
159
public/system-files/globals.orc.bak
Normal file
159
public/system-files/globals.orc.bak
Normal file
@ -0,0 +1,159 @@
|
||||
gktempo init 1
|
||||
gkphasor init 0
|
||||
gkslowph init 0
|
||||
gkbeat init 0
|
||||
gkgain init 0.05
|
||||
#define tempo #gktempo#
|
||||
|
||||
instr metronome_instr
|
||||
kenv = expseg(1.01, p3, 0.01) - 0.01
|
||||
asig = oscili(0.3, 3000) * kenv
|
||||
chnmix(asig, "out1")
|
||||
chnmix(asig, "out2")
|
||||
endin
|
||||
|
||||
opcode metronome, 0, 0
|
||||
kmet = gkbeat
|
||||
if(kmet == 1) then
|
||||
schedulek("metronome_instr", 0, 0.1)
|
||||
endif
|
||||
endop
|
||||
|
||||
instr gclock
|
||||
gkphasor = phasor:k(gktempo)
|
||||
gkslowph = phasor:k(gktempo / 100)
|
||||
gkbeat = metro:k(gktempo)
|
||||
endin
|
||||
schedule("gclock", 0, -1)
|
||||
|
||||
opcode reset_clock, 0, 0
|
||||
turnoff2( nstrnum("gclock"), 0, 0)
|
||||
schedule("gclock", 0.01, -1)
|
||||
endop
|
||||
|
||||
instr audio_out
|
||||
|
||||
a1 = clip:a(chnget:a("out1"), 0, 0.99);limit:a(chnget:a("out1"), -1, 1) ;* gkgain
|
||||
a2 = clip:a(chnget:a("out2"), 0, 0.99);limit:a(chnget:a("out2"), -1, 1) ;* gkgain
|
||||
chnclear("out1")
|
||||
chnclear("out2")
|
||||
outs a1, a2
|
||||
endin
|
||||
schedule("audio_out", 0, -1)
|
||||
|
||||
|
||||
gklorenz_speed init 0.00001
|
||||
|
||||
gklorenz_x init 0
|
||||
gklorenz_y init 0
|
||||
gklorenz_z init 0
|
||||
gkmirlorenz_x init 0
|
||||
gkmirlorenz_y init 0
|
||||
gkmirlorenz_z init 0
|
||||
galorenz_x init 0
|
||||
galorenz_y init 0
|
||||
galorenz_z init 0
|
||||
|
||||
opcode lorenz_ctl, aaa, kppp
|
||||
kspeed, ix, iy, iz xin
|
||||
kspeed = limit:k(kspeed, 0.0000001, 0.09)
|
||||
ksv init 10
|
||||
krv init 28
|
||||
kbv init 2.6
|
||||
; kh init 0.001
|
||||
kh = kspeed
|
||||
ix = (ix != 0) ? ix : 0.6
|
||||
iy = (iy != 0) ? iy : 0.6
|
||||
iz = (iz != 0) ? iz : 0.6
|
||||
iskip = 1
|
||||
ax1, ay1, az1 lorenz ksv, krv, kbv, kh, ix, iy, iz, iskip
|
||||
|
||||
ax1 /= krv
|
||||
ay1 /= krv
|
||||
az1 /= krv
|
||||
|
||||
xout ax1, ay1, az1
|
||||
endop
|
||||
|
||||
#define LORENZ_TIME #720#
|
||||
|
||||
instr lorenz_sched
|
||||
ix = random:i(0, 1)
|
||||
iy = random:i(0, 1)
|
||||
iz = random:i(0, 1)
|
||||
ax, ay, az lorenz_ctl gklorenz_speed, ix, iy, iz
|
||||
gklorenz_x = lag(k(ax), 0.01)
|
||||
gklorenz_y = lag(k(ay), 0.01)
|
||||
gklorenz_z = lag(k(az), 0.01)
|
||||
gkmirlorenz_x = mirror:k(gklorenz_x, 0, 1)
|
||||
gkmirlorenz_y = mirror:k(gklorenz_y, 0, 1)
|
||||
gkmirlorenz_z = mirror:k(gklorenz_z, 0, 1)
|
||||
galorenz_x = ax
|
||||
galorenz_y = ay
|
||||
galorenz_z = az
|
||||
schedule("lorenz_sched", $LORENZ_TIME, $LORENZ_TIME)
|
||||
endin
|
||||
|
||||
schedule("lorenz_sched", 0, $LORENZ_TIME)
|
||||
|
||||
#define FQ #
|
||||
isavage_mode init p6
|
||||
ifq mtof inote
|
||||
|
||||
ksavage init 0
|
||||
if(isavage_mode == 1) then
|
||||
ksavage = savage_1()
|
||||
elseif(isavage_mode == 2) then
|
||||
ksavage = savage_2()
|
||||
elseif(isavage_mode == 3) then
|
||||
ksavage = savage_3()
|
||||
elseif(isavage_mode == 4) then
|
||||
ksavage = savage_4()
|
||||
elseif(isavage_mode == 5) then
|
||||
ksavage = savage_5()
|
||||
endif
|
||||
|
||||
kfq = limit:k(ifq + (ksavage * ifq), 20, 20000)
|
||||
#
|
||||
|
||||
#define FQPERC #
|
||||
isavage_mode = rint:i(1, 5)
|
||||
ksavage init 0
|
||||
if(isavage_mode == 1) then
|
||||
ksavage = savage_1()
|
||||
elseif(isavage_mode == 2) then
|
||||
ksavage = savage_2()
|
||||
elseif(isavage_mode == 3) then
|
||||
ksavage = savage_3()
|
||||
elseif(isavage_mode == 4) then
|
||||
ksavage = savage_4()
|
||||
elseif(isavage_mode == 5) then
|
||||
ksavage = savage_5()
|
||||
endif
|
||||
#
|
||||
|
||||
#define SAVAGE(isavage_mode') #
|
||||
ksavage init 0
|
||||
if(isavage_mode == 1) then
|
||||
ksavage = savage_1()
|
||||
elseif(isavage_mode == 2) then
|
||||
ksavage = savage_2()
|
||||
elseif(isavage_mode == 3) then
|
||||
ksavage = savage_3()
|
||||
elseif(isavage_mode == 4) then
|
||||
ksavage = savage_4()
|
||||
elseif(isavage_mode == 5) then
|
||||
ksavage = savage_5()
|
||||
endif
|
||||
#
|
||||
|
||||
opcode tempo, 0, k
|
||||
kval xin
|
||||
$tempo = limit:k(kval, 0.001, 10)
|
||||
endop
|
||||
|
||||
opcode chaos_speed, 0, k
|
||||
kval xin
|
||||
gklorenz_speed = 0.0000001 * (limit:k(kval, 0.01, 100) * 10)
|
||||
endop
|
||||
|
||||
@ -57,7 +57,7 @@ opcode array_rhythm, k, k[]
|
||||
kcnt init 0
|
||||
ilen = lenarray(karr)
|
||||
ktrig = 0
|
||||
if( kmet > 0 ) then
|
||||
if ( kmet > 0 ) then
|
||||
kval = karr[kcnt]
|
||||
ktrig = kval
|
||||
kcnt = (kcnt + 1) % ilen
|
||||
@ -82,7 +82,7 @@ opcode phase_trig, k, k
|
||||
kold init 1
|
||||
ktrigger init 0
|
||||
ktrigger = 0
|
||||
if(kold > kphase) then
|
||||
if (kold > kphase) then
|
||||
ktrigger = 1
|
||||
endif
|
||||
kold = kphase
|
||||
@ -92,7 +92,7 @@ endop
|
||||
opcode downprint, 0, kki
|
||||
kprint, kdown, imargin xin
|
||||
kcnt init 0
|
||||
if(kcnt == 0) then
|
||||
if (kcnt == 0) then
|
||||
printk2(kprint, imargin)
|
||||
endif
|
||||
kcnt = (kcnt + 1) % kdown
|
||||
@ -101,13 +101,13 @@ endop
|
||||
|
||||
opcode phasor_fqmult, k, kk
|
||||
kphase, kmult xin
|
||||
if(kmult <= 0) then
|
||||
if (kmult <= 0) then
|
||||
kmult = 1
|
||||
endif
|
||||
kfphase init 0
|
||||
if(kmult <= 1) then
|
||||
if (kmult <= 1) then
|
||||
kfphase = mfmod(gkslowph * (kmult * 100), 1)
|
||||
elseif(kmult > 1) then
|
||||
elseif (kmult > 1) then
|
||||
kfphase = mfmod(gkslowph * (kmult * 100), 1)
|
||||
;kfphase= mfmod(gkphasor * kmult, 1)
|
||||
endif
|
||||
@ -117,7 +117,7 @@ endop
|
||||
opcode rh_subd, k, k[]P
|
||||
karr[], kpdiv xin
|
||||
ilen = lenarray(karr)
|
||||
if(kpdiv <= 0) then
|
||||
if (kpdiv <= 0) then
|
||||
kpdiv = ilen
|
||||
endif
|
||||
kdiv = kpdiv
|
||||
@ -125,7 +125,7 @@ opcode rh_subd, k, k[]P
|
||||
ktr = phase_trig(kph)
|
||||
kidx init 0
|
||||
ktrigger = 0
|
||||
if(ktr == 1) then
|
||||
if (ktr == 1) then
|
||||
ktrigger = karr[kidx]
|
||||
kidx = (kidx+1) % ilen
|
||||
endif
|
||||
@ -135,7 +135,7 @@ endop
|
||||
opcode rhythm, k, k[]P
|
||||
karr[], kpdiv xin
|
||||
ilen = lenarray(karr)
|
||||
if(kpdiv <= 0) then
|
||||
if (kpdiv <= 0) then
|
||||
kpdiv = ilen
|
||||
endif
|
||||
kdiv = kpdiv
|
||||
@ -143,7 +143,7 @@ opcode rhythm, k, k[]P
|
||||
ktr = phase_trig(kph)
|
||||
kidx init 0
|
||||
ktrigger = 0
|
||||
if(ktr == 1) then
|
||||
if (ktr == 1) then
|
||||
ktrigger = karr[kidx]
|
||||
kidx = (kidx+1) % ilen
|
||||
endif
|
||||
@ -166,7 +166,7 @@ opcode swing, k, kk
|
||||
kph = phasor_fqmult(gkphasor, kspeed)
|
||||
ktr1 = phase_trig(kph)
|
||||
ktr2 = 0
|
||||
if(kold < ksw && kph >= ksw) then
|
||||
if (kold < ksw && kph >= ksw) then
|
||||
ktr2 = 0.6
|
||||
endif
|
||||
kold = kph
|
||||
@ -219,16 +219,16 @@ endop
|
||||
opcode alternate, k, kkkO
|
||||
kone, ktwo, kspeed, kduty xin
|
||||
|
||||
if(kduty == 0) then
|
||||
if (kduty == 0) then
|
||||
kduty = 0.5
|
||||
endif
|
||||
if(kspeed <= 0) then
|
||||
if (kspeed <= 0) then
|
||||
kspeed = 1
|
||||
endif
|
||||
kspeed = limit:k(to_tempo_dur(kspeed), 0.0001, 1000)
|
||||
kph = phasor_fqmult(gkphasor, kspeed)
|
||||
kres init i(kone)
|
||||
if(kph < kduty) then
|
||||
if (kph < kduty) then
|
||||
kres = kone
|
||||
else
|
||||
kres = ktwo
|
||||
@ -245,7 +245,7 @@ endop
|
||||
|
||||
opcode oscillation, k, kkk
|
||||
kmin, kmax, kspeed xin
|
||||
if(kmin > kmax) then
|
||||
if (kmin > kmax) then
|
||||
ktmp = kmin
|
||||
kmin = kmax
|
||||
kmax = ktmp
|
||||
@ -262,14 +262,14 @@ endop
|
||||
opcode sequence, k, k[]P
|
||||
karr[], kpdiv xin
|
||||
ilen = lenarray(karr)
|
||||
if(kpdiv <= 0) then
|
||||
if (kpdiv <= 0) then
|
||||
kpdiv = ilen
|
||||
endif
|
||||
kdiv = kpdiv
|
||||
kph = phasor_fqmult(gkphasor, kdiv )
|
||||
ktr = phase_trig(kph)
|
||||
kidx init 0
|
||||
if(ktr == 1) then
|
||||
if (ktr == 1) then
|
||||
kidx = (kidx+1) % ilen
|
||||
endif
|
||||
ktrigger = karr[kidx]
|
||||
@ -313,15 +313,15 @@ opcode savage_1, k, 0
|
||||
|
||||
ksel init 0
|
||||
ksel_sig init 0
|
||||
if(trigger:k(kmod, 0.5, 0) == 1) then
|
||||
if (trigger:k(kmod, 0.5, 0) == 1) then
|
||||
ksel = rint:k(0, 2)
|
||||
endif
|
||||
|
||||
if(ksel == 0) then
|
||||
if (ksel == 0) then
|
||||
ksel_sig = k1
|
||||
elseif(ksel == 1) then
|
||||
elseif (ksel == 1) then
|
||||
ksel_sig = k2
|
||||
elseif(ksel == 2) then
|
||||
elseif (ksel == 2) then
|
||||
ksel_sig = k3
|
||||
endif
|
||||
|
||||
@ -341,7 +341,7 @@ opcode savage_3, k, 0
|
||||
kduty = gkmirlorenz_y
|
||||
kph = phasor:k(gkmirlorenz_x * 5 )
|
||||
kres init 0
|
||||
if(kph < kduty) then
|
||||
if (kph < kduty) then
|
||||
kres = 1
|
||||
else
|
||||
kres = 0
|
||||
@ -358,7 +358,7 @@ opcode savage_4, k, 0
|
||||
kchange init 1
|
||||
kchange = changed:k(round(abs(gklorenz_x )))
|
||||
kmod init 1
|
||||
if(kchange == 1) then
|
||||
if (kchange == 1) then
|
||||
iarr[0] = random:i(0, 1)
|
||||
iarr[1] = random:i(0, 1)
|
||||
iarr[2] = random:i(0, 1)
|
||||
@ -381,11 +381,11 @@ opcode chaos_rhythm, k, kk
|
||||
kthresh = limit:k(kthresh, 0, 1)
|
||||
kchoice = int(limit:k(kchoice, 1, 3.99))
|
||||
kval init 0
|
||||
if(kchoice == 1) then
|
||||
if (kchoice == 1) then
|
||||
kval = gkmirlorenz_x
|
||||
elseif(kchoice == 2) then
|
||||
elseif (kchoice == 2) then
|
||||
kval = gkmirlorenz_y
|
||||
elseif(kchoice == 3) then
|
||||
elseif (kchoice == 3) then
|
||||
kval = gkmirlorenz_z
|
||||
endif
|
||||
|
||||
@ -399,11 +399,11 @@ opcode chaos_control, k, kkk
|
||||
kmin = min:k(kmin, kmax)
|
||||
kchoice = int(limit:k(kchoice, 1, 3.99))
|
||||
kval init 0
|
||||
if(kchoice == 1) then
|
||||
if (kchoice == 1) then
|
||||
kval = gkmirlorenz_x
|
||||
elseif(kchoice == 2) then
|
||||
elseif (kchoice == 2) then
|
||||
kval = gkmirlorenz_y
|
||||
elseif(kchoice == 3) then
|
||||
elseif (kchoice == 3) then
|
||||
kval = gkmirlorenz_z
|
||||
endif
|
||||
kdiff = kmax - kmin
|
||||
|
||||
414
public/system-files/lib.orc.bak
Normal file
414
public/system-files/lib.orc.bak
Normal file
@ -0,0 +1,414 @@
|
||||
; instruments management
|
||||
instr KillImpl
|
||||
Sinstr = p4
|
||||
if (nstrnum(Sinstr) > 0) then
|
||||
turnoff2(Sinstr, 0, 0)
|
||||
endif
|
||||
turnoff
|
||||
endin
|
||||
|
||||
opcode kill, 0, S
|
||||
Sinstr xin
|
||||
schedule("KillImpl", 0, .05, Sinstr)
|
||||
endop
|
||||
|
||||
opcode refresh, 0, S
|
||||
Sinstr xin
|
||||
if (nstrnum(Sinstr) > 0) then
|
||||
kill(Sinstr)
|
||||
schedule(Sinstr, ksmps / sr, -1)
|
||||
endif
|
||||
endop
|
||||
|
||||
#define _endin #
|
||||
endin
|
||||
refresh("livecoding")
|
||||
#
|
||||
|
||||
opcode rint, i, ii
|
||||
imin, imax xin
|
||||
irnd = int(random:i(imin, int(imax) + 0.99))
|
||||
xout irnd
|
||||
endop
|
||||
|
||||
opcode rint, k, kk
|
||||
kmin, kmax xin
|
||||
krnd = int(random:k(kmin, int(kmax) + 0.99))
|
||||
xout krnd
|
||||
endop
|
||||
|
||||
opcode euclidian, k, kkkk
|
||||
konset, kdiv, kpulses, krot xin
|
||||
kphasor = gkphasor
|
||||
kph = int( ( ( (kphasor + krot) * kdiv) / 1) * kpulses)
|
||||
keucval = int((konset / kpulses) * kph)
|
||||
kold_euc init i(keucval)
|
||||
kold_ph init i(kph)
|
||||
kres = ((kold_euc != keucval) && (kold_ph != kph)) ? 1 : 0
|
||||
kold_euc = keucval
|
||||
kold_ph = kph
|
||||
xout kres
|
||||
endop
|
||||
|
||||
// Simple rhythm array
|
||||
opcode array_rhythm, k, k[]
|
||||
karr[] xin
|
||||
kmet = gkbeat
|
||||
kcnt init 0
|
||||
ilen = lenarray(karr)
|
||||
ktrig = 0
|
||||
if ( kmet > 0 ) then
|
||||
kval = karr[kcnt]
|
||||
ktrig = kval
|
||||
kcnt = (kcnt + 1) % ilen
|
||||
endif
|
||||
|
||||
xout ktrig
|
||||
endop
|
||||
|
||||
opcode trunc, k, k
|
||||
kx xin
|
||||
ky = (kx < 0) ? -(floor(-kx)) : floor(kx)
|
||||
xout ky
|
||||
endop
|
||||
opcode mfmod, k, kk
|
||||
kone, ktwo xin
|
||||
kres = kone - trunc(kone/ktwo) * ktwo
|
||||
xout kres
|
||||
endop
|
||||
|
||||
opcode phase_trig, k, k
|
||||
kphase xin
|
||||
kold init 1
|
||||
ktrigger init 0
|
||||
ktrigger = 0
|
||||
if (kold > kphase) then
|
||||
ktrigger = 1
|
||||
endif
|
||||
kold = kphase
|
||||
xout ktrigger
|
||||
endop
|
||||
|
||||
opcode downprint, 0, kki
|
||||
kprint, kdown, imargin xin
|
||||
kcnt init 0
|
||||
if (kcnt == 0) then
|
||||
printk2(kprint, imargin)
|
||||
endif
|
||||
kcnt = (kcnt + 1) % kdown
|
||||
endop
|
||||
|
||||
|
||||
opcode phasor_fqmult, k, kk
|
||||
kphase, kmult xin
|
||||
if (kmult <= 0) then
|
||||
kmult = 1
|
||||
endif
|
||||
kfphase init 0
|
||||
if (kmult <= 1) then
|
||||
kfphase = mfmod(gkslowph * (kmult * 100), 1)
|
||||
elseif (kmult > 1) then
|
||||
kfphase = mfmod(gkslowph * (kmult * 100), 1)
|
||||
;kfphase= mfmod(gkphasor * kmult, 1)
|
||||
endif
|
||||
xout kfphase
|
||||
endop
|
||||
|
||||
opcode rh_subd, k, k[]P
|
||||
karr[], kpdiv xin
|
||||
ilen = lenarray(karr)
|
||||
if (kpdiv <= 0) then
|
||||
kpdiv = ilen
|
||||
endif
|
||||
kdiv = kpdiv
|
||||
kph = phasor_fqmult(gkphasor, kdiv )
|
||||
ktr = phase_trig(kph)
|
||||
kidx init 0
|
||||
ktrigger = 0
|
||||
if (ktr == 1) then
|
||||
ktrigger = karr[kidx]
|
||||
kidx = (kidx+1) % ilen
|
||||
endif
|
||||
xout ktrigger
|
||||
endop
|
||||
|
||||
opcode rhythm, k, k[]P
|
||||
karr[], kpdiv xin
|
||||
ilen = lenarray(karr)
|
||||
if (kpdiv <= 0) then
|
||||
kpdiv = ilen
|
||||
endif
|
||||
kdiv = kpdiv
|
||||
kph = phasor_fqmult(gkphasor, kdiv)
|
||||
ktr = phase_trig(kph)
|
||||
kidx init 0
|
||||
ktrigger = 0
|
||||
if (ktr == 1) then
|
||||
ktrigger = karr[kidx]
|
||||
kidx = (kidx+1) % ilen
|
||||
endif
|
||||
xout ktrigger
|
||||
endop
|
||||
|
||||
opcode beat, k, k
|
||||
kmult xin
|
||||
kmult = limit:k(kmult, 0.001, 1000)
|
||||
km = rhythm(array(1), kmult)
|
||||
;kph = phasor:k(kmult * gktempo)
|
||||
;km = phase_trig(kph)
|
||||
xout km
|
||||
endop
|
||||
|
||||
opcode swing, k, kk
|
||||
kspeed, ksw xin
|
||||
ktrig init 0
|
||||
kold init 0
|
||||
kph = phasor_fqmult(gkphasor, kspeed)
|
||||
ktr1 = phase_trig(kph)
|
||||
ktr2 = 0
|
||||
if (kold < ksw && kph >= ksw) then
|
||||
ktr2 = 0.6
|
||||
endif
|
||||
kold = kph
|
||||
ktrig = limit:k(ktr1 + ktr2, 0, 1)
|
||||
xout ktrig
|
||||
endop
|
||||
|
||||
opcode drunk, k, kk
|
||||
kspeed, kdrunk xin
|
||||
kold init 0
|
||||
kspeed = limit:k(kspeed, 0.001, 1000)
|
||||
knoi = random:k(0, kdrunk)
|
||||
|
||||
kph = phasor_fqmult(gkphasor, kspeed)
|
||||
;kph = phase_incr_mod(gkphasor, 1/ kspeed)
|
||||
ktrig = limit:k(phase_trig(kph) + ((kold < knoi && kph > knoi) ? 1 : 0), 0, 1)
|
||||
|
||||
kold = kph
|
||||
xout ktrig
|
||||
endop
|
||||
|
||||
|
||||
opcode filter_first_trig, k, k
|
||||
ktrig xin
|
||||
ksub init 1
|
||||
ktrig -= ksub
|
||||
ksub = 0
|
||||
xout ktrig
|
||||
endop
|
||||
|
||||
opcode check_trig, k, k
|
||||
ktrig xin
|
||||
kf = filter_first_trig(ktrig)
|
||||
kres = (changed:k(kf) > 0 && kf > 0) ? 1 : 0
|
||||
xout kres
|
||||
endop
|
||||
|
||||
opcode to_tempo_dur, k, k
|
||||
kdur xin
|
||||
ktdur = kdur / gktempo
|
||||
xout ktdur
|
||||
endop
|
||||
|
||||
opcode chance, k, kk
|
||||
kmin, kmax xin
|
||||
kres = random:k(kmin, kmax)
|
||||
xout kres
|
||||
endop
|
||||
|
||||
opcode alternate, k, kkkO
|
||||
kone, ktwo, kspeed, kduty xin
|
||||
|
||||
if (kduty == 0) then
|
||||
kduty = 0.5
|
||||
endif
|
||||
if (kspeed <= 0) then
|
||||
kspeed = 1
|
||||
endif
|
||||
kspeed = limit:k(to_tempo_dur(kspeed), 0.0001, 1000)
|
||||
kph = phasor_fqmult(gkphasor, kspeed)
|
||||
kres init i(kone)
|
||||
if (kph < kduty) then
|
||||
kres = kone
|
||||
else
|
||||
kres = ktwo
|
||||
endif
|
||||
xout kres
|
||||
endop
|
||||
|
||||
opcode trajectory, k, kkk
|
||||
kfrom, kdur, kto xin
|
||||
kdur = to_tempo_dur(kdur)
|
||||
kres = linseg:k( i(kfrom), i(kdur), i(kto) )
|
||||
xout kres
|
||||
endop
|
||||
|
||||
opcode oscillation, k, kkk
|
||||
kmin, kmax, kspeed xin
|
||||
if (kmin > kmax) then
|
||||
ktmp = kmin
|
||||
kmin = kmax
|
||||
kmax = ktmp
|
||||
endif
|
||||
kspeed = limit:k(gktempo / kspeed, 0.001, 1000)
|
||||
|
||||
kfq = kspeed ; / gktempo
|
||||
iphs init i(gkphasor)
|
||||
kosc = oscili(0.5, kfq, -1, iphs) + 0.5
|
||||
kres = kosc * (kmax - kmin) + kmin
|
||||
xout kres
|
||||
endop
|
||||
|
||||
opcode sequence, k, k[]P
|
||||
karr[], kpdiv xin
|
||||
ilen = lenarray(karr)
|
||||
if (kpdiv <= 0) then
|
||||
kpdiv = ilen
|
||||
endif
|
||||
kdiv = kpdiv
|
||||
kph = phasor_fqmult(gkphasor, kdiv )
|
||||
ktr = phase_trig(kph)
|
||||
kidx init 0
|
||||
if (ktr == 1) then
|
||||
kidx = (kidx+1) % ilen
|
||||
endif
|
||||
ktrigger = karr[kidx]
|
||||
xout ktrigger
|
||||
endop
|
||||
|
||||
opcode random_array_int, i[], iii
|
||||
isize, imin, imax xin
|
||||
iarr[] init isize
|
||||
|
||||
icnt init 0
|
||||
while icnt < isize do
|
||||
iarr[icnt] = int(random:i(imin, imax+0.99))
|
||||
icnt += 1
|
||||
od
|
||||
xout iarr
|
||||
endop
|
||||
|
||||
opcode random_array_int, k[], iii
|
||||
isize, imin, imax xin
|
||||
kArr[] init isize
|
||||
icnt init 0
|
||||
iArr[] = random_array_int(isize, imin, imax)
|
||||
while icnt < isize do
|
||||
kArr[icnt] = iArr[icnt]
|
||||
icnt += 1
|
||||
od
|
||||
xout kArr
|
||||
endop
|
||||
|
||||
#define arr #fillarray(#
|
||||
|
||||
; kind of random based savage
|
||||
opcode savage_1, k, 0
|
||||
k1 = gkmirlorenz_x
|
||||
k2 = abs(oscili:k(1, gkmirlorenz_y * 6 + 0.01))
|
||||
k3 = rspline:k(0, gkmirlorenz_z, 1, 5)
|
||||
|
||||
kfq = gkmirlorenz_x * rspline:k(1, 3, 1, 5) + 0.001
|
||||
kmod = beat(kfq) ;lfo:k(1, kfq, 3)
|
||||
|
||||
ksel init 0
|
||||
ksel_sig init 0
|
||||
if (trigger:k(kmod, 0.5, 0) == 1) then
|
||||
ksel = rint:k(0, 2)
|
||||
endif
|
||||
|
||||
if (ksel == 0) then
|
||||
ksel_sig = k1
|
||||
elseif (ksel == 1) then
|
||||
ksel_sig = k2
|
||||
elseif (ksel == 2) then
|
||||
ksel_sig = k3
|
||||
endif
|
||||
|
||||
kres = (kmod > 0) ? ksel_sig : 0
|
||||
xout kres
|
||||
endop
|
||||
|
||||
; direct lorenz savage mode
|
||||
opcode savage_2, k, 0
|
||||
kmult = pow(abs(lfo:k(1, rspline:k(0, gklorenz_x, 0.1, 3), 1)),3)
|
||||
kmod = abs(poscil:k( pow(gkmirlorenz_z, 3) * kmult, gkmirlorenz_x * gkmirlorenz_y * 40))
|
||||
xout kmod
|
||||
endop
|
||||
|
||||
; pwm based savage mode
|
||||
opcode savage_3, k, 0
|
||||
kduty = gkmirlorenz_y
|
||||
kph = phasor:k(gkmirlorenz_x * 5 )
|
||||
kres init 0
|
||||
if (kph < kduty) then
|
||||
kres = 1
|
||||
else
|
||||
kres = 0
|
||||
endif
|
||||
|
||||
kmult = mirror:k(gklorenz_z, 0, 1)
|
||||
kres *= kmult
|
||||
xout kres
|
||||
endop
|
||||
|
||||
opcode savage_4, k, 0
|
||||
iarr[] = fillarray(random:i(0, 1), random:i(0, 1), random:i(0, 1), random:i(0, 1))
|
||||
|
||||
kchange init 1
|
||||
kchange = changed:k(round(abs(gklorenz_x )))
|
||||
kmod init 1
|
||||
if (kchange == 1) then
|
||||
iarr[0] = random:i(0, 1)
|
||||
iarr[1] = random:i(0, 1)
|
||||
iarr[2] = random:i(0, 1)
|
||||
iarr[3] = random:i(0, 1)
|
||||
endif
|
||||
ksel = int(abs(gklorenz_x) * 4.99) % 4
|
||||
kres = limit:k (lineto(iarr[ksel], mirror:k(abs(gklorenz_y), 0, 1) ), 0, 1)
|
||||
xout kres
|
||||
endop
|
||||
|
||||
opcode savage_5, k, 0
|
||||
kamp = pow(abs(gklorenz_x), 2)
|
||||
kfq = 8 - (0.01 + abs(gklorenz_y) * 8)
|
||||
kmod = oscili:k(kamp, kfq)
|
||||
xout kmod
|
||||
endop
|
||||
|
||||
opcode chaos_rhythm, k, kk
|
||||
kchoice, kthresh xin
|
||||
kthresh = limit:k(kthresh, 0, 1)
|
||||
kchoice = int(limit:k(kchoice, 1, 3.99))
|
||||
kval init 0
|
||||
if (kchoice == 1) then
|
||||
kval = gkmirlorenz_x
|
||||
elseif (kchoice == 2) then
|
||||
kval = gkmirlorenz_y
|
||||
elseif (kchoice == 3) then
|
||||
kval = gkmirlorenz_z
|
||||
endif
|
||||
|
||||
kres = trigger:k(kval, kthresh, 2)
|
||||
xout kres
|
||||
endop
|
||||
|
||||
opcode chaos_control, k, kkk
|
||||
kchoice, kmin, kmax xin
|
||||
kmax = max:k(kmin, kmax)
|
||||
kmin = min:k(kmin, kmax)
|
||||
kchoice = int(limit:k(kchoice, 1, 3.99))
|
||||
kval init 0
|
||||
if (kchoice == 1) then
|
||||
kval = gkmirlorenz_x
|
||||
elseif (kchoice == 2) then
|
||||
kval = gkmirlorenz_y
|
||||
elseif (kchoice == 3) then
|
||||
kval = gkmirlorenz_z
|
||||
endif
|
||||
kdiff = kmax - kmin
|
||||
kres = kval * kdiff + kmin
|
||||
xout kres
|
||||
endop
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
instr livecoding
|
||||
instr livecoding
|
||||
|
||||
$_endin
|
||||
|
||||
3
public/system-files/livecode.orc.bak
Normal file
3
public/system-files/livecode.orc.bak
Normal file
@ -0,0 +1,3 @@
|
||||
instr livecoding
|
||||
|
||||
$_endin
|
||||
27
public/system-files/project.csd
Normal file
27
public/system-files/project.csd
Normal file
@ -0,0 +1,27 @@
|
||||
<CsoundSynthesizer>
|
||||
<CsOptions>
|
||||
-m0 -d
|
||||
</CsOptions>
|
||||
<CsInstruments>
|
||||
0dbfs=1
|
||||
nchnls=2
|
||||
ksmps = 64
|
||||
sr = 44100
|
||||
seed 0
|
||||
#include "globals.orc"
|
||||
#include "lib.orc"
|
||||
#include "synth.orc"
|
||||
#include "scale.orc"
|
||||
#include "livecode.orc"
|
||||
|
||||
</CsInstruments>
|
||||
<CsScore>
|
||||
f 0 z
|
||||
f 1 0 2049 -16 0 204 -5.6072 1 1843 -10 0 ; kind of karplustrong
|
||||
|
||||
|
||||
</CsScore>
|
||||
</CsoundSynthesizer>
|
||||
|
||||
|
||||
|
||||
@ -125,16 +125,16 @@ opcode scale_up, k, ikkk
|
||||
knote init ibase
|
||||
kitv init 0
|
||||
ilen = ftlen(iscale)
|
||||
if(ktrig == 1) then
|
||||
if (ktrig == 1) then
|
||||
kpick = (kpick + 1) ;% ilen
|
||||
if(kpick == ilen) then
|
||||
if (kpick == ilen) then
|
||||
kpick = 0
|
||||
kitv = 0
|
||||
endif
|
||||
kitv = table(kpick, iscale) - kitv
|
||||
printk2 kitv
|
||||
knote = knote + kitv
|
||||
if(knote > kmax) then
|
||||
if (knote > kmax) then
|
||||
knote = kmin + (knote - kmax)
|
||||
endif
|
||||
endif
|
||||
@ -150,11 +150,11 @@ opcode scale_up, k, ikkk
|
||||
kpick init 0
|
||||
knote init ibase
|
||||
ilen = ftlen(iscale)
|
||||
if(ktrig == 1) then
|
||||
if (ktrig == 1) then
|
||||
kpick = (kpick + 1) % ilen
|
||||
kitv = table(kpick, iscale)
|
||||
knote = knote + kitv
|
||||
if(knote > kmax) then
|
||||
if (knote > kmax) then
|
||||
knote = kmin + (knote - kmax)
|
||||
endif
|
||||
endif
|
||||
@ -172,11 +172,11 @@ opcode scale_down, k, ikkk
|
||||
kpick init 0
|
||||
knote init ibase
|
||||
ilen = ftlen(iscale)
|
||||
if(ktrig == 1) then
|
||||
if (ktrig == 1) then
|
||||
kpick = (kpick + 1) % ilen
|
||||
kitv = table(kpick, iscale)
|
||||
knote = knote - kitv
|
||||
if(knote < kmin) then
|
||||
if (knote < kmin) then
|
||||
knote = kmax ;- (kmin - knote)
|
||||
endif
|
||||
endif
|
||||
@ -191,15 +191,15 @@ opcode scale_random, k, ikkk
|
||||
kpick init 0
|
||||
knote init ibase
|
||||
ilen = ftlen(iscale)
|
||||
if(ktrig == 1) then
|
||||
if (ktrig == 1) then
|
||||
ksign = (rint:k(0, 1) == 0) ? -1 : 1
|
||||
kpick = (kpick + 1) % ilen
|
||||
kitv = table(kpick, iscale)
|
||||
knote = knote + (kitv * ksign)
|
||||
if(knote < kmin) then
|
||||
if (knote < kmin) then
|
||||
knote = kmax ;- (kmin - knote)
|
||||
endif
|
||||
if(knote > kmax) then
|
||||
if (knote > kmax) then
|
||||
knote = kmin ;+ (knote - kmax)
|
||||
endif
|
||||
endif
|
||||
|
||||
207
public/system-files/scale.orc.bak
Normal file
207
public/system-files/scale.orc.bak
Normal file
@ -0,0 +1,207 @@
|
||||
gi3semitone ftgen 0, 0, 5, -2, 0, 3, 6, 9, 12
|
||||
gi4semitone ftgen 0, 0, 4, -2, 0, 4, 8, 12
|
||||
giaeolian ftgen 0, 0, 7, -2, 0, 2, 3, 5, 7, 8, 10
|
||||
giaeolian ftgen 0, 0, 8, -2, 0, 2, 3, 5, 7, 8, 10, 12
|
||||
gialgerian ftgen 0, 0, 8, -2, 0, 2, 3, 6, 7, 8, 11, 12
|
||||
gialgerian1 ftgen 0, 0, 8, -2, 0, 2, 3, 6, 7, 8, 11, 12
|
||||
gialgerian2 ftgen 0, 0, 8, -2, 0, 2, 3, 5, 7, 8, 10, 12
|
||||
gialtered ftgen 0, 0, 8, -2, 0, 1, 3, 4, 6, 8, 10, 12
|
||||
giarabian ftgen 0, 0, 8, -2, 0, 1, 4, 5, 7, 8, 11, 12
|
||||
giaugmented ftgen 0, 0, 7, -2, 0, 3, 4, 7, 8, 11, 12
|
||||
gibalinese ftgen 0, 0, 6, -2, 0, 1, 3, 7, 8, 12
|
||||
gibebopdominant ftgen 0, 0, 9, -2, 0, 2, 4, 5, 7, 9, 10, 11, 12
|
||||
gibebopdominantflatnine ftgen 0, 0, 9, -2, 0, 1, 4, 5, 7, 9, 10, 11, 12
|
||||
gibebopmajor ftgen 0, 0, 9, -2, 0, 2, 4, 5, 7, 8, 9, 11, 12
|
||||
gibebopminor ftgen 0, 0, 9, -2, 0, 2, 3, 5, 7, 8, 9, 10, 12
|
||||
gibeboptonicminor ftgen 0, 0, 9, -2, 0, 2, 3, 5, 7, 8, 9, 11, 12
|
||||
giblues ftgen 0, 0, 7, -2, 0, 3, 5, 6, 7, 10, 12
|
||||
gibyzantine ftgen 0, 0, 8, -2, 0, 1, 4, 5, 7, 8, 11, 12
|
||||
gichahargah ftgen 0, 0, 8, -2, 0, 1, 4, 5, 7, 8, 11, 12
|
||||
gichinese ftgen 0, 0, 6, -2, 0, 2, 4, 7, 9, 12
|
||||
gichinese2 ftgen 0, 0, 6, -2, 0, 4, 6, 7, 11, 12
|
||||
gichroma ftgen 0, 0, 12, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
|
||||
gichromatic ftgen 0, 0, 13, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
|
||||
gidim ftgen 0, 0, 4, -2, 0, 3, 6, 9
|
||||
gidiminished ftgen 0, 0, 9, -2, 0, 2, 3, 5, 6, 8, 9, 11, 12
|
||||
gidorian ftgen 0, 0, 7, -2, 0, 2, 3, 5, 7, 9, 10
|
||||
gidorian ftgen 0, 0, 8, -2, 0, 2, 3, 5, 7, 9, 10, 12
|
||||
gidoubleharmonic ftgen 0, 0, 8, -2, 0, 1, 4, 5, 7, 8, 11, 12
|
||||
giegyptian ftgen 0, 0, 8, -2, 0, 2, 3, 6, 7, 8, 11, 12
|
||||
gienigmatic ftgen 0, 0, 8, -2, 0, 1, 4, 6, 8, 10, 11, 12
|
||||
giethiopian ftgen 0, 0, 8, -2, 0, 2, 4, 5, 7, 8, 11, 12
|
||||
giflamenco ftgen 0, 0, 9, -2, 0, 1, 3, 4, 5, 7, 8, 10, 12
|
||||
gigypsy ftgen 0, 0, 8, -2, 0, 1, 4, 5, 7, 8, 11, 12
|
||||
giharmonic ftgen 0, 0, 7, -2, 0, 2, 4, 5, 7, 9, 11
|
||||
giharmonicmajor ftgen 0, 0, 8, -2, 0, 2, 4, 5, 8, 9, 11, 12
|
||||
giharmonicminor ftgen 0, 0, 7, -2, 0, 2, 3, 5, 7, 8, 11
|
||||
giharmonicminor ftgen 0, 0, 8, -2, 0, 2, 3, 5, 7, 8, 11, 12
|
||||
gihindu ftgen 0, 0, 8, -2, 0, 2, 4, 5, 7, 8, 10, 12
|
||||
gihirajoshi ftgen 0, 0, 6, -2, 0, 2, 3, 7, 8, 12
|
||||
gihungariangypsy ftgen 0, 0, 8, -2, 0, 2, 3, 6, 7, 8, 11, 12
|
||||
gihungarianmajor ftgen 0, 0, 8, -2, 0, 3, 4, 6, 7, 9, 10, 12
|
||||
gihungarianminor ftgen 0, 0, 8, -2, 0, 2, 3, 6, 7, 8, 11, 12
|
||||
giindian ftgen 0, 0, 8, -2, 0, 1, 3, 4, 7, 8, 10, 12
|
||||
giinverteddiminished ftgen 0, 0, 9, -2, 0, 1, 3, 4, 6, 7, 9, 10, 12
|
||||
giionian ftgen 0, 0, 7, -2, 0, 2, 4, 5, 7, 9, 11
|
||||
giionian ftgen 0, 0, 8, -2, 0, 2, 4, 5, 7, 9, 11, 12
|
||||
giiwato ftgen 0, 0, 6, -2, 0, 1, 5, 6, 10, 12
|
||||
gijapanese ftgen 0, 0, 6, -2, 0, 1, 5, 7, 8, 12
|
||||
gijavanese ftgen 0, 0, 8, -2, 0, 1, 3, 5, 7, 9, 10, 12
|
||||
gijewish ftgen 0, 0, 8, -2, 0, 1, 4, 5, 7, 8, 10, 12
|
||||
gikumoi ftgen 0, 0, 6, -2, 0, 1, 5, 7, 8, 12
|
||||
gileadingwholetone ftgen 0, 0, 8, -2, 0, 2, 4, 6, 8, 10, 11, 12
|
||||
gilocrian ftgen 0, 0, 7, -2, 0, 1, 3, 5, 6, 8, 10
|
||||
gilocrian ftgen 0, 0, 8, -2, 0, 1, 3, 5, 6, 8, 10, 12
|
||||
gilocrianmajor ftgen 0, 0, 8, -2, 0, 2, 4, 5, 6, 8, 10, 12
|
||||
gilocriannatural ftgen 0, 0, 8, -2, 0, 2, 3, 5, 6, 8, 10, 12
|
||||
gilocriansuper ftgen 0, 0, 8, -2, 0, 1, 3, 4, 6, 8, 10, 12
|
||||
gilocrianultra ftgen 0, 0, 8, -2, 0, 1, 3, 4, 6, 8, 9, 12
|
||||
gilydian ftgen 0, 0, 7, -2, 0, 2, 4, 6, 7, 9, 11
|
||||
gilydian ftgen 0, 0, 8, -2, 0, 2, 4, 6, 7, 9, 11, 12
|
||||
gilydianaugmented ftgen 0, 0, 8, -2, 0, 2, 4, 6, 8, 9, 10, 12
|
||||
gilydiandominant ftgen 0, 0, 8, -2, 0, 2, 4, 6, 7, 9, 10, 12
|
||||
gilydianminor ftgen 0, 0, 8, -2, 0, 2, 4, 6, 7, 8, 10, 12
|
||||
gim7 ftgen 0, 0, 19, -2, 0, 3, 7, 10, 14, 17, 21, 24, 27, 31, 34, 38, 41, 45, 48, 51, 55, 58, 62
|
||||
gimajor ftgen 0, 0, 7, -2, 0, 2, 4, 5, 7, 9, 11
|
||||
gimarva ftgen 0, 0, 8, -2, 0, 1, 4, 6, 7, 9, 11, 12
|
||||
gimelodicminor ftgen 0, 0, 8, -2, 0, 2, 3, 5, 7, 9, 11, 12
|
||||
gimelodicminorascending ftgen 0, 0, 7, -2, 0, 2, 3, 5, 7, 9, 11
|
||||
gimelodicminordescending ftgen 0, 0, 7, -2, 0, 2, 3, 5, 7, 8, 10
|
||||
giminor ftgen 0, 0, 7, -2, 0, 2, 3, 5, 7, 8, 10
|
||||
giminor3 ftgen 0, 0, 7, -2, 0, 2, 2.75, 5, 7.15, 8, 10
|
||||
gimjnor ftgen 0, 0, 7, -2, 0, 1.75, 2.75, 5.35, 7.35, 8, 10
|
||||
giminor2v5 ftgen 0, 0, 7, -2, 0, 2, 2.5, 5, 7, 8, 10
|
||||
gimixolydian ftgen 0, 0, 7, -2, 0, 2, 4, 5, 7, 9, 10
|
||||
gimixolydian ftgen 0, 0, 8, -2, 0, 2, 4, 5, 7, 9, 10, 12
|
||||
gimixolydianaugmented ftgen 0, 0, 8, -2, 0, 2, 4, 5, 8, 9, 10, 12
|
||||
gimohammedan ftgen 0, 0, 8, -2, 0, 2, 3, 5, 7, 8, 11, 12
|
||||
gimongolian ftgen 0, 0, 6, -2, 0, 2, 4, 7, 9, 12
|
||||
gimonotone ftgen 0, 0, 1, -2, 0
|
||||
ginaturalminor ftgen 0, 0, 7, -2, 9, 11, 0, 2, 4, 5, 7
|
||||
ginaturalminor ftgen 0, 0, 8, -2, 0, 2, 3, 5, 7, 8, 10, 12
|
||||
gineapolitanmajor ftgen 0, 0, 8, -2, 0, 1, 3, 5, 7, 9, 11, 12
|
||||
gineapolitanminor ftgen 0, 0, 8, -2, 0, 1, 3, 5, 7, 8, 11, 12
|
||||
giocta_1_2 ftgen 0, 0, 8, -2, 0, 1, 3, 4, 6, 7, 9, 10
|
||||
giocta_2_1 ftgen 0, 0, 8, -2, 0, 2, 3, 5, 6, 8, 9, 11
|
||||
gioriental ftgen 0, 0, 8, -2, 0, 1, 4, 5, 6, 9, 10, 12
|
||||
giovertone ftgen 0, 0, 8, -2, 0, 2, 4, 6, 7, 9, 10, 12
|
||||
gipa ftgen 0, 0, 6, -2, 0, 2, 3, 7, 8, 12
|
||||
gipb ftgen 0, 0, 6, -2, 0, 1, 3, 6, 8, 12
|
||||
gipd ftgen 0, 0, 6, -2, 0, 2, 3, 7, 9, 12
|
||||
gipe ftgen 0, 0, 6, -2, 0, 1, 3, 7, 8, 12
|
||||
gipelog ftgen 0, 0, 6, -2, 0, 1, 3, 7, 10, 12
|
||||
gipentamaj ftgen 0, 0, 5, -2, 0, 2, 4, 7, 9
|
||||
gipentamin ftgen 0, 0, 5, -2, 0, 3, 5, 7, 10
|
||||
gipentatonicmajor ftgen 0, 0, 6, -2, 0, 2, 4, 7, 9, 12
|
||||
gipentatonicminor ftgen 0, 0, 6, -2, 0, 3, 5, 7, 10, 12
|
||||
gipersian ftgen 0, 0, 8, -2, 0, 1, 4, 5, 6, 8, 11, 12
|
||||
gipfcg ftgen 0, 0, 6, -2, 0, 2, 4, 7, 9, 12
|
||||
giphrygian ftgen 0, 0, 7, -2, 0, 1, 3, 5, 7, 8, 10
|
||||
giphrygian ftgen 0, 0, 8, -2, 0, 1, 3, 5, 7, 8, 10, 12
|
||||
giphrygianmajor ftgen 0, 0, 8, -2, 0, 1, 4, 5, 7, 8, 10, 12
|
||||
giquarter ftgen 0, 0, 22, -2, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5
|
||||
giromanian ftgen 0, 0, 8, -2, 0, 2, 3, 6, 7, 9, 10, 12
|
||||
gispanish ftgen 0, 0, 8, -2, 0, 1, 4, 5, 7, 8, 10, 12
|
||||
gispanish8tone ftgen 0, 0, 9, -2, 0, 1, 3, 4, 5, 6, 8, 10, 12
|
||||
gisymmetrical ftgen 0, 0, 9, -2, 0, 1, 3, 4, 6, 7, 9, 10, 12
|
||||
gitodi ftgen 0, 0, 8, -2, 0, 1, 3, 6, 7, 8, 11, 12
|
||||
giwhole ftgen 0, 0, 6, -2, 0, 2, 4, 6, 8, 10
|
||||
giwhole ftgen 0, 0, 7, -2, 0, 2, 4, 6, 8, 10, 12
|
||||
gibp ftgen 0, 0, 12, -2, 0, 1.3324, 3.0185, 4.3508, 5.8251, 7.3693, 8.8436, 10.1760, 11.6502, 13.1944, 14.6687, 16.0011, 17.6872, 19.0196
|
||||
|
||||
#define chinese #gichinese#
|
||||
#define persian #gipersian#
|
||||
#define indian #giindian#
|
||||
#define arabian #giarabian#
|
||||
#define minor #giminor#
|
||||
#define major #gimajor#
|
||||
|
||||
opcode scale_up, k, ikkk
|
||||
iscale, kmin, kmax, kspeed xin
|
||||
ktrig = metro:k(kspeed)
|
||||
idiff = abs( i(kmax) - i(kmin) )
|
||||
ibase = i(kmin)
|
||||
kpick init 0
|
||||
knote init ibase
|
||||
kitv init 0
|
||||
ilen = ftlen(iscale)
|
||||
if(ktrig == 1) then
|
||||
kpick = (kpick + 1) ;% ilen
|
||||
if(kpick == ilen) then
|
||||
kpick = 0
|
||||
kitv = 0
|
||||
endif
|
||||
kitv = table(kpick, iscale) - kitv
|
||||
printk2 kitv
|
||||
knote = knote + kitv
|
||||
if(knote > kmax) then
|
||||
knote = kmin + (knote - kmax)
|
||||
endif
|
||||
endif
|
||||
xout knote
|
||||
endop
|
||||
|
||||
/*
|
||||
opcode scale_up, k, ikkk
|
||||
iscale, kmin, kmax, kspeed xin
|
||||
ktrig = metro:k(kspeed)
|
||||
idiff = abs( i(kmax) - i(kmin) )
|
||||
ibase = i(kmin) + (idiff/2)
|
||||
kpick init 0
|
||||
knote init ibase
|
||||
ilen = ftlen(iscale)
|
||||
if(ktrig == 1) then
|
||||
kpick = (kpick + 1) % ilen
|
||||
kitv = table(kpick, iscale)
|
||||
knote = knote + kitv
|
||||
if(knote > kmax) then
|
||||
knote = kmin + (knote - kmax)
|
||||
endif
|
||||
endif
|
||||
xout knote
|
||||
endop
|
||||
|
||||
*/
|
||||
|
||||
opcode scale_down, k, ikkk
|
||||
iscale, kmin, kmax, kspeed xin
|
||||
ktrig = metro:k(kspeed)
|
||||
|
||||
idiff = abs( i(kmax) - i(kmin) )
|
||||
ibase = i(kmax)
|
||||
kpick init 0
|
||||
knote init ibase
|
||||
ilen = ftlen(iscale)
|
||||
if(ktrig == 1) then
|
||||
kpick = (kpick + 1) % ilen
|
||||
kitv = table(kpick, iscale)
|
||||
knote = knote - kitv
|
||||
if(knote < kmin) then
|
||||
knote = kmax ;- (kmin - knote)
|
||||
endif
|
||||
endif
|
||||
xout knote
|
||||
endop
|
||||
|
||||
opcode scale_random, k, ikkk
|
||||
iscale, kmin, kmax, kspeed xin
|
||||
ktrig = metro:k(kspeed)
|
||||
idiff = abs( i(kmax) - i(kmin) )
|
||||
ibase = i(kmin) + (idiff/2)
|
||||
kpick init 0
|
||||
knote init ibase
|
||||
ilen = ftlen(iscale)
|
||||
if(ktrig == 1) then
|
||||
ksign = (rint:k(0, 1) == 0) ? -1 : 1
|
||||
kpick = (kpick + 1) % ilen
|
||||
kitv = table(kpick, iscale)
|
||||
knote = knote + (kitv * ksign)
|
||||
if(knote < kmin) then
|
||||
knote = kmax ;- (kmin - knote)
|
||||
endif
|
||||
if(knote > kmax) then
|
||||
knote = kmin ;+ (knote - kmax)
|
||||
endif
|
||||
endif
|
||||
xout knote
|
||||
endop
|
||||
@ -12,7 +12,7 @@ opcode basic_sine_gen, 0, kk
|
||||
ktrig, kamp xin
|
||||
kamp = limit:k(kamp, 0, 1)
|
||||
ktrig = limit:k(ktrig, 0, 1)
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("basic_sine", 0, random:k(0.03, 0.1), random:k(50, 80), kamp * ktrig)
|
||||
endif
|
||||
endop
|
||||
@ -35,7 +35,7 @@ opcode pop, 0, kkkk
|
||||
knote = limit:k(knote, 0, 100) + 27
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.01, 1))
|
||||
ktrig = limit:k(ktrig, 0, 1)
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("pop_impl", 0, kdur, knote, kamp * ktrig)
|
||||
endif
|
||||
endop
|
||||
@ -78,7 +78,7 @@ opcode kick, 0, kkO
|
||||
ktrig = limit:k(ktrig, 0, 1)
|
||||
|
||||
ksav = rint:i(1, 5)
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("basic_kick", 0, 0.1, kamp * ktrig, 0)
|
||||
endif
|
||||
endop
|
||||
@ -112,7 +112,7 @@ opcode hihat, 0, kkkkO
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 100))
|
||||
kfq = mtof(limit:k(knote, 0, 100) + 27)
|
||||
ktrig = limit:k(ktrig, 0, 1)
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("noisy_hat", 0, kdur, kfq, kamp * ktrig, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -125,7 +125,7 @@ instr bass_impl
|
||||
aenv = expsegr:a(0.01, 0.05, 1.01, p3 - 0.05, 1.01, p3/16, 0.01) - a(0.01)
|
||||
|
||||
imult = rint:i(1, 8)
|
||||
if(imodspeed >= 0) then
|
||||
if (imodspeed >= 0) then
|
||||
imult = imodspeed
|
||||
endif
|
||||
kmodfq = gktempo * imult
|
||||
@ -146,7 +146,7 @@ opcode wah, 0, kkkkJ
|
||||
kfq = mtof(limit:k(knote, 0, 100) + 20)
|
||||
ktrigger = limit:k(ktrigger, 0, 1)
|
||||
kmodspeed = limit:k(kmodspeed, -1, 100)
|
||||
if(check_trig(ktrigger) == 1) then
|
||||
if (check_trig(ktrigger) == 1) then
|
||||
schedulek("bass_impl", 0, kdur, kamp * ktrigger, kfq, kmodspeed)
|
||||
endif
|
||||
endop
|
||||
@ -175,7 +175,7 @@ opcode glide, 0, kkkkO
|
||||
kamp = limit:k(kamp, 0, 1)
|
||||
kfq = mtof(limit:k(knote, 0, 100) + 20)
|
||||
ktrig = limit:k(ktrig, 0, 1)
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
kcnt = 0
|
||||
while kcnt < kdensity do
|
||||
schedulek("glide_impl", 0, to_tempo_dur(kdur), kamp * ktrig, kfq, ksav)
|
||||
@ -212,7 +212,7 @@ opcode ping, 0, kkkkO
|
||||
kamp = limit:k(kamp, 0, 1)
|
||||
kfq = mtof(limit:k(knote, 0, 100) + 20)
|
||||
kdur = limit:k(kdur, 0.001, 1000)
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("trumpet_impl", 0, to_tempo_dur(kdur), kfq, kamp, rint:k(1, 3), random:k(1, 4), ksav)
|
||||
endif
|
||||
endop
|
||||
@ -258,7 +258,7 @@ opcode wave, 0, kkkkO
|
||||
kamp = limit:k(kamp, 0, 1)
|
||||
ktrig = limit:k(ktrig, 0, 1)
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("wave_impl", 0, kdur, kamp, kfq, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -271,7 +271,7 @@ instr pluck_impl
|
||||
imult init p6
|
||||
iamp init p4
|
||||
inote init p5
|
||||
if(imult <= 0) then
|
||||
if (imult <= 0) then
|
||||
imult = rint:i(1, 10)
|
||||
endif
|
||||
|
||||
@ -309,7 +309,7 @@ opcode chord, 0, kkkkJO
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
kmult = limit:k(kmult, -1, 10)
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("pluck_impl", 0, kdur, kamp, knote, kmult, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -325,9 +325,9 @@ opcode funkymod, k, kkk
|
||||
; 5 saw down
|
||||
; 6 pwm
|
||||
iwave = rint:i(1, 6)
|
||||
if(iwave == 3) then
|
||||
if (iwave == 3) then
|
||||
iwave = 4
|
||||
elseif(iwave == 6) then
|
||||
elseif (iwave == 6) then
|
||||
iwave = 5
|
||||
endif
|
||||
|
||||
@ -335,7 +335,7 @@ opcode funkymod, k, kkk
|
||||
kpwm_amp = 1 - klf_amp
|
||||
|
||||
klfo = lfo:k(kamp, kfq)
|
||||
if(iwave < 3) then
|
||||
if (iwave < 3) then
|
||||
klfo += kamp
|
||||
klfo /= 2
|
||||
endif
|
||||
@ -391,7 +391,7 @@ opcode buzzy, 0, kkkkO
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("buzzy_impl", 0, kdur, mtof:k(knote), kamp, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -422,7 +422,7 @@ opcode noisy, 0, kkkk
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("fnoise_impl", 0, kdur, mtof:k(knote), kamp)
|
||||
endif
|
||||
endop
|
||||
@ -471,7 +471,7 @@ opcode pulsar, 0, kkkkkk
|
||||
|
||||
kformant_fq = limit:k(kformant_fq, 0, 10) * 150 + 300
|
||||
ksine_cycles = int(limit:k(ksine_cycles, 1, 10))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("pulsar_impl", 0, kdur, kamp, mtof:k(knote), kformant_fq, ksine_cycles)
|
||||
endif
|
||||
endop
|
||||
@ -524,7 +524,7 @@ opcode piou, 0, kkkkk
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
kQ = limit:k(kQ, 1, 10)
|
||||
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("graou_impl", 0, kdur, kamp, mtof:k(knote), kQ)
|
||||
endif
|
||||
endop
|
||||
@ -554,7 +554,7 @@ opcode buzzwave, 0, kkkkO
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(trigger:k(ktrig, 0.5, 0) == 1) then
|
||||
if (trigger:k(ktrig, 0.5, 0) == 1) then
|
||||
schedulek("smooth_wave_instr", 0, kdur, knote, kamp, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -594,7 +594,7 @@ opcode noisywave, 0, kkkkO
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(trigger:k(ktrig, 0.5, 0) == 1) then
|
||||
if (trigger:k(ktrig, 0.5, 0) == 1) then
|
||||
schedulek("smooth_noise_instr", 0, kdur, knote, kamp, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -628,7 +628,7 @@ opcode crunchy, 0, kkkkO
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("crunchy_instr", 0, kdur, knote, kamp, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -652,7 +652,7 @@ instr crunchyslow_instr
|
||||
adist *= aenv * iamp
|
||||
ipan_base = rint:i(0, 1)
|
||||
kpan = gkmirlorenz_y
|
||||
if(ipan_base > 0) then
|
||||
if (ipan_base > 0) then
|
||||
kpan = 1 - kpan
|
||||
endif
|
||||
aL, aR pan2 adist * gkgain, kpan
|
||||
@ -666,7 +666,7 @@ opcode crunchy_wav, 0, kkkkO
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("crunchyslow_instr", 0, kdur, knote, kamp, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -693,7 +693,7 @@ instr shinywave_instr
|
||||
adist *= aenv * iamp * 0.7
|
||||
ipan_base = rint:i(0, 1)
|
||||
kpan = gkmirlorenz_y
|
||||
if(ipan_base > 0) then
|
||||
if (ipan_base > 0) then
|
||||
kpan = 1 - kpan
|
||||
endif
|
||||
aL, aR pan2 adist * gkgain, kpan
|
||||
@ -707,7 +707,7 @@ opcode brightwave, 0, kkkkO
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("shinywave_instr", 0, kdur, knote, kamp, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -744,7 +744,7 @@ opcode glidy, 0, kkkkO
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("glide_instr", 0, kdur, knote, kamp, ksav)
|
||||
endif
|
||||
endop
|
||||
@ -811,7 +811,7 @@ opcode snare, 0, kkO
|
||||
ktrig, kamp, ksav xin
|
||||
ktrig = limit:k(ktrig, 0, 1)
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
;i34 0.0 .5 30000 7.00 .5 .7 1 1 1 1 1.5 .1
|
||||
idur random 1/12, 1/8 ; Duration
|
||||
kdyn = kamp ; random 1/9, 1/2 ; Amplitude
|
||||
@ -890,7 +890,7 @@ opcode water_drop, 0, kkk
|
||||
kspeed = limit:k(kspeed, 0.001, 1)*15
|
||||
|
||||
kmet = drunk(kspeed, 0.7)
|
||||
if(kmet == 1) then
|
||||
if (kmet == 1) then
|
||||
kfq1 = random:k(380, 500) ;430
|
||||
kfq2 = random:k(900, 1200) ; 1000
|
||||
kfq3 = random:k(700, 880) ;800
|
||||
@ -937,7 +937,7 @@ opcode strike, 0, kkkk
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("ks_impl", 0, kdur, knote, kamp)
|
||||
endif
|
||||
endop
|
||||
@ -981,7 +981,7 @@ opcode smooth, 0, kkkk
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("vibish_impl", 0, kdur, knote, kamp)
|
||||
endif
|
||||
endop
|
||||
@ -1032,7 +1032,7 @@ opcode bounce, 0, kkkk
|
||||
kamp = limit:k(kamp ,0, 1)
|
||||
knote = limit:k(knote, 0, 100) + 20
|
||||
kdur = to_tempo_dur(limit:k(kdur, 0.001, 1000))
|
||||
if(check_trig(ktrig) == 1) then
|
||||
if (check_trig(ktrig) == 1) then
|
||||
schedulek("bounce_impl", 0, kdur, knote, kamp)
|
||||
endif
|
||||
endop
|
||||
|
||||
1039
public/system-files/synth.orc.bak
Normal file
1039
public/system-files/synth.orc.bak
Normal file
File diff suppressed because it is too large
Load Diff
@ -299,11 +299,11 @@
|
||||
</button>
|
||||
{/snippet}
|
||||
<button
|
||||
onclick={() => editorWithLogsRef?.triggerEvaluate()}
|
||||
onclick={handleExecuteFile}
|
||||
class="icon-button evaluate-button"
|
||||
disabled={!$initialized}
|
||||
class:is-running={$running}
|
||||
title="Evaluate Block (Cmd-E)"
|
||||
title="Run File (Cmd-R)"
|
||||
>
|
||||
<Play size={18} />
|
||||
</button>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { getAppContext } from '../../contexts/app-context';
|
||||
import { themes } from '../../themes';
|
||||
import CsoundVersionToggle from '../settings/CsoundVersionToggle.svelte';
|
||||
|
||||
const { editorSettings } = getAppContext();
|
||||
|
||||
@ -18,6 +19,10 @@
|
||||
</script>
|
||||
|
||||
<div class="editor-settings">
|
||||
<div class="setting version-setting">
|
||||
<CsoundVersionToggle />
|
||||
</div>
|
||||
|
||||
<div class="setting">
|
||||
<label>
|
||||
<span class="label-text">Theme</span>
|
||||
@ -245,4 +250,10 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.version-setting {
|
||||
margin-bottom: var(--space-xl);
|
||||
padding-bottom: var(--space-lg);
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
</style>
|
||||
|
||||
77
src/lib/components/settings/CsoundVersionToggle.svelte
Normal file
77
src/lib/components/settings/CsoundVersionToggle.svelte
Normal file
@ -0,0 +1,77 @@
|
||||
<script lang="ts">
|
||||
import { getCsoundVersion, setCsoundVersion } from '../../utils/preferences';
|
||||
|
||||
let useCsound7 = $state(getCsoundVersion());
|
||||
|
||||
function handleVersionChange(version7: boolean) {
|
||||
if (useCsound7 === version7) return;
|
||||
|
||||
const confirmed = confirm(
|
||||
`Switch to Csound ${version7 ? '7' : '6'}?\n\n` +
|
||||
`This will reload the page to apply the changes.`
|
||||
);
|
||||
|
||||
if (confirmed) {
|
||||
useCsound7 = version7;
|
||||
setCsoundVersion(useCsound7);
|
||||
if (typeof window !== 'undefined') {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="csound-version-toggle">
|
||||
<button
|
||||
class="version-toggle-button"
|
||||
class:active={!useCsound7}
|
||||
onclick={() => handleVersionChange(false)}
|
||||
title="Csound 6.18.7 (recommended for CCN)"
|
||||
>
|
||||
Csound 6
|
||||
</button>
|
||||
<button
|
||||
class="version-toggle-button"
|
||||
class:active={useCsound7}
|
||||
onclick={() => handleVersionChange(true)}
|
||||
title="Csound 7.0.0-beta11 (experimental)"
|
||||
>
|
||||
Csound 7
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.csound-version-toggle {
|
||||
display: flex;
|
||||
gap: var(--space-xs);
|
||||
padding: var(--space-xs);
|
||||
}
|
||||
|
||||
.version-toggle-button {
|
||||
flex: 1;
|
||||
padding: var(--space-sm);
|
||||
background-color: transparent;
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: var(--font-sm);
|
||||
font-weight: 600;
|
||||
transition: all var(--transition-base);
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.version-toggle-button:hover:not(.active) {
|
||||
color: var(--text-color);
|
||||
background-color: var(--editor-active-line);
|
||||
border-color: var(--accent-color);
|
||||
}
|
||||
|
||||
.version-toggle-button.active {
|
||||
color: var(--accent-color);
|
||||
background-color: rgba(100, 200, 255, 0.15);
|
||||
border-color: var(--accent-color);
|
||||
}
|
||||
</style>
|
||||
@ -6,6 +6,7 @@ import { ExecutionContext } from '../csound/execution-context';
|
||||
import { createEditorSettingsStore } from '../stores/editorSettings';
|
||||
import { EditorState } from '../stores/editorState.svelte';
|
||||
import { UIState } from '../stores/uiState.svelte';
|
||||
import { getCsoundVersion } from '../utils/preferences';
|
||||
import type { CsoundStore } from '../csound/store';
|
||||
import type { EditorSettingsStore } from '../stores/editorSettings';
|
||||
|
||||
@ -23,7 +24,15 @@ const APP_CONTEXT_KEY = Symbol('app-context');
|
||||
export function createAppContext(): AppContext {
|
||||
const db = new FileDatabase();
|
||||
const fileManager = new FileManager(db);
|
||||
const csound = createCsoundStore();
|
||||
|
||||
const csound = createCsoundStore({
|
||||
getProjectFiles: async () => {
|
||||
const result = await fileManager.getAllFiles();
|
||||
return result.success ? result.data : [];
|
||||
},
|
||||
useCsound7: getCsoundVersion()
|
||||
});
|
||||
|
||||
const executionContext = new ExecutionContext(csound);
|
||||
|
||||
return {
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
import { Csound } from '@csound/browser';
|
||||
import { Csound as Csound6 } from '@csound/browser';
|
||||
import { Csound as Csound7 } from 'csound7';
|
||||
import type { File } from '../project-system/types';
|
||||
import { compileCSD, type CsoundObj } from './types';
|
||||
|
||||
export interface CsoundEngineOptions {
|
||||
onMessage?: (message: string) => void;
|
||||
onError?: (error: string) => void;
|
||||
onPerformanceEnd?: () => void;
|
||||
onAnalyserNodeCreated?: (node: AnalyserNode) => void;
|
||||
getProjectFiles?: () => Promise<File[]>;
|
||||
useCsound7?: boolean;
|
||||
}
|
||||
|
||||
export interface PerformanceMetrics {
|
||||
@ -19,7 +24,7 @@ export interface CompilationResult {
|
||||
}
|
||||
|
||||
export class CsoundEngine {
|
||||
private csound: Csound | null = null;
|
||||
private csound: CsoundObj | null = null;
|
||||
private initialized = false;
|
||||
private compiled = false;
|
||||
private running = false;
|
||||
@ -27,9 +32,11 @@ export class CsoundEngine {
|
||||
private scopeNode: AnalyserNode | null = null;
|
||||
private audioNode: AudioNode | null = null;
|
||||
private audioContext: AudioContext | null = null;
|
||||
private useCsound7: boolean;
|
||||
|
||||
constructor(options: CsoundEngineOptions = {}) {
|
||||
this.options = options;
|
||||
this.useCsound7 = options.useCsound7 ?? false;
|
||||
}
|
||||
|
||||
async init(): Promise<void> {
|
||||
@ -42,7 +49,9 @@ export class CsoundEngine {
|
||||
|
||||
private async ensureCsoundInstance(): Promise<void> {
|
||||
if (!this.csound) {
|
||||
this.log('Creating Csound instance...');
|
||||
const version = this.useCsound7 ? '7' : '6';
|
||||
this.log(`Creating Csound ${version} instance...`);
|
||||
const Csound = this.useCsound7 ? Csound7 : Csound6;
|
||||
this.csound = await Csound();
|
||||
this.setupCallbacks();
|
||||
}
|
||||
@ -68,6 +77,7 @@ export class CsoundEngine {
|
||||
}
|
||||
|
||||
await this.csound!.setOption('-m0');
|
||||
await this.csound!.setOption('-d');
|
||||
await this.csound!.setOption('-odac');
|
||||
await this.csound!.setOption('-+msg_color=false');
|
||||
await this.csound!.setOption('--daemon');
|
||||
@ -82,14 +92,43 @@ export class CsoundEngine {
|
||||
throw new Error('Failed to compile base header');
|
||||
}
|
||||
|
||||
await this.csound!.start();
|
||||
|
||||
this.compiled = true;
|
||||
this.running = true;
|
||||
this.setupAnalyser();
|
||||
this.log('Csound restarted and ready');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync all project files to Csound's virtual filesystem
|
||||
* This enables #include directives to work properly
|
||||
*/
|
||||
private async syncProjectFilesToFS(): Promise<void> {
|
||||
if (!this.csound) {
|
||||
this.log('Warning: Cannot sync files - no Csound instance');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.options.getProjectFiles) {
|
||||
this.log('Warning: Cannot sync files - no getProjectFiles callback');
|
||||
return;
|
||||
}
|
||||
|
||||
const files = await this.options.getProjectFiles();
|
||||
this.log(`Syncing ${files.length} files to virtual FS...`);
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
const content = encoder.encode(file.content);
|
||||
await this.csound.fs.writeFile(file.title, content);
|
||||
this.log(` - ${file.title}`);
|
||||
} catch (error) {
|
||||
this.log(`Warning: Failed to write ${file.title}: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
this.log('File sync complete');
|
||||
}
|
||||
|
||||
private setupCallbacks(): void {
|
||||
if (!this.csound) return;
|
||||
|
||||
@ -174,7 +213,98 @@ export class CsoundEngine {
|
||||
await this.csound!.readScore(event);
|
||||
}
|
||||
|
||||
async evaluateCode(code: string): Promise<void> {
|
||||
/**
|
||||
* Run a .csd file (composition mode)
|
||||
* Syncs all files to virtual FS, then uses native CSD compilation
|
||||
*/
|
||||
async playCSD(filename: string, content?: string): Promise<void> {
|
||||
if (!this.initialized) {
|
||||
throw new Error('Csound not initialized. Call init() first.');
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('[Engine] playCSD() called with filename:', filename);
|
||||
console.log('[Engine] Content provided:', !!content);
|
||||
if (content) {
|
||||
console.log('[Engine] Content preview:', content.substring(0, 100));
|
||||
console.log('[Engine] Content length:', content.length);
|
||||
}
|
||||
|
||||
if (this.running) {
|
||||
await this.stop();
|
||||
}
|
||||
|
||||
await this.restart();
|
||||
this.scopeNode = null;
|
||||
|
||||
// Sync all files to virtual FS so #includes work
|
||||
await this.syncProjectFilesToFS();
|
||||
|
||||
// If content is provided, write it to the filename
|
||||
if (content) {
|
||||
const encoder = new TextEncoder();
|
||||
const encoded = encoder.encode(content);
|
||||
console.log('[Engine] Encoded content length:', encoded.length);
|
||||
await this.csound!.fs.writeFile(filename, encoded);
|
||||
this.log(`Wrote ${filename} to virtual FS (${encoded.length} bytes)`);
|
||||
console.log('[Engine] Successfully wrote to virtual FS');
|
||||
|
||||
// Verify the file was written correctly
|
||||
try {
|
||||
const readBack = await this.csound!.fs.readFile(filename);
|
||||
const decoder = new TextDecoder();
|
||||
const readContent = decoder.decode(readBack);
|
||||
console.log('[Engine] Read back from FS:', readContent.substring(0, 100));
|
||||
console.log('[Engine] Read back length:', readContent.length);
|
||||
console.log('[Engine] Contains closing tag:', readContent.includes('</CsoundSynthesizer>'));
|
||||
} catch (e) {
|
||||
console.error('[Engine] Failed to read back file:', e);
|
||||
}
|
||||
}
|
||||
|
||||
this.log(`Compiling ${filename}...`);
|
||||
|
||||
// Debug: List files in virtual FS root to verify file exists
|
||||
try {
|
||||
const files = await this.csound!.fs.readdir('/');
|
||||
console.log('[Engine] Files in virtual FS root:', files);
|
||||
} catch (e) {
|
||||
console.error('[Engine] Failed to list FS:', e);
|
||||
}
|
||||
|
||||
// Use native CSD compilation (Csound handles #includes)
|
||||
// Mode 0 = path (read from virtual FS), Mode 1 = text (parse as CSD content)
|
||||
console.log('[Engine] Calling compileCSD with filename:', filename, 'mode: 0 (path)');
|
||||
const result = await compileCSD(this.csound!, filename, 0);
|
||||
console.log('[Engine] compileCSD returned:', result);
|
||||
|
||||
if (result !== 0) {
|
||||
throw new Error(`Failed to compile ${filename}`);
|
||||
}
|
||||
|
||||
this.compiled = true;
|
||||
this.log('CSD compiled successfully');
|
||||
|
||||
// Start performance after successful compilation
|
||||
this.log('Starting performance...');
|
||||
await this.csound!.start();
|
||||
this.running = true;
|
||||
this.setupAnalyser();
|
||||
this.log('Performance started');
|
||||
|
||||
} catch (error) {
|
||||
this.running = false;
|
||||
this.compiled = false;
|
||||
const errorMsg = error instanceof Error ? error.message : 'Evaluation failed';
|
||||
this.error(errorMsg);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a .orc file (orchestra only, no score)
|
||||
*/
|
||||
async playORC(orchestraCode: string): Promise<void> {
|
||||
if (!this.initialized) {
|
||||
throw new Error('Csound not initialized. Call init() first.');
|
||||
}
|
||||
@ -185,25 +315,25 @@ export class CsoundEngine {
|
||||
}
|
||||
|
||||
await this.restart();
|
||||
|
||||
this.scopeNode = null;
|
||||
|
||||
const orcMatch = code.match(/<CsInstruments>([\s\S]*?)<\/CsInstruments>/);
|
||||
const scoMatch = code.match(/<CsScore>([\s\S]*?)<\/CsScore>/);
|
||||
this.log('Compiling orchestra...');
|
||||
|
||||
if (!orcMatch || !scoMatch) {
|
||||
throw new Error('Invalid CSD format. Must contain <CsInstruments> and <CsScore> sections.');
|
||||
const result = await this.csound!.compileOrc(orchestraCode);
|
||||
|
||||
if (result !== 0) {
|
||||
throw new Error('Failed to compile orchestra');
|
||||
}
|
||||
|
||||
const orc = orcMatch[1].trim();
|
||||
const sco = scoMatch[1].trim();
|
||||
|
||||
await this.csound!.compileOrc(orc);
|
||||
this.compiled = true;
|
||||
this.log('Orchestra compiled successfully');
|
||||
|
||||
if (sco) {
|
||||
await this.readScore(sco);
|
||||
}
|
||||
// Start performance after successful compilation
|
||||
this.log('Starting performance...');
|
||||
await this.csound!.start();
|
||||
this.running = true;
|
||||
this.setupAnalyser();
|
||||
this.log('Performance started');
|
||||
|
||||
} catch (error) {
|
||||
this.running = false;
|
||||
@ -214,6 +344,28 @@ export class CsoundEngine {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Incremental code evaluation (live coding mode)
|
||||
* Requires Csound to be already running
|
||||
*/
|
||||
async evalCode(code: string): Promise<void> {
|
||||
if (!this.csound) {
|
||||
throw new Error('No Csound instance available');
|
||||
}
|
||||
|
||||
if (!this.running) {
|
||||
throw new Error('Csound not running. Use playCSD() or playORC() first.');
|
||||
}
|
||||
|
||||
this.log('Evaluating code...');
|
||||
const result = await this.csound.evalCode(code);
|
||||
|
||||
if (result !== 0) {
|
||||
this.error('Code evaluation failed');
|
||||
throw new Error('Code evaluation failed');
|
||||
}
|
||||
}
|
||||
|
||||
async setControlChannel(name: string, value: number): Promise<void> {
|
||||
if (!this.csound) {
|
||||
throw new Error('No Csound instance available');
|
||||
|
||||
@ -12,28 +12,46 @@ export class ExecutionContext {
|
||||
this.contentProvider = provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if content is a complete CSD file
|
||||
*/
|
||||
private isCSDContent(code: string): boolean {
|
||||
return code.includes('<CsoundSynthesizer>') &&
|
||||
code.includes('<CsInstruments>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute entire file (composition mode: full restart)
|
||||
*/
|
||||
async executeFile(): Promise<void> {
|
||||
const content = this.contentProvider?.() ?? '';
|
||||
console.log('[ExecutionContext] Content from provider:', content.substring(0, 100));
|
||||
console.log('[ExecutionContext] Content length:', content.length);
|
||||
|
||||
if (!content.trim()) {
|
||||
console.log('[ExecutionContext] Content is empty, aborting');
|
||||
return;
|
||||
}
|
||||
|
||||
this.initialized = false;
|
||||
await this.csound.stop();
|
||||
await this.csound.evaluate(content);
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute code block (live coding mode: incremental evaluation)
|
||||
* If the code is a complete CSD file, routes to executeFile() instead
|
||||
*/
|
||||
async executeBlock(code: string): Promise<void> {
|
||||
if (!code.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If this is a complete CSD file, use composition mode
|
||||
if (this.isCSDContent(code)) {
|
||||
return await this.executeFile();
|
||||
}
|
||||
|
||||
if (!this.initialized) {
|
||||
await this.csound.restart();
|
||||
this.initialized = true;
|
||||
@ -81,6 +99,7 @@ export class ExecutionContext {
|
||||
}
|
||||
|
||||
// Default: orchestra code (instrument definitions, opcodes, etc.)
|
||||
await this.csound.compileOrchestra(trimmed);
|
||||
// Use evalCode() to maintain macro context from initial CSD compilation
|
||||
await this.csound.evalCode(trimmed);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,8 @@ export class LiveCodingStrategy implements ExecutionStrategy {
|
||||
await this.handleChannelSet(csound, filteredCode);
|
||||
}
|
||||
else {
|
||||
await csound.compileOrchestra(filteredCode);
|
||||
// Use incremental evalCode for live coding
|
||||
await csound.evalCode(filteredCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { writable, derived } from 'svelte/store';
|
||||
import { CsoundEngine, type PerformanceMetrics, type CompilationResult } from './engine';
|
||||
import type { File } from '../project-system/types';
|
||||
|
||||
export interface LogEntry {
|
||||
timestamp: Date;
|
||||
@ -22,6 +23,9 @@ export interface CsoundStore {
|
||||
readScore: (score: string) => Promise<void>;
|
||||
sendScoreEvent: (event: string) => Promise<void>;
|
||||
evaluate: (code: string) => Promise<void>;
|
||||
playCSD: (filename: string) => Promise<void>;
|
||||
playORC: (orchestraCode: string) => Promise<void>;
|
||||
evalCode: (code: string) => Promise<void>;
|
||||
stop: () => Promise<void>;
|
||||
restart: () => Promise<void>;
|
||||
setControlChannel: (name: string, value: number) => Promise<void>;
|
||||
@ -41,7 +45,12 @@ export interface CsoundStore {
|
||||
destroy: () => Promise<void>;
|
||||
}
|
||||
|
||||
export function createCsoundStore(): CsoundStore {
|
||||
export interface CsoundStoreOptions {
|
||||
getProjectFiles?: () => Promise<File[]>;
|
||||
useCsound7?: boolean;
|
||||
}
|
||||
|
||||
export function createCsoundStore(options: CsoundStoreOptions = {}): CsoundStore {
|
||||
const initialState: CsoundState = {
|
||||
initialized: false,
|
||||
compiled: false,
|
||||
@ -76,7 +85,9 @@ export function createCsoundStore(): CsoundStore {
|
||||
},
|
||||
onAnalyserNodeCreated: (node) => {
|
||||
analyserNodeListeners.forEach(listener => listener(node));
|
||||
}
|
||||
},
|
||||
getProjectFiles: options.getProjectFiles,
|
||||
useCsound7: options.useCsound7
|
||||
});
|
||||
|
||||
await engine.init();
|
||||
@ -145,7 +156,20 @@ export function createCsoundStore(): CsoundStore {
|
||||
}
|
||||
|
||||
try {
|
||||
await engine.evaluateCode(code);
|
||||
console.log('[Store] evaluate() received code:', code.substring(0, 100));
|
||||
console.log('[Store] Code length:', code.length);
|
||||
console.log('[Store] Contains <CsoundSynthesizer>:', code.includes('<CsoundSynthesizer>'));
|
||||
|
||||
// Legacy method - detect file type and route appropriately
|
||||
if (code.includes('<CsoundSynthesizer>')) {
|
||||
console.log('[Store] Detected CSD file, calling playCSD');
|
||||
// Pass the CSD content to playCSD which will write it after file sync
|
||||
await engine.playCSD('temp.csd', code);
|
||||
} else {
|
||||
console.log('[Store] Detected ORC file, calling playORC');
|
||||
// Assume it's orchestra code
|
||||
await engine.playORC(code);
|
||||
}
|
||||
update(state => ({
|
||||
...state,
|
||||
compiled: engine!.isCompiled(),
|
||||
@ -159,6 +183,60 @@ export function createCsoundStore(): CsoundStore {
|
||||
}
|
||||
},
|
||||
|
||||
async playCSD(filename: string) {
|
||||
if (!engine) {
|
||||
throw new Error('Csound engine not initialized');
|
||||
}
|
||||
|
||||
try {
|
||||
await engine.playCSD(filename);
|
||||
update(state => ({
|
||||
...state,
|
||||
compiled: engine!.isCompiled(),
|
||||
running: engine!.isRunning()
|
||||
}));
|
||||
} catch (error) {
|
||||
const errorMsg = error instanceof Error ? error.message : 'CSD playback failed';
|
||||
addLog(errorMsg, 'error');
|
||||
update(state => ({ ...state, compiled: false, running: false }));
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
async playORC(orchestraCode: string) {
|
||||
if (!engine) {
|
||||
throw new Error('Csound engine not initialized');
|
||||
}
|
||||
|
||||
try {
|
||||
await engine.playORC(orchestraCode);
|
||||
update(state => ({
|
||||
...state,
|
||||
compiled: engine!.isCompiled(),
|
||||
running: engine!.isRunning()
|
||||
}));
|
||||
} catch (error) {
|
||||
const errorMsg = error instanceof Error ? error.message : 'Orchestra playback failed';
|
||||
addLog(errorMsg, 'error');
|
||||
update(state => ({ ...state, compiled: false, running: false }));
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
async evalCode(code: string) {
|
||||
if (!engine) {
|
||||
throw new Error('Csound engine not initialized');
|
||||
}
|
||||
|
||||
try {
|
||||
await engine.evalCode(code);
|
||||
} catch (error) {
|
||||
const errorMsg = error instanceof Error ? error.message : 'Code evaluation failed';
|
||||
addLog(errorMsg, 'error');
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
async stop() {
|
||||
if (!engine) return;
|
||||
|
||||
|
||||
22
src/lib/csound/types.ts
Normal file
22
src/lib/csound/types.ts
Normal file
@ -0,0 +1,22 @@
|
||||
// CsoundObj is a type that represents the Csound instance
|
||||
// returned by the Csound() function from either version
|
||||
export type CsoundObj = any;
|
||||
|
||||
export function isCsound7(csound: CsoundObj): boolean {
|
||||
// Csound 7 uses compileCSD (capital D), Csound 6 uses compileCsd (lowercase d)
|
||||
return 'compileCSD' in csound && typeof csound.compileCSD === 'function';
|
||||
}
|
||||
|
||||
export async function compileCSD(
|
||||
csound: CsoundObj,
|
||||
filename: string,
|
||||
mode: number
|
||||
): Promise<number> {
|
||||
if (isCsound7(csound)) {
|
||||
// Csound 7: compileCSD(filename, mode)
|
||||
return await csound.compileCSD(filename, mode);
|
||||
} else {
|
||||
// Csound 6: compileCsd(filename) - no mode parameter
|
||||
return await csound.compileCsd(filename);
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,7 @@ const SYSTEM_FILE_NAMES = [
|
||||
'globals.orc',
|
||||
'lib.orc',
|
||||
'livecode.orc',
|
||||
'project.csd',
|
||||
'scale.orc',
|
||||
'synth.orc',
|
||||
] as const;
|
||||
|
||||
18
src/lib/utils/preferences.ts
Normal file
18
src/lib/utils/preferences.ts
Normal file
@ -0,0 +1,18 @@
|
||||
const CSOUND_VERSION_KEY = 'useCsound7';
|
||||
|
||||
export function getCsoundVersion(): boolean {
|
||||
if (typeof window === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const stored = localStorage.getItem(CSOUND_VERSION_KEY);
|
||||
return stored === 'true';
|
||||
}
|
||||
|
||||
export function setCsoundVersion(useCsound7: boolean): void {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
localStorage.setItem(CSOUND_VERSION_KEY, useCsound7.toString());
|
||||
}
|
||||
Reference in New Issue
Block a user