手持ちの16khz/16bitのwavデータで試したらちゃんと歌ってくれますww
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "voice.h" // 16khz, 16bit, wav data block | |
// add 0x8000 to each original wave format data | |
void setup() | |
{ | |
Serial.begin(115200); | |
Serial.println("start"); | |
sigmaDeltaSetup(0, 16000); | |
sigmaDeltaSetup(1, 16000); | |
sigmaDeltaAttachPin(25,0); | |
sigmaDeltaAttachPin(26,1); | |
sigmaDeltaWrite(0, 0); | |
sigmaDeltaWrite(1, 0); | |
} | |
int count = 0; | |
const int length = sizeof(voice) / sizeof(uint16_t); | |
void loop() | |
{ | |
uint8_t left = (voice[count++] >> 8) & 0xff; | |
uint8_t right = (voice[count++] >> 8) & 0xff; | |
sigmaDeltaWrite(0, left); | |
sigmaDeltaWrite(1, right); | |
if (count > length) { | |
count = 0; | |
Serial.println("loop"); | |
} | |
ets_delay_us(60); | |
} |