Digital AY synth

Show us what you're working on, (preferably with screenshots).
User avatar
Stefan
Manic Miner
Posts: 809
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Digital AY synth

Post by Stefan »

Very nice! With the SAM MOD player, where t-states are hard to find, I display the lines being played in a wrap around box.
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Digital AY synth

Post by djnzx48 »

Good idea, I might try that. The reason I went for paging is because I thought a long delay incurred once in a while would be better than shorter delays every row, but redrawing the display took longer than I expected.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: Digital AY synth

Post by Ast A. Moore »

djnzx48 wrote: Sun Mar 29, 2020 3:21 am I've now added a scrolling (well, paging) tracker display synchronised with the music. You can try it here: synth-v0.1.0-0-g2bd8639_128.tap

The problem is, the rendering speed is not great (even when the code is placed in uncontended memory) and this causes noticeable gaps in the song playback. Is this acceptable in its current state? Would it be better to have the user stare at a static screen while the song is playing?
I think you can easily lose the waveform display. As for the tracker, yeah, it’s a bit of a problem. You could do something like display a keyboard and use the attributes to highlight the notes being played (something along the lines of what Instrument did). It’s better than nothing, for playback at least.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Digital AY synth

Post by djnzx48 »

That could also be a good alternative. I think I'll finish the editing part before deciding what kind of visuals to use for playback.

The waveform display doesn't really require any additional CPU. I can easily add an option to disable it if it does turn out to be an issue.
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Digital AY synth

Post by djnzx48 »

So the program is basically complete (at least for now). It currently has:
  • PM synthesis across three tone channels
  • A chorus/octave effect
  • Oscillator sync
  • User-defined instruments
  • Sample playback
  • Ornaments and pitch bends
  • Bank switching
  • Runtime configurable output device (AY, SpecDrum, etc.)
  • A cool name
Furthermore, the timing has been improved. Aside from when loading patterns, the sample rate should not deviate from the nominal 10.7kHz (on a 128) by even a single T-state.

The full source code is available here.

I don't know if anyone will want to use this routine in games, for menu music or something, but if you do then let me know.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: Digital AY synth

Post by Ast A. Moore »

I’ve been digging the demo tune you made since your first post in this thread. I hope you don’t mind, but I added a guitar track to it. Also, I thought 10.7 kHz just didn’t do it justice, though, so I upsampled it to 44.1 kHz (in a manner of speaking). I think the whole thing sounds a tiny bit fuller now. ;)
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Digital AY synth

Post by djnzx48 »

Oh, nice! I like it! Great-sounding solo, and I like the sound of the kit as well. (Were you using a virtual kit, or live drums?) Just in case you weren't aware, this is the original song that I based the tune on. I also used it to obtain some samples for the demo.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2641
Joined: Mon Nov 13, 2017 3:16 pm

Re: Digital AY synth

Post by Ast A. Moore »

djnzx48 wrote: Thu Apr 09, 2020 2:26 pm Oh, nice! I like it! Great-sounding solo, and I like the sound of the kit as well. (Were you using a virtual kit, or live drums?) Just in case you weren't aware, this is the original song that I based the tune on. I also used it to obtain some samples for the demo.
Holy moly! I’d no I idea I was covering Steely Dan. Thought it was your song. :D Damn well transcribed, sir. Very authentic.

I recorded the Speccy’s output and then transcribed the Rhodes and the bass parts by ear. I then learned and played the bass part on my fretted six-string, and sat behind the drum kit to lay down the drums (it’s an e-drum kit—a mishmash of Roland, Alesis, and custom-made pads—triggering Superior Drummer). I looped the bass and the electric piano once, but played the drums straight through to add variety (I’m a lousy drummer, but banging on the drums is a lot of fun). It all sounded a little bare, so decided to add the guitar just to spice things up a bit.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Re: Digital AY synth

Post by XoRRoX »

Very nice project :)
I'm keen on trying it out on my real Spectrum. The scripts seem to be for Unix. Any idea of how I can build it on Windows?
Or an already compiled version?
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

Re: Digital AY synth

Post by utz »

It just occured to me that I didn't voice my excitement about this yet! So: This is a fantastic project, I love it!

I would actually want to support the driver in my upcoming new tracker/chiptune audio workstation. However, I have some concerns regarding the license. Generally speaking, chip music and GPL don't mix well. The problem is that most chip music nowadays is published under Creative Commons licenses, and the most common ones (CC-BY-SA and CC-BY-ND) are incompatible with GPL. That wouldn't be such a big deal when releasing recordings of a song made with this, but chip music is commonly released in executable form, which of course does include the player code. Would it be an option to relicense the player under LGPL or a permissive license?
User avatar
DouglasReynholm
Manic Miner
Posts: 349
Joined: Wed Feb 20, 2019 8:38 pm

Re: Digital AY synth

Post by DouglasReynholm »

[mention]djnzx48[/mention]
wAYve might be a good prefix at least

wAYveRider? Or similar.. wAYveSource, etc..

Again, this is very impressive stuff!
User avatar
MonkZy
Manic Miner
Posts: 279
Joined: Thu Feb 08, 2018 1:01 pm

Re: Digital AY synth

Post by MonkZy »

[mention]djnzx48[/mention] I still load up this tune every now and then. Really good sound, certainly one of the best Spectrum tunes ever.
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Digital AY synth

Post by djnzx48 »

XoRRoX wrote: Tue May 12, 2020 1:14 pm Very nice project :)
I'm keen on trying it out on my real Spectrum. The scripts seem to be for Unix. Any idea of how I can build it on Windows?
Or an already compiled version?
The build scripts are designed to work on Windows as well. I should probably add some kind of README with build instructions, but for now:

On Windows, you need to install Git Bash (or possibly some other shell replacement) and have it in your PATH. Then you can run setup.bat to download all the necessary tools, and build.bat to build everything.

On Linux, the process works similarly, but you need to have Wine installed, and use the .sh scripts instead of the batch files.

Otherwise, you can find automated builds here (click the links on the right to download build artifacts).
utz wrote: Tue May 12, 2020 4:33 pm It just occured to me that I didn't voice my excitement about this yet! So: This is a fantastic project, I love it!

I would actually want to support the driver in my upcoming new tracker/chiptune audio workstation. However, I have some concerns regarding the license. Generally speaking, chip music and GPL don't mix well. The problem is that most chip music nowadays is published under Creative Commons licenses, and the most common ones (CC-BY-SA and CC-BY-ND) are incompatible with GPL. That wouldn't be such a big deal when releasing recordings of a song made with this, but chip music is commonly released in executable form, which of course does include the player code. Would it be an option to relicense the player under LGPL or a permissive license?
OK, that shouldn't be a problem. I think using LGPL may complicate things given that the Spectrum that doesn't any formal kind of dynamic linking, unless you count something like including the player as a separate block on the tape. I have changed the license to 2-clause BSD, is this acceptable?

With regard to Bintracker, it's nice to see the development progress! I did attempt to get the player working with the initial release of the tracker, but decided to wait for the updated version to be released (among other things, I was finding the MDAL configuration a little confusing). The music format should be fairly straightforward, but feel free to ask if you have any questions.
DouglasReynholm wrote: Tue May 12, 2020 5:11 pm [mention]djnzx48[/mention]
wAYve might be a good prefix at least

wAYveRider? Or similar.. wAYveSource, etc..

Again, this is very impressive stuff!
Good ideas! I'll consider using them.

Although the player is basically complete, there's one thing I'm not entirely satisfied with, and that is the amount of distortion that occurs in the mono AY version. Most of this distortion is caused by the need to update three volume registers, which introduces erroneous intermediate volume values in the output. The 768-byte volume level lookup table I'm currently using can definitely be improved, but I'm not quite sure of the best method to deal with this yet.
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: Digital AY synth

Post by RMartins »

djnzx48 wrote: Sun Mar 29, 2020 3:21 am I've now added a scrolling (well, paging) tracker display synchronised with the music. You can try it here: synth-v0.1.0-0-g2bd8639_128.tap

The problem is, the rendering speed is not great (even when the code is placed in uncontended memory) and this causes noticeable gaps in the song playback. Is this acceptable in its current state? Would it be better to have the user stare at a static screen while the song is playing?
You can shorten the height of the rolling/scrolling display, to save CPU.
You can also use a 6 pixel height font, to minimize its height further hence CPU, or just use a font that does not use the top and bottom pixels, and just render the other 6 pixels, this allows to keep the line height, while reducing CPU load.

By the way, the music player sounds incredible.
Last edited by RMartins on Wed May 13, 2020 12:15 pm, edited 2 times in total.
User avatar
utz
Microbot
Posts: 116
Joined: Wed Nov 15, 2017 9:04 am
Contact:

Re: Digital AY synth

Post by utz »

djnzx48 wrote: Wed May 13, 2020 5:59 am OK, that shouldn't be a problem. I think using LGPL may complicate things given that the Spectrum that doesn't any formal kind of dynamic linking, unless you count something like including the player as a separate block on the tape. I have changed the license to 2-clause BSD, is this acceptable?
Great! 2-clause BSD will do just fine. In fact I prefer it over LGPL, just didn't dare to ask. You know, license discussions tend to get heated rather quickly. Anyway, thanks a lot!
djnzx48 wrote: Wed May 13, 2020 5:59 am With regard to Bintracker, it's nice to see the development progress! I did attempt to get the player working with the initial release of the tracker, but decided to wait for the updated version to be released (among other things, I was finding the MDAL configuration a little confusing). The music format should be fairly straightforward, but feel free to ask if you have any questions.
Yep, old "protoype" Bintracker is mostly just a proof-of-concept at this point, and mistakes were made ;) I'll get in touch when I start to add more engines. Think it'll still take a few months before that happens, though.
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Re: Digital AY synth

Post by XoRRoX »

[mention]djnzx48[/mention] Thanks for the directions. I'm not sure about bashing a git... but just downloaded from build artefacts. I already ran both versions in an emulator and they sound great. Really nice work.

Curious about the possible improvements for the AY version you mentioned for a future version.
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Digital AY synth

Post by djnzx48 »

RMartins wrote: Wed May 13, 2020 11:46 am
djnzx48 wrote: Sun Mar 29, 2020 3:21 am I've now added a scrolling (well, paging) tracker display synchronised with the music. You can try it here: synth-v0.1.0-0-g2bd8639_128.tap

The problem is, the rendering speed is not great (even when the code is placed in uncontended memory) and this causes noticeable gaps in the song playback. Is this acceptable in its current state? Would it be better to have the user stare at a static screen while the song is playing?
You can shorten the height of the rolling/scrolling display, to save CPU.
You can also use a 6 pixel height font, to minimize its height further hence CPU, or just use a font that does not use the top and bottom pixels, and just render the other 6 pixels, this allows to keep the line height, while reducing CPU load.
You know, I thought that I was only drawing 6 pixel rows of each character already, but it seems I was not. Thanks for the tip! If I end up rewriting the display code, the graphics are going to have to be more minimalistic to allow for faster drawing.
XoRRoX wrote: Wed May 13, 2020 4:20 pm Curious about the possible improvements for the AY version you mentioned for a future version.
I don't yet know exactly how much of an improvement can be gained, if any. I'll try to do some further testing and post the results here.
User avatar
zxbruno
Manic Miner
Posts: 214
Joined: Sun Mar 04, 2018 6:13 am

Re: Digital AY synth

Post by zxbruno »

As someone who likes to play music but doesn't code, I still have trouble understanding what's happening. :/ I understand the concepts of Sample Tracker, wav2ay by Gasman, AY playing digitised samples in Robocop and Chase 128K, but I'm still confused re. what the Digital AY synth does. I do understand it's something new and I heard the examples. Any plans to upload something to YouTube visually showing what it is, how to use it, etc?
User avatar
djnzx48
Manic Miner
Posts: 730
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Digital AY synth

Post by djnzx48 »

Hmm. I'm a little busy right now, but let me see if I can come up with some better explanations later. Although I'm not completely familiar with all those tools you listed, I think the difference is that the sample-based trackers operate on samples (as the name would suggest), while this program operates on single-cycle waveforms (although it does have a dedicated channel for samples). It also allows you to define instruments using those waveforms, which means you can have things like different attack or decay times for different instruments. Along with this, most of the existing sample players for the AY chip are limited to 4-bit samples, while this program can utilise 8-bit samples. As there is currently no editor, using it requires that the music data be specified in assembly language.
Post Reply