From 92e83efd95250c8c61a6993c7a3c8e211b49d9a8 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Sat, 17 Dec 2022 11:57:48 -0600 Subject: Add new bytebeat in Scheme implementation --- .gitignore | 9 --------- README.md | 26 ++------------------------ m | 4 ---- main.scm | 19 +++++++++++++++++++ mc | 4 ---- mconv | 4 ---- mplay | 4 ---- 7 files changed, 21 insertions(+), 49 deletions(-) delete mode 100644 .gitignore delete mode 100755 m create mode 100644 main.scm delete mode 100755 mc delete mode 100755 mconv delete mode 100755 mplay diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 5dc83e0..0000000 --- a/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# ---> Scheme -*.ss~ -*.ss#* -.#*.ss - -*.scm~ -*.scm#* -.#*.scm - diff --git a/README.md b/README.md index 43b62cf..748a808 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,2 @@ -# M - -A minimal and ergonomic music programming language, inspired by Lisp - -## Design - -A M source code file has the extension `.m` and is basically a Scheme program with some extra spice. All lines that start with an open parenthesis, space, or tab are treated as lines of a normal Scheme program. Lines that do not start with those characters correspond to generating a music tone at a certain time. These lines have the following format: -``` -401/2A 441/2A 471/2A -``` - -Each line consists of multiple notes separated by tab characters. You can use any Scheme variables in for these notes instead of actual numbers. It's recommended to set your tab size to 8 so the notes in different lines are aligned. - -Each note consists of multiple characters: -1. The first character is the octave. -2. The second is the step of the scale it's on in base 12, so 0 is equivalent to the traditional A, A is equivalent to the traditional G, and B is equivlanet to the traditional G sharp. -3. The next few characters are the length of the note. This can be a fraction. -4. The final character is a modifier that changes some property of the note, such as its volume. - -## Toolchain - -The M compiler `mc` will first interpret the Scheme program and generate an M intermediate format file with file extension `.min`. This file consists of all the music tone lines that the compiler ran into while interpreting the Scheme program. This can be then played by the `mplay` tool or converted to formats like `.mp3` with `mconv`. - -The `m` wrapper tool automates this process and will compile and play an M file if no output is specified, or convert it to the desired output format if specified. +# Lambeat +Bytebeat in Scheme diff --git a/m b/m deleted file mode 100755 index 8b18461..0000000 --- a/m +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/guile -s -!# - -(display "hello world") diff --git a/main.scm b/main.scm new file mode 100644 index 0000000..348a2ba --- /dev/null +++ b/main.scm @@ -0,0 +1,19 @@ +(define (note freq start len) ( + lambda (t) ( + if (or (< t start) (> t (+ start len))) + 0 + freq + ) +)) + +(define (music t) ( + (note 440 0 10) t +)) + +(define (play t) ( + if (< t 100) + (cons (music t) (play (+ t 1))) + (music t) +)) + +(display (play 0)) diff --git a/mc b/mc deleted file mode 100755 index 8b18461..0000000 --- a/mc +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/guile -s -!# - -(display "hello world") diff --git a/mconv b/mconv deleted file mode 100755 index 8b18461..0000000 --- a/mconv +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/guile -s -!# - -(display "hello world") diff --git a/mplay b/mplay deleted file mode 100755 index 8b18461..0000000 --- a/mplay +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/guile -s -!# - -(display "hello world") -- cgit v1.2.3-70-g09d2