A waveguide in a loudspeaker is designed with the acoustic topology optimization method. The main objective of this work is to maximize the difference on sound pressure magnitude between a desired acoustic region and a undesired acoustic region by optimizing distribution of transmitting and reflecting material in the waveguide area. A finite element formulation for a fully coupled acoustic-structure interaction problem is used to simulate the sound generated by the cone of a loudspeaker. The sensitivity of the objective with respect to the design variables is calculated using adjoint variable method. Numerical experiments validate that the optimization procedure generates waveguides with desired acoustical properties in the form of improved directivity patterns.