Sound output fails on reboot after phat beat installation

I am using phat beat and have installed the software using curl https://get.pimoroni.com/phatbeat | bash. I get audio output after installation and can see that the phat beat is working.

However, after rebooting the device, the audio output no longer works. On terminal, I get

ALSA lib pcm_hw.c:1713:(_snd_pcm_hw_open) Invalid value for card
audio_open_alsa: failed to open audio device default. No such file or directory

And if I resintall again, the problem would resolved, until the device reboots, then the problem will recur. Could anyone advise me on this matter?

What are you using to play sound?

Which version of Raspbian is this?

I am using flite, a speech synthesis program to play sound, as well as aplay function within my script to play an audio file. This is on Stretch OS. The problem occurs about 1/3 of the time. Sometimes it happens when I reboot, other times I dont get this issue. It is however still ongoing.

What do you see if you run:

aplay -l
aplay -L

It may be that the Speech Synthesis program and Pulse Audio are not getting on well. You should try stopping Pulse before running it and see if that helps:

sudo systemctl stop pulseaudio

On entering aplay -l on terminal, I get aplay: device_list:270: no soundcards found...

On entering aplay -L on terminal, I get:

null
Discard all samples (playback) or generate zero samples (capture)
default
pivumeter
softvol_and_pivumeter

Entering sudo systemctl stop pulseaudio does not seem to make a difference.

This is strange, could you post the contents of your /boot/config.txt please?

The contents are:

dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4                              $
dtparam=i2c_arm=on
dtoverlay=i2s-mmap
dtoverlay=hifiberry-dac

You need to remove:

dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4   

Since pin 18 is the i2s clock, and is required for audio-output to function.

Additionally pin 13 is the rewind button on pHAT BEAT.

Thanks! Deleted as suggested and it works now.