In my previous post, I have come up with a simplistic implementation of an AVAudioEffectNode with a custom render block. At that time, I assumed a fixed setup with two channels and a sample rate of 44,100 Hz. However, a reader recently reached out, asking how to adapt this for an audio effect that converts stereo input to mono output. This inspired me to modify the AVAudioEffectNode
class for greater flexibility.
-
AVAudioEffectNode: Configurable Input-Output
-
AVAudioEffectNode: painless low level audio effects written in Swift
In a previous post, I covered two AVFoundation nodes that can generate sound or tap into the output of an existing node. If you experiment with them, you'll quickly realize:
-
CaseSequencable: Put your enums in order
Enums are often used to model states. If we want to move to the next state (in order of declaration) we have to do the switch dance:
-
UserDefaultsPersistable: Save and Load any struct to/from UserDefaults
The user’s defaults database is a key-value store that let’s you persist data across app launches. It is meant to be used to store user preferences. Using the
Codeable
protocol and aJSONEncoder
you can very easily convert Swift types to JSON data in order to store them. -
How To Upload Data To A Server: Multipart/Form-Data HTTP Requests in Swift
So you are making your first face beautifier© app and it’s about time to upload some images to a server. The backend person asks you to do it via a type of HTTP POST request known as
multipart/form-data
. Soon you come to realise thatURLSession
does not provide you with an out of the boxURLRequest
orDataTask
for this specific task, despite the fact that this is a very standard way of uploading data. -
AVAudioSourceNode, AVAudioSinkNode: Low-Level Audio In Swift
Apple introduced AVAudioSourceNode and AVAudioSinkNode in WWDC2019. These two new AVAudio nodes are part of the AVFoundation framework and can be used in macOS 10.15 and iOS 13 onwards.
-
Jekyll: Testing Swift Code Blocks
Reading through last week's iOSDevWeekly I came across Doctest, an exciting new project that aims to make Swift documentation testable.
-
Podfast: a Podcast Discovery App
I can clearly recall my mother's disappointment once she realised she couldn’t listen to the radio through her new iPhone. Which made total sense to me.
-
How to Set Up Xcode Build Configurations
Build configurations are useful for a handful of reasons. If you are developing an app that's currently in production, chances are you are switching from your production API endpoints to some kind of test environment endpoints for development. Of course you can do the "comment/uncomment URL constants" dance everytime you need to switch environments, but other than being a tedious and error-prone process there are cases where build configurations are unavoidable.