public void F0EstimationDio(double[] x, int x_length, WorldParameters world_parameters) { var option = new DioOption(); Core.InitializeDioOption(option); option.frame_period = world_parameters.frame_period; option.speed = 1; option.f0_floor = 71.0; option.allowed_range = 0.1; world_parameters.f0_length = Core.GetSamplesForDIO(world_parameters.fs, x_length, world_parameters.frame_period); world_parameters.f0 = new double[world_parameters.f0_length]; world_parameters.time_axis = new double[world_parameters.f0_length]; double[] refined_f0 = new double[world_parameters.f0_length]; System.Console.WriteLine("Analysis"); Core.Dio(x, x_length, world_parameters.fs, option, world_parameters.time_axis, world_parameters.f0); Core.StoneMask(x, x_length, world_parameters.fs, world_parameters.time_axis, world_parameters.f0, world_parameters.f0_length, refined_f0); for (var i = 0; i < world_parameters.f0_length; ++i) { world_parameters.f0[i] = refined_f0[i]; } }
public static void Dio(double[] x, int x_length, int fs, DioOption option, double[] time_axis, double[] f0) { IntPtr ptr_time = Marshal.AllocHGlobal(Marshal.SizeOf <double>() * time_axis.Length); IntPtr ptr_f0 = Marshal.AllocHGlobal(Marshal.SizeOf <double>() * f0.Length); CoreDefinitions.Dio(x, x_length, fs, option, ptr_time, ptr_f0); Marshal.Copy(ptr_time, time_axis, 0, time_axis.Length); Marshal.Copy(ptr_f0, f0, 0, f0.Length); Marshal.FreeHGlobal(ptr_time); Marshal.FreeHGlobal(ptr_f0); }
public static void InitializeDioOption(DioOption option) => CoreDefinitions.InitializeDioOption(option);
static extern void InitOption([Out] out DioOption option);
static extern void Compute([In] double[] x, int x_length, int fs, [In] ref DioOption option, [Out] double[] temporal_positions, [Out] double[] f0);
public static void InitializeDioOption(DioOption option) { }
public static void Dio(double[] x, int x_length, int fs, DioOption option, double[] time_axis, double[] f0) { }
public static extern void InitializeDioOption([Out] DioOption option);
public static extern void Dio([In][MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] double[] x, int x_length, int fs, [In] DioOption option, [In][Out] IntPtr time_axis, [In][Out] IntPtr f0);