Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Related: someone has reproduced the beep in Javascript for posterity:

http://blog.parse.com/2013/02/27/reproducing-the-macintosh-b...



I wonder how to get rid of the "smacking" sound at the beginning.


Just need to fade the volume up from zero (actually -∞ but never mind) over the first few samples. Same at the end.

The problem is that the generated waveform does not begin at zero, causing your speakers to jump from the zero position instantaneously to some other position when the sound begins playing.

Now, obviously the laws of physics prevent this from actually happening, so you hear a pop. The lower the pitch of the sound, the louder the pop is likely to be, for reasons I'm sure people here can work out.

So, the solution is to generate a wave that starts at zero, or add some tiny fades. Note that music playback software does this when you hit pause/play. Some of them have an obvious fade you can hear, but they all add some fading, to avoid popping from stopping/starting the sound in the middle of a cycle.

EDIT: I was feeling ultra-helpful so I took a screenshot of the waveform to show what I mean: http://imgur.com/uWOlJcs


That is indeed ultra-helpful, thanks for the explanation!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: