Comments (5)
If it crashes there must be an error message. What is it?
I just tested it in VS2019 and it works out of the box. If you look at the demo code you'll see that all it does is resample a few samples, print one line to the console (only the console, not the debug output window of your IDE), and exit.
SRC.NET/SRC.NET/LibSampleRate.Demo/Program.cs
Lines 82 to 85 in 42bbb67
from src.net.
The thing is, that there is no message. It's just a hard crash without any messages or prompts.
My use case attempt was to convert a single input (I get a small data amount per each frame) to a required sample rate (44.1kHz to 16kHz), in order to be able to input that resampled data into a neural network.
So it's basically a real-time use case attempt:
public class SRCConverter {
SampleRateConverter src;
int inputSampleCount;
int outputSampleCount;
float[] outputBuffer = new float[2048];
int inputRate, outputRate;
public SRCConverter(int _inputRate, int _outputRate) {
src = new SampleRateConverter(ConverterType.SRC_SINC_MEDIUM_QUALITY, 1);
inputRate = _inputRate;
outputRate = _outputRate;
}
public float[] SingleConversion(float[] sourceData) {
src.SetRatio(outputRate / inputRate);
src.Process(sourceData, 0, sourceData.Length,
outputBuffer, 0, outputBuffer.Length,
true, out inputSampleCount, out outputSampleCount);
float[] output = new float[outputSampleCount];
Array.Copy(outputBuffer, output, outputSampleCount);
output = outputBuffer;
return output;
}
}
Usage:
float[] data = converter.SingleConversion(_input.audioDataSlice.ToArray());
audioDataSlice[] is quite small, around 60-70 values. Could that be the problem? Does it expect large arrays?
from src.net.
A small number of samples should be fine. If the number is too small you just won't get any output until you feed it more data. Then my guess would be an incompatibility with your Unity environment - can't help with that, sorry.
from src.net.
I see. Oh well :(
BTW, when you tested it, was it on Dot NET Standard 2.1?
from src.net.
from src.net.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from src.net.