summaryrefslogtreecommitdiff
path: root/Radio
diff options
context:
space:
mode:
Diffstat (limited to 'Radio')
-rw-r--r--Radio/Utils/WaterfallFile/NaiveFFT512.swift24
1 files changed, 24 insertions, 0 deletions
diff --git a/Radio/Utils/WaterfallFile/NaiveFFT512.swift b/Radio/Utils/WaterfallFile/NaiveFFT512.swift
index b4dca7e..0e6373a 100644
--- a/Radio/Utils/WaterfallFile/NaiveFFT512.swift
+++ b/Radio/Utils/WaterfallFile/NaiveFFT512.swift
@@ -46,4 +46,28 @@ class NaiveFFT512 {
return transform_result
}
+ func computeLine1024(_ processingArray: [Int8]) -> [Float] {
+
+ var dataFloat = [Float](repeating: 0.0, count: NaiveFFT512.sampleCount*2)
+
+ if processingArray.count != NaiveFFT512.sampleCount*2 {
+ print("Not supporting arrays not equail to \(NaiveFFT512.sampleCount)")
+ return []
+ }
+
+ vDSP.convertElements(of: processingArray, to: &dataFloat)
+ //dataFloat = vDSP.add(127.0, dataFloat)
+ //print(dataFloat)
+
+ //move from -127.0 to 128.0 range -1.0...1.0
+ //var adjusted = vDSP.divide(dataFloat, Float(sampleCount))
+ var adjusted = dataFloat
+ //print(adjusted)
+
+ var transform_result = forwardDCT.transform(adjusted)
+ transform_result = vDSP.absolute(transform_result)
+
+ return transform_result
+ }
+
}