Skip to content

Commit

Permalink
Merge pull request #153 from mahal/main
Browse files Browse the repository at this point in the history
Added harmonic series with a phase as example to Table recipe
  • Loading branch information
NickCulbertson authored Apr 10, 2024
2 parents 7284bc3 + f8fac76 commit 6786cbc
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class TableConductor {
let square: AudioKit.Table
let triangle: AudioKit.Table
let sine: AudioKit.Table
let sineHarmonic: AudioKit.Table
let fileTable: AudioKit.Table
let custom: AudioKit.Table

Expand All @@ -18,7 +19,8 @@ class TableConductor {
let url = Bundle.module.resourceURL?.appendingPathComponent("Samples/beat.aiff")
let file = try! AVAudioFile(forReading: url!)
fileTable = Table(file: file)!

let harmonicOvertoneAmplitudes: [Float] = [0.0, 0.0, 0.016, 0.301]
sineHarmonic = Table(.harmonic(harmonicOvertoneAmplitudes), phase: 0.75)
custom = Table(.sine, count: 256)
for i in custom.indices {
custom[i] += Float.random(in: -0.3 ... 0.3) + Float(i) / 2048.0
Expand All @@ -37,6 +39,8 @@ struct TableRecipeView: View {
TableDataView(view: TableView(conductor.triangle))
Text("Sine")
TableDataView(view: TableView(conductor.sine))
Text("Sine Harmonic")
TableDataView(view: TableView(conductor.sineHarmonic))
Text("File")
TableDataView(view: TableView(conductor.fileTable))
Text("Custom Data")
Expand Down

0 comments on commit 6786cbc

Please sign in to comment.