Hello guys,
so I made a script using Visual Studio that I want to use in my project. My project should be able to take two audio signals and convolute them against each other.
What have I done so far?
- can use the files
- extracted float[ ] from mono audio tracks
- convolution algorithm manually typed, works (but takes ages)
Since my algorithm takes ages I wanted to get a faster one from the internet. Found one at CenterSpace. Downloaded their packages and wanted to use them. Then I used Assembly References in the project in Visual Studio to reference the NMath.dll to my project. In Visual Studio everything is fine. In Unity it says: “are you missing assembly reference?”
Since I googled two whole days to resolve this issue and tried out the world, I finally stranded here.
Usefull information: the NMath.dll is compiled against NET Framework 4.0. Unity says that the editor uses only 3.5. In the dll import settings I turned off using the dll for the editor (exclude editor). Still this doesn’t seem to solve my problem.
I also came across importing the DLL via dllImport[ ]… but I seem to be doing it wrong.
Is there a way, maybe even other than “using CenterSpace.NMath.Core;” in my code, that I can get this running?
using CenterSpace.NMath.Core;
using System.Linq;
using UnityEngine;
public class LastTry : MonoBehaviour
{
...
void Convolute(float[] audio, float[] impRsp)
{
...
var convolution = new Float1DConvolution(impRsp, impRsp.Length);
FloatVector result = convolution.Convolve(audio);
...
}
...
}
I need the type “FloatVector” and the methods of “Float1DConvolution”, which is a class in the NMath.dll
Thanks for any help.