Created
February 9, 2018 22:15
-
-
Save mmuszynski/a86aa9f7cfa1f1050755f7743d0eaf1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Version 1, very slow | |
_powerData = [Float](repeatElement(0, count: loadedAudioData.count)) | |
for value in loadedAudioData.enumerated() { | |
let square = value.element * value.element | |
_powerData![value.offset] = square | |
} | |
//Version 2, much faster | |
_powerData = loadedAudioData.map({ (value) in | |
return value * value | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment