Nerdspace: Amiga Mod Files auf dem Arduino abspielen

Ich habe die Kate­go­rie »Nerd­space« lei­der lan­ge arg ver­nach­läs­sigt und wer­de ver­su­chen, das mal etwas zu ver­bes­sern. Erfolg nicht garan­tiert. ;) Zur Erin­ne­rung: unter Nerd­space wer­den Din­ge ein­sor­tiert, die unter »Phan­tas­tik« nicht ganz pas­sen, aber trotz­dem inter­es­sant sind, bei­spiels­wei­se aus den Berei­chen RasPi oder Ardui­no, 3D-Druck oder »Hacks«.

Heu­te: Abspie­len von Ami­ga Mods auf einem Ardui­no. Für die Unein­ge­weih­ten: »Mods« nennt der Ami­gia­ner Musik­stü­cke für die Sound­chips von Ami­gas. Um die hat sich eine rege Retro-Sze­ne ent­wi­ckelt und man fin­det hau­fen­wei­se davon auf ein­schlä­gi­gen Web­sei­ten (ein Bei­spiel: »Sound o´da luna­tic«).

Jark­ko Lem­pia­i­nen hat einen Ardui­no so pro­gram­miert und erwei­tert, dass er die­se Ami­ga-Mods abspie­len kann (man muss die dafür aller­dings konvertieren):

This weekend pro­ject: Tur­ned my 8‑bit resis­tor DAC on Ardui­no Uno to an Ami­ga MOD play­er. Uno is based on 8‑bit AVR chip (ATMega328, 32KB flash, 2KB RAM) run­ning at 16MHz. The play­er plays 4‑channel MOD files @ 20KHz (mono).
The DAC is just 16 careful­ly sel­ec­ted resis­tors (2 resis­tors in par­al­lel for each bit/pin) with power-of-two resis­tance values (start­ing at ~81.7Ohm for MSB). I had bunch of resis­tors (~150) with dif­fe­rent resis­tances available, so I mea­su­red them all with a mul­ti­me­ter and wro­te an appli­ca­ti­on that found the best pair of resis­tors for each pin. The accu­ra­cy of the resis­tors is important par­ti­cu­lar­ly for hig­her bits for bet­ter audio qua­li­ty becau­se only ~1% error in MSB makes LSB use­l­ess and intro­du­ces noi­se to the sound. I should have pro­ba­b­ly used a bit hig­her resis­tance for the MSB for bet­ter qua­li­ty (less error in the resis­tance). Adding ~1mF capa­ci­tor to low-pass fil­ter the signal would pro­ba­b­ly also impro­ve the qua­li­ty, but I did­n’t have such a capa­ci­tor available.
I wro­te a MOD con­ver­ter soft­ware which takes a MOD file as input and con­verts and packs the music pat­tern data for the Ardui­no play­er to make it fit into the 32KB of flash memo­ry of Uno (inclu­ding the play­er code, which is curr­ent­ly ~3.5KB). The chip­tu­ne in the video is »Net Sur­fer« by JosSs, and it is ~13KB com­pres­sed. I don’t com­press the sam­ple data, so it’s just raw 8‑bit PCM data like in MOD files.

Wei­te­re Infor­ma­tio­nen fin­det man auf der Git­hub-Sei­te zu sei­nem Pro­jekt.

Views: 1

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Nach oben scrollen