static void Main(string[] args) { //HSPとかで簡単に描画できるように //1/640秒ごとに計算して出力します var synth = new FMSynthesiser(new FMOperatorInfomation[] { new FMOperatorInfomation { Envelope = Envelope.Default, Oscillator = FMOscillators.Triangle }, new FMOperatorInfomation { Envelope = Envelope.Default, Oscillator = FMOscillators.Sine }, }, FMAlgorithms.PairModulationAlgorithm); var str = ""; var freq = 1.0; synth.Attack(freq); for (int i = 0; i < 640; i++) { var pos = i / 640.0; var st = synth.GetState(pos); str += st.ToString() + Environment.NewLine; } File.WriteAllText("fm.txt", str, Encoding.GetEncoding("Shift-JIS")); Console.WriteLine("fm.txt wrote"); Console.ReadLine(); }
public Form1() { InitializeComponent(); TimerStreaming = new SysTimer(5); TimerStreaming.Elapsed += TimerStreaming_Tick; format = new WaveFormat(44100, 1); Envelope menv = new Envelope(0, 0.5, 0, 0); Envelope m2env = new Envelope(0, 0.5, 0, 0); FMOperator car = new FMOperator(new FMOperatorInfomation { Oscillator = FMOscillators.Sine, Envelope = menv }); FMOperator mod = new FMOperator(new FMOperatorInfomation { Oscillator = FMOscillators.Sine, Envelope = menv, ModulationIndex = 5 }); atk = new NoteEvent[chs]; synth = new FMSynthesiser[chs]; time = new double[chs]; vel = new double[chs]; for (int i = 0; i < chs; i++) { synth[i] = new FMSynthesiser(new[] { car.GetInfomation(), mod.GetInfomation() }, FMAlgorithms.SerialModulationAlgorithm); //synth[i].Operators.Add(car); //synth[i].Operators.Add(mod); time[i] = 0.0; } }