Cepstral stream only needs magnitude as input, so make that explicit
1 files changed, 12 insertions(+), 14 deletions(-)

M frequency-domain-fn.sml
M frequency-domain-fn.sml +12 -14
@@ 703,12 703,12 @@ functor PhaseUnwrappedBlockStreamFn (P :
 
 end
           
-(** Transform a frequency-domain block stream into real-valued
-    cepstral data for spectral envelope estimation or compensation.
-    The conjugate half of the frequency-domain data is unused, so the
-    input stream could use OMIT_CONJUGATE_HALF.
+(** Transform a frequency-domain magnitude block stream into
+    real-valued cepstral data for spectral envelope estimation or
+    compensation.  The conjugate half of the frequency-domain data is
+    unused, so the input stream could use OMIT_CONJUGATE_HALF.
  *)
-functor CepstralBlockStreamFn (S : FREQUENCY_DOMAIN_BLOCK_STREAM) :
+functor CepstralBlockStreamFn (S : FREQUENCY_DOMAIN_MAGNITUDE_BLOCK_STREAM) :
         sig
             include BLOCK_STREAM
 

          
@@ 763,25 763,23 @@ functor CepstralBlockStreamFn (S : FREQU
 
     structure RV = RealVector
     structure RVS = RealVectorSlice
-    structure CV = ComplexVector
-    structure CVS = ComplexVectorSlice
                                       
     fun process ({ fft, method, upstream } : stream)
-                (complexSpectrum : CV.vector)
+                (magnitudes : RV.vector)
         : RV.vector =
         case (method, fft) of
             (INVERSE_SYMMETRIC, BQ_FFT bqfft) =>
-            BqFft.inverse_cepstral (bqfft, CV.abs complexSpectrum)
+            BqFft.inverse_cepstral (bqfft, magnitudes)
           | _ =>
             let val bs = S.fftsize upstream
                 val hs = Int.quot (bs, 2)
                 val eps = 0.000001
                 val logMags = BqVec.log
                                   (BqVec.increment
-                                       (CV.abs (CVS.vector
-                                                    (CVS.slice
-                                                         (complexSpectrum,
-                                                          0, SOME hs))),
+                                       (RVS.vector
+                                            (RVS.slice
+                                                 (magnitudes,
+                                                  0, SOME hs)),
                                         eps))
                 fun zeros n = RV.tabulate (n, fn _ => 0.0)
             in

          
@@ 836,7 834,7 @@ functor CepstralBlockStreamFn (S : FREQU
             (fn (upstream', m) =>
                 let val m' =
                         SampleMatrix.fromRows
-                            (map (process stream) (ComplexMatrix.toRows m))
+                            (map (process stream) (RealMatrix.toRows m))
                 in
                     ({ fft = fft,
                        method = method,