diff --git a/pkgs/development/octave-modules/ltfat/default.nix b/pkgs/development/octave-modules/ltfat/default.nix new file mode 100644 index 00000000000..505670f6298 --- /dev/null +++ b/pkgs/development/octave-modules/ltfat/default.nix @@ -0,0 +1,54 @@ +{ buildOctavePackage +, lib +, fetchurl +, fftw +, fftwSinglePrec +, fftwFloat +, fftwLongDouble +, lapack +, blas +, portaudio +, jdk +}: + +buildOctavePackage rec { + pname = "ltfat"; + version = "2.3.1"; + + src = fetchurl { + url = "mirror://sourceforge/octave/${pname}-${version}.tar.gz"; + sha256 = "0gghh5a4w649ff776wvidfvqas87m0n7rqs960pid1d11bnyqqrh"; + }; + + patches = [ + # Fixes a syntax error with performing multiplication. + ./syntax-error.patch + ]; + + buildInputs = [ + fftw + fftwSinglePrec + fftwFloat + fftwLongDouble + lapack + blas + portaudio + jdk + ]; + + meta = with lib; { + name = "The Large Time-Frequency Analysis Toolbox"; + homepage = "https://octave.sourceforge.io/ltfat/index.html"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ KarlJoad ]; + description = "Toolbox for working with time-frequency analysis, wavelets and signal processing"; + longDescription = '' + The Large Time/Frequency Analysis Toolbox (LTFAT) is a Matlab/Octave + toolbox for working with time-frequency analysis, wavelets and signal + processing. It is intended both as an educational and a computational + tool. The toolbox provides a large number of linear transforms including + Gabor and wavelet transforms along with routines for constructing windows + (filter prototypes) and routines for manipulating coefficients. + ''; + }; +} diff --git a/pkgs/development/octave-modules/ltfat/syntax-error.patch b/pkgs/development/octave-modules/ltfat/syntax-error.patch new file mode 100644 index 00000000000..732030b7043 --- /dev/null +++ b/pkgs/development/octave-modules/ltfat/syntax-error.patch @@ -0,0 +1,15 @@ +diff --git a/inst/nonstatgab/nsdgt.m b/inst/nonstatgab/nsdgt.m +index ac53963..81656cb 100644 +--- a/inst/nonstatgab/nsdgt.m ++++ b/inst/nonstatgab/nsdgt.m +@@ -149,8 +149,8 @@ for ii = 1:N + col = ceil(Lg/M(ii)); + + temp = zeros(col*M(ii),W,assert_classname(f,g{1})); +- temp([end-floor(Lg/2)+1:end,1:ceil(Lg/2)],:) = bsxfun(@ ... +- times,f(win_range,:),g{ii}(idx)); ++ temp([end-floor(Lg/2)+1:end,1:ceil(Lg/2)],:) = bsxfun(@times, ... ++ f(win_range,:),g{ii}(idx)); + + temp = reshape(temp,M(ii),col,W); + X = squeeze(fft(sum(temp,2)));