https://forum.pjrc.com/threads/27409-Play-RAW-from-Serial-Flash?p=61996&viewfull=1#post61996Frank,
Where do I find the required "flash_spi.h" file?
W25Q128FV Serial Flasher
Initializing SD card...done.
201159~1.RAW 182271 Bytes
82583_~1.RAW 158463 Bytes
86334_~1.RAW 75775 Bytes
86773_~1.RAW 1622527 Bytes
102790~1.RAW 99327 Bytes
171104~1.RAW 43007 Bytes
P2.RAW 207103 Bytes
7 File(s), 2388473 Bytes
Flash Status: 0x0, ID:0xEF,0x40,0x18,0x0 is ok.
File(s) fit(s) in serial flash, 14388743 Bytes remaining.
Check flash content: Verify.
1. Verifying "201159~1.RAW" at position: 0x0000000...ok.
2. Verifying "82583_~1.RAW" at position: 0x002C800...ok.
3. Verifying "86334_~1.RAW" at position: 0x0053300...ok.
4. Verifying "86773_~1.RAW" at position: 0x0065B00...ok.
5. Verifying "102790~1.RAW" at position: 0x01F1D00...ok.
6. Verifying "171104~1.RAW" at position: 0x020A100...ok.
7. Verifying "P2.RAW" at position: 0x0214900...ok.
Flash content ok. Nothing to do.
Ready.
Copy'n paste:
const int SPIFlash[7] = {
0x0000000, //"201159~1.RAW"
0x002C800, //"82583_~1.RAW"
0x0053300, //"86334_~1.RAW"
0x0065B00, //"86773_~1.RAW"
0x01F1D00, //"102790~1.RAW"
0x020A100, //"171104~1.RAW"
0x0214900}; //"P2.RAW"
const char SPIFlashFilename[7][13] = {
"201159~1.RAW",
"82583_~1.RAW",
"86334_~1.RAW",
"86773_~1.RAW",
"102790~1.RAW",
"171104~1.RAW",
"P2.RAW"};
I dont care how they are stored. I just need to know which ones are what so I can apply my code to finding them based on user selection.
const int SPIFlash[7] = {
0x0000000, //"201159~1.RAW"
0x002C800, //"82583_~1.RAW"
0x0053300, //"86334_~1.RAW"
0x0065B00, //"86773_~1.RAW"
0x01F1D00, //"102790~1.RAW"
0x020A100, //"171104~1.RAW"
0x0214900}; //"P2.RAW"
const char SPIFlashFilename[7][13] = {
"201159~1.RAW",
"82583_~1.RAW",
"86334_~1.RAW",
"86773_~1.RAW",
"102790~1.RAW",
"171104~1.RAW",
"P2.RAW"};
Well more than a second will be too long I think.
So saving my variables with the file location to flash wont be stored permanently?
W25Q128FV Serial Flasher
Initializing SD card...done.
XX.RAW 8703 bytes
XXX.RAW 4607 bytes
XXXX.RAW 46335 bytes
XXXXX.RAW 72191 bytes
4 file(s): 131836 bytes
Pages consumed for file info: 1 page(s)
--> total: 132092 bytes
Flash Status: 0x0, ID:0xEF,0x40,0x18,0x0 is ok.
File(s) fit(s) in serial flash, 16645124 Bytes remaining.
Check flash content:
Verify.
Files on flash ? --> file #: no match
Erasing chip....
done.
-- > Flashing file # 1 : "XX.RAW" at file_position: 0x0000100 ...
-- > Flashing file # 2 : "XXX.RAW" at file_position: 0x0002300 ...
-- > Flashing file # 3 : "XXXX.RAW" at file_position: 0x0003500 ...
-- > Flashing file # 4 : "XXXXX.RAW" at file_position: 0x000EA00 ...
File info (1 page(s)):
-- > Flashing info page # 1 (of 1) at file_position: 0x0000000 ...
done.
Extract file info:
-- > found 4 file(s): ok
-- > file_adr[0] = 0x0000100 ......
-- > file_adr[1] = 0x0002300 ......
-- > file_adr[2] = 0x0003500 ......
-- > file_adr[3] = 0x000EA00 ......
done.
Ready.
The reason a second would be too long when selecting a sample to use, is that the user will be wanting to hear the sample selection right away.
Instead you want to write code to flash and then play it. Ok, if that's more easy for you...Because then Id have to setup WAV and Flash player objects instead of just flash player objects.
Flash Status: 0x0, ID:0xEF,0x40,0x18,0x0 is ok.
File(s) fit(s) in serial flash, 16368395 Bytes remaining.
Check flash content:
Verify.
Files on flash ? --> # 11 file(s): ok
1. Verifying "XX.RAW" at file_position: 0x0000100...ok.
2. Verifying "XXX.RAW" at file_position: 0x0011B00...ok.
3. Verifying "XXXX.RAW" at file_position: 0x0012D00...ok.
4. Verifying "XXXXX.RAW" at file_position: 0x001E200...ok.
5. Verifying "XXXXXX.RAW" at file_position: 0x002FC00...ok.
6. Verifying "Z.RAW" at file_position: 0x0030E00...ok.
7. Verifying "ZZZ.RAW" at file_position: 0x0042800...ok.
8. Verifying "ZZZZ.RAW" at file_position: 0x004DD00...ok.
9. Verifying "X.RAW" at file_position: 0x004EF00...ok.
10. Verifying "ZZ.RAW" at file_position: 0x0051100...ok.
11. Verifying "XXXXXXXX.RAW" at file_position: 0x0052300...ok.
Extracting file info:
-- > found 11 file(s): ok
xx -- > file_adr[0] = 0x0000100 ......
xxx -- > file_adr[1] = 0x0011B00 ......
xxxx -- > file_adr[2] = 0x0012D00 ......
xxxxx -- > file_adr[3] = 0x001E200 ......
xxxxxx -- > file_adr[4] = 0x002FC00 ......
z -- > file_adr[5] = 0x0030E00 ......
zzz -- > file_adr[6] = 0x0042800 ......
zzzz -- > file_adr[7] = 0x004DD00 ......
x -- > file_adr[8] = 0x004EF00 ......
zz -- > file_adr[9] = 0x0051100 ......
xxxxxxxx -- > file_adr[10] = 0x0052300 ......
done.
Ready.
With filextensions, this could be used for more fileformats
fwiw, here's a variation on the flash tool:
i haven't really tested what happens if you flash more than 21 files or so, in which case that'll be two pages for the file information, but i guess it should be fine.
Flash Status: 0x0, ID:0xEF,0x40,0x18,0x0 is ok.
Check flash content:
Extracting file info:
-- > found 26 file(s): ok
xx -- > file_adr[0] = 0x0000200 ......
xxx -- > file_adr[1] = 0x0011C00 ......
xxxx -- > file_adr[2] = 0x0012E00 ......
xxxxx -- > file_adr[3] = 0x001E300 ......
xxxxxx -- > file_adr[4] = 0x002FD00 ......
ooo -- > file_adr[5] = 0x0030F00 ......
oooo -- > file_adr[6] = 0x0033100 ......
oo -- > file_adr[7] = 0x0034300 ......
x -- > file_adr[8] = 0x0045D00 ......
o -- > file_adr[9] = 0x0047F00 ......
ooooo -- > file_adr[10] = 0x0059900 ......
oooooo -- > file_adr[11] = 0x006B300 ......
xxxxxxxx -- > file_adr[12] = 0x006C500 ......
oooooooo -- > file_adr[13] = 0x007DF00 ......
zz -- > file_adr[14] = 0x008F900 ......
zzz -- > file_adr[15] = 0x00A1300 ......
zzzzz -- > file_adr[16] = 0x00AC800 ......
yyyyy -- > file_adr[17] = 0x00ADA00 ......
zzzz -- > file_adr[18] = 0x00BF400 ......
y -- > file_adr[19] = 0x00C1600 ......
yyy -- > file_adr[20] = 0x00D3000 ......
yyyy -- > file_adr[21] = 0x00D4200 ......
qqq -- > file_adr[22] = 0x00E5C00 ......
qqqq -- > file_adr[23] = 0x00E7E00 ......
usw -- > file_adr[24] = 0x00E9000 ......
www -- > file_adr[25] = 0x00EA200 ......
done.
The access is faster, you can play more files parallel (polyphonic). I' did not test how many, but according to Pensive at minimum 8 (@120MHz, 16 BIT 44kHz) for the variant without SPIFifo.