Code Monkey home page Code Monkey logo

chassis-ios's Introduction

Chassis-iOS

A wrapper for AVAudioEngine to help create basic and prosumer multi-track audio applications on iOS.

Chassis is written to abstract away some of the gritty parts of CoreAudio present in multi-track AVAudioEngine usage.

AVAudioEngine works on the basis of AVAudioNodes connected to a mixer node, and then to an output node, much like a recording studio would connect sources to destinations. AVAudioEngine network

Chassis abstracts this away by using a Track model and a simple loadAllTracksAndAddToMix method to add an array of audio files to a node, then to the mixer, and the output. Chassis network

This saves the end user the trouble of managing audio files, urls, and nodes separately.

Similarly, AVAudioEngine's AVAudioSinkNode provides a way to record input into a file that utilizes Core Audio's ring buffer pattern to populate a new file with the incoming data. AVAudioEngine Recording

Chassis attempts to abstract this away as well by providing a single startRecording and stopRecording function pair to connect the sink node and populate a file. Chassis Recording

To create an instance of Chassis' engine, simply instantiate AudioEngine.

import Chassis

...
private var engine: AudioEngine = AudioEngine()
...

To add a file to a mix, create a Track object, and call loadAllTracksAndAddToMix.

import Chassis

...
let newTrack = Track(urlString: Bundle.main.url(forResource: "M1F1-int16s-AFsp",
                                                withExtension: "aif")!.lastPathComponent,
                     startTime: nil)
engine.loadAllTracksAndAddToMix(tracks: [newTrack])
...

Chassis is not meant to be a pro-audio framework, as it abstracts away certain sample-locked parts from the user. Having said that, its main purpose is to facilitate the entry-point to multi-track audio for consumer applications on iOS.

Chassis relies on Combine, so I have decided to make it iOS 13 +.

I have begun updating Issues with a list of issues I'd like to address...collaborators are welcome! There will be many more issues to come; Chassis was ripped out of an ongoing project and packaged up, so a lot of the missing features just haven't been necessary up to now.

I will also be continuing to update this readme with notes about how Chassis is written, and some of its shortcomings.

If something is a mystery, or missing, or confusing, please feel free to write me directly at rawbirdtoe --(at)-- g mail dot com. This is a labor of love to try to make multi-track audio more accessible, but I am fully aware that in its current state it only serves a very narrow set of requirements. I promise not to give up or abandon it, so please add any issues or feature requests!

chassis-ios's People

Contributors

diatrevolo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

chassis-ios's Issues

Add some unit tests

Is your feature request related to a problem? Please describe.
Need some tests, let's be clear.

Describe the solution you'd like
Write the tests!

Describe alternatives you've considered
N/A

Additional context
N/A

Add non-destructive volume and panning

Is your feature request related to a problem? Please describe.
As a user, I'd like to be able to alter the volume and pan of tracks.

Describe the solution you'd like
This probably involves two new methods that edit the Node in question.

Describe alternatives you've considered
N/A

Additional context
N/A

Expose new API to use Track model uniformly

Is your feature request related to a problem? Please describe.
Many methods in AudioEngine use filenames, URLs and Tracks arbitrarily, a product of ripping Chassis out of a working project.

Describe the solution you'd like
While I'd like to maintain the old method signatures, convenience methods or new full methods, exposed in the protocol, should standardize across the Track model, for simplicity.

Describe alternatives you've considered
N/A

Additional context
N/A

Reuse AVAudioPlayerNodes by adding a token system to the Track model

Is your feature request related to a problem? Please describe.
Node allocation and deallocation are expensive activities. Ideally, we want a bunch of nodes, created lazily, that get files from Track models, and files that are tracked by tokens. This allows us to use a single AVAudioFile for multiple tracks as a welcome side effect.

Describe the solution you'd like
Add a token property to Track. On addTrack operations, select an existing node, if available. If not, create a new node. Track these nodes in a dictionary by token number. Set the AVAudioFile via its token into an AVAudioPlayerNode, and set the start time via the Track property.

Convert to Swift Package

Describe the solution you'd like
Moving from a framework to a Swift Package will allow us to release on Swift Package Manager more easily.

Nodes not being recycled appropriately on stop()

Describe the bug
On stop, nodes don't get unloaded, but do get reloaded. New ones are created.

To Reproduce
Steps to reproduce the behavior:

  1. Play
  2. Stop
  3. Play

Expected behavior
Nodes should be tagged as not in use if they are to be reloaded. Alternatively, we can keep the engine running after stop.

Expand getMixLength in AudioEngine

Is your feature request related to a problem? Please describe.
getMixLength assumes the track that ends last starts at zero, effectively giving the duration of the longest track. This may not be the case if tracks start at different times, so this method would fail in some cases.

Describe the solution you'd like
getMixLength should account for tracks not starting at zero necessarily.

Describe alternatives you've considered
N/A

Additional context
N/A

Pan and volume are not persistent after stop

Describe the bug
Pan and volume return to default after a stop.

To Reproduce
Steps to reproduce the behavior:

  1. Select a track
  2. Change pan or volume
  3. Play to end
  4. Play again

Expected behavior
Should persist after a stop.

Add scrubTo functionality to AudioEngine

Is your feature request related to a problem? Please describe.
As a user, I'd like to be able to seek to an arbitrary point in time for recording and/or playing.

Describe the solution you'd like
Implement scrubTo, updating currentPosition.

Describe alternatives you've considered
N/A

Additional context
N/A

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.