How to add sound?


@filmote … I’ll be back with you in a moment

@Hanski … PlayMusic example worked right out of the box


@filmote - clarification needed. Are you talking about the original ArduboyTones library or something that is inside Arduboy2 lib ?


Definitely the ArduboyTones library.

Just now? What might I be doing wrong then??


You mean this:

Pokitto equivalent is here:

Agreed, there is just functions listed. No further info. Even if some other functions have more info, we are clearly missing description and examples for each.

But, for a newcomer like me, it is not so straightforward to find an info about the Arduboy tones functions either. all I can find is the above and this:
Neither is talking about sequence of tones.



@filmote : 101starships has a melody, exactly in the way you need

it is using the Gamebuino system (port of GB classic game)

While I am digging up the ArduboyTones port I made (must be 2 yrs ago) you might take a look at how 101Starships does it

EDIT: my_settings.h for that project

#define PROJ_GBSOUND 1
#define PROJ_AUD_FREQ 22050

EDIT: took out the unnecessary defines


Just checking, @filmote and @jonne, are you both talking about working on HW? Not in the Emulator or Simulator?


@jonne As no one wants to write documentation, could we have a documentation contest to improve the situation?


Works in HW and Simulator, emulator - as we know - does not support sound so well

@filmote , what IDE are you using?


I am using FemtoIDE and I have tested PlayMusic on physical hardware and I get no sound. When you said …

… are you talking about the example in the repo as it exists now?

@Hanski . I am talking about the AruboyTones library that @uxe posted.


Yes. The example in the repo, compiled in embitz, no changes.

I think I need to try it in FemtoIDE also


Oh … so I can get different results because I am using FemtoIDE?


I don’t know, it needs to be checked.

The reason why you get no sound is still to be solved


That should not be the case, as it uses the same PokittoLib, but have to checked.


@filmote , @Hanski also reported no sound in FemtoIDE. Same PokittoLib. We are investigating.


Did you test with the volume set to maximum?


In FemtoIDE and on the physical hardware … no sound!


I’m going to do some more testing tonight, but I do get sound on hardware with PlayMusic when I set the volume to maximum.


I’ve been porting my stochastic music toy from java to c++ and I have experienced very similar problems with sound. The PlaySFX example worked ok and also writing directly to Pokitto’s sound buffers, but with everything else (SFXeditor, PlayMusic, SynthTest) I got very faint sound on hardware and no sound at all on emulator.

I finally found a solution after testing different defines in My_settings.h file. Adding this line made the sound work:

My_settings.h file:


#define PROJ_HIRES 1            //1 = high resolution (220x176) , 0 = low resolution fast mode (110x88)

#define PROJ_ENABLE_SOUND 1     // 0 = all sound functions disabled
#define PROJ_AUD_FREQ 22050

//#define PROJ_USE_PWM 0