KeyAudioManager - A swift package to make it a lot easier to play audio in your app

Overview

KeyAudioManager

A swift package to make it a lot easier to play audio in your app.


Installation

In Xcode go to File -> Add Packages... -> Search or Enter Package URL and paste in the repo's url: https://github.com/pedroesli/KeyAudioManager

How to use

To be able to play an audio using the KeyAudioManager, you must first provide the audios file name and file extension using the add method

let audioManager = KeyAudioManager()

// Add the audios
do {
    try audioManager.addAudio(key: "buttonSound", audioFileName: "Button Sound", fileExtension: "mp3")
    try audioManager.addAudio(key: "song", audioFileName: "Main Menu Song", fileExtension: "mp3")
}
catch{
    print("Error adding audio file: \(error)")
}

// Play an audio using its key
audioManager.play(key: "song")

Useful methods

play

audioManager.play(key: "song")

// Or to play an audio after the first one is done playing

audioManager.play(key: "buttonSound"){
    audioManager.play(key: "song")
}

remove

audioManager.removeAudio(key: "buttonSound")

pause

audioManager.pause(key: "song")

stop

audioManager.stop(key: "song")

volume

// Values ranging from 0.0 for silence to 1.0 for full volume.
audioManager.volume(key: "song", 0.5)

audio Loop

// repeats and audio indefinitely with a time interval in between the audios 
audioManager.playLoop(key: "song", 2.0)

// To stop repeating audio 
audioManager.stopLoop()

sequence

// play a series of audio in a sequence with a time interval (seconds) in between the audios
audioManage.playInSequence("song", "buttonSound", "sound1", "song", timeInterval: 2)
You might also like...
Voice Memos is an audio recorder App for iPhone and iPad that covers some of the new technologies and APIs introduced in iOS 8 written in Swift.
Voice Memos is an audio recorder App for iPhone and iPad that covers some of the new technologies and APIs introduced in iOS 8 written in Swift.

VoiceMemos Voice Memos is a voice recorder App for iPhone and iPad that covers some of the new technologies and APIs introduced in iOS 8 written in Sw

App for adding and listening audio files
App for adding and listening audio files

SomeSa SomeSa (самса) – приложение, позволяющее загружать и воспроизводить произвольные аудиофайлы. Протестировано на форматах файлов .wav и .mp3, раз

A drop-in universal library allows to record audio within the app with a nice User Interface.
A drop-in universal library allows to record audio within the app with a nice User Interface.

IQAudioRecorderController IQAudioRecorderController is a drop-in universal library allows to record and crop audio within the app with a nice User Int

This app demonstrates how to use the Google Cloud Speech API and Apple on-device Speech library to recognize speech in live recorded audio.

SpeechRecognitionIOS This app demonstrates how to use Google Cloud Speech API and Apple on-device Speech library to recognize speech in live audio rec

MusicalInstrument - Play musical instrument in just few lines of swift code

MusicalInstrument Play musical instrument in just few lines of swift code. Requi

Beethoven is an audio processing Swift library
Beethoven is an audio processing Swift library

Beethoven is an audio processing Swift library that provides an easy-to-use interface to solve an age-old problem of pitch detection of musical signals.

SwiftAudioPlayer - Swift-based audio player with AVAudioEngine as its base

SwiftAudioPlayer Swift-based audio player with AVAudioEngine as its base. Allows for: streaming online audio, playing local file, changing audio speed

Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS
Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS

AudioKit AudioKit is an audio synthesis, processing, and analysis platform for iOS, macOS (including Catalyst), and tvOS. Installation To add AudioKit

Multiple Audio Player With Swift

MultipleAudioPlayer I needed to play sequential audio files in a number of places so I made a package. Usage There are 2 inits, one takes filenames fr

Owner
Pedro Esli
Currently, I'm a student of Universidade Católica de Brasilia. I'm studying computer science and as a hobby, I like to make video games.
Pedro Esli
Subsonic is a small library that makes it easier to play audio with SwiftUI

Subsonic is a small library that makes it easier to play audio with SwiftUI

Paul Hudson 218 Dec 16, 2022
The Amazing Audio Engine is a sophisticated framework for iOS audio applications, built so you don't have to.

Important Notice: The Amazing Audio Engine has been retired. See the announcement here The Amazing Audio Engine The Amazing Audio Engine is a sophisti

null 523 Nov 12, 2022
AudiosPlugin is a Godot iOS Audio Plugin that resolves the audio recording issue in iOS for Godot Engine.

This plugin solves the Godot game engine audio recording and playback issue in iOS devices. Please open the Audios Plugin XCode Project and compile the project. You can also use the libaudios_plugin.a binary in your project.

null 3 Dec 22, 2022
I'm trying to make Flutter based Audio Unit Extensions possible.

Flutter AUv3 Audio Unit Error Demo Motivation We are the developers of Audanika, a professional MIDI Controller app written in Flutter. Many of our us

Gabriel Gatzsche 0 Jan 5, 2022
AIB indicates for your app users which audio is playing. Just like the Podcasts app.

Audio Indicator Bars for iOS and tvOS Indicates for your app users which audio is playing. Just like the Podcasts app. Index Requirements and Details

Leonardo Cardoso 285 Nov 23, 2022
The easiest way to prepare, play, and remove sounds in your Swift app!

Chirp The easiest way to prepare, play, and remove sounds in your Swift app! ##Installation ###CocoaPods Installation Chirp is available on CocoaPods.

null 309 Dec 17, 2022
SoundManager - A simple framework to load and play sounds in your app.

SoundManager - A simple framework to load and play sounds in your app.

Jonathan Chacón 3 Jan 5, 2022
FDWaveformView is an easy way to display an audio waveform in your app

FDWaveformView is an easy way to display an audio waveform in your app. It is a nice visualization to show a playing audio file or to select a position in a file.

William Entriken 1.1k Dec 21, 2022
AudioPlayer is syntax and feature sugar over AVPlayer. It plays your audio files (local & remote).

AudioPlayer AudioPlayer is a wrapper around AVPlayer. It also offers cool features such as: Quality control based on number of interruption (buffering

Kevin Delannoy 676 Dec 25, 2022
An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and more.

SpotifyClone An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and

null 104 Jan 7, 2023