LoginSignup
3
4

More than 5 years have passed since last update.

AudioKitフレームワークを導入する

Last updated at Posted at 2018-04-21

XcodeにAudioKitフレームワーク導入に手こずったのでメモしておきます
AudioKitサイト

Cocoapodsは導入ずみ前提で箇条書きしていきます

  1. XcodeでSingleViewのプロジェクトに適当に名前をつけ立ち上げます
  2. 一度プロジェクトを閉じます
  3. ターミナルを起動
  4. プロジェクトのあるフォルダのメニューをだしaltを押すと「”AudioKitImport”をコピー」の部分が「”〜”のパス名をコピー」に変わるのでコピーする
    スクリーンショット 2018-04-21 20.24.09.png

  5. ターミナルで

cd 先ほどコピーしたアドレスを貼り付け
pod init

6.プロジェクトのあるファイルにpodfileができているので立ち上げ

target 'プロジェクトのあるフォルダ名' do
  use_frameworks!
pod 'AudioKit', '~> 4.2.3'

end

と変更

7.ターミナルに戻り

pod 'AudioKit', '~> 4.2.3'
pod install

これでAudioKitフレームワークは導入完了です!

8.プロジェクトフォルダに戻り通常のプロジェクトアイコンではなくworkspaceアイコンから開きます
9. ViewControllerにAudioKitをimportしてサンプルコードを書いてiPhoneにビルドすれば完了です!

ピーってなります!

ViewController
import UIKit
import AudioKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        let oscillator = AKOscillator()
        oscillator.amplitude = 0.1
        AudioKit.output = oscillator
        try! AudioKit.start()

        oscillator.start()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4