wave shield + 12 bit

hi :slight_smile:
I'm new in the arduino world
and I'm tried to build a simple project:
a voice activated from a sensor, when people are near the sensor the voice speak them..

I use a PIR sensor, an arduino 2009 and a wave shield (!!!)
is quiet simple and all system work good
the only problem is with the wave shield that want only 12 bit wav file
if you don't use a human voice with the shield this is not a big problem..because the sound is played.. but distort! :0

and it seems impossible to convert file in this format, =(
no one software make this conversion
I tried with many of this, from free to professional

Any one else have this problem?
help me
thank you
fraz

What is the shield, link to product doc would be helpful, and post your scetch.
In short, conversion from int_16 to int_12 is right shift operation, for example , sample_12 = sample_16 >>4;

ok, I'm sorry
the shield is the adafruits wave shield Adafruit Wave Shield for Arduino Kit [v1.1] : ID 94 : $22.00 : Adafruit Industries, Unique & fun DIY electronics and kits
and this is my sketch

#include <AF_Wave.h>
#include <avr/pgmspace.h>
#include "util.h"
#include "wave.h"

int pirPin= 0; // Reading from digital pin 11 PIR sensor!
int val = 0;

AF_Wave card;
File f;
Wavefile wave;

void setup() {
// set up serial port
Serial.begin(9600);
pinMode(pirPin, INPUT);

// set up waveshield pins
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(0, INPUT);

// open memory card...........This part is necessary to set up and read SDcard!
if (!card.init_card()) {
putstring_nl("Card init. failed!"); return;
}
if (!card.open_partition()) {
putstring_nl("No partition!"); return;
}
if (!card.open_filesys()) {
putstring_nl("Couldn't open filesys"); return;
}
if (!card.open_rootdir()) {
putstring_nl("Couldn't open dir"); return;
}

putstring_nl("Files fuond:");
ls();
}

void ls() {
char name[13];
int ret;

card.reset_dir();
putstring_nl("Files found:");
while (1) {
ret = card.get_next_name_in_dir(name);
if (!ret) {
card.reset_dir();
return;
}
Serial.println(name);
}
}

void loop(){
val = analogRead(pirPin);
Serial.println(val);
if (val < 10) {
Serial.println("e vai!");
playcomplete("PEN3.WAV");
}
if (val > 11) {
Serial.println ("zitto");
}
delay (500);
// while (LOW==analogRead(pirPin)) {;}
// delay(5000);
}

void playcomplete(char *name){

playfile(name);
while (wave.isplaying);
card.close_file(f);
}

void playfile(char *name) {
// stop any file already playing
if (wave.isplaying) {
wave.stop();
card.close_file(f);
}

f = card.open_file(name);
if (f && wave.create(f)) {
wave.play();
}
}

but what mean this? : sample_12 = sample_16 >>4;
thank you :slight_smile:
f

I don't know if the documentation is out of date or it's some other reason but 16 bit wavs are fine. They have to be mono. 44.1 or 22 khz will work but you only get to use the volume control on 22s. I've got one and it works fine.