Swiftpack.co -  dhrebeniuk/RosaKit as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
LibRosa port to Swift for ability using same prepossessing logic in iOS/MacOS platforms
.package(url: "https://github.com/dhrebeniuk/RosaKit.git", from: "0.0.4")


RosaKit - LibRosa port to Swift for iOS and macOS platforms.

Library can generate Mel-spectrogram using Short-time Fourier transform (STFT) algorithm.

It's provide methods for calcualte Short-time Fourier transform window and Spectrogram.


Via CocoaPods:

pod 'RosaKit'


  • Generate Spectrogram for visualisations

  • Preprocessing steps for most Machine Learning models in Sound Recognition Sphere

Original Project:




Usage in swift

You can use such code:

let rawAudioData = Data(...)

let chunkSize = 66000
let chunkOfSamples = Array(rawAudioData[0..<chunkSize])    

let powerSpectrogram = samples.melspectrogram(nFFT: 1024, hopLength: 512, sampleRate: Int(sampleRate), melsCount: 128)

Results of processing:

Please look in Examples

Default Gauge

Used in Applications:

Decibel Meter:



Stars: 25
Last commit: 11 hours ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics