Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Recipes #142

Merged
merged 8 commits into from
Dec 8, 2023
Merged

New Recipes #142

merged 8 commits into from
Dec 8, 2023

Conversation

NickCulbertson
Copy link
Member

Added Additional Packages category with their respective demos: Controls, Flow, Keyboard, Piano Roll, Synthesis Toolkit, & Waveform
Added Arpeggiator recipe (using Sequencer)
Added SpriteKit Audio recipe
Added DunneAudioKit Synth recipe (in WIP)
Added Polyphonic STK + MIDIKit recipe (in WIP)
Added Input Device Demo recipe (already in project but unlinked)
Added parameters to Instrument SFZ
Added info button
Reordered categories

Added Additional Packages category with their respective demos: Controls, Flow, Keyboard, Piano Roll, Synthesis Toolkit, & Waveform
Added Arpeggiator recipe (using Sequencer)
Added SpriteKit Audio recipe
Added DunneAudioKit Synth recipe (in WIP)
Added Input Device Demo recipe (already in project but unlinked)
Added parameters to Instrument SFZ
Added info button
Reordered categories
.alert("AudioKit Cookbook", isPresented: $showingInfo) {
Button("OK", role: .cancel) { }
} message: {
Text("AudioKit is an audio synthesis, processing, and analysis platform for iOS, macOS, and tvOS.\n\nMost of the examples that were inside of AudioKit are now in this application.\n\nIn addition to the resources found here, there are various open-source example projects on GitHub and YouTube created by AudioKit contributors.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 200 characters or less: currently 340 characters (line_length)

}
}
var body: some View {
GeometryReader { proxy in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Closure Parameter Violation: Unused parameter "proxy" in a closure should be replaced with _. (unused_closure_parameter)

@State var angle: Float = 0
@State var x: Float = 0.5
@State var y: Float = 0.5

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@State var radius: Float = 0
@State var angle: Float = 0
@State var x: Float = 0.5
@State var y: Float = 0.5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'y' (identifier_name)

@State var modulation: Float = 0
@State var radius: Float = 0
@State var angle: Float = 0
@State var x: Float = 0.5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'x' (identifier_name)

.alert("AudioKit Cookbook", isPresented: $showingInfo) {
Button("OK", role: .cancel) { }
} message: {
Text("AudioKit is an audio synthesis, processing, and analysis platform for iOS, macOS, and tvOS.\n\nMost of the examples that were inside of AudioKit are now in this application.\n\nIn addition to the resources found here, there are various open-source example projects on GitHub and YouTube created by AudioKit contributors.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 200 characters or less: currently 340 characters (line_length)

}
}
var body: some View {
GeometryReader { proxy in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Closure Parameter Violation: Unused parameter "proxy" in a closure should be replaced with _. (unused_closure_parameter)

@State var angle: Float = 0
@State var x: Float = 0.5
@State var y: Float = 0.5

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@State var radius: Float = 0
@State var angle: Float = 0
@State var x: Float = 0.5
@State var y: Float = 0.5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'y' (identifier_name)

@State var modulation: Float = 0
@State var radius: Float = 0
@State var angle: Float = 0
@State var x: Float = 0.5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'x' (identifier_name)

}

var randomWires: Set<Wire> = []
for n in 0 ..< 50 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'n' (identifier_name)

/// Bit of a stress test to show how Flow performs with more nodes.
func randomPatch() -> Patch {
var randomNodes: [Node] = []
for n in 0 ..< 50 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'n' (identifier_name)

.alert("AudioKit Cookbook", isPresented: $showingInfo) {
Button("OK", role: .cancel) { }
} message: {
Text("AudioKit is an audio synthesis, processing, and analysis platform for iOS, macOS, and tvOS.\n\nMost of the examples that were inside of AudioKit are now in this application.\n\nIn addition to the resources found here, there are various open-source example projects on GitHub and YouTube created by AudioKit contributors.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 200 characters or less: currently 340 characters (line_length)

}
}
var body: some View {
GeometryReader { proxy in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Closure Parameter Violation: Unused parameter "proxy" in a closure should be replaced with _. (unused_closure_parameter)

@State var angle: Float = 0
@State var x: Float = 0.5
@State var y: Float = 0.5

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@State var radius: Float = 0
@State var angle: Float = 0
@State var x: Float = 0.5
@State var y: Float = 0.5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'y' (identifier_name)

@State var modulation: Float = 0
@State var radius: Float = 0
@State var angle: Float = 0
@State var x: Float = 0.5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'x' (identifier_name)

/// Bit of a stress test to show how Flow performs with more nodes.
func randomPatch() -> Patch {
var randomNodes: [Node] = []
for n in 0 ..< 50 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'n' (identifier_name)


@State var model = PianoRollModel(notes: [
PianoRollNote(start: 1, length: 2, pitch: 3),
PianoRollNote(start: 5, length: 1, pitch: 4),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Comma Violation: Collection literals should not have trailing commas. (trailing_comma)

let indicatorSize = 10.0

var body: some View {
GeometryReader { gp in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'gp' (identifier_name)

return try! AVAudioFile(forReading: url)
}

func clamp(_ x: Double, _ inf: Double, _ sup: Double) -> Double {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'x' (identifier_name)


func getFile() -> AVAudioFile {
let url = Bundle.module.url(forResource: "Samples/Piano", withExtension: "mp3")!
return try! AVAudioFile(forReading: url)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force Try Violation: Force tries should be avoided. (force_try)

.alert("AudioKit Cookbook", isPresented: $showingInfo) {
Button("OK", role: .cancel) { }
} message: {
Text("AudioKit is an audio synthesis, processing, and analysis platform for iOS, macOS, and tvOS.\n\nMost of the examples that were inside of AudioKit are now in this application.\n\nIn addition to the resources found here, there are various open-source example projects on GitHub and YouTube created by AudioKit contributors.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 200 characters or less: currently 340 characters (line_length)

}
}
var body: some View {
GeometryReader { proxy in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Closure Parameter Violation: Unused parameter "proxy" in a closure should be replaced with _. (unused_closure_parameter)

@State var angle: Float = 0
@State var x: Float = 0.5
@State var y: Float = 0.5

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@State var radius: Float = 0
@State var angle: Float = 0
@State var x: Float = 0.5
@State var y: Float = 0.5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'y' (identifier_name)

@State var modulation: Float = 0
@State var radius: Float = 0
@State var angle: Float = 0
@State var x: Float = 0.5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'x' (identifier_name)

Color.clear : Color(red: 0.9, green: 0.9, blue: 0.9))
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Newline Violation: Files should have a single trailing newline. (trailing_newline)

struct ArpeggiatorView: View {
@StateObject var conductor = ArpeggiatorConductor()
@Environment(\.colorScheme) var colorScheme

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

sequencer.length = 0.25
sequencer.loopEnabled = true
sequencer.add(noteNumber: 60, position: 0.0, duration: 0.24)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

} catch {
Log("Could not load instrument")
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

engine.output = PeakLimiter(Mixer(instrument, midiCallback), attackTime: 0.001, decayTime: 0.001, preGain: 0)

do {
if let fileURL = Bundle.main.url(forResource: "Sounds/Sampler Instruments/sawPiano1", withExtension: "exs") {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 121 characters (line_length)

}

var randomWires: Set<Wire> = []
for n in 0 ..< 50 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'n' (identifier_name)

/// Bit of a stress test to show how Flow performs with more nodes.
func randomPatch() -> Patch {
var randomNodes: [Node] = []
for n in 0 ..< 50 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'n' (identifier_name)


@State var model = PianoRollModel(notes: [
PianoRollNote(start: 1, length: 2, pitch: 3),
PianoRollNote(start: 5, length: 1, pitch: 4),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Comma Violation: Collection literals should not have trailing commas. (trailing_comma)

let indicatorSize = 10.0

var body: some View {
GeometryReader { gp in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'gp' (identifier_name)

return try! AVAudioFile(forReading: url)
}

func clamp(_ x: Double, _ inf: Double, _ sup: Double) -> Double {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'x' (identifier_name)

}

engine.output = PeakLimiter(Mixer(instrument, midiCallback), attackTime: 0.001, decayTime: 0.001, preGain: 0)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

}
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

self.fireTimer()
} else if status == 128 { //Note Off
//all notes off
for i in 0...127 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'i' (identifier_name)

if status == 144 { //Note On
self.fireTimer()
} else if status == 128 { //Note Off
//all notes off
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment Spacing Violation: Prefer at least one space after slashes for comments. (comment_spacing)

midiCallback = CallbackInstrument { status, note, vel in
if status == 144 { //Note On
self.fireTimer()
} else if status == 128 { //Note Off
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment Spacing Violation: Prefer at least one space after slashes for comments. (comment_spacing)

Color.clear : Color(red: 0.9, green: 0.9, blue: 0.9))
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Newline Violation: Files should have a single trailing newline. (trailing_newline)

struct ArpeggiatorView: View {
@StateObject var conductor = ArpeggiatorConductor()
@Environment(\.colorScheme) var colorScheme

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

sequencer.length = 0.25
sequencer.loopEnabled = true
sequencer.add(noteNumber: 60, position: 0.0, duration: 0.24)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

} catch {
Log("Could not load instrument")
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

engine.output = PeakLimiter(Mixer(instrument, midiCallback), attackTime: 0.001, decayTime: 0.001, preGain: 0)

do {
if let fileURL = Bundle.main.url(forResource: "Sounds/Sampler Instruments/sawPiano1", withExtension: "exs") {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 120 characters or less: currently 121 characters (line_length)


init() {

midiCallback = CallbackInstrument { status, note, vel in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused Closure Parameter Violation: Unused parameter "note" in a closure should be replaced with _. (unused_closure_parameter)
Unused Closure Parameter Violation: Unused parameter "vel" in a closure should be replaced with _. (unused_closure_parameter)

}

init() {

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

}
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)


//remove notes from an array
for i in heldNotes {
if i == mynote {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Where Violation: where clauses are preferred over a single if inside a for. (for_where)

let mynote = pitch.intValue

//remove notes from an array
for i in heldNotes {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'i' (identifier_name)

@NickCulbertson NickCulbertson merged commit 1be7189 into main Dec 8, 2023
5 checks passed
@NickCulbertson NickCulbertson deleted the NewRecipes branch December 8, 2023 15:34

do {
try midiManager.addInputConnection(
to: .allOutputs, // no need to specify if we're using .allEndpoints
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super trivial detail, but the comment was probably made before a MIDIKit API change from .allEndpoints to .allOutputs. Could just update the comment to avoid any confusion.

Copy link
Member Author

@NickCulbertson NickCulbertson Dec 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing it! It's fixed now: 3b8f606

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants