Your amplifier arrangement is fundamentally flawed. At the moment you are "tickling" the top end of the electromagnet in the speaker - that is, you are energising it when the Arduino outputs a HIGH, and leaving it energised to de-energise by itself when the Arduino outputs a LOW. Coupled with that the fact that a PCM file outputs PWM with a carrier ...
The first thing to try is to use the 'proper' pins for the SPI:
SCK to Pin 10 on Arduino ---> Pin 13
CS to Pin 11 on Arduino ---> Pin 10
MISO to Pin 12 on Arduino ---> Pin 12
MOSI to Pin 13 on Arduino ---> Pin 11
VCC to 3.3V source on Arduino
GND to Arduino Ground
Try that first and see how you get on.
By the way, just thought I'd mention, ...
This is now 5 months later - but I recently had the same problem.
Because the TMRpcm library plays through pulse width modulation, make sure your speakers are hooked up to a PWM capable pin.
That caused me no end of headaches trying to figure out.
You are right that the values in a wav file are amplitudes. 16 bit signed values to be precise.
And that amplitude is just a voltage. Negative values are normally a negative voltage, but they don't have to be. They can be just a voltage below a pre-determined mid voltage around which the wave swings (known as a DC offset).
To play the waveform you just ...
I don't know the source of the problem, but here are a few things that might help diagnose where the problem begins or what it is due to.
(a) To track execution progress, and detect which statement, if any, ruins LCD operation: Create a routine to display current line number in code to LCD and Serial; make a macro ss to use for invoking that routine; ...
This post was awhile ago, but I wanted to offer some more definitive info for others like myself who were trying to identify it. What you have there is the Keyes KY-037 "high-sensitivity voice sensor" module. Mine came with the Inland Arduino Uno RFID Learning Kit.
Apparently the KY-037 and the KY-038 are the same except the KY-037 has a higher sensitivity ...
You could edit the VirtualWire.cpp source to use Timer2 instead of Timer1. For VirtualWire 1.18 the relevant section starts on line 512 with #else // ARDUINO.
On line 515 change (uint16_t)-1 to (uint8_t)-1 since Timer2 is only 8 bit. Then change all the TCCR1A, TCCR1B, OCR1A, TIMSK1 and OCIE1A to their Timer2 equivalent (hint: swap the 1's for 2's). Line ...
The problem is
ProxSensor==LOW is false so 0. you read the pin 0 and the outcome is random. The surrounding wiring can affect that. If digitalRead(0) is zero the wav starts playing immediately again. At least use
while (digitalRead(ProxSensor) == LOW);
As @Juraj mentioned it was solved by changing the setting and I was able easily to play the sound when I matched the setting to this file:
So, I could not create one from scratch matches above setting but I was able to convert existing sound through this site
which allowed me to convert with desire setting and here finally the exiting sound has matched the ...
I would (and do) use snprintf to format a string as a filename:
// Global scope, or local static
uint32_t myFileNumber = 1;
// in your function - results in 00000001.WAV
snprintf(filename, 12, "%08d.WAV", myFileNumber);
%08d will allow between 00000000.WAV and 99999999.WAV and always with 8 digits. Any more and it will get truncated and ...
You might try an audio transformer in the circuit, following a low-pass filter to smooth the PCM signal. Here's a picture of suitable inexpensive transformers (from alexnld.com; but similar transformers are available on Ebay etc.):
The effect of the transformer in the circuit is transforming the high voltage, high impedance output of the transistor driving ...
Oh, the joys of buying something off the Internet with no datasheet, no part number and no clue how to use it. And then expecting somebody else to tell you how it works.
That module looks like a KY-038, made by Keyes. No guarantees, though, because I'm not telepathic.
Bytes don't "pass through the soundsensor". Bytes don't pass anywhere, in fact. That ...
the virtual wire library has been obsoleted, and you should now use the RadioHead library. In this RadioHead Library, you can edit the RH_ASK.cpp file, and uncomment the #define RH_ASK_ARDUINO_USE_TIMER2 near the top.