Hello everyone, this is my first post on this forum. This is also my first project using any sort of Arduino controller. I am currently following a guide for building a lightsaber based on an Arduino Nano. This is the instructable if you want to take a look Arduino Based Lightsaber With Light and Sound Effects : 14 Steps (with Pictures) - Instructables. Everything seems to be working fine except for the speaker, which is playing .wav sounds, but is sounding very bad.
The program plays a "hum" sound on a loop from a connected micro sd card, and when you swing the lightsaber it should temporarily stop the "hum" sound and play the "swoosh" sound until completion; where the "hum" will then cut back in and continue its loop. The problem is that instead of a "hum" noise, it is a loud buzzing sound. When I swing the lightsaber and the "swoosh" noise cuts in and sounds fine for the duration that it plays.
I have tried using other .wav files in place of the "hum" noise that I am trying to play, but the buzzing sound still sounds the exact same. Turning down the volume made the "swoosh" sounds quieter, but the buzzing noise was still just as loud. The program is using tmrpcm to control all of the .wav files, if that helps.
I am using a 4ohm 3W speaker, an Arduino Nano, XM1584 DCDC step down (drops the 11.1v battery down to 4.5v for the amp), and PAM8403 amp. The sounds are all 8 bit, 16kHz, mono .wav files.
I have attached the .ino file for the code below because it is a very large program. The wiring diagram is also attached
Thank you for the help!
Basic_Code.ino (24 KB)