how to record my voice in Vs1003?
Re: how to record my voice in Vs1003?
thanks
my problem is that I am recording just one block and I don't know how continue recording for long time could you please learn me by an example ? if you can put for me codes is so appreciated
my problem is that I am recording just one block and I don't know how continue recording for long time could you please learn me by an example ? if you can put for me codes is so appreciated
Re: how to record my voice in Vs1003?
Maybe you can share your code and I can show how you can change it?
-Panu
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy
Panu-Kristian Poiksalo, VLSI Solution Oy
Re: how to record my voice in Vs1003?
Hello Panu,Panu wrote:Ok we can do it step by step.
First create a file on the SD card. Write this data into the file:Then add 448 bytes of zero to the file. Then add this data to the file.Code: Select all
const unsigned char RIFFHeader0[] = { 'R' , 'I' , 'F' , 'F' , // Chunk ID (RIFF) 0x70, 0x70, 0x70, 0x70, // Chunk payload size (calculate after rec!) 'W' , 'A' , 'V' , 'E' , // RIFF resource format type 'f' , 'm' , 't' , ' ' , // Chunk ID (fmt ) 0x14, 0x00, 0x00, 0x00, // Chunk payload size (0x14 = 20 bytes) 0x11, 0x00, // Format Tag (IMA ADPCM) 0x01, 0x00, // Channels (1) 0x80, 0x3e, 0x00, 0x00, // Sample Rate, 0x3e80 = 16.0kHz 0xd7, 0x0f, 0x00, 0x00, // Average Bytes Per Second 0x00, 0x01, // Data Block Size (256 bytes) 0x04, 0x00, // ADPCM encoded bits per sample (4 bits) 0x02, 0x00, // Extra data (2 bytes) 0xf9, 0x01, // Samples per Block (505 samples) 'f' , 'a' , 'c' , 't' , // Chunk ID (fact) 0xc8, 0x01, 0x00, 0x00, // Chunk payload size (456 bytes (zeropad!)) 0xff, 0xff, 0xff, 0xff // Number of Samples (calculate after rec!) };
There should now be 512 bytes of data in the file.Code: Select all
const unsigned char RIFFHeader504[] = { 'd' , 'a' , 't' , 'a' , // Chunk ID (data) 0x70, 0x70, 0x70, 0x70 // Chunk payload size (calculate after rec!) };
Let's continue after you have completed this step.
-Panu
I tried to record voice and used the below header but when i try to play it window media player is unable to recognize it. Also can you please tell how is headers 512 bytes long? i calculated and it comes out to be 508 bytes
Code: Select all
const unsigned char header[]={
'R' , 'I' , 'F' , 'F' , // Chunk ID (RIFF)
0x70, 0x70, 0x70, 0x70, // Chunk payload size (calculate after rec!)
'W' , 'A' , 'V' , 'E' , // RIFF resource format type
'f' , 'm' , 't' , ' ' , // Chunk ID (fmt )
0x14, 0x00, 0x00, 0x00, // Chunk payload size (0x14 = 20 bytes)
0x11, 0x00, // Format Tag (IMA ADPCM)
0x01, 0x00, // Channels (1)
0x80, 0x3e, 0x00, 0x00, // Sample Rate, 0x3e80 = 16.0kHz
0xd7, 0x0f, 0x00, 0x00, // Average Bytes Per Second
0x00, 0x01, // Data Block Size (256 bytes)
0x04, 0x00, // ADPCM encoded bits per sample (4 bits)
0x02, 0x00, // Extra data (2 bytes)
0xf9, 0x01, // Samples per Block (505 samples)
'f' , 'a' , 'c' , 't' , // Chunk ID (fact)
0xc8, 0x01, 0x00, 0x00, // Chunk payload size (456 bytes (zeropad!))
0xff, 0xff, 0xff, 0xff, // Number of Samples (calculate after rec!)
0x00, 0x00, 0x00, 0x00, // Insert 448 zeroes here!
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
'd' , 'a' , 't' , 'a' , // Chunk ID (data)
0x70, 0x70, 0x70, 0x70 // Chunk payload size (calculate after rec!)
};
Code: Select all
void cpyADPCMHeader(char * buffer) {
//strcpy(buffer, header);
int temp = 0;
for(temp=0; temp<508; temp++) {
buffer[temp] = header[temp];
}
}
void VSRecordOn() {
//setVSRegister(SPI_VS_CLOCKF, 0x68, 0x48);
setVSRegister(SPI_VS_AICTRL0, 0x00, 0x06);
//setVSRegister(SPI_VS_AICTRL0, 0x00, 0x09);
setVSRegister(SPI_VS_AICTRL1, 0x10, 0x00);
setVSRegister(SPI_VS_MODE, 0x18, 0x04);
}
cpyADPCMHeader(&temp_buffer);
temp_buffer_counter = 508;
VSRecordOn();
while(temp_buffer_counter<30743) {
temp_len = 0;
while(temp_len < 256 || temp_len >= 896) {
temp_len = getVSRegister(0x09);
}
for(temp=0; temp<temp_len; temp++) {
temp_data = getVSRegister(0x08);
temp_buffer[temp_buffer_counter] = temp_data >> 8;
temp_buffer_counter++;
temp_buffer[temp_buffer_counter] = temp_data&255;
temp_buffer_counter++;
}
}
VSReset();
- Attachments
-
- RECORD.WAV
- (30.5 KiB) Downloaded 266 times
Re: how to record my voice in Vs1003?
Hi!
Hmmh, I am not sure. Perhaps I miscalculated the number of zero padding required? I added 4 more zeros so that the data chunk starts at offset 504 and now your file plays. I can hear you tapping someting
-Panu
Hmmh, I am not sure. Perhaps I miscalculated the number of zero padding required? I added 4 more zeros so that the data chunk starts at offset 504 and now your file plays. I can hear you tapping someting

-Panu
- Attachments
-
- RECORD.WAV
- Fixed :)
- (30.5 KiB) Downloaded 295 times
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy
Panu-Kristian Poiksalo, VLSI Solution Oy
Re: how to record my voice in Vs1003?
Thank You!
I have just one more question is it possible to force VS1003 to output mono instead of stereo? I want to connect a single (mono) amplifier with vs1003, how should i connect it? should i simply short left and right channel and use as one channel?
thanks
I have just one more question is it possible to force VS1003 to output mono instead of stereo? I want to connect a single (mono) amplifier with vs1003, how should i connect it? should i simply short left and right channel and use as one channel?
thanks
Re: how to record my voice in Vs1003?
Panu wrote:Maybe you can share your code and I can show how you can change it?
-Panu
I used that codes that I put in several days ago (please refer to post "Thu May 22, 2014 11:12 am") and you said the header isn't same by your header, notice I used your header but it didn't work! so I use myself header codes, and with that software I can record WAV till 75kb so just tell me which filed of header file I should change till can record for example 150kb? notice if you can give me some example for different file size is so appreciated
Re: how to record my voice in Vs1003?
Hi every body
I could record different WAV file size by changing the amount of Chunk size and subchunk3 size, that was too easy. in the following I have two question, please guide me
1- how can I distinguish the volume of wav file after recording if I want to change the header file after recording ?
2- during recording,there is an Echo and I can hear my voice from speaker while recording so I would like to know how can I cancel Echo due to not to hear my voice from speaker while I am recording
fast reply is too appreciated.
I could record different WAV file size by changing the amount of Chunk size and subchunk3 size, that was too easy. in the following I have two question, please guide me
1- how can I distinguish the volume of wav file after recording if I want to change the header file after recording ?
2- during recording,there is an Echo and I can hear my voice from speaker while recording so I would like to know how can I cancel Echo due to not to hear my voice from speaker while I am recording
fast reply is too appreciated.
Re: how to record my voice in Vs1003?
Hi!
To not hear the echo, write to VOLUME register (set volume low)
-Panu
To not hear the echo, write to VOLUME register (set volume low)
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy
Panu-Kristian Poiksalo, VLSI Solution Oy
Re: how to record my voice in Vs1003?
Mr PanuPanu wrote:Hi!
To not hear the echo, write to VOLUME register (set volume low)
-Panu
thank you very much I removed Echo but how about my first question?
1- how can I distinguish the volume of wav file after recording if I want to change the header file after recording ?
Re: how to record my voice in Vs1003?
I am sorry, but I don't understand this question. Can you ask it with different words, perhaps with an example of a problem?1- how can I distinguish the volume of wav file after recording if I want to change the header file after recording ?
To change the header:
- if your microcontroller supports fseek: fseek to the beginning of the file and write a new header.
- if your microcontroller does not support fseek, you must:
1) determine the sector location of the start of the file
2) read the first sector of the file (first 512 bytes) to RAM
3) change the bytes in RAM
4) write the sector back to the disk (into same position) from the RAM
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy
Panu-Kristian Poiksalo, VLSI Solution Oy