Пример #1
0
        public static void D4C(double[] x, int x_length, int fs, double[] time_axis,
                               double[] f0, int f0_length, int fft_size, D4COption option,
                               double[,] aperiodicity)
        {
            int outer = aperiodicity.GetLength(0);
            int inner = aperiodicity.GetLength(1);

            IntPtr[] ptrs_ap = new IntPtr[outer];

            for (var i = 0; i < outer; i++)
            {
                ptrs_ap[i] = Marshal.AllocHGlobal(inner * Marshal.SizeOf <double>());
            }

            CoreDefinitions.D4C(x, x_length, fs, time_axis, f0, f0_length, fft_size, option, ptrs_ap);

            var tmp_arr = new double[inner];

            for (var i = 0; i < outer; i++)
            {
                Marshal.Copy(ptrs_ap[i], tmp_arr, 0, inner);
                Buffer.BlockCopy(tmp_arr, 0, aperiodicity, i * inner * sizeof(double), inner * sizeof(double));
                Marshal.FreeHGlobal(ptrs_ap[i]);
            }
        }
Пример #2
0
        public void AperiodicityEstimation(double[] x, int x_length, WorldParameters world_parameters)
        {
            var option = new D4COption();

            Core.InitializeD4COption(option);
            option.threshold = 0.85;

            world_parameters.aperiodicity = new double[world_parameters.f0_length, world_parameters.fft_size / 2 + 1];

            Core.D4C(x, x_length, world_parameters.fs, world_parameters.time_axis,
                     world_parameters.f0, world_parameters.f0_length,
                     world_parameters.fft_size, option, world_parameters.aperiodicity);
        }
Пример #3
0
 public static void InitializeD4COption(D4COption option)
 => CoreDefinitions.InitializeD4COption(option);
Пример #4
0
 static extern void InitOption([Out] out D4COption option);
Пример #5
0
 static extern void Compute([In] double[] x, int x_length, int fs,
                            [In] double[] temporal_positions, [In] double[] f0, int f0_length,
                            int fft_size, [In] ref D4COption option, [In, Out] IntPtr[] aperiodicity);
Пример #6
0
 public static void InitializeD4COption(D4COption option)
 {
 }
Пример #7
0
 public static void D4C(double[] x, int x_length, int fs, double[] time_axis,
                        double[] f0, int f0_length, int fft_size, D4COption option,
                        double[,] aperiodicity)
 {
 }
Пример #8
0
 public static extern void InitializeD4COption([Out] D4COption option);
Пример #9
0
 public static extern void D4C([In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] double[] x,
                               int x_length, int fs, [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] double[] time_axis,
                               [In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] double[] f0, int f0_length, int fft_size, [In] D4COption option,
                               [In][Out] IntPtr[] aperiodicity);