Create your blog and photo album with postbit
Create your blog and photo album

Create new post

Content:

Upload a picture:
Tags (keywords separated by comma)

Save Cancel
The JavaScript Blog js:   Followers: 3 ; Following: 3

Explore The JavaScript Blog's photo albums:
Javascript tools (2)
Photos from posts (7)

Ultra bass sound in Javascript


Copy the code below in this page to hear a bass sound created with JavaScript:
Page to test Javascript audio api (html5 audio): http://js.do/blog/sound-waves-with-javascript/
Code to paste and play:

var f = 140*(2/3); // Try 3/3, 4/3, 5/3, 6/3 to change tone
var samples_length = 44100;
for (var i=0; i < samples_length ; i++) {
  var t = i/samples_length;
  var w = 1*PI*f*t;
  samples[i] = cos(w + 8*sin(w*6/6) * exp(-t*2) );
  samples[i] *= exp(-t*2); // Fade sound
// samples[i] *= exp(t*6); // Uncomment to add distortion effect
}

Post by The JavaScript Blog (2013-12-16 12:37)

Post your comment:

Name: Email: Site:




| Explore users | New posts | Create your blog | Create your photo album |
| About Postbit | Our blog | Terms of use | Contact Postbit |


Copyright © 2017 - postbit.com