|
Author |
Topic: synthesizing semitones (Read 386 times) |
|
Vair
|
synthesizing semitones
« on: Nov 11th, 2004, 10:48pm » |
|
Let me begin by saying that what I don't know about music theory can and does fill entire libraries. For fun, I'm modifying the sine wave example (found here http://pitaru.com/sonia/examples/LiveOutput/index.html ) in order to make it play a tune. I realise that I can play notes by feeding it with integers (from about 3 upwards) and each successive integer will play roughly a semitone higher. Now what I've been trying to explore is using equal temperament ( http://en.wikipedia.org/wiki/Equal_temperament ) A list of frequencies can be found here http://www.phy.mtu.edu/~suits/notefreqs.html My guess was that if I change the output length to 1000 (to be one second - a guess), I could feed in the frequencies in the list to get nice sounding notes. And it kind of works - I can hear the semitones going up and it sounds as though it might be right but the problem is that if I use any number with a value after the floating point, the notes produced have a loud rattling sound. I realise that the most likely cause of the problem is my misunderstanding of the code or the musical theory so I would appreciate insight from those of you who understand both (or one). The important bit of code here: float dat = amp* sin(float(i*oneCycle*freq)); (This is in a for loop so i is incremented by 1 from 0 to the output length (1000) and oneCycle is (TWO_PI) / outputLen; amp is amplitude (.5) in this case and freq is a frequency from the list linked to earlier. edit: I realise that this question could be far more simply put as "how do you synthesize music with sonia?".
|
« Last Edit: Nov 11th, 2004, 11:59pm by Vair » |
|
|
|
|
Vair
|
Re: synthesizing semitones
« Reply #1 on: Nov 12th, 2004, 4:33am » |
|
Well I finally figured out that that's what the next example does so I guess there's no need to reply to my questions. What is this phase stuff about anyway? Where can I find a good entry level reference for all this?
|
|
|
|
|