Attempting to generate sound, and set cells automatically
This commit is contained in:
29
Audio/SoundProcessor.cs
Normal file
29
Audio/SoundProcessor.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using FluidSim.Components;
|
||||
using FluidSim.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace FluidSim.Audio
|
||||
{
|
||||
public static class SoundProcessor
|
||||
{
|
||||
public static float MaxDeltaP { get; set; } = 100_000f;
|
||||
public static float MaxArea { get; set; } = 1e-4f;
|
||||
public static float MaxVelocity { get; set; } = 343f;
|
||||
public static float ReferenceDensity { get; set; } = 1.225f;
|
||||
public static float ReferenceSpeedOfSound { get; set; } = 343f;
|
||||
public static float Gain { get; set; } = 1.0f;
|
||||
|
||||
public static double ComputeSample(Connection conn)
|
||||
{
|
||||
Port portA = conn.PortA;
|
||||
Port portB = conn.PortB;
|
||||
|
||||
double pressureUp = portA.Pressure;
|
||||
double pressureDown = portB.Pressure;
|
||||
|
||||
// No flow or no pressure drop → silence
|
||||
double deltaP = pressureUp - pressureDown;
|
||||
return deltaP / 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user