موضوع سوال در مورد کد دو متد,.
C#, برنامه نویس, برنامه نویسیتاريخ ارسال:2014/07/16
هاست سنتر سلام می خواستم یدونم این دو تا متد کارشون دقیقا چیه ... این پایین دو مقدار فرکانس و صدا رو میگیره بقیش رو نمی دونم private WaveSound CreateBeep(int frequencyHz, int volumne) { // samples for 1/beepLength seconds short[] samples = new short[waveSound.Format.SamplesPerSec / beepLength]; double xValue = 0; short yValue; double xStep = (2 * Math.PI) / waveSound.Format.SamplesPerSec; // 1 Hz xStep = xStep * frequencyHz; for (int n = 0; n < samples.Length; n++) { xValue += xStep; yValue = (short)(Math.Sin(xValue) * volumne); samples[n] = yValue; } WaveSound beep = new WaveSound(waveSound.Format, samples); return beep; } این یکی هم یک مقدار مییگیره که tolerance هست بقیش رو نمی دونم public void FindAnything(short tolerance) { //size of scan window in samples int scanWindowSize = waveSound.Format.SamplesPerSec / beepLength; //size of scan window in seconds float scanWindowSizeSeconds = (float)scanWindowSize / (float)waveSound.Format.SamplesPerSec; int startIndex = -1; int endIndex = -1; int countSilentSamples = 0; for (int n = 0; n < waveSound.Count; n++) { if (Math.Abs(WaveSound[n]) > tolerance) { //found a sound countSilentSamples = 0; if(startIndex < 0){ startIndex = n; } } else if (startIndex > -1) { //searched and found silence countSilentSamples++; if (countSilentSamples == scanWindowSize) { endIndex = n - scanWindowSize; NotifyOnBeep(startIndex, endIndex, scanWindowSizeSeconds); //scan next time window countSilentSamples = 0; startIndex = -1; } } } if (startIndex > -1) { //wave ends with a beep NotifyOnBeep(startIndex, waveSound.Count-1, scanWindowSizeSeconds); } private void NotifyOnBeep(int startIndex, int endIndex, float silentSeconds) { if (BeepFound != null) { //get the second in the wave at which the sound stops float second = (float)endIndex / (float)waveSound.Format.SamplesPerSec; //notify BeepFound(this, new BeepFoundEventArgs( new Beep(startIndex, endIndex, second - silentSeconds, second))); } تشکر :قلب: هاست,دامین,سایت,وب,طراحی
میزبانی وب ,هاست,فضای وب,ویندوز,لینوکس,دات نت,پی اچ پی,web hosting,windows host,linux host,asp.net,php,sql server,mysql میزبان پایتخت ارائه دهنده خدمات میزبانی وب، هاست و هاستینگ، میزبانی هاست، دامین، میزبانی نمایندگی، نمایندگی وب، سرور مجازی و سرور مجازی ابری می باشد.هاست,میزبانی وب,دامین,سرور مجازی,میزبان پایتخت,host,domain,vps,mizban paytakht,hosting,share hosting,میزبان وب,میزبانی هاست,هاستینگ
google