I recently bought two PSRAM chip for teensy 4.1 . it is
from fabtolab . after soldering it on board , i uploaded test program from github.com
got report is below
i think it is ok installled. now i am searching for example code of PSRAM , inwhich a .wav sample is loaded to Ram memory . and played it from ram faster by key input. here is my sketch below inwhich i want to add this code.
wav files ("003_00.WAV", "003_01.WAV", "003_02.WAV", "003_03.WAV", "003_04.WAV") are being played well.
i want to play some drum sample using ram memory
"SMP_01.WAV", from mykey 5
"SMP_02.WAV", from mykey 6
"SMP_03.WAV", from mykey 7
"SMP_04.WAV" from mykey 8
along with running file . i tried to find (play audio from PSRAM ) but could not found .
what code is used to load any audio SMP to PSRAM FROM SD card ???
how loaded SMP file is played from key input is there detailed information about it ????
shoul i need another format of audio instead of .wav on sd card ???
is any reading alert in serial monitor , when audio sample are being loaded to ram memory , ???
my wav files ("003_00.WAV", "003_01.WAV", "003_02.WAV", "003_03.WAV", "003_04.WAV") are 2-3 second long each (drum loops)
and "SMP_01.WAV", "SMP_02.WAV", "SMP_03.WAV", "SMP_04.WAV" are 1-2 second long each (drum shots)
plaese reply ....... any suggested forum or page link if it is mentioned anywhere ???
,,,,,,,,,,,,,,, THANK YOU,,,,,,,,,,,,,,,,,,,
got report is below
Code:
EXTMEM Memory Test, 16 Mbyte
CCM_CBCMR=B5AE8304 (88.0 MHz)
testing with fixed pattern 5A698421
testing with pseudo-random sequence, seed=2976674124
testing with pseudo-random sequence, seed=1438200953
testing with pseudo-random sequence, seed=3413783263
testing with pseudo-random sequence, seed=1900517911
testing with pseudo-random sequence, seed=1227909400
testing with pseudo-random sequence, seed=276562754
testing with pseudo-random sequence, seed=146878114
testing with pseudo-random sequence, seed=615545407
testing with pseudo-random sequence, seed=110497896
testing with pseudo-random sequence, seed=74539250
testing with pseudo-random sequence, seed=4197336575
testing with pseudo-random sequence, seed=2280382233
testing with pseudo-random sequence, seed=542894183
testing with pseudo-random sequence, seed=3978544245
testing with pseudo-random sequence, seed=2315909796
testing with pseudo-random sequence, seed=3736286001
testing with pseudo-random sequence, seed=2876690683
testing with pseudo-random sequence, seed=215559886
testing with pseudo-random sequence, seed=539179291
testing with pseudo-random sequence, seed=537678650
testing with pseudo-random sequence, seed=4001405270
testing with pseudo-random sequence, seed=2169216599
testing with pseudo-random sequence, seed=4036891097
testing with pseudo-random sequence, seed=1535452389
testing with pseudo-random sequence, seed=2959727213
testing with pseudo-random sequence, seed=4219363395
testing with pseudo-random sequence, seed=1036929753
testing with pseudo-random sequence, seed=2125248865
testing with pseudo-random sequence, seed=3177905864
testing with pseudo-random sequence, seed=2399307098
testing with pseudo-random sequence, seed=3847634607
testing with pseudo-random sequence, seed=27467969
testing with pseudo-random sequence, seed=520563506
testing with pseudo-random sequence, seed=381313790
testing with pseudo-random sequence, seed=4174769276
testing with pseudo-random sequence, seed=3932189449
testing with pseudo-random sequence, seed=4079717394
testing with pseudo-random sequence, seed=868357076
testing with pseudo-random sequence, seed=2474062993
testing with pseudo-random sequence, seed=1502682190
testing with pseudo-random sequence, seed=2471230478
testing with pseudo-random sequence, seed=85016565
testing with pseudo-random sequence, seed=1427530695
testing with pseudo-random sequence, seed=1100533073
testing with fixed pattern 55555555
testing with fixed pattern 33333333
testing with fixed pattern 0F0F0F0F
testing with fixed pattern 00FF00FF
testing with fixed pattern 0000FFFF
testing with fixed pattern AAAAAAAA
testing with fixed pattern CCCCCCCC
testing with fixed pattern F0F0F0F0
testing with fixed pattern FF00FF00
testing with fixed pattern FFFF0000
testing with fixed pattern FFFFFFFF
testing with fixed pattern 00000000
test ran for 72.86 seconds
All memory tests passed :-)
Code:
#include <Keypad.h>
#include <Arduino.h>
#include <Audio.h>
#include <SD.h>
#include <TeensyVariablePlayback.h>
#include <SPI.h>
#include <Wire.h>
const uint8_t ROWS = 7; // 7 rows
const uint8_t COLS = 4; //4 columns
char keys[ROWS][COLS] = {
{ 1, 2, 3, 4 },
{ 5, 6, 7, 8 },
{ 9, 10, 11, 12 },
{ 13, 14, 15, 16 },
{ 17, 18, 19, 20 },
{ 21, 22, 23, 24 },
{ 25, 26, 27, 28 }
};
uint8_t rowPins[ROWS] = { 33, 34, 35, 36, 37, 38, 39 };
uint8_t colPins[COLS] = { 40, 41, 14, 16 };
Keypad kpd = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
// GUItool: begin automatically generated code
AudioPlaySdResmp playSdWav1;
AudioMixer4 mixer1;
AudioOutputI2S i2s2;
AudioConnection patchCord1(playSdWav1, 0, mixer1, 0);
AudioConnection patchCord2(playSdWav1, 1, mixer1, 1);
AudioConnection patchCord3(mixer1, 0, i2s2, 0);
AudioConnection patchCord4(mixer1, 0, i2s2, 1);
AudioControlSGTL5000 audioShield;
// GUItool: end automatically generated code
char *wav[5] = {"003_00.WAV", "003_01.WAV", "003_02.WAV", "003_03.WAV", "003_04.WAV"};
char *SMP[5] = {"SMP_00.WAV", "SMP_01.WAV", "SMP_02.WAV", "SMP_03.WAV", "SMP_04.WAV"};
void setup() {
Serial.begin(57600);
kpd.setHoldTime(2000);
if (!(SD.begin(BUILTIN_SDCARD))) {
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
AudioMemory(128);
audioShield.enable();
audioShield.volume(1.0);
playSdWav1.enableInterpolation(true);
Serial.println("Audio TEST:");
}
void loop() {
if (kpd.getKeys()) {
for (int i = 0; i < LIST_MAX; i++)
{ int mykey = (kpd.key[i].kchar);
if (kpd.key[i].stateChanged) // -----------------------------------------Key Changed----------------
{ switch (kpd.key[i].kstate) {
case PRESSED:
Serial.println(mykey); Serial.println("PRESSED");
break;
case RELEASED:
Serial.println(mykey); Serial.println("RELEASED");
break;
}
} //--------------------------------------------------------------------------------------------------
if ((kpd.key[i].stateChanged) && (mykey > 0) && (mykey < 5)) // -----------------------------------------Key Changed----------------
{ switch (kpd.key[i].kstate) {
case PRESSED:
playSdWav1.playWav(wav[mykey]);
if (mykey == 4) { playSdWav1.setLoopType(looptype_repeat); } else { playSdWav1.setLoopType(looptype_none); }
break;
}
} //--------------------------------------------------------------------------------------------------
if ((kpd.key[i].stateChanged) && (mykey > 4) && (mykey < 9)) // -----------------------------------------Key Changed----------------
{ switch (kpd.key[i].kstate) {
case PRESSED:
// what code to play ( "SMP_01.WAV", "SMP_02.WAV", "SMP_03.WAV", "SMP_04.WAV" from PSRAM )
break;
}
} //--------------------------------------------------------------------------------------------------
}
}
}
i want to play some drum sample using ram memory
"SMP_01.WAV", from mykey 5
"SMP_02.WAV", from mykey 6
"SMP_03.WAV", from mykey 7
"SMP_04.WAV" from mykey 8
along with running file . i tried to find (play audio from PSRAM ) but could not found .
what code is used to load any audio SMP to PSRAM FROM SD card ???
how loaded SMP file is played from key input is there detailed information about it ????
shoul i need another format of audio instead of .wav on sd card ???
is any reading alert in serial monitor , when audio sample are being loaded to ram memory , ???
my wav files ("003_00.WAV", "003_01.WAV", "003_02.WAV", "003_03.WAV", "003_04.WAV") are 2-3 second long each (drum loops)
and "SMP_01.WAV", "SMP_02.WAV", "SMP_03.WAV", "SMP_04.WAV" are 1-2 second long each (drum shots)
plaese reply ....... any suggested forum or page link if it is mentioned anywhere ???
,,,,,,,,,,,,,,, THANK YOU,,,,,,,,,,,,,,,,,,,