AudioKit非常棒,可让您启动一些振荡器并即时改变频率.现在我想改变波形的形状,这样我就可以为振荡器创建自定义音色.
- sine - triangle (good sine approximate) - square wave - sawtooth - reverse sawtooth wave
所有这些听起来都不同,但如果我可以通过使用内置的waveTable支持来改变Waveform的类型,那将会非常棒.
http://audiokit.io/docs/Structs/AKTable.html#/s:vV8AudioKit7AKTable6valuesGSaSf_提到AKMorphingOscillator就像一个可以改变振荡器波形的奇迹类.默认设置都有效,但我真的很想填充AKTable字段.
git页面https://github.com/audiokit/AudioKit/blob/master/AudioKit/Common/Internals/AKTable.swift显示:
/// A table of values accessible as a waveform or lookup mechanism public struct AKTable { // MARK: - Properties /// Values stored in the table public var values = [Float]() /// Number of values stored in the table var size = 4096 /// Type of table var type: AKTableType // MARK: - Initialization /// Initialize and set up the default table /// /// - parameter tableType: AKTableType of teh new table /// - parameter size: Size of the table (multiple of 2) /// public init(_ tableType: AKTableType = .Sine,size tableSize: Int = 4096) { type = tableType size = tableSize ....
所以我的问题是,我可以直接访问values数组并简单地修改它以生成新的波形吗?这样做有明智或惯用的方法吗?
丹科.