1 (edited by Shiru 2017-02-14 07:22:18)

Topic: Phaser1 on Arduino

Continuing the least imaginative way, here is second port of a ZX beeper engine to Arduino, in C.

This time it is an interleaving type engine. Porting approach is totally naive, just a timer interrupt at the bit output frequency, similar to the Octode implementation, but doubled because of the interleaving, with two alternating code paths. It easily works on its original sample rate of 23972 Hz (47945 Hz interrupts), and actually can work even at 44100 Hz (88200 Hz interrupts!). Didn't try higher rates because it was near the timer resolution limit with selected prescaler.

The most difficult part in the porting process was the Phaser1 format itself, it is quite tricky as you know. I chose the Beepola version, so you can just compile Phaser1 songs in Beepola and export them as BIN without player. Just don't forget that if you change the compile address in Beepola, you have to change the COMPILE_ADR in the C code too. Only the 'digital drums' version is implemented.

The song in the demo build is Mister Beep's Greetings to C64.

As for code tricks, nothing special here. The only tricky moment was catching the carry for 16-bit addition. It was done by checking if the value become lesser than it was before addition (normally should become greater), like that:

add hl,bc
jr c,...

if(acc<n) ...
Post's attachments

arduino_phaser1.zip 19.72 kb, 46 downloads since 2017-02-14 

You don't have the permssions to download the attachments of this post.
website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

2 (edited by garvalf 2017-02-14 13:19:23)

Re: Phaser1 on Arduino

wow, that's very good too! Congrat and thank you for this port.

I've made a recording of the demo song by Mister Beep:
http://picosong.com/GFmm/ (it's not complete)

I've also found an old Phaser1 project I hadn't finished yet, the conversion was easy thanks to your clever script:


I have an account on the arduino forum, I'm sure your 2 engines will be praised by several people, do you want I post a link to this forum, or do you prefer to do it yourself? (And I can do this too on the Chipmusic.org forum)

Re: Phaser1 on Arduino

Sure, post about it whenever you think it is appropriate, maybe it'll inspire someone to do more 1-bit experiments. I personally don't have accounts on any Arduino-related resources.

Interesting, the carrier artifact is very prominent in these recordings. I wonder how it compares to the original ZX. There is hardware recording by Mister Beep himself, and it does not have any noticeable carrier, although he maybe EQed it a bit.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

Re: Phaser1 on Arduino

maybe it's my low pass filter which is not very adapted to this type of sound. I'll make more tests of possible.

Re: Phaser1 on Arduino

Awesome! Listening to the demo tune right now, and I can confirm there's no noticable artifact/carrier noise on my setup.

Well, would be great if this gets some exposition on the Arduino forums. If there's enough interest, we might even consider opening a special Arduino sub-board on here.

Re: Phaser1 on Arduino

I've posted (the same) message there:

http://forum.arduino.cc/index.php?topic … msg3131717
http://chipmusic.org/forums/topic/19450 … n-arduino/

Re: Phaser1 on Arduino

I cooked up a more or less quality hookup schematics for headphones and line in, and indeed, no artifact/carrier noise.

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

Re: Phaser1 on Arduino

the low pass filter was ok, I can hear it clearly from headphones, I think it's because of the crappy soundcard / setup, I wasn't using my usual external usb one.

Re: Phaser1 on Arduino

Still having some fun with this engine port on Arduino. Here is a recording from a new tune published on Battle of the Bits: http://battleofthebits.org/arena/Entry/ … ht+/27390/
You can listen to the difference with the ZX Spectrum version on this page (the first song in the list at the time of writing): http://garvalf.online.fr/index.php?page=musiques_zx.en


Re: Phaser1 on Arduino

Damn, I need to get back into this Arduino business. Or actually not, because your song is already awesome enough smile

Re: Phaser1 on Arduino

Here is a successful use of the Phaser1 on Arduino: https://soundcloud.com/erwan-lerale/gar … y-workflow