Thermal spectrum in leaky cavities: A string model