Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 02 03:17
    Jman420 synchronize #88
  • Apr 01 16:45
    Jman420 commented #88
  • Apr 01 16:44
    Jman420 synchronize #88
  • Apr 01 16:13
    Jman420 synchronize #88
  • Apr 01 13:09
    Jman420 commented #88
  • Apr 01 12:58
    Jman420 commented #88
  • Apr 01 12:58
    Jman420 commented #88
  • Mar 31 19:55
    Jman420 opened #88
  • Mar 31 09:27

    dlevin256 on 4.2.0

    (compare)

  • Mar 26 16:06
    mipac commented #87
  • Mar 26 14:11
    dlevin256 commented #87
  • Mar 26 14:07
    mipac closed #87
  • Mar 26 14:06
    mipac commented #87
  • Mar 26 07:12

    dlevin256 on master

    Add instructions for archlinux … Merge pull request #85 from acx… (compare)

  • Mar 26 05:10
    dlevin256 closed #53
  • Mar 26 05:08
    dlevin256 commented #59
  • Mar 26 04:43
    dlevin256 commented #85
  • Mar 26 04:43

    dlevin256 on dev

    Add instructions for archlinux … Merge pull request #85 from acx… (compare)

  • Mar 26 04:43
    dlevin256 closed #85
  • Mar 26 04:42
    dlevin256 edited #85
Dan Levin
@dlevin256

KFR has reached a stable release.

Added in version 1.0:

  • Full ARM NEON support. Since this release, all algorithms are also available for the armv7, armv7s and aarch64.
  • Stereo conversion (LR -> MS, MS -> LR)
  • DC offset removal
  • Fast Upsample/Downsample by powers of two

In addition to the above features, this release brings a lot of improvements and fixes (nearly 200 commits since the previous version)
Many new tests have been added, not only to check new functionality but also to more stringently check existing functionality

Adriel
@adr7x
Hi, the function absminof always return 0 even when univector contains negative numbers. Is this right?
Dan Levin
@dlevin256

Hi,
This function works as follows:

absminof(v) = min(abs(v[0]), abs(v[1]), ...)

So it returns 0 if (and only if) at least one element of the input sequence is zero.
Which data type you use? Floating point, signed integer, unsigned integer?

Adriel
@adr7x

Which fbase (double). Example:

univector<fbase> test = sin(linspace(0.0, c_pi<qreal, 2> * 4.0, someSize));
fbase minValue = absminof(test); // always return 0 - absmaxof works as expected

Thanks for response

Dan Levin
@dlevin256

absminof returns the minimum of the absolute values of the input vector.
So returning 0 for absminof in this case is absolutely correct behavior because the input vector contains 0 (result of the sine function at 0 is 0).
Example:

min(abs(sin(0)), abs(sin(0.5*pi)), abs(sin(pi), abs(1.5*pi), ...)
min(abs(0), abs(-1), abs(0), abs(+1), ...)
min(0, 1, 0, 1, ...) = 0

absminof in Python:

import math
import numpy
numpy.amin(numpy.absolute(numpy.sin(numpy.linspace(0, 2 * math.pi * 4, 12))))
>>> 0
Adriel
@adr7x
Thanks for the explanation
KFR has some function which return the minor value of a vector?
In c++11:
std::min_element(std::begin(vec), std::end(vec));
Dan Levin
@dlevin256
minof returns the minimum element of a vector. maxof returns the maximum element of a vector. Exactly as std::min_element/max_element do
Adriel
@adr7x
Hi,
KFR supports continuous/real-time biquad or fir filter?
Dan Levin
@dlevin256
Hi, yes
Adriel
@adr7x
Hi,
Please you could show a simple example for best implementation in add new samples to biquad without proccessing all samples in each interation?
And a example for a FIR filter (windowed) for continuous data?
Another question, I can buy the perpetual license after the project is finished or I need buy now?
Thanks
Fabio Massaioli
@fbbdev

Hello @adr7x , this is how I'm solving this problem right now. @dlevin256 please correct me if I'm doing it the wrong way :smile:

For FIR filters:

fir_state<fbase> filter(/* fir taps */);
while (/* ... */) {
    output = fir(filter, /* new samples here */);
}

Also, if I got it right, this should work:

univector<fbase, /* block size */> input;
auto filter_expr = fir(input, /* fir taps */);
while (/* ... */) {
    input = /* read new samples into input */;
    output = filter_expr;
Fabio Massaioli
@fbbdev
The last version should also work for biquads, I think. Is that right? @dlevin256
@dlevin256 any hopes of getting #19 merged? :grin:
Adriel
@adr7x
Hello @fbbdev , many thanks for the examples.
I'll try this implementations.
Dominic Létourneau
@doumdi
Hello?
  //Will use namespace kfr
    using namespace kfr;

    constexpr size_t input_sr  = 100;
    constexpr size_t output_sr = 50;

    //1Hz sine signal to be generated
    constexpr fbase frequency = 1.0;
    const univector<fbase, input_sr> o1 = sine(counter(0,1.0/input_sr) * 2.0 * constants<fbase>::pi * frequency);

    println("input_signal");
    println(o1.size());
    println(o1);

    //allocation of output vector
    univector<fbase> resampled(o1.size() * output_sr / input_sr);

    //Resampler
    auto r = resampler<fbase>(resample_quality::normal, output_sr, input_sr, 1.0, 0.496);

    println("output_signal");
    //Resample & get size
    const size_t destsize = r(resampled.data(), o1);
    println(destsize);
    println(resampled); 
Dominic Létourneau
@doumdi
I am trying to resample a 1Hz signal from sampling rate 100 to sampling rate 50.
The sine wave is properly generated :
input_signal
100
0 0.0627905 0.125333 0.187381 0.24869 0.309017 0.368125 0.42578
0.481754 0.535827 0.587786 0.637425 0.684548 0.728969 0.770513 0.809017
0.844327 0.876306 0.904826 0.929776 0.951056 0.968583 0.982288 0.992116
0.998027 0.999999 0.998027 0.992116 0.982288 0.968583 0.951056 0.929776
0.904826 0.876306 0.844327 0.809017 0.770513 0.728969 0.684548 0.637425
0.587786 0.535827 0.481754 0.42578 0.368125 0.309017 0.24869 0.187381
0.125333 0.0627905 0 -0.063 -0.125333 -0.187381 -0.24869 -0.309017
-0.368125 -0.42578 -0.481754 -0.535827 -0.587786 -0.637425 -0.684548 -0.728969
-0.770513 -0.809017 -0.844327 -0.876306 -0.904826 -0.929776 -0.951056 -0.968583
-0.982288 -0.992116 -0.998027 -0.999999 -0.998027 -0.992116 -0.982288 -0.968583
-0.951056 -0.929776 -0.904826 -0.876306 -0.844327 -0.809017 -0.770513 -0.728969
-0.684548 -0.637425 -0.587786 -0.535827 -0.481754 -0.42578 -0.368125 -0.309017
-0.24869 -0.187381 -0.125333 -0.063
But the resampled data is not correct :
output_signal
50
0 -5.4e-11 -8.5e-09 1.8e-08 -3.6e-08 5.5e-08 -8.2e-08 1.1e-07
-1.5e-07 1.9e-07 -2.4e-07 2.9e-07 -3.5e-07 4.2e-07 -4.8e-07 5.6e-07
-6.4e-07 7.3e-07 -8.2e-07 9.3e-07 -1e-06 1.1e-06 -1.3e-06 1.4e-06
-1.5e-06 1.6e-06 -1.8e-06 1.9e-06 -2.1e-06 2.2e-06 -2.4e-06 2.5e-06
-2.7e-06 2.9e-06 -3e-06 3.2e-06 -3.4e-06 3.5e-06 -3.7e-06 3.8e-06
-4e-06 4.1e-06 -4.3e-06 4.4e-06 -4.5e-06 4.6e-06 -4.7e-06 4.8e-06
-4.9e-06 4.9e-06
The code is based on the sample_rate_conversion.cpp example. I am doing something wrong ?
Dominic Létourneau
@doumdi
I used the latest code in master branch.
Colin Sivak
@Abounding
alright im tilted lol
Visual studio complains whenever I try to compile my code, could you guys help me?
Does the library support visual studio? What compiler should I be using if I want to compile for windows
I tried msvc and gcc
Colin Sivak
@Abounding
image.png
image.png
Fabio Massaioli
@fbbdev
Hi! I'm no authority on this library but those "not found" identifiers are clearly GCC intrinsics, so something strange is definitely going on... Have you tried clang on Windows? Which version of the library are you using? Which version of MSVC?
I'm not sure how to interpret the README but it may suggest that only clang is supported on Windows.
BTW master has some new commits on October 21 that say "fix building in MSYS2" so have you tried building the latest revision with mingw?
Fabio Massaioli
@fbbdev
I'm reading the README again and I noticed that even with MinGW clang is required, so I strongly suggest you try clang :smile:
Dan Levin
@dlevin256

Hi,
@Abounding , Current version of Visual Studio contains a bug that prevents building KFR. But there is a way to use clang compiler with Visual Studio (no changes to your code are required because clang supports MSVC syntax and ABI).
README is updated with more detailed information about setting up environment, building etc.
The following combinations are supported and well tested:

  • MSVC+clang (in both IDE and command line modes)
  • MinGW+clang (and MSYS2+clang)
  • MinGW+GCC
  • Xcode (in both IDE and command line modes)
  • Linux+clang
  • Linux+GCC

KFR is best supported with clang 5.0+, GCC 8.x is also supported (but performance may be lower in some cases).

KFR 3.0 is about to be released with many changes, including non-power of 2 DFT and AVX-512 (already in master).

@fbbdev , thank you for replying.

Justin
@Jman420
Hey KFR Team. I'm trying to integrate KFR into an Android Project I'm working on and seem to be running into some problems with actually finding the data types and functions mentioned in the documentation and examples. I've got my project & branch hosted on Github here : https://github.com/Jman420/menrva/tree/fix/accuracy-experiments
Not sure if I've misconfigured something in CMake or AndroidStudio is angry about something... I'd like to be able try to use KFR, but I can't seem to find any of the types that are in the examples.
gah... ignore me... I totally missed the 'using namespace kfr' line. Think I might need a nap...
Verinder Rana
@genGoblin
Hi guys, I am a complete newb in c++ and I have the following question
i have a "std::vector<std::complex<float>> samples;"
I want to convert this to a univector but when I do "univector<complex<float>> temp = make_univector(&samples.front(), samples.size());"
i get an error stating no viable conversion type. What would be the best way to convert my complex vector to the univector?
Verinder Rana
@genGoblin
??????
Dan Levin
@dlevin256
Hi, you have to use the same numeric type for the vector or do a conversion manually. You have std::complex and complex (kfr::complex). This is different but fully compatible types . Use reinterpret_cast to convert the pointer to proper type.
Verinder Rana
@genGoblin
Thanks for that @dlevin256
Verinder Rana
@genGoblin
Hello, any updates?
Tomás Roig Martinez
@tomroima
Hello, i have been struggling to set up KFR to work for me(i haven't touched C++ for a long time). I made it through the new compilation method with CMake since version 3.0.0, using clang as the compiler. It works with the FFT example on the blog. Now i'm trying to analize some wav audio, but it says "undefined reference to `drwav_open'". Can someone lend me a hand with this?
Tomás Roig Martinez
@tomroima
I'm using version 3.0.9
Dan Levin
@dlevin256
@tomroima Hello, Do you use add_subdirectory and link to kfr?
Then you should link to kfr_io as well because drwav_open is part of kfr_io library.
Tomás Roig Martinez
@tomroima
Thank you @dlevin256, i will try it as soon as i can! I have been recently interested in DSP, and this library seems one of the best choices.