File ddsp.spec of Package ddsp
#
# spec file for package ddsp
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: ddsp
Version: 1.1.0
Release: 0
Summary: Realtime DDSP Neural Synthesizer and Effect
License: Apache-2.0
Group: Productivity/Multimedia/Sound/Midi
URL: https://github.com/magenta/ddsp-vst
Source0: %{name}-%{version}.tar.gz
# Models downloaded during build https://storage.googleapis.com/ddsp-vst/releases/DDSP-VST-Models.zip
Source1: DDSP-VST-Models.zip
# Borrow tanserflow-lite from: science:machinelearning/tensorflow-lite
Source2: tensorflow-2.10.0.tar.gz
# Although some of the following libraries are available in Factory, they can
# not be used as explicit versions are needed which differ from the Factory ones.
# License10: MIT
Source10: https://github.com/google/farmhash/archive/0d859a811870d10f53a594927d0d0b97573ad06d.tar.gz#/farmhash.tar.gz
# License11: Apache-2.0
Source11: https://github.com/google/gemmlowp/archive/fda83bdc38b118cc6b56753bd540caa49e570745.zip#/gemmlowp.zip
# License12: Apache-2.0
# Source12: https://github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz#/abseil-cpp.tar.gz
Source12: abseil-cpp-1679929101.b971ac5.tar.xz
# License13: MPL-2.0
# NOTE: tensorflow only uses MPL-2.0 part of eigen
Source13: https://gitlab.com/libeigen/eigen/-/archive/7792b1e909a98703181aecb8810b4b654004c25d/eigen-7792b1e909a98703181aecb8810b4b654004c25d.tar.gz#/eigen.tar.gz
# License14: BSD-2-Clause
Source14: https://github.com/intel/ARM_NEON_2_x86_SSE/archive/1200fe90bb174a6224a525ee60148671a786a71f.tar.gz#/arm_neon_2_x86_sse.tar.gz
# Deps sources for Tensorflow-Lite (use same eigen, gemmlowp and abseil_cpp packages as non lite version)
# License15: Apache-2.0
Source15: https://github.com/google/flatbuffers/archive/v2.0.6.tar.gz#/flatbuffers.tar.gz
# License16: BSD like
Source16: https://storage.googleapis.com/mirror.tensorflow.org/github.com/petewarden/OouraFFT/archive/v1.0.tar.gz#/fft2d.tgz
# Source17: Apache-2.0
Source17: https://github.com/google/ruy/archive/841ea4172ba904fe3536789497f9565f2ef64129.zip#/ruy.zip
# License18: BSD-3-Clause
Source18: https://github.com/google/XNNPACK/archive/6b409ac0a3090ebe74d0cdfb494c4cd91485ad39.zip#/xnnpack.zip
# transitive tensorflow-lite dependencies for xnnpack
# License21: BSD 2-Clause
Source21: https://github.com/pytorch/cpuinfo/archive/5e63739504f0f8e18e941bd63b2d6d42536c7d90.tar.gz#/cpuinfo.tar.gz
# NOTE: the github url is non-deterministic for the following zipfile archives (!?) Content is the same, but the hashes of the zipfiles differ.
# License30: MIT
# Source30: https://github.com/Maratyszcza/FP16/archive/4dfe081cf6bcd15db339cf2680b9281b8451eeb3.zip #/FP16.zip
Source30: FP16.zip
# License31: MIT
# Source31: https://github.com/Maratyszcza/FXdiv/archive/b408327ac2a15ec3e43352421954f5b1967701d1.zip #/FXdiv.zip
Source31: FXdiv.zip
# License32: BSD-2-Clause
# Source32: https://github.com/Maratyszcza/pthreadpool/archive/545ebe9f225aec6dca49109516fac02e973a3de2.zip #/pthreadpool.zip
Source32: pthreadpool.zip
# License33: MIT
# Source33: https://github.com/Maratyszcza/psimd/archive/072586a71b55b7f8c584153d223e95687148a900.zip #/psimd.zip
Source33: psimd.zip
Patch0: 01-ddsp-std-isnan.patch
Patch1: 02-ddsp-cmake.patch
BuildRequires: JUCE6-devel
BuildRequires: Mesa-libGL-devel
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libXcursor-devel
BuildRequires: libXrandr-devel
BuildRequires: libcurl-devel
BuildRequires: libjack-devel
BuildRequires: lv2-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xext)
BuildRequires: pkgconfig(xinerama)
BuildRequires: unzip
BuildRequires: lv2_ttl_generator
%description
https://magenta.tensorflow.org/ddsp-vst
DDSP morphs audio into a range of different instruments.
Unlike MIDI notes, DDSP preserves the nuances of pitch and dynamics for expressive neural synthesis.
You can also play DDSP just like a typical virtual instrument.
Integrate neural synthesis smoothly into your workflow with all your favorite MIDI sources and effects.
%package doc
Summary: Documentation for DDSP plugin
Buildarch: noarch
%description doc
https://magenta.tensorflow.org/ddsp-vst
DDSP morphs audio into a range of different instruments.
Unlike MIDI notes, DDSP preserves the nuances of pitch and dynamics for expressive neural synthesis.
You can also play DDSP just like a typical virtual instrument.
Integrate neural synthesis smoothly into your workflow with all your favorite MIDI sources and effects.
%package -n vst3-%{name}
Summary: Realtime DDSP Neural Synthesizer and Effect (VST3)
%description -n vst3-%{name}
https://magenta.tensorflow.org/ddsp-vst
DDSP morphs audio into a range of different instruments.
Unlike MIDI notes, DDSP preserves the nuances of pitch and dynamics for expressive neural synthesis.
You can also play DDSP just like a typical virtual instrument.
Integrate neural synthesis smoothly into your workflow with all your favorite MIDI sources and effects.
%package -n vst-%{name}
Summary: Realtime DDSP Neural Synthesizer and Effect (VST)
%description -n vst-%{name}
https://magenta.tensorflow.org/ddsp-vst
DDSP morphs audio into a range of different instruments..
Unlike MIDI notes, DDSP preserves the nuances of pitch and dynamics for expressive neural synthesis.
You can also play DDSP just like a typical virtual instrument.
Integrate neural synthesis smoothly into your workflow with all your favorite MIDI sources and effects.
%package -n lv2-%{name}
Summary: Realtime DDSP Neural Synthesizer and Effect (LV2)
%description -n lv2-%{name}
https://magenta.tensorflow.org/ddsp-vst
DDSP morphs audio into a range of different instruments..
Unlike MIDI notes, DDSP preserves the nuances of pitch and dynamics for expressive neural synthesis.
You can also play DDSP just like a typical virtual instrument.
Integrate neural synthesis smoothly into your workflow with all your favorite MIDI sources and effects.
%prep
%setup -q
%autopatch -p1
unzip %{SOURCE1} -d models/
mv models/DDSP-VST-Models models/ddsp
tar xf %{SOURCE2} --strip-components=1 --one-top-level=externals/tensorflow
sed -i -e '/^#include <math.h>/a #include <cstdint>' externals/tensorflow/tensorflow/lite/kernels/internal/spectrogram.cc
# prepare third-party sources, transitive dependencies of FP16
unzip %{SOURCE30} -d externals/tensorflow/third_party/FP16
unzip %{SOURCE31} -d externals/tensorflow/third_party/FP16
unzip %{SOURCE32} -d externals/tensorflow/third_party/FP16
unzip %{SOURCE33} -d externals/tensorflow/third_party/FP16
%build
cmake -B cmake-build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/lib64/juce -DLV2_TTL_GENERATOR=/usr/bin/lv2_ttl_generator \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DOVERRIDABLE_FETCH_CONTENT_farmhash_URL=%{SOURCE10} \
-DOVERRIDABLE_FETCH_CONTENT_gemmlowp_URL=%{SOURCE11} \
-DOVERRIDABLE_FETCH_CONTENT_abseil-cpp_URL=%{SOURCE12} \
-DOVERRIDABLE_FETCH_CONTENT_eigen_URL=%{SOURCE13} \
-DINCLUDE_INSTALL_DIR:PATH=include/eigen3 \
-DOVERRIDABLE_FETCH_CONTENT_neon2sse_URL=%{SOURCE14} \
-DOVERRIDABLE_FETCH_CONTENT_flatbuffers_URL=%{SOURCE15} \
-DOVERRIDABLE_FETCH_CONTENT_fft2d_URL=%{SOURCE16} \
-DOVERRIDABLE_FETCH_CONTENT_ruy_URL=%{SOURCE17} \
-DOVERRIDABLE_FETCH_CONTENT_xnnpack_URL=%{SOURCE18} \
-DOVERRIDABLE_FETCH_CONTENT_clog_URL=%{SOURCE21} \
-DOVERRIDABLE_FETCH_CONTENT_cpuinfo_URL=%{SOURCE21} \
-DFP16_SOURCE_DIR:PATH=$(realpath externals/tensorflow/third_party/FP16/FP16-*) \
-DFXDIV_SOURCE_DIR:PATH=$(realpath externals/tensorflow/third_party/FP16/FXdiv-*) \
-DPTHREADPOOL_SOURCE_DIR:PATH=$(realpath externals/tensorflow/third_party/FP16/pthreadpool-*) \
-DPSIMD_SOURCE_DIR:PATH=$(realpath externals/tensorflow/third_party/FP16/psimd-*) \
# FIXME: you should use the %%cmake macros
cmake --build cmake-build %{?_smp_mflags}
%install
mkdir -p %{buildroot}%{_bindir}
install cmake-build/DDSPEffect_artefacts/Release/Standalone/* %{buildroot}%{_bindir}/
install cmake-build/DDSPSynth_artefacts/Release/Standalone/* %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_libdir}/vst3
cp -r cmake-build/DDSPEffect_artefacts/Release/VST3/*.vst3 %{buildroot}%{_libdir}/vst3/
cp -r cmake-build/DDSPSynth_artefacts/Release/VST3/*.vst3 %{buildroot}%{_libdir}/vst3/
mkdir -p %{buildroot}%{_libdir}/lv2
cp -r cmake-build/DDSPEffect_artefacts/Release/LV2/*.lv2 %{buildroot}%{_libdir}/lv2/
cp -r cmake-build/DDSPSynth_artefacts/Release/LV2/*.lv2 %{buildroot}%{_libdir}/lv2/
mkdir -p %{buildroot}%{_libdir}/vst
cp -r cmake-build/DDSPEffect_artefacts/Release/VST/* %{buildroot}%{_libdir}/vst/
cp -r cmake-build/DDSPSynth_artefacts/Release/VST/* %{buildroot}%{_libdir}/vst/
mkdir -p %{buildroot}%{_docdir}/ddsp/
cp docs/* %{buildroot}%{_docdir}/ddsp/
%files
%{_bindir}/*
%license LICENSE
%doc README.md
%files doc
%{_docdir}/ddsp/explain-ddsp-ui.png
%{_docdir}/ddsp/getting-started.md
%{_docdir}/ddsp/verified-builds.md
%files -n vst3-%{name}
%{_libdir}/vst3/
%doc README.md
%license LICENSE
%files -n vst-%{name}
%dir %{_libdir}/vst
%{_libdir}/vst/
%doc README.md
%license LICENSE
%files -n lv2-%{name}
%{_libdir}/lv2/
%doc README.md
%license LICENSE
%changelog