void hannWindowToolStripMenuItemClick(object sender, EventArgs e) { window = RaisedCosineWindow.Hann(2048); reset(); hannWindowToolStripMenuItem.Checked = true; }
public PitchShifterWithPhaseVocoder(int windowLength) { if (windowLength % 2 != 0) { throw new ArgumentException(); } this._windowLength = windowLength; this._window = RaisedCosineWindow.Hann(windowLength); this._fftBuffer = new Complex[windowLength]; this._magnitudeSpectrum = new double[windowLength]; this._phaseSpectrum = new double[windowLength]; this._modifiedMagnitudeSpectrum = new double[windowLength]; var omega = new double[windowLength]; for (var i = 0; i < omega.Length; i++) { omega[i] = 2.0 * Math.PI * (windowLength / 2.0) * i / windowLength; } this._omega = omega; this._lastPhase = new double[windowLength]; this._targetPhase = new double[windowLength]; this._inputBuffer = new float[windowLength / 2]; this._vocoderInputBuffer = new float[windowLength]; this._vocoderOutputBuffer = new float[windowLength]; this._nextOutputBuffer = new float[windowLength]; }
public Form1() { InitializeComponent(); redis = ConnectionMultiplexer.Connect("localhost,abortConnect=false"); deviceList = new Dictionary <string, ACT12x>(); for (int x = 0; x < checkedListBoxChannel.Items.Count; x++) { this.checkedListBoxChannel.SetItemChecked(x, false); } dataQueue = new ConcurrentQueue <DataValue>(); backgroundWorkerSaveData = new BackgroundWorker(); signalBuffer = new float[WindowSize]; backgroundWorkerSaveData.WorkerSupportsCancellation = true; backgroundWorkerSaveData.DoWork += BackgroundWorkerSaveData_DoWork; window = RaisedCosineWindow.Hann(WindowSize); LoadDevices(); vact = null; saveDataSuccess = false; isStarted = false; ToolStripMenuItemStart.Enabled = true; ToolStripMenuItemStop.Enabled = false; }
public VibrationACT12x(string id, string ip, int port, Chart chart, string deviceType, string path, string database, TextBox tb) { dataQueue = new ConcurrentQueue <float[]>(); uiQueue = new ConcurrentQueue <float[]>(); backgroundWorkerProcessData = new BackgroundWorker(); backgroundWorkerReceiveData = new BackgroundWorker(); backgroundWorkerUpdateUI = new BackgroundWorker(); backgroundWorkerProcessData.WorkerSupportsCancellation = true; backgroundWorkerProcessData.DoWork += BackgroundWorkerProcessData_DoWork; backgroundWorkerUpdateUI.WorkerSupportsCancellation = true; backgroundWorkerUpdateUI.DoWork += BackgroundWorkerUpdateUI_DoWork; backgroundWorkerReceiveData.WorkerSupportsCancellation = true; backgroundWorkerReceiveData.DoWork += BackgroundWorkerReceiveData_DoWork; window = RaisedCosineWindow.Hann(WindowSize); this.ip = ip; this.deviceId = id; this.deviceType = deviceType; this.udpPort = port; this.chart1 = chart; this.textBoxLog = tb; this.basePath = path; this.database = database; this.isUpdateChart = false; this.vibrateChannels = new Dictionary <int, string>(); LoadChannels(); }
public ACT1228CableForceV4(string id, string ip, string localIP, int port, Chart chart, string deviceType, string path, string database, TextBox tb, double threshold, ConnectionMultiplexer redis) { this.Tag = ip + " : "; dataQueue = new ConcurrentQueue <float[]>(); uiQueue = new ConcurrentQueue <float[]>(); rawQueue = new ConcurrentQueue <string>(); this.redis = redis; Threshold = threshold; backgroundWorkerProcessData = new BackgroundWorker(); backgroundWorkerReceiveData = new BackgroundWorker(); backgroundWorkerUpdateUI = new BackgroundWorker(); backgroundWorkerSaveRawData = new BackgroundWorker(); backgroundWorkerProcessData.WorkerSupportsCancellation = true; backgroundWorkerProcessData.DoWork += BackgroundWorkerProcessData_DoWork; backgroundWorkerUpdateUI.WorkerSupportsCancellation = true; backgroundWorkerUpdateUI.DoWork += BackgroundWorkerUpdateUI_DoWork; backgroundWorkerReceiveData.WorkerSupportsCancellation = true; backgroundWorkerReceiveData.DoWork += BackgroundWorkerReceiveData_DoWork; backgroundWorkerSaveRawData.WorkerSupportsCancellation = true; backgroundWorkerSaveRawData.DoWork += backgroundWorkerSaveRawData_DoWork; hourTimer = new System.Timers.Timer(1000 * 60 * 60 * 1); hourTimer.Elapsed += new System.Timers.ElapsedEventHandler(HourTimer_TimesUp); hourTimer.AutoReset = true; //每到指定时间Elapsed事件是触发一次(false),还是一直触发(true) minuteTimer = new System.Timers.Timer(1000 * 60 * 5); minuteTimer.Elapsed += new System.Timers.ElapsedEventHandler(MinuteTimer_TimesUp); minuteTimer.AutoReset = false; //每到指定时间Elapsed事件是触发一次(false),还是一直触发(true) window = RaisedCosineWindow.Hann(WindowSize); this.ip = ip; this.localIP = localIP; this.deviceId = id; this.deviceType = deviceType; this.udpPort = port; this.chart1 = chart; this.textBoxLog = tb; this.basePath = path; this.database = database; this.isUpdateChart = false; this.vibrateChannels = new Dictionary <int, VibrateChannel>(); db = redis.GetDatabase(); LoadChannels(); }
public PitchShifterWithStft(int windowLength) { if (windowLength % 2 != 0) { throw new ArgumentException(); } this._windowLength = windowLength; this._window = RaisedCosineWindow.Hann(windowLength); this._fftBuffer = new Complex[windowLength]; this._modifiedSpectrum = new Complex[windowLength]; this._inputBuffer = new float[windowLength / 2]; this._fftInputBuffer = new float[windowLength]; this._fftOutputBuffer = new float[windowLength]; this._nextOutputBuffer = new float[windowLength]; }
public Form1() { InitializeComponent(); deviceList = new Dictionary <string, VibrationACT12x>(); for (int x = 0; x < checkedListBoxChannel.Items.Count; x++) { this.checkedListBoxChannel.SetItemChecked(x, false); } dataQueue = new ConcurrentQueue <float[]>(); uiQueue = new ConcurrentQueue <float[]>(); backgroundWorkerProcessData = new BackgroundWorker(); backgroundWorkerReceiveData = new BackgroundWorker(); backgroundWorkerUpdateUI = new BackgroundWorker(); signalBuffer = new float[WindowSize]; backgroundWorkerProcessData.WorkerSupportsCancellation = true; backgroundWorkerProcessData.DoWork += BackgroundWorkerProcessData_DoWork; backgroundWorkerUpdateUI.WorkerSupportsCancellation = true; backgroundWorkerUpdateUI.DoWork += BackgroundWorkerUpdateUI_DoWork; backgroundWorkerReceiveData.WorkerSupportsCancellation = true; backgroundWorkerReceiveData.DoWork += BackgroundWorkerReceiveData_DoWork; window = RaisedCosineWindow.Hann(WindowSize); LoadDevices(); vact = null; //Set series chart type //chart1.Series["Series1"].ChartType = SeriesChartType.Line; //chart2.Series["Series1"].ChartType = SeriesChartType.Line; //chart1.Series["Series1"].IsValueShownAsLabel = true; }