An inverse source problem which aims to determine the source density taking place in the wave equation is considered. One assumes that is a function of bounded support while can be measured on the boundary of a convex domain D during a certain finite time interval [0,T]. An explicit expression of the solution is given in terms of the surface integral of the data on . Two illustrative examples show the applicability as well as the effectiveness of the method. In one of these examples consists of a spheroid while in the other it consists of a half of the spheroid and a disc. The problem is motivated by photo-acoustic and thermo-acoustic applications.