当前位置: 首页>>代码示例>>C#>>正文


C# Complex.GetType方法代码示例

本文整理汇总了C#中Complex.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Complex.GetType方法的具体用法?C# Complex.GetType怎么用?C# Complex.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Complex的用法示例。


在下文中一共展示了Complex.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NotesFromFile

        public static List<Note> NotesFromFile(string[] args)
        {
            if (args.Length < 3)
                throw new ArgumentException("You need three arguments dawg ");

            var path = string.Empty;
            if (args[0].Length != 0)
            {
                path = args[0];
                SAMPLE_COUNT = int.Parse(args[1]);
                LOWER_THRESHOLD = double.Parse(args[2]);
            }
            else
            {
                path = @"C:\Users\zhadowoflight\Desktop\Studies\COEN_9\y-hack\lotr.wav";
                //var path = @"C:\Users\zhadowoflight\Desktop\Studies\COEN_9\y-hack\fureliseshort.wav";
                //var path = @"C:\Users\zhadowoflight\Desktop\Studies\COEN_9\y-hack\furelise2.wav";
                //var path = @"C:\Users\zhadowoflight\Desktop\Studies\COEN_9\y-hack\furs.wav"; //toats shit
                //var path = @"C:\Users\zhadowoflight\Desktop\Studies\COEN_9\y-hack\all.wav";
            }
            
            //double[] arr = { 0, 10, 100, 1000, 10000, 400, 440, 32.703 };
            //foreach (double d in arr)
            //{
            //    string actual = FrequencyToNote(d).ToString();
            //}
            // This launches the Mathematica kernel:
            IKernelLink ml = MathLinkFactory.CreateKernelLink();
            var myComplexType = new Complex(1,2);
            ml.ComplexType = myComplexType.GetType();
            ml.WaitAndDiscardAnswer();
            // Discard the initial InputNamePacket the kernel will send when launched.

            var data = GetDataFromWav(ml, path);
            data = MovingAverageSmooth(data);
            var rate = GetSamplingRateFromWav(ml, path);
            List<double[]> MajorFrequencies = new List<double[]> ();
            for (var ii = 0; ii < data.Length + SAMPLE_COUNT; ii += SAMPLE_COUNT)
            {
                var temp_data = new double[SAMPLE_COUNT];
                try
                {
                    Array.Copy(data, ii, temp_data, 0, SAMPLE_COUNT);
                }
                catch (ArgumentException)
                {
                    if (ii + SAMPLE_COUNT < data.Length)
                        Console.WriteLine("Not supposed to happen!!");
                    break;
                }
                var fft_data = GetMagnitudeOfComplexArray( GetFourierTransform(ml, temp_data) );
                fft_data = MovingAverageSmooth(fft_data);
                MajorFrequencies.Add(GetMajorFrequenciesFromTransform( fft_data , rate ));
#if DEBUG
             //  File.WriteAllText(string.Format("test{0}.txt",ii),string.Join("\n",fft_data));
#endif
            }

            List<Note[]> MajorNotes = GetMajorNotesFromFrequencies(MajorFrequencies);
            WriteResults(MajorNotes);
            WriteResults(MajorFrequencies);
            var a = MakeMusicSheet(MajorNotes);
            Console.WriteLine("All done");
            MusicSheetGenerator.generateMusicSheet(a);            
            return a; // 'a' is the most descriptive variable name.... EVER
        }
开发者ID:nicnhus22,项目名称:Y-Hack,代码行数:66,代码来源:Program.cs

示例2: LoadComplex

 /// <summary>
 /// Emit the code to create a complex value.
 /// </summary>
 /// <param name="value">Complex value</param>
 public void LoadComplex(Complex value)
 {
     LoadDouble(value.Real);
     LoadDouble(value.Imaginary);
     Emit0(OpCodes.Newobj, value.GetType().GetConstructor(new [] { typeof(double), typeof(double) } ));
 }
开发者ID:stevewpalmer,项目名称:jcom,代码行数:10,代码来源:emit.cs


注:本文中的Complex.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。