Skip to content

Instantly share code, notes, and snippets.

Avatar
🪴

Christian Priva28

🪴
View GitHub Profile
@Priva28
Priva28 / AudioPlayThrough.swift
Last active Oct 8, 2022
This is a basic Swift function that allows for incoming system audio to be played to the system output. It uses the modern Swift syntax for setting up and using RemoteIO Audio Units. I hope someone can use it to avoid the pains of having to use AVAudioEngine and understand how to setup RemoteIO Audio Units in Swift just a little bit easier :)
View AudioPlayThrough.swift
// This is a basic Swift function that allows for incoming system audio (like the microphone or USB input) to be
// played to the system output. It uses the modern Swift syntax for setting up and using RemoteIO Audio Units.
// Of course, before running this function, you would have to setup your AVAudioSession with the playAndRecord category,
// as well as whatever other options you might like. This is just a barebones function that demonstrates the capability
// and you should implement some better error handling and respond to audio session route changes or interruptions.
// I've only created this gist because even though it seems like it would be a simple thing, there is essentially
// zero documentation on anyone trying to do this on the entire internet, and if there was any, it was basically
// ancient and using Objective-C and outdated APIs. Now with this I hope someone can use it to avoid the pains of
// having to use AVAudioEngine and understand how to setup RemoteIO Audio Units in Swift just
@Priva28
Priva28 / GradientEffect.swift
Last active Jun 14, 2022
Gradient effect to emulate Apple Music Lyrics/Now Playing screen.
View GradientEffect.swift
//
// ContentView.swift
// GradientEffect
//
// Created by Christian Privitelli on 18/7/20.
//
import SwiftUI
struct ContentView: View {