Go Down

Topic: Arduino library for WTV020-SD-16P audio module (Read 196758 times) previous topic - next topic

Caladonis

These little modules still are a great value and I find the very best way to get them working is get it to the bare minimums in stand alone mode without the arduino. If it wont play in stand alone, it wont work with the arduino. You only must have +3.3v, gnd, speaker and a ground point to use on the play (pin 9) and next/previous (pins 12 and 13). I'm not saying how long I worked because the SD card gets tight before it actually locks in place  :-[ 


My question is has anyone used two of these modules and being controlled by one arduino? I really don't want to go to a wav trigger card just so I can have two independent channels, one for background music/ ambiance sounds and one for triggered events/effects. Two of these with SD cards are still a fraction of the cost of a wav trigger that is overkill for my application.


Domino60

The WTV020-SD-16P audio module it's waste of money, you need a lot of work to do making it work.
To be or not to be? Read a book and you will see.

Goldenshuttle

The WTV020-SD-16P audio module it's waste of money, you need a lot of work to do making it work.
I tend to agree with you. Wasted so much valuable time.
why they did not make it mp3.
who wants to waste time on AD4 and software and all this stuff?
waste of time and money..add 1$ extra and move to new modules..just to name:
LMD102
JQ6500
Live to learn & make

Amator90

I finally got this module work. Now I have another issue to solve. Could you please give me a hint how to play specific file? For example:
If condition X
then play song 0012.ad4

Thanks for any advice.

Tomasina

I finally got this module work. Now I have another issue to solve. Could you please give me a hint how to play specific file? For example:
If condition X
then play song 0012.ad4
wtv020sd16p.playVoice(11);

lalufendy

WTV020-SD-16P audio module:



This is my first contribution for the Arduino community. With this library you will be able to play wav or ad4 files easily. Will be adding new method or features in the future. Built this cause I need it for my Arduino project.

Code: [Select]
/*
 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>

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.

/*
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 setup() {
  //Initializes the module.
  wtv020sd16p.reset();
}

void loop() {
  //Plays synchronously an audio file. Busy pin is used for this method.
  wtv020sd16p.playVoice(0);
  //Plays asynchronously an audio file.
  wtv020sd16p.asyncPlayVoice(1);
  //Plays audio file number 1 during 2 seconds.
  delay(5000);
  //Pauses audio file number 1 during 2 seconds. 
  wtv020sd16p.pauseVoice();
  delay(5000);
  //Resumes audio file number 1 during 2 seconds.
  wtv020sd16p.pauseVoice();
  delay(5000); 
  //Stops current audio file playing.
  wtv020sd16p.stopVoice();
  //Plays synchronously an audio file. Busy pin is used for this method. 
  wtv020sd16p.asyncPlayVoice(2);
  delay(2000);   
  //Mutes audio file number 2 during 2 seconds.
  wtv020sd16p.mute();
  delay(2000);
  //Unmutes audio file number 2 during 2 seconds.
  wtv020sd16p.unmute();
  delay(2000);   
  //Stops current audio file playing.
  wtv020sd16p.stopVoice();
}


Unzip Wtv020sd16p.zip and copy Its content into the Arduino library IDE folder. If you have any question or request, please don't hesitate in contact me.

Update: August 6th.
Added pause, stop, mute and unmute method as well updated the example program. Hope this helps.
i am sorry, i am no expert speak english..
i have a question..

i want to handle file music(ad4) in wtv020 modul,,,,
my plan i want use capacitive sensor in arduino for playing music in wtv020...

can u help me..
example : if i touch sensor capacitive then song (001) is play...

katonafull

#291
Jan 26, 2016, 07:31 am Last Edit: Feb 02, 2016, 10:17 pm by katonafull
The library or something isn't work aright for me with the WTV020-SD-16P audio module.
If i use this simple code and I use delay before the playing... the song starts playing, but after some seconds (1-2) it will restart:
But it does not have to be so.
I tried this with an other module too. The result is the same.

Code: [Select]
/*
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>

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.

/*
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 setup() {
 //Initializes the module.
 wtv020sd16p.reset();
}

void loop() {
 //Plays synchronously an audio file. Busy pin is used for this method.
 wtv020sd16p.playVoice(0);

}



What are you think, what is the problem?

kalata23

Guys, I have that module WTV020m01.. I tried to turn it on with push buttons instead of arduino. It couldn't play .ad4 files, nor wav. I tried everything, lowering down the records volume and so on.. I tried to connect the 6-th SD CARD pin with 8-th of the module, it didn't work also. My SD card is 2GB, I dunno what is the manufacture, but THE SOLUTION WAS FORMATING THE SD-CARD INTO FAT(DEFAULT) FORMAT SYSTEM. When the module didn't work, the sd-card was in fat32 system, but after formating the card again in just FAT i worked perfectly.
I hope that works for most of you too.

nishu123

hi..how can we know wtv020m01 module is working or not?

Dr_Ugi

Thanks again to all who contributed to this thread - I used the WTV module in a pong/invaders game project I did with my kids and some of their friends (see below).  Your comments on this thread were invaluable in making the sound work reliably for the kids:


See This Instructable if you're interested.  I know lots of well-respected posters here don't rate instructables, but the way to change that is to post some good ones!

Ugi

Sleepingshorty

HI@all.

Thank you for the library. I added the function "setVolume" with Levels from 0 to 7 as it is written in the datasheet. It is working fine until I use a volume level of 4 or less.

Then the sound volume varies and there is some hiss.

Any idea?

Here is what I did:

Code: [Select]

//Volume 0 to 7
void Wtv020sd16p::setVolume(int volumeLevel){

  switch (volumeLevel){
 
  case 0:
  sendCommand(0xFFF0);
  break;
 
  case 1:
  sendCommand(0xFFF1);
  break;
 
  case 2:
  sendCommand(0xFFF2);
  break;
 
  case 3:
  sendCommand(0xFFF3);
  break;
 
  case 4:
  sendCommand(0xFFF4);
  break;
 
  case 5:
  sendCommand(0xFFF5);
  break;
 
  case 6:
  sendCommand(0xFFF6);
  break;
 
  case 7:
  sendCommand(0xFFF7);
  break;
 
  default:
  break;
  }


Thank you. :)

Antsette

Is there a way for me to access and play a specific file via the arduino?

Is there a way for me to initiate a skip, or previous or such via the arduino?

himijendrix

Good evening,

I have two older projects in which I used the WTV020 module and it always has been a nightmare.
I play rather big files with it (> 1 hour) and one important thing regarding sound quality is the decoding process. WAV Files (12 kHz, 16 bit) work and quality is okay BUT a loud periodic "pop/tick" sound will occur.

So it has to be AD4. Most people use the "UsbRecorder" recorder Software and honestly I didn't find any alternative for this. Audacity can encode to ADPCM (which is what the AD4 file is encoded to) but the only result you get is noise and very distorted audio. Maybe it's a problem with the header file.

Best practice for me is:
1) convert to 12 or 16kHz, 16bit Mono WAV
2) normalize it to -4 dB, which seems to fix the problem that sometimes the audio starts to hang -->
But that still has to be investigated further. I read about it in other posts.
2) convert to AD4 using the USBRecorder

When using 32kHz as sample rate either the AD4 Encoder seems to produce errors or the WTV020 has a problem with 32kHz. Volume starts to change randomly and audio distorts.

other useful things (most have already been mentioned here):
- delay(1000); after wtv020sd16p.reset();
- delay(xxx) before reading the busy Pin (LOW == playing file). The delay time also depends on your hardware layout.
- Low Pass Filter (~100nF/~100ohm) and coupling capacitor (~1uF) on the audio output

the SD is a samsung 2gb...

Ciao!

scrato

Hi, am trying to figure out why I can't make this happen with arduino. I can play songs when I bring GND on PLAY/PAUSE (in fact it is, PLAY/RESTART), but with arduino library I really can't do anything. I even found some code for AVR, and that one also doesn't work. I am pretty sure I missed something obvious, some quick action that makes serial connection active or something...
I connect sparkfun wtv020sd with schematic from datasheet, but i am not sure in anything anymore.
 :smiley-eek-blue:

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy