New 1bit PWM music engine for the CoCo and Dragon

Use this forum to submit new files for the download section of the archive. I will check each submission and upload it to the archive on a regular basis.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

New 1bit PWM music engine for the CoCo and Dragon

Post by zephyr »

A single bit PWM music engine from Simon Jonassen. Z80 to 6809 conversion by John Kowalski (Sock Master).
1 bit revisited......

I hooked up with the LEGENDARY SOCKMASTER to work out this 1 bit routine....

I provided him with some z80 sourcecode which he quickly converted to
6809.... we tried it and it sounded shite, so we set about some
debugging.... (over 2 days)....

now we have a decent 1 bit music player for the coco - you can use the zx
spectrum program (beepola) to make music... (choose the engine called THE
MUSIC STUDIO).......

then export the data as an.asm file ( junk the z80 code and grab the song
data)....

sound of this engine here ( any funky sounds are lag on my old laptop):

http://www.roust-it.dk/coco/coco1bit.wav

https://www.youtube.com/watch?v=WDIdBKCgSKg
https://www.youtube.com/watch?v=1_0TOZxOzn4

REMEMBER THIS IS 1 BIT PWM.......

/Simon :-)
There's absolutely no samples going on here.....

The coco is mixing the sound in realtime and outputting it to either the 1
bit output at $ff22 or the highest bit on the dac at $ff20 (in this case the
dac because i need $ff22 for other stuff)

The player is given a set of data which consists of pattern pointers and a
set of patterns....

The patterns consist of 16 rows of 2 bytes (1 for each channel) the second
also doubles as "interrupting drum" (as in no note on channel 2 just
percussion)

The data is produced by using the pc program "Beepola" and specifically
chosing "the music studio" engine.... You can tehn make a tune of your own
choice, when you have done that, beepola can save the data as normal text
(eg. .byte 100,20 etc)....

This data is then tagged onto the end of an assembly file which contains the
player...

Now fire up your favourite assembler and assemble it.... Bobs your uncle....

/Simon :-)
i'm pretty sure that the routine would play without any problem on the Dragon.....


(the 1bitv4 plays at 2xpoke)

the others play at normal speed.....

here you have 3 assembly listings with full 1 bit player and tunes included....

have fun...

/Simon :-)
Attachments
source_code.zip
(8.18 KiB) Downloaded 235 times
single-bit-demo.zip
(9.61 KiB) Downloaded 231 times
Beepola_v1.07.03.zip
(1.67 MiB) Downloaded 249 times
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: New 1bit PWM music engine for the CoCo and Dragon

Post by zephyr »

I made some quick changes to the formx code. The program now disables audio, and returns safely to basic when the music patterns end. Both source and compiled demo are attached.

I was quite surprised when I checked the source code. :)

EDIT: Attachment (formx2.zip) removed.
Last edited by zephyr on Sun Dec 01, 2013 3:44 am, edited 2 times in total.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: New 1bit PWM music engine for the CoCo and Dragon

Post by zephyr »

I made a few more quick changes to the formx code. DAC is now always selected as the sound source.

EDIT: Attachment (formx3.zip)removed.
Last edited by zephyr on Sun Dec 01, 2013 3:45 am, edited 2 times in total.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: New 1bit PWM music engine for the CoCo and Dragon

Post by zephyr »

I made the same changes to 1bitv4.asm and astroforce.asm. All three of the originals had the same problem of continuing after the end of the music. This resulted in random sounds, and not returning to basic when the music finished.

EDIT: Attachment (Zephyr-modified_v3.zip) removed.
Last edited by zephyr on Sun Dec 01, 2013 3:43 am, edited 1 time in total.
Rink
Posts: 236
Joined: Mon Sep 05, 2011 7:01 pm

Re: New 1bit PWM music engine for the CoCo and Dragon

Post by Rink »

Sweet. Thanks for uploading this mate. I'm looking forward to having a play with it.
simon
Posts: 163
Joined: Wed Nov 27, 2013 8:56 pm

Re: New 1bit PWM music engine for the CoCo and Dragon

Post by simon »

Hey Guys !

If you choose to make a song with Beepola, it will sound wrong unless you play it with the 2x poke !

if you want to play it at normal speed, then halve the pattern tempos on the data in the assembly file eg. (16 down to 8).....

I just choose export to .asm listing in beepola.... grab the whole data section and paste it into the 1bit engine.....
i then do a replace on defb to .byte and defw to .word

I then twiddle the pattern tempos for normal operation or leave them for highspeed poke.....

:mrgreen:

you might be wondering why the DAC is the soundsource ?

answer: because i'm bashing too heavily on $ff22 for other funky hardware effects.... (only 1 bit of the DAC gets twiddled)

Have fun and if you have any questions don't hesitate to ask......

/Simon :-)
simon
Posts: 163
Joined: Wed Nov 27, 2013 8:56 pm

Re: New 1bit PWM music engine for the CoCo and Dragon

Post by simon »

the music was never meant to return to basic in my case.....

i'm making an assembly demo.... hehe :mrgreen:

but i'm glad to see you're playing with the routine....

/Simon :-)
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: New 1bit PWM music engine for the CoCo and Dragon

Post by zephyr »

I made a few more quick changes. Added fake pattern data to indicate end of music. Moved sound enable/disable routines above main code to keep $3F Direct Page addresses within range.

EDIT: Attachment (Zephyr-modified_v4.zip) removed.
Last edited by zephyr on Sun Dec 08, 2013 8:01 pm, edited 2 times in total.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: New 1bit PWM music engine for the CoCo and Dragon

Post by zephyr »

I made a few more changes. Replaced the fake data idea with a proper music length counter. Rearranged the code a bit. Cleaned-up the source code to make it easier to read.

Thanks to Simon, there is a new file (jarre5) added to the .zip archive. :)

EDIT: Attachment (Zephyr-modified_v5.zip) removed.
Last edited by zephyr on Sun Dec 01, 2013 5:39 pm, edited 1 time in total.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: New 1bit PWM music engine for the CoCo and Dragon

Post by zephyr »

I did some quick code size/speed optimization. Sound is a little bit cleaner now.

EDIT: Attachment (Zephyr-modified_v6.zip) removed.
Last edited by zephyr on Mon Dec 02, 2013 11:02 pm, edited 1 time in total.
Post Reply