In the old days I was rather a Commodere PC guy, but I know of colleagues of mine that were addicted to the Commodore 64 and knew it inside out. So, here is another project that makes you feel nostalgic:

Sound Interface Device (SID) is a audio format used by the Commodore 64.

To get some SID files, I can recommend The High Voltage SID Collection (HVSC) which is a freeware hobby project that organizes Commodore 64 music into an archive for both musicians and fans alike.

Unfortunately we can not feed SID files incrementally to a codec, so this does not fit with my audio codecs that are used e.g. in the AudioPlayer of the AudioTools library.

Therefore I created a separate project, that provides a dedicated SID stream and a SID player that can play SID from files or from in memory hex dumps on Arduino. The player is based on the AudioPlayer from the Arduino Audio Tools, so you can use different audio sources and audio sinks.

The SID emulation is based on cSID light by Hermit (Mihaly Horvath), (Year 2017).

Arduino Sketch

Here is a simple demo sketch that plays a SID hex file:

#include "AudioTools.h"
#include "SIDStream.h"
#include "AudioLibs/AudioKit.h"
#include "audio/commando.h" 

uint16_t sample_rate=32000;
uint8_t channels = 2; 
AudioKitStream out; 
SIDStream sid(music_Commando_sid, music_Commando_sid_len);
StreamCopy copier(out, sid); 

// Arduino Setup
void setup(void) {  
  // Open Serial 
  Serial.begin(115200);
  AudioLogger::instance().begin(Serial, AudioLogger::Info);

  // start I2S
  Serial.println("starting I2S...");
  auto config = out.defaultConfig(TX_MODE);
  config.sample_rate = sample_rate; 
  config.channels = channels;
  config.bits_per_sample = 16;
  out.begin(config);

  // Setup SID
  auto scfg = sid.defaultConfig();
  scfg.copyFrom(config);
  sid.begin(scfg);
  //sid.setSID(music_Commando_sid, music_Commando_sid_len);

}

// Arduino loop - copy sound to out 
void loop() {
  copier.copy();
}

The project and further examples can be found on Github.

The project supports cmake, so you can also build and run it on the desktop!


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *