Icing #include <avr\pgmspace.h> is not portable. It should always be avr/… You have that wrong in a lot of files. Also a lot of your includes are not working on non PC platforms. I have almost got it to compile, but I still have one WProgram.h that is wrong. It really needs to be < > not “” for includes that are not in the actual directory do to the stupid magic the arduino package uses.
Now I am stuck on a multiple defined conflict with the WiShield library on __vector_3 which I have added to support the blackwidow board you guys sold me. Any suggestions on how to resolve that one?
You can first try to not use the function of recording by choosing ATmega328, so that you can make sure the other parts of the code is compiled ok. Then we can look into the problem of record.c.
Yes, thank you, we will fix it in the next version.
In fact, we did not test the 2G microSD card. I guess the high speed of mass storage mircoSD card may not supported by the low SPI speed of ATmega. You may do that for a try.
Yes, it should be as you described. However it compiles ok on my PC (win7) , so that I ignored that problem.
I think using “WProgram.h” is ok as you can find it is used in some arduino libraries like Stepper, and it works ok on my platform.
I added WiShield to the library and recompiled the sketch of music, and it’s ok.
So I’m also confused by the problem you encountered, as we did test the code on non windows platforms.
I suggest you may try them first on woindows.
May it helpful to you, and any question is welcome!
Sorry no easy to access window box at home, yewh I get paid if I am touching that mess. Only at work. I do not understand why the WiShield.o has a coliding reference with WInterrupt.o, but that is where the collision appears, only when I try to recompile the music shield sources. With a bunch of include fixes, it now compiles on a mac. I now need to find a small enough card to try it out.
In addition to the \ bug I had to change a bunch of the “”"s to <>s to get it to work, and add a missing include or two. Because the magic nonsense the arduino environment does in constructing the build file, copying the libraries, and reordering includes and defines, the actual order of compilation is not what most people think. As such differing platforms with different directory ordering can cause things to appear to randomly work or fail. (As I have expressed elsewhere I think the arduino people will burn for their sins, but all that matters here is that we can get things working everywhere.) BTW libraries are compiled like straight gcc files, only sketches get magicly restructured. Do shift click on the compile button and look at the temp files, and the build files. The includes in libraries have completely different rules than the includes in sketches. (I did not make these rules, but I have stubbed my toes repeatedly on this nonsense.)
Sectors per Cluster: 64
FAT Start sector: 139
Root start sector: 609
Data start sector: 513
ClockF:B800
Found file name is A OGG
File size: 4623274bytes.
Found file name is A OGG means there is playing A.ogg file on the card.
So it seems you are stuck in the initialization of microSD card. What memory size your card is? You may try to do like this:
Format the card with FAT16.
copy one mp3 or other music file to the card.
install the card into the music shield.
download the sketch of Music to atmega328.
Plug the music sheld to the atmega328.
Open the console.
If everything is ok, you’ll find the message as above. Otherwise, try to pull out the card and put in again, click the CloseCom/OpenCom button of SSCOM to reset the program.
May this helpful to you, and feel free to ask any question.
I just got a 2G sandisk, and with my changes I can record ogg, and now on to play back.
From the datasheet it appears it could play m4a, apples acc files, but I am unsure of the packaging. guess there is one way to find out. Which modes are enabled via your demo app icing?
@icing, if you do another rev please add one more button, it really needs a record button/indicator. Trying to figure out how to do it with the current set, without it being too complex.
Yes, from the datasheet of vs1053 it appears it could play m4a, however we did not test that. We only tested the function listed on the music shield user manual.
If you want to test it, I don’t think it need extra configuration, just as playing normal music file.
We have one record button, multi-used with play/stop button.
You mean it is not convenient to use record function as described in the user manual?
We may give up so many buttons, replaced by rotation switch in the next version.
Okay two things 1) .m4a files do work, as in they appear to play fine.
2) Something is corrupting the sd card. I can read and write it on a PC or Mac. I use it in the player, and then I can only read it on a PC, and a chkdsk reveals that there are multiply allocated clusters. So we appear to have a software issue with the file system code. (This is going to be fun to find, but people should beware something is corrupting the Fat-16 filesystem. I have not tracked this down to see if record is what does it, or something else.
@icing, I tried your hold in the play while powering up, and this is too klunky and hard to get right for me. A knob is an interesting idea, but the first add for me is going to be a display.
Using Apples Universal Doc with IR remote. Pause/Play works and volume from the base work with the remote, not clear if that is the pre-amp in the base or the shield.
Next/Previous song do not work.
The shield buttons work, but the ir command is not working.
“PALY/Pause indicator LED (GREEN): If play, green LED blinks.”
Should read
Play/Pause indicator LED (GREEN) If playing, the green LED blinks.
I really would need some documentation on how to get started…
My compile errors.
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp: In function ‘void InitSPI()’:
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:8: error: ‘PB4’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:9: error: ‘PB3’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:10: error: ‘PB5’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:14: error: ‘PB2’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp: In function ‘void InitIOForVs10xx()’:
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:42: error: ‘PC1’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:43: error: ‘PC2’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:44: error: ‘PC3’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:45: error: ‘PC0’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp: In function ‘void InitIOForKeys()’:
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:62: error: ‘PD7’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:63: error: ‘PD6’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:64: error: ‘PD5’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:65: error: ‘PD3’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:66: error: ‘PD4’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp: In function ‘void InitIOForLEDs()’:
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:73: error: ‘PB1’ was not declared in this scope
F:\arduino\arduino-0018\libraries\Music_v1_0\config.cpp:74: error: ‘PB0’ was not declared in this scope
Forgot to mention that im running a Duemilanove board with ATmega328
As said in the doc , i replaced the portpins.h file.
Now it all compiles fine , i imported the library music_V1_0 first and then added the example. that dont work , compiles errors.
Now i only load the example and the board lits up and i can serial monitor it. seems to work . need to fix my micro sd card with some music now
Glad you got it working, the 1.0 sources will only compile under windows, but they fixes are not hard. Been using it for a couple of days, and I need to start hacking the app. Static play list is not my friend.
@icing: I notice that you have at least partial fat-32 support from the sources, how far from working is that?
@icing:
As I understand the current code, it actually goes sequential through the file table playing files. Is that correct? (This means it plays files in the order added, not in the order found in a directory. But if you delete and add some other files, they maybe put in the place of the files you deleted. Can you confirm my understanding here?) I want to implement two changes. One is the random mode I like best, but few ever implement, which is pick a random leaf directory, and play all the files there, then pick a new leaf directory. The other things I want to do is make next, skip to the next directory not the next file. This seems like a complete rewrite, which is not attractive to me, so I was considering the following hack. On next keep selecting the next file until I find one not in the same directory, but it is not clear that this would work, because as I saw it you ignore all directories. Any comments or pointers would be appreciated.
Yes, you are right. The music file is played sequentially.
I think to skip to the next directory not the next file is not very complicated. You need to understand the structure of function OpenFile(), and may do some changes on it.
Anther way implement the function you need is to built an music file table in initialization before playing any music.
For example:
[code]typedef struct ALBUM_TABLE_
{
//char albumName[ALBUM_NAME_LEN];//to save ram,reduce album name item as we do not display it
u8 totalTrackCnt;
addressType trackAddr[TRACK_MAX_NUMBER];//track file start block
}ALBUM_TABLE;
ALBUM_TABLE album[ALBUM_MAX_NUMBER];[/code]
Then you can establish an album table by changing OpenFile(). After all album and corresponding tracks is got, you can play any track in any album as you need. And you don’t need to look through the fat table every time playing music file as the start address of which has been recorded in the album table in initialization.
However it is just an general idea, and you must consider the ram space it needs, as it increases as the ALBUM_MAX_NUMBER increases.
The following main work of me may be the software optimization.
PS2: To use the recording function, you need to press the play/stop button when power on, and release it as the green led light and stable. If you open an serial console on pc, it will give some instructive message.
Okay thanks for the feedback, I will give it a shot. I am still seeing Fat-16 problems with long playing, 4-6hours of files on a 2G san disk card. The play got lost in the middle of a song, random loops and noise coming out. I hope it is not corrupted again as I have not recorded. I definitely need a randomize startup, as I am getting tired of a fixed start point. Good suggestions. Do you think there is any hope of FAT-32 working, I see code for it, I guess I just need to try. I have an 8 G card around somewhere, time to load it up.
On a mega I should be able to build a list of unique albums, and go from that. Names are not yet important, until I hitch up a display. For record, more feedback is needed for that feature to be usable. Without the serial line it is hopeless. I want to think of how to make it optional, without too much bloat, but it would be really useful. If memory becomes too big an issue, I have a flash chip or too I could use to store album data on, and then cache it. Or if file writing can be fixed to not corrupt, I would write an index file/playlist capability to the flash disk. Not sure if I should write that on the arduino, or optionally build it with a java client on the host. Check date, and if upto date use it. Can 2 files be open at once?