From: Mark K. <mar...@gm...> - 2004-12-06 01:35:21
|
On Sun, 5 Dec 2004 17:06:24 -0500, Vladimir Senkov <ha...@gm...> wrote: > Mark, > > If i understand what you mean by "sync" correctly . . . > How is playing two notes in sync different from playing one note? > In other words, it when the second note is triggered we could just > figure out the parameters that need to be brought fromt he first note > to the second and then we could just start playing the second note and > not play the first one anymore. > But clearly for some instruments it is not going to work well because > the form of the wave could change dramatically in time. So playing two > notes of the same but starting from different position is in fact more > like playing two different notes. So you can't really "sync" them up . > . . > So I think I'm not getting the idea across very well. Let's take an example of a gig file that holds a simple sine wave. Assume I hit some key that generates a 1000Hz sine wave. I hit the key and LS starts playing the note, along with it's envelope. Nothing new here. That's what LS does today. Now assume at some random time I play a second of the same note. Again 1KHz. It starts playing with it's attendant envelope. The two signals are summed together to create the final output. That's what we do today. The issue to see here is that the exact time the second note starts can, in this simple case, have a dramatic effect on what you hear. If I play the second note exactly at a time n*1/1000 seconds later, then the second note reinforces the first and you get a signal that's twice as loud. However, if I play the note at n*1/2000 seconds later, where n is odd, then the two notes exactly cancel and you get no sound! The first sine wave is going down at the very instant that the second is going up. (A 180 degree phase shift) The second example is something that cannot happen with a real piano string. Whatever the resultant waveform clearly the string is still vibrating. There are not two separate sine waves of the same frequency on the same string. There is one resultant vibration. As a thought experiment I was considering what this means in LS. All I'm suggesting, as an idea, and not as a real suggestion for developers to implement, is that when the first note is played we would remember the time in which it started. From that time forward, until that note was finished playing, we would only start playing new notes (for the same MIDI key) at n*1/1000 seconds later. (Assuming the key was supposed to generate a 1KHz fundamental.) If we did that then the two notes would be 'in sync' or would be playing with a 0 degree phase shift. This means that the two sets of samples are being read and played back in sync. The way playing two notes is different from playing one note is that the second note is reading the starting samples while the first note is reading samples further on in the stream. The idea is that we keep the two streams separated by a value equal to some multiple of their fundamental frequencies. I can elaborate on this more if required. I hope this helps explain the idea anyway. It's just an idea but I think it's similar to synced oscillators some newer hardware synths. I'm just extending it to samplers. - Mark |