Giter Site home page Giter Site logo

dzodzievtemirlan / sfbaudioengine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sbooth/sfbaudioengine

0.0 0.0 0.0 8.09 MB

A powerful audio playback engine for macOS and iOS

Home Page: https://sbooth.github.io/SFBAudioEngine/

License: MIT License

C++ 9.36% Objective-C++ 36.56% Objective-C 49.67% C 0.05% Swift 4.32% Shell 0.04%

sfbaudioengine's Introduction

SFBAudioEngine

SFBAudioEngine is a framework for macOS and iOS audio playback using Swift or Objective-C. SFBAudioEngine supports the following formats:

  • WAVE
  • AIFF
  • Apple Lossless
  • AAC
  • FLAC
  • MP3
  • WavPack
  • Ogg Vorbis
  • Ogg Speex
  • Ogg Opus
  • Musepack
  • Monkey's Audio
  • True Audio
  • Shorten
  • All formats supported by libsndfile
  • All formats supported by Core Audio
  • DSD to PCM conversion for DSD64

In addition to playback SFBAudioEngine supports reading and writing of metadata for most supported formats.

Requirements

macOS 10.15+ or iOS 13.0+

Building SFBAudioEngine

  1. Clone the SFBAudioEngine repository.
  2. Download the dependencies and decompress in the project's root
  3. Open the project, build, and play something using SimplePlayer!

Quick Start

Playing an audio file is as simple as:

import SFBAudioEngine
let player = AudioPlayer()
let url = URL(fileURLWithPath: "example.flac")
try? player.play(url)

Reading audio properties and metadata is similarly trivial:

if let audioFile = try? AudioFile(readingPropertiesAndMetadataFrom: url) {
    let sampleRate = audioFile.properties.sampleRate
    let title = audioFile.metadata.title
}

Design

Audio decoders in SFBAudioEngine are broadly divided into two categories, those producing PCM output and those producing DSD output. Audio decoders read data from an SFBInputSource which may refer to a file, buffer, or network source.

All audio decoders in SFBAudioEngine implement the SFBAudioDecoding protocol. PCM decoders additionally implement SFBPCMDecoding while DSD decoders implement SFBDSDDecoding.

Three special decoder subclasses that wrap an underlying audio decoder instance are also provided: SFBLoopableRegionDecoder, SFBDoPDecoder, and SFBDSDPCMDecoder. For seekable inputs, SFBLoopableRegionDecoder allows arbitrary looping and repeating of a specified PCM decoder segment. SFBDoPDecoder and SFBDSDPCMDecoder wrap a DSD decoder providing DSD over PCM (DoP) and PCM output respectively.

SFBAudioPlayerNode is a subclass of AVAudioSourceNode that provides rich playback functionality within an AVAudioEngine processing graph. SFBAudioPlayerNode supports gapless playback and comprehensive status notifications through delegate callbacks.

SFBAudioPlayer wraps an AVAudioEngine processing graph driven by SFBAudioPlayerNode. SFBAudioPlayer provides complete player functionality with no required configuration but also allows customization of the underlying processing graph as well as rich status notifications through delegate callbacks.

Audio properties and metadata are accessed from instances of SFBAudioFile. Audio properties are read-only while metadata is writable for most formats.

Sample Audio Players

Two versions of SimplePlayer, one for macOS and one for iOS, are provided illustrate the usage of SFBAudioEngine.

macOS

Image of an audio player window

SimplePlayer for macOS is written in Swift using AppKit and supports gapless sequential playback of items from a playlist. The essential functionality is contained in one file, PlayerWindowController.swift.

iOS

Image of audio file playback progress

SimplePlayer for iOS is written in Swift using SwiftUI and supports playback of a single item selected from a list.

License

SFBAudioEngine is released under the MIT License.

sfbaudioengine's People

Contributors

sbooth avatar mathbunnyru avatar bsneed avatar antebarac avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.