Arduino library for WTV020-SD-16P audio module

I'm having the same issue, can anyone that has it re-upload the library?

Will re-upload the library this night from home.

And what about re-upload?

Edited fist post. Hope this helps.

Unfortunately I still cannot access the library, clicking the link still pulls up the same error page.

Hi Rebel, (and all the readers aswell... :wink: )

I downloaded right now the library and when unpacked I see TWO identical files.

One of them named: Wtv020sd16p.cpp
Another one named: Wtv020sd16p.cpp~
Both them 2183bytes.

Is that correct??

Gracias,
Rafa.

I think it's okay, the Wtv020sd16p.cpp~ might just be a temporary file that was not deleted.

Thanks to Rebel for the Library! I got it to work on my module, after trying several SD-Cards. Talk about this thing is picky with SD-Cards.

Does anyone have any idea on how to interrupt the currently playing voice, and play another one when a button is pressed?

I tried modifying rebels playVoice function into:

void Wtv020sd16p::playSound(int voiceNumber){  
 if (_busyPinState==HIGH) {
  sendCommand(STOP);
 }
 else {
 sendCommand(voiceNumber);
 }
  _busyPinState=digitalRead(_busyPin);
  while(_busyPinState==HIGH){
    _busyPinState=digitalRead(_busyPin);
 }
}

it checks for the busy pin's state, if it is HIGH, send the STOP command, and then play the voice.

Unfortunately it does not work. Or i'm just not doing it right.

Why not use .stopVoice method?

For those wondering how this audio module works with music, here you have an example:

By the way, everything is now working with 3.3v. I just bought a new Mini Pro working at 8Mhz 3.3V, downloaded the same program I did for the previous Arduino and tada, worked out like a charm.

nice job!..

the only difference should be the audio files you use now.. (making sure it for a 8MHz instead of 16Mhz) :slight_smile:

now you just gotta merge everything together (Arduino, Amp, SD card) into one awesome, tiny board!!! :slight_smile:

this is gonna go great for the "V" project. :slight_smile:

As a matter of fact, audio files are the same rate. There's no need in change them.
And yes, if will be a great project for the v community

no need to change them? and they play same 'rate/speed'? awesome!..

glad things finally came together..

good luck!.

the-rebel-agent:
Why not use .stopVoice method?

Thank you for the reply.

I tried that too.

Even tried using pin change interrupts, thought maybe it just the delay in reading the digitalRead status for the pins.

Basically, what I wanted to achieve, is that whenever a button is pressed, it will interrupt the currently playing sound clip and play the sound clip associated with the button that was pressed (Even if it was the same button).

Here's the code I'm using:
I'm using the pinchangeint library.

/*
 Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
 Created by Diego J. Arevalo, August 6th, 2012.
 Released into the public domain.
 */

#include <Wtv020sd16p.h>
#include <PinChangeInt.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.

#define BUTTON01  7
#define BUTTON02  8

/*
Create an instance of the Wtv020sd16p class.
 1st parameter: Reset pin number.
 2nd parameter: Clock pin number.
 3rd parameter: Data pin number.
 4th parameter: Busy pin number.
 */

Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void playSound01(){
  wtv020sd16p.stopVoice();
  wtv020sd16p.playVoice(0);
}

void playSound02(){
  wtv020sd16p.stopVoice();
  wtv020sd16p.playVoice(1);

void setup() {
  //Initializes the module.

  pinMode(BUTTON01, INPUT);
  digitalWrite(BUTTON01, HIGH);
  PCintPort::attachInterrupt(BUTTON01, &playSound01, RISING);
  
  pinMode(BUTTON02, INPUT);
  digitalWrite(BUTTON02, HIGH);
  PCintPort::attachInterrupt(BUTTON02, &playSound02, RISING);
  
  wtv020sd16p.reset();
}

void loop() {
 
}

xl97:
no need to change them? and they play same 'rate/speed'? awesome!..

glad things finally came together..

good luck!.

There is no need cause the Arduino is not managing WTV clock. Only clock provided from Arduino is to control the commands you send to it.

purgedsoul:

the-rebel-agent:
Why not use .stopVoice method?

Thank you for the reply.

I tried that too.

Even tried using pin change interrupts, thought maybe it just the delay in reading the digitalRead status for the pins.

Basically, what I wanted to achieve, is that whenever a button is pressed, it will interrupt the currently playing sound clip and play the sound clip associated with the button that was pressed (Even if it was the same button).

Here's the code I'm using:
I'm using the pinchangeint library.

/*

Example: Control a WTV020-SD-16P module to play voices from an Arduino board.
Created by Diego J. Arevalo, August 6th, 2012.
Released into the public domain.
*/

#include <Wtv020sd16p.h>
#include <PinChangeInt.h>

int resetPin = 2;  // The pin number of the reset pin.
int clockPin = 3;  // The pin number of the clock pin.
int dataPin = 4;  // The pin number of the data pin.
int busyPin = 5;  // The pin number of the busy pin.

#define BUTTON01  7
#define BUTTON02  8

/*
Create an instance of the Wtv020sd16p class.
1st parameter: Reset pin number.
2nd parameter: Clock pin number.
3rd parameter: Data pin number.
4th parameter: Busy pin number.
*/

Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);

void playSound01(){
  wtv020sd16p.stopVoice();
  wtv020sd16p.playVoice(0);
}

void playSound02(){
  wtv020sd16p.stopVoice();
  wtv020sd16p.playVoice(1);

void setup() {
  //Initializes the module.

pinMode(BUTTON01, INPUT);
  digitalWrite(BUTTON01, HIGH);
  PCintPort::attachInterrupt(BUTTON01, &playSound01, RISING);
 
  pinMode(BUTTON02, INPUT);
  digitalWrite(BUTTON02, HIGH);
  PCintPort::attachInterrupt(BUTTON02, &playSound02, RISING);
 
  wtv020sd16p.reset();
}

void loop() {

}

Weird, cause If you check my previous video, that's what I am doing. Music is playing, I hit the trigger and plays a new sound. Even the fire selector plays it own sound. It should be there something wrong in the source code, not in the module.

can you post the code you used on the previous video? So i can try it on my board. I don't want to rule out another SD-Card problem, cause I have already tried several cards, before I got it to make a sound. :0 this thing is pesky with sd-cards. =(

Also, I tried playing a voice and have it loop, well, it can't do gapless loop.

@xl97: your board looks good, do you sell them cause I'm interested.

Shared it on gallery section. Look for v laser gun.

Thanks! Got it. XD This should keep me busy.

Well, it was definitely my code.

Anyone got ideas how to have this play a pseudo-gapless/seamless loop? Or this is just the limitation of this sound module.

Module limitation. It is a 20ms delay.