### Read Audio Properties and Metadata (Swift) Source: https://github.com/sbooth/sfbaudioengine/blob/main/README.md This example shows how to access audio properties and metadata from an audio file using SFBAudioEngine. It attempts to initialize an `AudioFile` instance from a given URL and then safely retrieves common properties like `sampleRate` and metadata such as `title`. ```Swift if let audioFile = try? AudioFile(readingPropertiesAndMetadataFrom: url) { let sampleRate = audioFile.properties.sampleRate let title = audioFile.metadata.title } ``` -------------------------------- ### Perform Advanced Audio Conversion to Data (Swift) Source: https://github.com/sbooth/sfbaudioengine/blob/main/README.md This example demonstrates a more complex audio conversion scenario, where the output is written to `Data` rather than directly to a file. It involves configuring an `AudioEncoder` with specific Core Audio settings for file type, format, and quality, then using `AudioConverter` to process the input and capture the encoded audio in memory. ```Swift let output = OutputSource.makeForData() let encoder = try AudioEncoder(outputSource: output, encoderName: .coreAudio) encoder.settings = [ .coreAudioFileTypeID: kAudioFileM4AType, .coreAudioFormatID: kAudioFormatMPEG4AAC, .coreAudioAudioConverterPropertySettings: [kAudioConverterCodecQuality: kAudioConverterQuality_High] ] try AudioConverter.convert(inputURL, using: encoder) // Encoder output is in `output.data` ``` -------------------------------- ### Play an Audio File with SFBAudioEngine (Swift) Source: https://github.com/sbooth/sfbaudioengine/blob/main/README.md This snippet demonstrates how to play an audio file using SFBAudioEngine. It initializes an `AudioPlayer` instance, creates a `URL` for the audio file, and attempts to play it. It's important to note that only file URLs are supported for playback. ```Swift import SFBAudioEngine let player = AudioPlayer() let url = URL(fileURLWithPath: "example.flac") try? player.play(url) ``` -------------------------------- ### Convert Audio File Format (Swift) Source: https://github.com/sbooth/sfbaudioengine/blob/main/README.md This snippet illustrates a simple audio file conversion using SFBAudioEngine's `AudioConverter`. It takes an input URL and an output URL, with the output file's format being automatically inferred from its file extension. This provides a straightforward method for basic audio format changes. ```Swift let inputURL = URL(fileURLWithPath: "music.wav") let outputURL = URL(fileURLWithPath: "music.flac") try AudioConverter.convert(inputURL, to: outputURL) ``` -------------------------------- ### SFBAudioEngine Audio Decoding API Overview Source: https://github.com/sbooth/sfbaudioengine/blob/main/README.md This section outlines the core protocols and classes for audio decoding within SFBAudioEngine. It details the two main categories of decoders (PCM and DSD) and introduces special subclasses that wrap underlying decoders for functionalities like looping, DSD over PCM (DoP), and DSD to PCM conversion. ```APIDOC SFBAudioDecoding Protocol: - Purpose: Base protocol implemented by all audio decoders in SFBAudioEngine. SFBPCMDecoding Protocol: - Purpose: Implemented by PCM-producing audio decoders. - Conforms to: SFBAudioDecoding SFBDSDDecoding Protocol: - Purpose: Implemented by DSD-producing audio decoders. - Conforms to: SFBAudioDecoding SFBInputSource: - Purpose: Represents the source of audio data (file, buffer, or data) for decoders. SFBLoopableRegionDecoder Class: - Purpose: Wraps an underlying audio decoder to allow arbitrary looping and repeating of a specified PCM decoder segment. - Conditions: Requires seekable inputs. - Wraps: SFBPCMDecoding instance. SFBDoPDecoder Class: - Purpose: Wraps a DSD decoder to provide DSD over PCM (DoP) output. - Wraps: SFBDSDDecoding instance. SFBDSDPCMDecoder Class: - Purpose: Wraps a DSD decoder to provide PCM output. - Wraps: SFBDSDDecoding instance. ``` -------------------------------- ### FLAC Library License Acknowledgment Source: https://github.com/sbooth/sfbaudioengine/blob/main/ACKNOWLEDGMENTS.md This section presents the copyright and license terms for the FLAC audio codec library, used within SFBAudioEngine. It specifies conditions for source and binary redistribution, including retaining copyright notices and prohibiting the use of the Xiph.Org Foundation's name for endorsement without prior permission. It also includes standard disclaimers of warranty and liability. ```License Copyright (C) 2000-2009 Josh Coalson Copyright (C) 2011-2023 Xiph.Org Foundation Redistribution and use in source and and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Xiph.Org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ``` -------------------------------- ### Monkey's Audio SDK License Acknowledgment Source: https://github.com/sbooth/sfbaudioengine/blob/main/ACKNOWLEDGMENTS.md This section contains the copyright and license agreement for the Monkey's Audio SDK, a component of SFBAudioEngine. It outlines the terms for redistribution in both source and binary forms, emphasizing the retention of copyright notices and disclaimers. It also restricts the use of the copyright holder's name for endorsement without explicit written consent. ```License Copyright © 2000-2024 by Matthew T. Ashland. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3) Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ``` -------------------------------- ### dsd2pcm License Acknowledgment Source: https://github.com/sbooth/sfbaudioengine/blob/main/ACKNOWLEDGMENTS.md This section provides the full copyright and license text for dsd2pcm, a component integrated into SFBAudioEngine. It details the conditions for redistribution in source and binary forms, including requirements for retaining copyright notices and disclaimers regarding warranties and liability. ```License Copyright 2009, 2011 Sebastian Gesemann. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY SEBASTIAN GESEMANN ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEBASTIAN GESEMANN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEBASTIAN GESEMANN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Sebastian Gesemann. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.