Stereo spatialization effect can be achieved using x,y coordinates to determine intensity and delay for the sound at each speaker at each moment. The hypothetical listener is placed at a point equidistant from the two speakers. The speakers are each assumed to be at some angle from the listener between 0 and pi radians, with 0 radians being straight to the right and pi/2 radians being directly in front of the listener. (For example, for speakers at the front-left and front-right corners of a square room, and the listener at the center, the angle of the left speaker would be 3pi/4 radians (135 degrees), and the angle of the right speaker would be pi/4 radians (45 degrees). When the angle of the localized sound is greater than or equal to 90 degrees (pi/2 radians) from a speaker, the amplitude from that speaker will be 0.

If we know the location of the speakers and the sound source, we can use the cosine function to calculate the distance from the listener, and the distance of the sound source relative to the distance of the speaker; and we can use the arctangent function to calculate the angle of the sound source relative to the angle of each speaker. Armed with all of this information, we can calculate the gain for each of the two channels, and we can calculate the delay of the sound in getting to the listener. The distance and angle of the sound source relative to each speaker will determine the gain at each speaker, and the distance of the sound source will determine the distance. If the distance is changing, the delay will change, and Doppler shift occurs.

In this Csound instrument, one specifies the location of the right speaker, in terms of the number of meters it is to the right (x coordinate) and in front of (y coordinate) the listener. The left speaker is assumed to be in the corresponding position on the left side. In the score, one specifies starting and ending x and y coordinates for the sound source, and the amount of time needed to get from one point to the other in a straight line. The instrument then uses this information to calculate the amplitude of the sound in each speaker as it "moves", and the delay it would have in getting to the listener (who is located at coordinate "0,0"). As the distance of the sound source from the listener changes, the changing delay introduces a pitch shift in the perceived sound, known as "Doppler shift".