ios – audiokit的波表参数

前端之家收集整理的这篇文章主要介绍了ios – audiokit的波表参数前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
AudioKit非常棒,可让您启动一些振荡器并即时改变频率.现在我想改变波形的形状,这样我就可以为振荡器创建自定义音色.

有四种标准类型,实际上是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数组并简单地修改它以生成新的波形吗?这样做有明智或惯用的方法吗?

丹科.

解决方法

由于AudioKit支持将Google网上论坛转移到StackOverflow,我在这里回答更老的问题.基本上表可以是你想要的任何东西.它们是类,而不是表格,并且有一个操场,显示如何使用它们并使用AKTableView绘制它们.

在这里查看:http://audiokit.io/playgrounds/Basics/Tables/

猜你在找的iOS相关文章