really replace π

This commit is contained in:
brevalferrari 2025-05-28 16:59:31 +02:00
parent c96bce8b37
commit de97e43b63
3 changed files with 4 additions and 4 deletions

View file

@ -14,7 +14,7 @@ modes:
-n NOTE[,...], --notes NOTE[,...] -n NOTE[,...], --notes NOTE[,...]
available notes: a list of comma-separated alphabetical note names available notes: a list of comma-separated alphabetical note names
-i EXPR, --instrument EXPR -i EXPR, --instrument EXPR
signal expression (instrument) to generate music samples (you can use the floating-point number t for the current time in seconds, n for the indice of the currently playing note in the list of available notes starting with 0 and N for the number of available notes) [default: "sin(2*PI*(442+442*((n+1)/N))*t)"] signal expression (instrument) to generate music samples (you can use the floating-point number t for the current time in seconds, n for the indice of the currently playing note in the list of available notes starting with 0 and N for the number of available notes) [default: "sin(2*pi()*(442+442*((n+1)/N))*t)"]
-l EXPR, --length EXPR -l EXPR, --length EXPR
expression to generate note length in seconds [default: "2^(2-log(2, l))*(60/T)"] expression to generate note length in seconds [default: "2^(2-log(2, l))*(60/T)"]
-v VARIABLE=VALUE, --variable VARIABLE=VALUE -v VARIABLE=VALUE, --variable VARIABLE=VALUE
@ -32,7 +32,7 @@ modes:
-n NOTE[,...], --notes NOTE[,...] -n NOTE[,...], --notes NOTE[,...]
available notes: a list of comma-separated alphabetical note names available notes: a list of comma-separated alphabetical note names
-i EXPR, --instrument EXPR -i EXPR, --instrument EXPR
signal expression (instrument) to generate music samples (you can use the floating-point number t for the current time in seconds, n for the indice of the currently playing note in the list of available notes starting with 0 and N for the number of available notes) [default: "sin(2*PI*(442+442*((n+1)/N))*t)"] signal expression (instrument) to generate music samples (you can use the floating-point number t for the current time in seconds, n for the indice of the currently playing note in the list of available notes starting with 0 and N for the number of available notes) [default: "sin(2*pi()*(442+442*((n+1)/N))*t)"]
-l EXPR, --length EXPR -l EXPR, --length EXPR
expression to generate note length in seconds [default: "2^(2-log(2, l))*(60/T)"] expression to generate note length in seconds [default: "2^(2-log(2, l))*(60/T)"]
-v VARIABLE=VALUE, --variable VARIABLE=VALUE -v VARIABLE=VALUE, --variable VARIABLE=VALUE

View file

@ -28,7 +28,7 @@ use nom_locate::{LocatedSpan, position};
use strum::{EnumDiscriminants, EnumString, IntoDiscriminant, IntoStaticStr}; use strum::{EnumDiscriminants, EnumString, IntoDiscriminant, IntoStaticStr};
use thiserror::Error; use thiserror::Error;
const DEFAULT_INSTRUMENT: &str = "sin(2*PI*(442+442*((n+1)/N))*t)"; const DEFAULT_INSTRUMENT: &str = "sin(2*pi()*(442+442*((n+1)/N))*t)";
const DEFAULT_LENGTH: &str = "2^(2-log(2, l))*(60/T)"; const DEFAULT_LENGTH: &str = "2^(2-log(2, l))*(60/T)";
fn main() { fn main() {

View file

@ -458,7 +458,7 @@ mod tests {
('l', 4.0), ('l', 4.0),
('T', 60.0), ('T', 60.0),
], ],
"sin(2*PI*(442+442*((n+1)/N))*t)".parse().unwrap(), "sin(2*pi()*(442+442*((n+1)/N))*t)".parse().unwrap(),
[('L', "2^(2-log(2, l))*(60/T)")].map(|(c, e)| (c, e.parse().unwrap())), [('L', "2^(2-log(2, l))*(60/T)")].map(|(c, e)| (c, e.parse().unwrap())),
) )
} }