Closed ganjiakhil closed 1 year ago
This is not a libsamplerate problem. This is a problem due to your incorrect usage of the compiler and associated tools.
The reason you see this error us because you are not linking the libsamplerate library. You need to fix that,
I can see you are using the clang
compiler which means you are probably on MacOS. You should ask this question in a Mac/Clang related forum.
I was able to successfully install libsamplerate and libsndfile following instrucitons in INSTALL file in libsamplerate source file. But I keep facing these errors when importing the samplerate.h and using it.
I have part of the waveform and I want to resample that from 16000 to 32000 and below is the code I am using (since unable to attach a cpp file)
but I keep facing the error as below -
Executing task: C/C++: g++ build active file
Starting build... /usr/bin/g++ -fdiagnostics-color=always -g /Users/aganji155/Documents/akhil/ResamplingAudio/APP.cpp -o /Users/aganji155/Documents/akhil/ResamplingAudio/APP Undefined symbols for architecture x86_64: "_src_simple", referenced from: _main in APP-811664.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Build finished with error(s).
Code -
include
include
include
include "libsamplerate-0.1.9/src/samplerate.h"
int main() { // Load audio waveform //const int inputSampleRate = 16000; //const int outputSampleRate = 16000; float waveform[100] = { -3.8146973e-03, -4.3029785e-03, -3.4179688e-03, -3.0517578e-03, -1.6174316e-03, -1.4038086e-03, -1.8310547e-04, 3.0517578e-04,1.4953613e-03, 1.2512207e-03, 2.8686523e-03, 2.8686523e-03,3.9367676e-03, 3.8146973e-03, 3.7231445e-03, 3.4484863e-03,2.8381348e-03, 2.1667480e-03, 1.7395020e-03, 3.3569336e-04,-1.2207031e-04, -1.1596680e-03, -1.1596680e-03, -2.5939941e-03,-2.4414062e-03, -3.3569336e-03, -3.3264160e-03, -4.0283203e-03,-3.2043457e-03, -2.4719238e-03, -2.1362305e-03, -1.5258789e-03,-3.6621094e-04, 4.5776367e-04, 1.2817383e-03, 1.5563965e-03,2.3498535e-03, 2.2277832e-03, 2.6245117e-03, 2.1972656e-03,2.2277832e-03, 8.5449219e-04, 9.7656250e-04, -1.5258789e-04,-9.1552734e-05, -1.2207031e-03, -9.7656250e-04, -8.5449219e-04,-1.1596680e-03, -6.4086914e-04, -4.2724609e-04, 0.0000000e+00, -3.9672852e-04, -5.7983398e-04, -5.7983398e-04, -4.2724609e-04,0.0000000e+00, 4.2724609e-04, 1.0070801e-03, 1.3732910e-03,1.6479492e-03, 2.1972656e-03, 2.4108887e-03, 2.6245117e-03,2.0446777e-03, 1.1901855e-03, 3.9672852e-04, -4.2724609e-04,-1.1291504e-03, -1.6174316e-03, -2.3803711e-03, -2.9602051e-03,-2.7465820e-03, -2.6855469e-03, -2.4414062e-03, -2.5939941e-03,-1.3427734e-03, -1.0986328e-03, 3.0517578e-05, 6.4086914e-04,1.6784668e-03, 1.4038086e-03, 1.5258789e-03, 1.4038086e-03,5.7983398e-04, 2.1362305e-04, 2.4414062e-04, 2.4414062e-04,4.8828125e-04, 1.1901855e-03, 8.8500977e-04, 1.1291504e-03,6.4086914e-04, 2.4414062e-04, -6.7138672e-04, -7.6293945e-04,-2.2277832e-03, -2.4414062e-03, -2.8381348e-03, -2.3498535e-03 }; // audio waveform data // SF_INFO inputSoundFileInfo; // SNDFILE* infile = nullptr; // infile = sf_open(filePath.c_str(), SFM_READ, &inputSoundFileInfo);
}
Please help, i am stuck with this more than a week now.