From a5a1db2889746ee8318691dca10c82c3da105b15 Mon Sep 17 00:00:00 2001 From: polsevev Date: Mon, 6 Mar 2023 22:00:57 +0100 Subject: [PATCH] fixed audio --- src/soundGenerator.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/soundGenerator.rs b/src/soundGenerator.rs index e677373..c98cb37 100644 --- a/src/soundGenerator.rs +++ b/src/soundGenerator.rs @@ -76,10 +76,7 @@ pub async fn generateTone(frequency: f32, duration:f32) -> Sound{ let value = f32::sin((2. * PI * (i as f32) * (frequency as f32)) / SAMPLE_RATE as f32); let channel = (amplitude * if i+100 > lim {0.} else {value}); - for i in channel.to_le_bytes(){ - soundFileBytes.push(i); - } - + soundFileBytes.append(&mut (channel as i16).to_le_bytes().to_vec()); }