1 Reply
      Latest reply on Jan 16, 2017 1:22 PM by Claude31
      ferasOS Level 1 Level 1 (0 points)

        Hi All,


        I need to run a DCT on multiple signals (time slices of the same audio signal).


        My current code looks like this:


            var ci = Array(stride(from: Float(0), to: Float(y.count), by: Float(p)))


            var c = Array<Float>(repeating:0.0, count:y.count)


            for (index,value) in ci.enumerated() {


             var i = index

             var v = Int(value)

             var newArray = Array(y[v...(v+Int(p)-1)])


             let DCTSetup = vDSP_DCT_CreateSetup(nil, vDSP_Length(newArray.count), vDSP_DCT_Type.II)


             var nac = Array<Float>(repeating:0.0, count:newArray.count)

             vDSP_DCT_Execute(DCTSetup!, &newArray, &nac)


             //c.append(contentsOf: nac)

             c.insert(contentsOf: nac, at: v)





        But this is taking ages. So for a 10 second audio sample it takes well over 60 seconds.

        Is there a way of doing a DCT on multiple signal quickly? (I have made up an array of each sample appended to the other for this computation).


        Hope you can help,




        Feras A.