Music shield issues

Has anyone gotten the source for the music shield to compile? I am using arduino-18 and it is choking on the record.c reference to the pgm space. before I go a hacking I thought I would ask.

Oh in the documentation the word Play is misspelled as paly in several places. You might want to fix that. :blush:

Is the 2 G limit due to the FAT16 support, or is there another reason for it?

#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?

Hi Rich,

Thanks for your feedback!

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. :slight_smile:

Yes, it should be as you described. However it compiles ok on my PC (win7) :wink: , 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. :wink:

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.)

I can supply you with the changes if you want.

could anyone run demo code successfully?
i can not run it with arduino328…

on serial console, “Card found, starting…” is the final message from arduino.

Hi funax,

The successful message should be like this:

Card found, starting… Ok.

Sectors per Cluster: 64
FAT Start sector: 139
Root start sector: 609
Data start sector: 513

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:

  1. Format the card with FAT16.
  2. copy one mp3 or other music file to the card.
  3. install the card into the music shield.
  4. download the sketch of Music to atmega328.
  5. Plug the music sheld to the atmega328.
  6. 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.



HI Icing! thanks for your reply.

What memory size your card is?

2GB. should I use 1GB card?

2GB should be ok! 1GB, 2GB are all tested ok on the music shield.



Hi, Icing. thank you for your advices.

I bought new Transcend’s MicroSD card (1GB), it works fine!
PQI’s card seems not compatible with Arduino libraries.

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.

Hi there,
Thanks for your updating!

@funax, glad to hear it works. Yes, there may be some card unsupported.


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.

Two more quick comments:

  1. 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.

  2. “PALY/Pause indicator LED (GREEN): If play, green LED blinks.”
    Should read
    Play/Pause indicator LED (GREEN) If playing, the green LED blinks.


Having only minor experience with arduino , installed some dogm lcd with buttons etc. but nothing complex as a whole shield.

I thought that it should be kind of plug and play and run the example that comes with the library but with no luck.

I cant get the music example to compile correctly getting lots of erros , maybe something i have installed wrong.

I downloaded the files available at
And installed the Music_v1_0 and NewSoftSerial in the libraries folder

But not portpins.h , do i need it ?

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


I found the documenatation , … manual.pdf

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 :slight_smile:

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?

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.