c# - Sine wave clicking with Beep.BeepBeep -


originally, project make song in windows console using c# used console.beep(freq,time);, unreliability of caused desyncs.

i changed using beep beep class. problem when playing baseline, there audible click @ end of every note. here's example. single note it's not bad, many consecutive notes it's unbearable.

even when opened in wave editor, no matter cropped it clicked.

how can rid of clicking, without installing bulky libraries c# console project?

have tried ramping amplitude @ start of sound , down again @ end. so, modify inner loop of beep beep class, reads...

    (int t = 0; t < samples; t++)     {       short sample = system.convert.toint16(a * math.sin(deltaft * t));       bw.write(sample);       bw.write(sample);     } 

could modified this

 (int t=0; t < samples; t++)  {      double ampramp = 1.0d;      if (t<1000) {          ampramp = ((double) t) / 1000.0d;      } else if (t > samples - 1000) {          ampramp = ((double) (samples - t)) / 1000.0d;      }      short sample = system.convert.toint16(a*ampramp*math.sin(deltaft * t));      bw.write(sample);      bw.write(sample);  } 

this ramps amplitude first 1000 samples, , ramps down last 1000, may have change number of samples ramp.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -