Jump to content
IGNORED

Need help with my music player code


Recommended Posts

I was afraid so. But it was my fault :) I was constantly writing 0 to SKCTL, but that should be 3 (masked with two-tone toggle bit). So it was not a bug in Altirra.

 

I did find one though :)

 

POKE 731,255

 

does not work on AltirraOS 3.26. It should disable the keyclick, but it does not.

 

@phaeron Could you have a look at it?

 

 

In the mean time, here's the new pokeyexp.xex. Explore! :)

 

pokeyexp.xex

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On 9/19/2020 at 8:14 PM, Synthpopalooza said:

Cool!  :)

It should work now on Altirra and real hardware :)

 

On 9/19/2020 at 8:14 PM, Synthpopalooza said:

I would probably institute the standard 16-bit $Ax table as a reference, since it's better tuned.  Can't wait to play with it!

I'm thinking about utilizing the second pokey as a tuning reference. Most people have at least one stereo pokey machine, and when used with Altirra you have two emulated pokeys available anyway.

 

On 9/19/2020 at 8:14 PM, Synthpopalooza said:

Also, you could put in a polycounter reset for those settings that make intermittent silence like the $Cx and $2x settings.

That's writing a non-zero value to STIMER, right?

 

Link to comment
Share on other sites

11 minutes ago, Synthpopalooza said:

You can also read 764 decimal to get keypresses without relying on the K: handler.  You just have to store 255 in it to reset it.

Haha, I tested exactly such a loop :)  and it worked on atari800, but it did not fix previous mentioned bug, so I reverted to CIO calls. I might reinstate the while(CH==255) loop, now that I fixed the SKCTL bug and don't use CIO anymore. It saves a few bytes of space, even though I'm not axactly writing this optimized for code size, as you can see by all the macros and simply switching LMS in the DL to change values :)

 

Edited by ivop
Link to comment
Share on other sites

Here's the last version for tonight. v0.1 :)

 

Reworked the UI to create more space for future features, added credits, added more "explanations" in the UI about key presses, and added '[' (next to P on PC) and '-'(next to P on an Atari) to reset the polycounter.

 

Let me know what you think. Positive or negative :)

 

atari000.png.05f01fa0d4ec820533cc114b973b7c4f.png

 

screenshot with FGJK on :)

 

edit:

 

I need to document 1E 03 (in this screenshot) which is AUDCTL and SKCTL. The reserved space is for sweeps and its parameters (8/16-bit and which channel(s), start value , end value, step, silent gap time). If I need more space, I can disable the 1-3, 2-4, 1-2, and 3-4 lines (filters and joins). That's why I added 1,2,3,4 to the register decorations.

 

pokeyexp-v0.1.xex

Edited by ivop
  • Thanks 1
Link to comment
Share on other sites

$1E in AUDCTL means 16 bit on both, plus the hi pass on both ... far as I know, only one hi pass is needed, and it depends on which 16-bit channel you are playing.  In $Ax mode it should be easy to document.

 

I tested out standard 16-bit with 1.79 mhz, and added 1.79 mhz on the other channel, with 16-bit on the last two channels.  This produced a lot of swirling SID effects and that arcade game Defender hum.  It will be easy to document as it partially uses the 16-bit $Ax table already, and the lower half of the table should be easy to extrapolate. 

Link to comment
Share on other sites

2 hours ago, Synthpopalooza said:

$1E in AUDCTL means 16 bit on both, plus the hi pass on both ... far as I know, only one hi pass is needed, and it depends on which 16-bit channel you are playing.  In $Ax mode it should be easy to document.

Sure. It's not a particularly useful setting, but I just enabled all the FGJK bits to show the UI elements present. When disabled, the lines are empty, except for the inverse video keys.

 

Tomorrow I'll be working on the sweep settings. Idea is:

Resolution  Channel(s)  Start       Stop        Step
8-bit       1           __00-__ff   __00-__ff   __00-__0f
            2
            3
            4

Resolution  Channel(s)  Start       Stop        Step
16-bit      1+2         0000-ffff   0000-ffff   0000-0fff
            3+4
            1+3
            2+4

; always assure stop >= start

Reverse LSB/MSB:	off

Play time:          0.1s, 0.5s, 1s, 1.5s, 2s, 4s, 8s, 16s
Silent gap time:    0s, 0.1s, 0.2s, 0.3s, 0.4s, 0.5s, 0.6s, 0.7s

And start and stop :)

 

Edited by ivop
elaborate
Link to comment
Share on other sites

I just tried it out on Altirra ... sounds great!  This is going to be useful.  Poly reset works too ... just tried it out on $2x @1.79 reverse 16 ... there are intervals of about 31 steps where a square wave is played, though it requires a poly reset.  This setting also has variable waveforms too.

Link to comment
Share on other sites

9 hours ago, Synthpopalooza said:

there are intervals of about 31 steps where a square wave is played, though it requires a poly reset.

Thanks. So my step interval should at least reach 31.

 

9 hours ago, Synthpopalooza said:

This will drastically cut down my worktime documenting these new settings!  Thank you for this ... this is gonna be a big time waster lol.

Sorry ;)  Glad I could help. I like writing small to medium sized applications like this (and midimon). Not sure if I'll finish sweeps today. Something came up, but we'll see.

Link to comment
Share on other sites

3 hours ago, ivop said:

Thanks. So my step interval should at least reach 31.

 

Sorry ;)  Glad I could help. I like writing small to medium sized applications like this (and midimon). Not sure if I'll finish sweeps today. Something came up, but we'll see.

It may be 31.  I know it's a huge number, but I will recheck when I am home tonight.   All of the $0x thru $4x settings have these properties, as does $8x plus poly9. 

Link to comment
Share on other sites

Working on the UI. It's getting crowded :)

 

pokeyexp-0_2wip.png.4a441f8d29ab93698e9efebda1df2fcd.png

 

I think the filters/joins are still easily readable. It saved me 24 scanlines.

 

Everything below and including "Press START to sweep" is not functional yet. They are not toggle flags like before, but resolution has three options (8,16,reverse 16), channel depends on resolution, but both times four options. Play time and Gap time have eight presets. Poly reset is none, once (at the beginning), or each (for every note), etc.....

 

SO, using display list LMS switching is no longer an option. That's wasting way too much memory. So memcpy it is... also for previous options.

  • Like 1
Link to comment
Share on other sites

Tried some settings where polycounter makes a difference:

 

atari000.png.7d2f811dd21e9e667d1ac8efec5793fa.png

 

Ignore the WIP stuff. This also works on v0.1. Channel 1: 04 83 and polycounter at 9-bit.

 

Now if you press - or [ to store a non-zero value to STIMER, you reset the polycounter. If you do that several times, the timbre of the sound changes repeatedly. Keep the key pressed, and you hear what I mean.

 

So the time between writing to STIMER and where you start your AUDF in the polycounter bitstream is also relevant. Now it's semi-random. When do you press the key? Does a VBI occur? It all influences the amount of cycles spent between the write to STIMER and when shadow pokey is copied to the real pokey.

 

I hear three different timbres. I think you could time both stores to generate all three timbres reliably, but!

 

Stores to STIMER also influence all the other channels. It sounds like hiccups or clicks on the other channels.

 

This could somewhat be mitigated by writing #$00 to AUDFx and immediately write your new value to AUDFx. If properly timed, perhaps you can also reliably select one of the three timbres.

 

	lda #$00
	ldx shadow_audfx
	sta pokey_audfx

; waste 0, 2, or more cycles with nop or nop-equivalent instruction

	stx pokey_audfx

 

Link to comment
Share on other sites

1 hour ago, Synthpopalooza said:

Theres a method ... 

 

In 8 bit mode, doing the reset right before the store to AUDF will generate T1 or T3 dependent on if its mod 3 or mod 6.  If you play it on channel 3 it always generates T2.  This also works somewhat similar in 16-bit mode.

By reset, do you mean writing to STIMER? What I tried to tell was that if the other channels are just playing their tune, they get hiccuped/clicked by the counter reset. That's why the $00/frequency trick was invented (not by me BTW).

 

58 minutes ago, Synthpopalooza said:

Also on mod 5 frequencies, a 4th tone, or silence, are intermittently generated.   if it's both mod 3 and 5 (mod 15) you get silence.

Very interesting. So T4 and T5 (silence) sometimes. In the end, I think there should be several play routines with different amounts of time between $00 and the frequency store. Either 8-bit or 16-bit. And for every channel. If done in the 72 (22 for NTSC) scanlines where ANTIC doesn't steal cycles, except for /refresh, and code synced with WSYNC, it might be possible to reliably select each timbre (T1-T5). Hopefuly :)

 

 

Edited by ivop
Link to comment
Share on other sites

there was a document written by pavros that explains the whole thing.  Basically what I got from it is, the first channel after a reset lets you play t1 and t2 depending on even or odd frequency, second channel reverses this, and the third will always play t3.  It may be possible to alter this at will tho.

Link to comment
Share on other sites

The table on page 15 is something I didn't know. I thought all channels sampled the poly stream at the same time, but they do not. Fascinating ;)

 

I think I'll implement the sweep(s) first with none,once,every note poly reset with a store to STIMER. Later on, SKCTL reset could be added (made a note of the 17 cycles in between stores :)) and after that refined per channel, per interval, per previous note poly resets ;)

 

As for the last thing I mentioned, am I understanding things correctly that resetting AUDF with $00 and then new frequency, depends on the previously played frequency? I mean, if you want to keep TimbreX, and you move from Freq1 to Freq2 (both have the same and other timbres available), the amount of time between setting $00 and the new frequency determines which Timbre the new frequency is?

 

Sorry if I sound daft, but I want to understand this as good as possible as to produce the best sweeper/explorer there is :)

 

Would be nice if you can eventually sweep $Cx several times with different start/end/interval settings and multiple stable polyreset code paths.

 

Edited by ivop
added missing words ;) 2nd edit: typo
Link to comment
Share on other sites

Here's a binary of v0.2wip. I have disabled all non-functional UI elements. I hate websites that say "under contruction". Well, then don't show it! ;) This is the same.

 

The only difference you can see is the extra key for polyreset and a compacter filter/join display. I don't think the v0.1 version will ever come back, as I'm struggling with screen real estate. But I think, with the added numbers to the channel rectangles, it's still as readable as before. So, here's the binary, so you can get used to this visible representation. This will probably not change anymore. Probably ;)

 

screenshot.thumb.png.93c54bcff7fa66cbc2acb9b941ba9ba9.png

 

 

pokeyexp-v0.2wip.xex

  • Thanks 1
Link to comment
Share on other sites

2 hours ago, ivop said:

As for the last thing I mentioned, am I understanding things correctly that resetting AUDF with $00 and then new frequency, depends on the previously played frequency? I mean, if you want to keep TimbreX, and you move from Freq1 to Freq2 (both have the same and other timbres available), the amount of time between setting $00 and the new frequency determines which Timbre the new frequency is?

To answer my own question, the answer is on page 18 and 19 of aforementioned pavros document (it's in the zip-file in the first post for those who wonder what we're talking about).

 

The only reliable per channel reset to a certain timbre that is available on that channel, is a combination of the $00 frequency trick and reset by SKCTL and mute in between. On channel 1 or 3 that takes 371 cycles, which can be done in the VBI. On channel 2 or 4 it takes 7168 cycles, which can only be done once before the tune starts. But if you keep playing the same intervals, that's not a problem.

 

22 hours ago, ivop said:

; waste 0, 2, or more cycles with nop or nop-equivalent instruction

A lot more, so it seems :)

 

Edited by ivop
clarified
Link to comment
Share on other sites

Here's v0.2beta2. Went from "wip" to "beta".  Screenshot with all bits on.

 

screenshot.png.edbfd1eb7c1ec4678cca08f6c20cb5dc.png

 

Functionaly, it should work as the previous version, but "under the hood" everything is migrated to a memcpy way to show the status of the AUDCTL and SKCTL bits, instead of LMS changes in the display list. This opens up the oportunity for variables with more than two options without wasting a lot of memory. Even now the binary is smaller than before.

 

Source is here.

 

Edit: @Synthpopalooza If you want, I can turn this into a separate thread.

 

pokeyexp-v0.2beta2.xex

Edited by ivop
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...