Swift wrapper for RNNoise C library.
Building manually is not required.
Run ./autogen.sh
or upload your own model to Libraries/RNNoise
before running. It is recommended to clone this repository and adding the package locally.
- Import
RNNoiseSwift
. - Use function
process(_ buffer: AVAudioPCMBuffer) -> AVAudioPCMBuffer?
Note: Buffers must be RAW PCM format, Float32.
Make sure git submodule
is initialized.
cd ./Libraries/RNNoise
- Run
./autogen.sh
to download latest model. - Run
./configure
with customCFLAGS
.
- Command for arm64 Apple iOS:
./configure --host=arm-apple-darwin CC="$(xcrun --sdk iphoneos --find clang)" CFLAGS="-arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path)"
- Command for arm64 Apple MacOS:
./configure CFLAGS="-arch arm64"
Note: The C library has to be built twice, once for iOS and once for MacOS, in order to make it compatible for XCFramework.
- Build C library with
make
Note: Clean build files with
make clean
- Archive XCFramework
xcodebuild archive \
-scheme RNNoise \
-destination "generic/platform=iOS" \
-archivePath "RNNoise" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
- Build for XCFramework - Building C library beforehand is required
xcodebuild -create-xcframework \
-library Libraries/RNNoise/.libs/librnnoise.a \
-headers Libraries/RNNoise/include \
-output RNNoise.xcframework
Before proceeding check for valid signature with codesign -dvvv ./RNNoise.xcframework
- Find valid certificate name
security find-identity -p codesigning
- Sign xcframework with
codesign --force --sign "Your Certificate Name" --timestamp ./RNNoise.xcframework