KASL
A language for audio synthesis, designed for those who want to sharpen their sounds with code.
gain.kasl
import std
input in: Float = 0.0
input gain: Float = 1.0
output out: Float = 0.0
func main() {
out = in * gain
}
Playground
Run your KASL code online.
Go to Playgroundkaslc
kaslc is a command-line tool to compile and run KASL code locally.
If you have cargo installed, you can install it with the command below:
If you do not have cargo installed, please visit the kaslc repository on GitHub.
Examples
fibonacci.kasl
import std
state a = 0
state b = 1
output result = 0
func main() {
result = a
let next = a + b
a = b
b = next
}
sine.kasl
import std
import math/float
state x = 0.0
output y = 0.0
func main() {
y = float.sin(x)
x = x + 0.1
}
double.kasl
import std
let count = 1
output out = 1
func main() {
loop count {
out = out * 2
}
}
fizzbuzz.kasl
import std
output result = [0; 100]
func main() {
var i = 1
loop 100 {
if i % 15 == 0 {
result[i - 1] = 3
} else if i % 3 == 0 {
result[i - 1] = 1
} else if i % 5 == 0 {
result[i - 1] = 2
}
i = i + 1
}
}