Store Audio Samples on Esp
Posted: Thu Jul 06, 2017 12:55 pm
Hello,
I already record and playback audio with i2s.
I now want to store a 16 Bit pcm sample encoded file from what i can read from. I dropped the file in the same folder my .c file is located.
but excecuteing this code:
lets the ESP32 crash trying to read the file.
What is the most convenient way to store this sample?
Im new to the ESP32 and have not so much programming skills :O
I attached the Volume.raw file ( as Volume.c to upload it)
mfG Philip
I already record and playback audio with i2s.
I now want to store a 16 Bit pcm sample encoded file from what i can read from. I dropped the file in the same folder my .c file is located.
but excecuteing this code:
Code: Select all
printf("Start reading file\n\n\n");
FILE *f = fopen("Test.raw", "rb");
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
fseek(f, 0, SEEK_SET); //same as rewind(f);
printf("%d is size of file\n\n\n", (int) fsize);
char *volumesample = malloc(fsize + 1);
fread(volumesample, fsize, 1, f);
fclose(f);
Is it even possible to do it this way?Start reading file
Guru Meditation Error of type LoadProhibited occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x400e406c PS : 0x00060430 A0 : 0x800e4031 A1 : 0x3ffd2720
0x400e406c: _fseeko_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/fseeko.c:141
A2 : 0x3ffd2a08 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x00000002
A6 : 0x3ff96458 A7 : 0x7ff2bf1d A8 : 0x8008425e A9 : 0x3ffd2750
A10 : 0x3ffd29a4 A11 : 0x3f406654 A12 : 0x00000000 A13 : 0x000001b6
A14 : 0x00000800 A15 : 0x0000002b SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000064 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffd
Backtrace: 0x400e406c:0x3ffd2720 0x400e4031:0x3ffd2790 0x400f5e30:0x3ffd27b0
0x400e406c: _fseeko_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/fseeko.c:141
0x400e4031: fseek at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/fseek.c:126
0x400f5e30: audio at C:/msys32/home/wellmp/esp/VIVO/soc/components/audio/audio.c:103
Rebooting...
What is the most convenient way to store this sample?
Im new to the ESP32 and have not so much programming skills :O
I attached the Volume.raw file ( as Volume.c to upload it)
mfG Philip