AudioKit / AudioKitUI

Controls and Visualization for AudioKit apps
MIT License
200 stars 53 forks source link

Microphone Analysis #15

Closed Lascorbe closed 3 years ago

Lascorbe commented 3 years ago

Hi there,

First, I wanted to thank you for the work you do on AudioKit, it's great to have a high quality and well maintained framework to work on audio 💯

The issue: I wanted to know if there's a way to achieve this with AudioKit 5: https://audiokit.io/examples/MicrophoneAnalysis/

I've tried:

let audioEngine = AudioKit.AudioEngine()
guard let node = audioEngine.input else { return nil }
try? audioEngine.start()
plot = AudioKitUI.NodeOutputPlot(node)

But it throws Error: Attempt to start engine with no output and doesn't seem to work.

Reading the AudioKit 5 Migration Guide I could get to this point but I really have no idea how to use AmplitudeTap or PitchTap:

let audioEngine = AudioKit.AudioEngine()
guard let node = audioEngine.input else { return nil }
let tracker = AudioKit.AmplitudeTap(node) // probably not correct?
audioEngine.output = tracker // nope
try? audioEngine.start()
plot = AudioKitUI.NodeOutputPlot(node)

Maybe this is not possible yet on AudioKit 5, no worries, but I'd love to know that so I can go with AudioKit 4 instead.

Thank you for your help ❤️

Lascorbe commented 3 years ago

Well, I just discovered https://github.com/AudioKit/Cookbook/blob/main/Cookbook/Cookbook/Recipes/Tuner.swift, which did help a lot, but I took a bit to find.

Thanks! I think this can be closed now.

PD: Now trying to see how to modify the output wave which seems to be gain :)

Chiyo-no-sake commented 1 year ago

Well, I just discovered https://github.com/AudioKit/Cookbook/blob/main/Cookbook/Cookbook/Recipes/Tuner.swift, which did help a lot, but I took a bit to find.

Thanks! I think this can be closed now.

PD: Now trying to see how to modify the output wave which seems to be gain :)

For reference, new link to that file is https://github.com/AudioKit/Cookbook/blob/main/Cookbook/CookbookCommon/Sources/CookbookCommon/Recipes/MiniApps/Tuner.swift