sound.playTone()

playTone(uint8_t os, uint16_t frq, uint8_t volume, uint32_t duration) isn’t working for me. I have:

#define PROJ_ENABLE_SOUND 1

in My_settings.h, and I can hear the background hiss change when sound should be playing… are there other things I need to be initialising somewhere that aren’t covered by begin()?

playTone is POKITTO_LIBS/Synth function, which is a more advanced sound generator thatn the Gamebuino legacy generator. See functions below.

Add this to your My_settings.h and it (finger crossed) should work. I haven’t had time to test it for a while

#define PROJ_ENABLE_SYNTH 1

And these are the functions:

void Sound::playTone(uint8_t os, int frq, uint8_t amp, uint8_t wav,uint8_t arpmode)
{
    if (wav>5) wav=0;
    if (arpmode>MAX_ARPMODE) arpmode=MAX_ARPMODE;
    if (os==1) setOSC(&osc1,1,wav,1,0,0,frq,amp,0,0,0,0,0,0,arpmode,0,0);
    else if (os==2) setOSC(&osc2,1,wav,1,0,0,frq,amp,0,0,0,0,0,0,arpmode,0,0);
    else if (os==3) setOSC(&osc3,1,wav,1,0,0,frq,amp,0,0,0,0,0,0,arpmode,0,0);
}

void Sound::playTone(uint8_t os, uint16_t frq, uint8_t volume, uint32_t duration)
{
    if (os==1) setOSC(&osc1,1,WSAW,frq,volume,duration);
    else if (os==2) setOSC(&osc2,1,WTRI,frq,volume,duration);
    else if (os==3) setOSC(&osc3,1,WTRI,frq,volume,duration);
}
1 Like

#define PROJ_ENABLE_SYNTH 1” got it working, thanks!

I ended up just using setOSC directly though, because the playTone function has a lot of oscillator parameters pre-defined, including echo… echo… echo… (!)