Microsoft Wav player, with binary [now source in github!]


Microsoft 16-bit PCM Wav player on Pokitto!

Here’s the binary

wavplay.bin (60.8 KB)

Here’s a Wav file to put on SD card (22Khz 16-bit signed PCM Wav file)

The file needs to be called “cyber22.wav” and put in the root of the SD card.

(The music file is 15mb in size and is “Cybernetic Love” by Casco 1983)

Still a proof of concept but we’re getting there

This is a combination of:

  • sound improvements
  • new SDFileSystem disk read/write routines

Sources and releases coming soon.

The demo code of this program looks as follows:

#include "Pokitto.h"
#include "SDFileSystem.h"
#include "wave_player.h"

SDFileSystem sd(/*MOSI*/P0_9, /*MISO*/P0_8, /*SCK*/P0_6, /*CS*/P0_7, /*Mountpoint*/"sd",NC,0,25000000);

Pokitto::Core game;

wave_player waver;
static FILE *fp = NULL;

int main() {

    fp = fopen("/sd/cyber22.wav", "rb");

    if(fp == NULL){
        game.display.println("Couldn't open file");
    while (game.isRunning())

    fseek(fp, 0, SEEK_SET);  // set file poiter to beginning

return 0;


Still some minor issues, I think I am missing something about the PCM coding (mayber theres cutoff or something) and I still have not got the I2C digital potentiometer (volume control) fully figured out (as evidence when I turn it to silent and theres a crackle)


Ok everyone, release of new sound routines and SD card lib is very close.

Small improvements to code have yielded quite substantial improvements in SD card sound output, both on internal speaker and headphone connection. I was able to get 44.1kHz (CD quality) but visualizer slowed down too much.

I think this is a pretty convincing proof-of-concept, considering its a 16-bit wav processed real time.


Does that mean we could now use the Pokkito as a portable music player? hehe

I wonder how long the battery would go with the screen off and playing music to headset. Also ask if MP3 could be supported too, but that might be too CPU intensive I guess?

1 Like

Yes. Only thing missing is the file selector. With earphones it will play for hours and hours.

Even with screen on, I have had Pokitto on for 8 hours from full charge.

AFAIK decoding MP3 requires special hardware.

1 Like

Hm I think you might emulate it with pure software, but yeah, that might be a lot on this chip haha

(Also I found this topic that might be related: )

The pokitto would make such a stylish music player for sure :blush:

Ofcourse I could do it (mp3 player) but I need to get this library revision out and focus on other things.

We have one big advantage in the Pokitto hardware: the sd card. I was thinking of doing a real FFT (fourier transformation) visualizer by preprocessing the sound file to the SD card before playback. The same strategy could be used to decode the mp3.

I hope someone takes up the challenge to make an user interface to the wav player once I push this code to the github repo.

1 Like

Binary here:

wavplay.bin (64.8 KB)

Sample wave file (16-bit signed PCM .wav file, 11025KHz):


That’s good to know. It might well outdo my actual mp3 player.

(By some miracle some of us still have mp3 players.)

It shouldn’t do.
It might not be possible to do it ‘on the fly’ (it might have to be converted to a .wav beforehand, even if the result is kept in RAM), but it should be possible to do in software.

Unfortunately it’s a complicated format:

So it’ll probably need a library.
If there isn’t an mbed one for it, it should be possible to port a general C++ library to do it.

Unfortunately this is one thing I can’t volunteer to contribute to - sound programming is one thing I’m still terrible at. I don’t even understand fourier transforms (yet).
(Plus I’m still working on other projects.)

Yeah, sound coding is pretty well outside my wheelhouse as well.

@jonne, how is the performance with the sound? I noticed that the previous sound library version slowed performance down pretty substantially (approximately 20-40%) just by being turned on without anything playing.

Adding sound will always take a performance hit. There is no dedicated sound chip, it is the same cpu taking care of things.

Performance is now 2x better than before.


Perhaps when it comes to the ‘hatting’ stage there ought to be an APU (Audio Processing Unit) hat for games that want a sound boost?
(e.g. A small board with a cheap chip and some software for number crunching audio signals.)