summaryrefslogtreecommitdiff
path: root/klangfarbrs
diff options
context:
space:
mode:
authorJacob Lee <jacob@unabridgedsoftware.com>2021-10-27 22:24:23 -0400
committerJacob Lee <jacob@unabridgedsoftware.com>2021-10-27 22:24:23 -0400
commit7bd9dd418ac6215094feb87087fcb59499c3aa69 (patch)
tree8dd0f98083f5d37e3ffd9d6c0a3d37cf8ae0d2d4 /klangfarbrs
parentfc2da03a2a385d9beac72246799a9ee5241f9859 (diff)
Fix pitch in rust code and limit to 3 second duration
Diffstat (limited to 'klangfarbrs')
-rw-r--r--klangfarbrs/src/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/klangfarbrs/src/lib.rs b/klangfarbrs/src/lib.rs
index 9bf1ded..9638690 100644
--- a/klangfarbrs/src/lib.rs
+++ b/klangfarbrs/src/lib.rs
@@ -10,13 +10,13 @@ pub struct MonoBuffer {
}
pub fn fill_frames() -> TypedArray<f32> {
- let tau = std::f32::consts::FRAC_PI_2;
let frequency = 440.0;
- let sample_rate = 8000.0;
+ let sample_rate = 44100.0;
+ let duration = sample_rate * 3.0;
let mut frames = TypedArray::new();
- for i in 0..512 {
- frames.push(f32::sin(tau * frequency * i as f32/sample_rate));
+ for i in 0..duration as i32 {
+ frames.push(f32::sin(std::f32::consts::TAU * frequency * i as f32/sample_rate));
}
return frames