|Fast sine wave calculation|
Type : waveform generation
References : James McCartney in Computer Music Journal, also the Julius O. Smith paper
(posted by Niels Gorisse)
If you change the frequency, the amplitude rises (pitch lower) or lowers (pitch rise) a LOT I fixed the first problem by thinking about what actually goes wrong. The answer was to recalculate the phase for that frequency and the last value, and then continue normally.
ip = phase of the first output sample in radians
w = freq*pi / samplerate
b1 = 2.0 * cos(w)
y0 = b1*y1 - y2
y2 = y1
y1 = y0
output is in y0 (y0 = sin(ip + n*freq*pi / samplerate), n= 0, 1, 2, ... I *think*)
Later note by James McCartney:
if you unroll such a loop by 3 you can even eliminate the assigns!!
y0 = b1*y1 - y2
y2 = b1*y0 - y1
y1 = b1*y2 - y0
Added on : 22/04/03 by kainhart[at]hotmail[ DOT ]com
try using this to make sine waves with frequency less that 1. I did and it gives very rough half triangle-like waves. Is there any way to fix this? I want to use a sine generated for LFO so I need one that works for low frequencies.
Added on : 24/10/06 by asynth[ AT ]io[ DOT ]com
looks like the formula has gotten munged.
w = freq * twopi / samplerate
Added on : 28/08/13 by joi[ AT ]nea[ DOT ]ufsc[ DOT ]br
Hey Rodrigo, great site! Learning a lot already. I was wrineondg, is there a way to make the sine wave not sound as tinny with riffwave.js? It sounds a lot cleaner in the Firefox example, and I'm guessing it's from the fact that you need to round it for riffwave? Is there any way to get around that?
Added on : 29/08/13 by la[ DOT ]cantina[ AT ]vp[ DOT ]pl
Kewl you should come up with that. <a href="http://mwxhfr.com">Exetnlelc!</a>
Added on : 29/08/13 by jennifergreen[ AT ]fairpoint[ DOT ]net
hi can we do a link exchange? i know that this is too much to ask but i'm hnivag trouble right now marketing my blog so I'm expanding my presence by doing link exchanges. I already added you in my blogroll so If you have the time you can check it out. My blog's a tech blog now shifting with anime and gaming. I hope you do have a time putting me in your sidebarthanks a lot!!kyle http://ncrlwgutn.com [url=http://xezivf.com]xezivf[/url] [link=http://oefkjqltn.com]oefkjqltn[/link]
Added on : 30/08/13 by dcrock323[ AT ]gmail[ DOT ]com
hello, do you mind doing a blog link exchange? my blog is about news of <a href="http://tkvflrtx.com">firuges</a> with mostly about PVC's. I already put your link in my blog, and hoping that I could be in your blog list too, thanks
Added on : 07/09/13 by trinakhol[ AT ]yahoo[ DOT ]com
Hi in England.. I'm from Liverpool been here in the U.S. forever thugoh. I went back home in 2009 and stayed with relatives in Leamington Spa and enjoyed every minute. I love Tiff & company they make me laugh, you make me laugh. I left a messaage on one of your amazon discussion pages. Glad I found your series, I'm now playing catch up and having fun reading about Tiff crawling through the prickly bush. http://htysfsodpj.com [url=http://mdaxssosf.com]mdaxssosf[/url] [link=http://rgvixai.com]rgvixai[/link]
Added on : 03/03/14 by 005fbff9n[ AT ]hotmail[ DOT ]com
Common insurance Quotes Chimp are run and created by customers of policy contract. Unlike an inventory firm, where purchasing an insurance plan provides the possessor no-interest in the insurance firm it self, the action of investing in an insurance policy from a shared firm makes the buyer a balanced person who owns such corporation. Officially, customers possess the corporation but use small handle over mgmt.
|Add your own comment|
Comments are displayed in fixed width, no HTML code allowed!