Tuesday, April 10, 2012

Spatialization 01: Time - Part I

  {Under Construction}                                                                         To Version II→
QUESTION 1
  •  Let S be an object at distances d1, d2  from microphones L and R, at angle Θ with respect to a reference line, at azimuthal angle Φ, and facing θ', φ' (local orientation).  
    Let L', R' be a pair of stereo speakers, and O' the listener.
    Let r(t) = (x(t),  y(t),  z(t))  be an arbitrary, vector-valued space curve.

    How can the recording be manipulated so that, when broadcast from L' and R', the apparent location and orientation of S relative to the listener follow the directed path r(t)? 
____________________________
 This is a question about time.
A wave disturbance, or signal, propagates outward from the source at a constant speed in a medium.  All other properties of waves and signals depend upon this relationship:  distance from the source and time are in direct proportion.

If we have not accounted for the source in our image (recording) as a function of time (distance) and direction, we are unable to reliably place it in relation to other objects in space or transform its location.

The first task, then, is to establish continuity of time:

Question 1.1:
  • Given a source S, microphones L, R and observer O;Given speakers L', R', and listener O', and implied source S
    What are the relationships among the above eight quantities with respect to time?
There are sources, microphones, speakers, and observers.  No reference is made to mixing.  We have:

                                     Recording:         Playback:
                              Microphones  L, R           Speakers    L', R'
                              Observer       O     Listener      O'
                              Source           S     Source       S'   (implied)  

{NOTE: I am dedicated to making this material accessible.
However, solving the Geometry and trig rapidly became too cumbersome.
I have moved the entire problem to Vector Calculus.
The updated version is here.}

I begin with a simple arrangement (particular case).   Place two omnidirectional microphones six feet apart.  Place the observer so that O, L, R  form an equilateral triangle.  For convenience, call this distance (6ft) the unit length:


For playback, place the listener O' at O, and the speakers L', R' at the same positions as the microphones:

Being the usual definition of a well-placed pair of stereo speakers, and listener.

Let S be a distance a from L, and lie on the straight line through O and L.  Assume S can be treated as a point source for small differences of angle. {In real life there is no such thing as a point source.}
Fig. 1 - Spaced Stereo Pair

Additional fixed values:

Now we may,

I. Given Any Value of a, Determine the Remaining Relationships
By the Pythagorean Theorem,


The Angles:

By the Laws of Sines and Cosines for ΔSLR,


I do not yet know what values I will need later.  Mousing over the image shows a number of supplementary points whose measures may, or may not, prove useful.  They are:


The first diagram made it easier to derive values.  I suspect the following measures to be more useful:
Fig. 2 Angles out of the speaker axis.

Specifically,
a)  k is the point where the signal will arrive at R at a right angle to the speaker orientation.
b)  φ gives the angle out alignment to this perpendicular. In the diagram, the corresponding angle for L is temporarily fixed at π/2.

Why so many points and triangles?  I'm feeling out the problem.  Ultimately, I want to use those measures which are most easily computed, and give the orientation of the object with respect to the microphones, speakers, and listener.  There are a number of references that might be useful. For example, the area of the small triangle Δpnq, and orientation, are easy to calculate.  Who couldn't use a compact triangle in a known position relative to the player, from which timing and phase of audio samples could be projected?


II.  Moving Object Perceived From Two Distinct, Fixed Points
NOTICE:
 Newton's Calculus Will Be Taken For Granted.
Generally, I seek a 3-Dimensional system for assisting spatial imaging; I intend to induce perturbations in the stereo field at playback, using a similar technique to the normal map.  In this case, the precomputed map will represent the field surrounding the listener.  Playhead position, changing in time, can be calculated from such a map, using only the position vectors of objects in the game world, as they are updated.

That is, assuming such a map is possible.  
Let us say that it is.  How might we go about its definition and construction?

Consider the diagram below.
A sound source recorded at L is rebroadcast at L'.
What is the relationship between the signal broadcast from the speaker (L') and the one which crossed the microphone (L), emanating from S?
Fig 3 - Equal-time curves

The lines connecting the intersections of circles around L and S are part of a directional field: the function is a family of quadratic equations.

If k is the speed of sound in an elastic medium (like air!), then kt is the distance the sound has traveled from the source after t seconds.  The radius of any circle around L or S can be written as kt, for some value of t.    I need slightly more than this.  I want to triangulate: to compare the timing of signals among three (or more) points.  For example,  among  L, S and  tin Fig 3.  

If tm is an object traveling along the line through tn, it moves an equal distance away (toward) both L and S in the same time.  
       
Any other path will change the timing among the three.   To describe a point such as tm, we need an equation which does not assume we are at an equal distance (time) from both L and S.   Let
       
I treat S as the origin.   At t=0, the radii of the circles are  r1 = kt, r2 = kt2, a constant offset for each radius which may be set separately, and thus define a value for t which satisfies both. ( For past and future times and rectification I am not yet sure if additional constants are necessary.)
I don't want to solve this system.  The rotation turns the algebra into spaghetti.  So I'll solve a different one, and rotate it.

First, move the origin to the midpoint between the foci S and L.  
       
{diagram}
Next, rotate LS to coincide with the x-axis.  No need for elegance:
       
If the global positions of L and S are not in memory, (if S' is the new S:
    (*)=  foo;
for example) then I will need a proper transform.  
I now have this:

{diagram}

L'' and S'' lie on the x-axis, a distance a on opposite sides of the origin.  Now the equations are
       
The symmetry makes the hyperbolas significantly easier to parameterize.  I may need different representations, so I have solved for several.  A Very Large Amount of ordinary Algebra produces the following equalities:

Discrete, rectangular vector components:
     

Quadratic family (x and y, no t).
     
Radii:
{To Do}
In the quadratic, comparison of k2δ2 and 4a2 gives the type of curve:
       
If I use the quadratic form, β cannot be divided without defining y(1/β) = 0  for (kd)2 =  4a2.  For arbitrary rotation of the system, the the third case is the straight line connecting points S and L.

Now, to return to Fig.1 and 2, and release the constraints on angle...

                                                                                      To Version II→

No comments:

Post a Comment