then opened pcmConfig.h file in text editor from Documents\Arduino\libraries\TMRpcm-master, Uncommented following three lines: #define SDFAT #define ENABLE_RECORDING #define BLOCK_COUNT 10000UL // 10000 = 500MB 2000 = 100MB
first one was required for using SDFAT library with TMRpcm library, and other two were required for recording feature in TMRpcm library.
then open a built in example "sdfat" from TMRpcm >> xtraFeatures >> sdfat, and when tried to compile it following error occurred:
Arduino: 1.9.0-beta (Windows 7), Board: "Arduino Uno"
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:195:2: error: 'Sd2Card' does not name a type; did you mean 'SdCard'?
Sd2Card card1;
^~~~~~~
SdCard
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In member function 'void TMRpcm::createWavTemplate(char*, unsigned int)':
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1609:5: error: 'SdVolume' was not declared in this scope
SdVolume vol;
^~~~~~~~
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1609:5: note: suggested alternative: 'FsVolume'
SdVolume vol;
^~~~~~~~
FsVolume
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1616:7: error: 'card1' was not declared in this scope
if (!card1.init(SPI_FULL_SPEED,CSPin)) {
^~~~~
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1620:6: error: 'vol' was not declared in this scope
if(!vol.init(&card1)){}//Serial.println("card failed"); }
^~~
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1620:6: note: suggested alternative: 'atol'
if(!vol.init(&card1)){}//Serial.println("card failed"); }
^~~
atol
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1620:16: error: 'card1' was not declared in this scope
if(!vol.init(&card1)){}//Serial.println("card failed"); }
^~~~~
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1621:21: error: 'vol' was not declared in this scope
if (!rut.openRoot(&vol)) {}//Serial.println("openRoot failed"); }
^~~
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1621:21: note: suggested alternative: 'atol'
if (!rut.openRoot(&vol)) {}//Serial.println("openRoot failed"); }
^~~
atol
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1622:27: error: no matching function for call to 'SdFile::remove(SdFile*, char*&)'
SdFile::remove(&rut, fNam);
^
In file included from C:\Users\CSharp\Documents\Arduino\libraries\SdFat-master\src/FatLib/FatVolume.h:28:0,
from C:\Users\CSharp\Documents\Arduino\libraries\SdFat-master\src/FatLib/FatLib.h:27,
from C:\Users\CSharp\Documents\Arduino\libraries\SdFat-master\src/SdFat.h:34,
from C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:9:
C:\Users\CSharp\Documents\Arduino\libraries\SdFat-master\src/FatLib/FatFile.h:718:8: note: candidate: bool FatFile::remove()
bool remove();
^~~~~~
C:\Users\CSharp\Documents\Arduino\libraries\SdFat-master\src/FatLib/FatFile.h:718:8: note: candidate expects 0 arguments, 2 provided
C:\Users\CSharp\Documents\Arduino\libraries\SdFat-master\src/FatLib/FatFile.h:733:8: note: candidate: bool FatFile::remove(const char*)
bool remove(const char* path);
^~~~~~
C:\Users\CSharp\Documents\Arduino\libraries\SdFat-master\src/FatLib/FatFile.h:733:8: note: candidate expects 1 argument, 2 provided
C:\Users\CSharp\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1631:9: error: 'card1' was not declared in this scope
if (!card1.erase(bgnBlock, endBlock)){
^~~~~
exit status 1
Error compiling for board Arduino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I tried my best to resolve this, worked many days and hours, searched on internet, tried different versions of both libraries and also tried with Arduino IDE version 1.8.11, but because of my limited knowledge in C++ , was not able to solve it, so decided to post here.
Sd2Card seems to be a feature of the basic Arduino SD library; it is not part of Bill Greiman's SdFat library. So I suppose you will need to uninstall SdFat, install SD, configure correspondingly and try again.
arduarn: Sd2Card seems to be a feature of the basic Arduino SD library; it is not part of Bill Greiman's SdFat library. So I suppose you will need to uninstall SdFat, install SD, configure correspondingly and try again.
Sir I previously have successfully used TMRpcm recording feature with Arduino built in SD library, but i my current project i have to use Software SPI , which is only available in SdFat not in Arduino SD library (please correct me if i am wrong).
And i am surprised that Recording feature of Tmrpcm library does not work with Sdfat library, The Author of TmrPcm recommended to use Sdfat Library over SD library in his Recording sketch , as in link below:
It says :
Better performance may be seen using the SdFat library.
If the author of TmrPcm is looking this Topic, he should look for this problem please. It is a Serious problem.
zeeakram:
The Author of TmrPcm recommended to use Sdfat Library over SD library in his Recording sketch
Well, things change with time and the SdFat library has changed considerably since the TmrPcm stuff was written. A further look at SdFat shows that Sd2Card was in version 1.* of the SdFat library, but was removed in version 2.. So in that case you would be better trying the most recent version of the 1. tree. Here is a link to it on GitHub.
zeeakram:
It says :If the author of TmrPcm is looking this Topic, he should look for this problem please. It is a Serious problem.
It looks like TmrPcm is still being occasionally maintained, so you would be best letting him know directly. If his library is so important to your project, then please consider making a donation to him to encourage further development (see his sponsor link on the GitHub page).
arduarn:
So in that case you would be better trying the most recent version of the 1.* tree. Here is a link to it on GitHub.
I have already tried all versions of Sdfat with TMRpcm, as i mentioned in my first post in this topic, but no success.
Anyway, thank you very much for your time and reply.
zeeakram:
...but i my current project i have to use SoftwareSerial, which is only available in SdFat not in Arduino SD library
I don't understand that statement at all. SoftwareSerial is an independent library from either SdFat or SD. More over, if using another serial port is really that important, switch to a platform with multiple hardware serial ports .... Mega, Arm, or even 32u4.
gfvalvo:
I don't understand that statement at all.
Sorry. it is my mistake, i should say software SPI instead*.*
Actually i have to use USB HOST Shield ( so i can connect usb barcode scanner) + SD Card Module (so i can record and play wave files from SD card) with Arduino , when using Arduino built in SD library there was a pins conflict between USB HOST Shield and SD Card Module, because of this conflict usb host shield was not detecting Usb barcode Scanner, with some reserach on internet i found it can be solved with SDfat library, as it allow Software SPI. As in the following topic: https://forum.arduino.cc/index.php?topic=592144.0
In last post of this topic i learned that there is an other library called SDfat that can provide Software SPI, and i changed Required pins for SD CARD Module to other available pins, and this problem solved, now wave file play function was working good with TMRpcm, but as i tried to Use its recording function, it gave the Error, so now i have to solve it, and it looks it will solve when Author of TmrPcm library will give update.
Any further Suggestions please ?
Yea, I'd still look at moving to more capable hardware. Consider the Teensy Family. Depending on the features you need, there's T3.2/5/6 and T4.0/1. They provide native USB hardware, support for USB Host, fast (32-bit) ARM cores, and probably the best Audio Library in the Arduino ecosystem.
I am a hobbyist and entered in wold of Arduino to do something useful for others, and did many.
My next full project is as follows:
I want to build a Useful device for students and learners with Arduino. This device will have a Audio play back functionality with Bar code Scanner , with scanner student will scan a printed barcode on his paper/book, device will play related Audio from SD Card inserted in SD CARD Module. This part was Done Successfully.
Now next step was to add Recording functionality with print on paper/Sticker Functionality, for this i learned use of Thermal printer with Arduino. The Idea was : Student will Start voice recording and when he will finish , Thermal printer will Print a barcode which will be linked with Recently recorded Voice , student will stick this barcode on his paper/book as a audio note link, which he will be able to Listen with same device when he wish.
Summary: This device will work as Devices already available Named Pen Quran / Digital pen , can play audio and also as voice note maker.
I hope i explained well about my project.
Any Suggestion about this project will be highly appreciated. Thanks a lot.
gfvalvo:
Yea, I'd still look at moving to more capable hardware. Consider the Teensy Family. Depending on the features you need, there's T3.2/5/6 and T4.0/1. They provide native USB hardware, support for USB Host, fast (32-bit) ARM cores, and probably the best Audio Library in the Arduino ecosystem.
OK, I will try to learn use of Teensy also. Thank you very much for your Suggestion.
please also read my post up and make any further Suggestions.