Jump to content
IGNORED

Trying to make some PoKEY music!


VinsCool

Recommended Posts

On 8/6/2021 at 3:43 AM, EnderDude said:

Indeed. So, I've also been trying to see if distortions other than pure square would work, and they do, but so far I only get what sounds like noise. I will experiment further with that though. For now, I've made another update to the Sanxion cover where the pwm is stable:

 

Sanxion2t.xex 5.56 kB · 6 downloads

I cannot believe what I am hearing here.

 

In three words: I am shocked.

 

In one word: Totally.

  • Like 2
Link to comment
Share on other sites

22 hours ago, tatqoo said:

I cannot believe what I am hearing here.

 

In three words: I am shocked.

 

In one word: Totally.

Sorry for hijacking the thread here, but I don't really understand your statement. 

I tell since decades that POKEY is the most powerful chip in the Atari, yet totally underused. 

 

I'm not using the 2 tone, because the control in software is all but funny. 

Also. The filter allows a much higher control of different sounds. 

 

So this one sounds like 2 pokey were playing, as there is the filter, and reverb modulation.

 

 

 

 

This one is also far more showing in flexibility and flow in the tuning. 

 

 

 

Not to tell that YT is claiming ths one "Original"...

 

 

Well, there exists the similar ingame tune of Bomb Jack, but without any copyright recognition. 

 

 

 

So why you are shocked with an unfinished tune?

Link to comment
Share on other sites

Took me a little bit of work tonight but I finally managed to implement a proper song timer :) 

Turns out this had nearly no impact on everything else because I managed to still use the 'printhex' subroutine to display the characters, the only thing that took some cycles was the timer itself.
It's currently pretty loose, I simply make it run once per vblank, and it's also set to reset when both the pattern and row values are 00, otherwise tunes that loop elsewhere will make the timer continue until 100 minutes are reached and overflow to 0 :D 

  • Like 3
Link to comment
Share on other sites

I forgot to listen to these yesterday.

21 hours ago, emkay said:

So this one sounds like 2 pokey were playing, as there is the filter, and reverb modulation.

Not bad, that reverberated part sounds pretty nice.

21 hours ago, emkay said:

This one is also far more showing in flexibility and flow in the tuning. 

Nice, the modulation works well, the second part has some cool Distortion C modulation from it.
I wonder who's tuning is that? ? 

21 hours ago, emkay said:

Not to tell that YT is claiming ths one "Original"...

Sounds nice, but several parts seem to be on the wrong key, other than that that's most of what is expected from using a filtered lead, it sounds good on its own.

21 hours ago, emkay said:

Well, there exists the similar ingame tune of Bomb Jack, but without any copyright recognition. 

Oh shit, it's the earworm again.
I'll maintain first one in this video sounds really good, the alternative tuning really shows how much things can flow very well, especially for the bass.

The one after I am not sure. It sounds nice, but something feels a little odd to me.

So what can I say? These tunes are nice for sure, but there isn't so much impossible sounds in my opinion.
Other than the things that could be done very easily with just the filter, there's definitely more possible :D 

Note that I am not saying the filter isn't great! That thing has a lot under utilised potential for creating new tonalities, and I know I also barely explored this feature myself still.

  • Like 2
Link to comment
Share on other sites

Dual Mono, NTSC in PAL, Timer mostly correct, and a Deku Palace cover I did a while ago.


Pretty much fixed the timing between regions, thanks to my timer code, I was able to get the region handling a little more precise as a well.
That also helped reduce the flickering between regions, so that's a double win for me.

Will also play correctly in NTSC, since this was the original region I made it after all.
Single POKEY playback also works fine, but visually it's a little misleading. I'll find a way to properly detect setups eventually...

Deku Palace.obx

  • Like 5
Link to comment
Share on other sites

2 hours ago, VinsCool said:

Dual Mono, NTSC in PAL, Timer mostly correct, and a Deku Palace cover I did a while ago.


Pretty much fixed the timing between regions, thanks to my timer code, I was able to get the region handling a little more precise as a well.
That also helped reduce the flickering between regions, so that's a double win for me.

Will also play correctly in NTSC, since this was the original region I made it after all.
Single POKEY playback also works fine, but visually it's a little misleading. I'll find a way to properly detect setups eventually...

Deku Palace.obx 8.58 kB · 4 downloads

See - unique sounding instruments can be in tune and not sound like nails down a chalkboard.

  • Thanks 2
Link to comment
Share on other sites

13 hours ago, VinsCool said:



So what can I say? These tunes are nice for sure, but there isn't so much impossible sounds in my opinion.
Other than the things that could be done very easily with just the filter, there's definitely more possible :D 

Note that I am not saying the filter isn't great! That thing has a lot under utilised potential for creating new tonalities, and I know I also barely explored this feature myself still.

 

The point is that the 2 tone could be used in tunes for straight sounding plus the tuning to some finer frequency FX. 

The fun might be in "solos" in a tune, so the 16 bit bass could add here as well.  

The filter PWM gixes the FX for everything, making a tune more floating .

A simple filter speep is build on "thousands" of different waveforms . 

Not to forget that 2 tone is intentional, while the PWM is a resulting feature, even the creator might not have been thinking of this. 

 

  • Like 1
Link to comment
Share on other sites

Even better, the high pass filter and the two-tone filter can be combined too!

 

I have barely explored this possibility, but the combination does work, and produces incredibly rich and unique timbres.

 

Having one is cool, having the other is also cool, but having both at the same time is fantastic :D

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

3 hours ago, VinsCool said:

Even better, the high pass filter and the two-tone filter can be combined too!

 

I have barely explored this possibility, but the combination does work, and produces incredibly rich and unique timbres.

 

Having one is cool, having the other is also cool, but having both at the same time is fantastic :D

Ofcourse, but it's very limited in the usage. 

Link to comment
Share on other sites

2 hours ago, emkay said:

Ofcourse, but it's very limited in the usage. 

I'd argue for the contrary.

Currently available tools are indeed limited for the purpose, but in theory this can be really powerful.

There are a bunch of tables floating around, mainly from synthpopalooza, and still a TON of things remains unexplored, waiting to be figured out to then be used.

 

Simply with a prebuild rmt module, this can work really well at conversion time either with RMT2LZSS (by setting SKCTL bits and using appropriate tables), or my custom rmtplayr (on the fly toggle code for Two-Tone fully operational, but does not work in the tracker itself due to being unemulated with current POKEY sound plugins).

 

And again, filter, or literally anything else, could still be used on top of each others, so that takes only a few seconds to realise how much possibilities still remain, untested, awaiting for someone to figure it out most likely by accident :D

 

The most challenging part is the tuning itself, a bunch of amazing timbres don't go very far if they are not harmonised or at least in-tune to everything else, but thankfully, the collective efforts are paying off, so it's only a question of time and (in)sanity before we reach another breakthrough.

  • Like 2
Link to comment
Share on other sites

2 hours ago, VinsCool said:

current POKEY sound plugins

What's the API/ABI of this Pokey DLL/plugin? Is that known or easily determined by examining the DLL? I'm not a windows guy, but I know how to cross-compile, so who knows what could happen ;)

  • Like 1
Link to comment
Share on other sites

18 minutes ago, ivop said:

What's the API/ABI of this Pokey DLL/plugin? Is that known or easily determined by examining the DLL? I'm not a windows guy, but I know how to cross-compile, so who knows what could happen ;)

I have honestly no idea, sorry ?
I'm more of a linux person, but a beginner programmer, so there is a lot that is beyond my ability for now.

Like right now I'm trying to load a font into that visual player but for some reason I'm doing it wrong and I feel stupid to not be able to follow the instructions lol

Link to comment
Share on other sites

19 minutes ago, VinsCool said:

I have honestly no idea, sorry ?
I'm more of a linux person, but a beginner programmer, so there is a lot that is beyond my ability for now.

Like right now I'm trying to load a font into that visual player but for some reason I'm doing it wrong and I feel stupid to not be able to follow the instructions lol

and yet look at the progress with pokey you've made... ;)

  • Thanks 1
Link to comment
Share on other sites

46 minutes ago, _The Doctor__ said:

and yet look at the progress with pokey you've made... ;)

I guess this shows I'm definitely more of a sound programmer than a graphic programmer, lol
There is a lot of progress left to do with the POKEY, still, but I know how stubborn I am, I'll eventually find a way for everything I want to do lol

 

oh hey, finally a result LOL
image.thumb.png.b8a3f32396276dd4b7b959bcdbabecc5.png
 

Edited by VinsCool
I am totally a very good programmer XD
  • Like 2
Link to comment
Share on other sites

2 hours ago, VinsCool said:

I guess this shows I'm definitely more of a sound programmer than a graphic programmer, lol
There is a lot of progress left to do with the POKEY, still, but I know how stubborn I am, I'll eventually find a way for everything I want to do lol

 

oh hey, finally a result LOL
image.thumb.png.b8a3f32396276dd4b7b959bcdbabecc5.png
 

Okay, I figured it out now :D 
image.thumb.png.2aed1150607231dae6c9420dd6acd5ef.png
 

  • Like 2
  • Haha 1
Link to comment
Share on other sites

The API I found there:

 

https://sourceforge.net/p/asap/code/ci/master/tree/win32/rmt/apokeysnd_dll.c

 

does not match what I eventually found here:

 

http://raster.infos.cz/atari/sa_libraries/sa_libraries.htm

 

Obviously Raster's site :)  The sa_pokey.zip file contains the DLL, and the source, and describes the API in the readme file:

========================================================================
DYNAMIC LINK LIBRARY: sa_pokey.dll                          license: GPL
Standalone Pokey emulation library, by C.P.U. 2003
========================================================================

This is the library created from the original Ron Fries POKEY (Atari
custom chip) emulator. Code was taken from Atari800 emulator 1.2.4
(http://atari800.sourceforge.net) and was stripped down for sound
generation only and lacks a lot of the original functionality (IRQ,
timers, keyboard, random number, potentiometers, etc.)

It provides this functions:

void Pokey_Initialise(int *argc, char *argv[]);
void Pokey_SoundInit(uint32 freq17, uint16 playback_freq, uint8 num_pokeys);
void Pokey_Process(uint8 * sndbuffer, const uint16 sndn);
UBYTE Pokey_GetByte(UWORD addr);
void Pokey_PutByte(UWORD addr, UBYTE byte);
void Pokey_About(char** name, char** author, char** description );

It's what I use with RMT 1.28, and patches.

 

Selected output of objdump:

sa_pokey.dll:     file format pei-i386
Name 				0000ff4e SA_POKEY.dll
	[   6] C6502_Initialise
	[   5] Pokey_About
	[   3] Pokey_GetByte
	[   0] Pokey_Initialise
	[   2] Pokey_Process
	[   4] Pokey_PutByte
	[   1] Pokey_SoundInit

There seems to be a 7th function, C6502_Intialise(). Probably that's related to the sa_c6502.dll.

 

sa = stand-alone :)

 

Edit: I can't promise an Altirra Pokey DLL, its code is too intertwined with Altirra itself, but a sound-only reimplementation in C based on Phaeron's documentation and code might be possible. First create a skeleton that outputs a sine wave, and prints debug data to stderr for each function.

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

On 8/8/2021 at 8:50 PM, emkay said:

Sorry for hijacking the thread here, but I don't really understand your statement. 

I tell since decades that POKEY is the most powerful chip in the Atari, yet totally underused. 

 

...

 

So why you are shocked with an unfinished tune?

Hi @emkay

 

I know what you have been telling everybody because I have been believing it and virtually supporting you here in Poland since the beginning.

 

What I said it basically means - I like it a lot!

 

Also this is in my opinion a bit more than just a technical proof of concept, because it sounds very, very nice. You obviously know how some of people react to your example tunes as do not understand the reason of them.

 

Long story short - a comment to you, but also to other people like @VinsCool - please keep showing us what is possible, because there are people who care. Even if we do not comment or "press-the-like-button" every single time. We are here and we need you continuing what you are doing.

 

That basically made me come back to the Atari scene 2-3 months ago and thank you for that. Grazie mille Guys !!! ;) 

Edited by tatqoo
  • Like 7
Link to comment
Share on other sites

6 hours ago, tatqoo said:

Hi @emkay

 

I know what you have been telling everybody because I have been believing it and virtually supporting you here in Poland since the beginning.

 

What I said it basically means - I like it a lot!

 

Also this is in my opinion a bit more than just a technical proof of concept, because it sounds very, very nice. You obviously know how some of people react to your example tunes as do not understand the reason of them.

 

Many tunes have been done just to show how complex results can be . Sorting the features of POKEY makes unbelievable things happen.

But there are also a lot tunes that were really good, but people  assume them to be "out of tune" just by their personal taste.

Well, this is really contra-useful, as particular for me, the resulting work leaves too much questions. 

 

Quote

 

Long story short - a comment to you, but also to other people like @VinsCool - please keep showing us what is possible, because there are people who care. Even if we do not comment or "press-the-like-button" every single time. We are here and we need you continuing what you are doing.

 

That basically made me come back to the Atari scene 2-3 months ago and thank you for that. Grazie mille Guys !!! ;) 

I'm still on it.

But the current software is a heap of weirdness. 

VinsCool did some right stuff, correcting the notation table for PAL tunes in RMT, but there seems no solution to put the results to the real thing.  

The 440Hz solution for PAL solves ALL tunes. But there still is the problem to have an editor that sounds different to the real thing. The depencency of the note range is done, but it is not possible to put POKEY to the right sound just by listening to the changes one does. 

I guess, you as a musician know how momentous it is , if you do a sound with your instrument, and to hear the change immediately.  

Edited by emkay
Link to comment
Share on other sites

That was the stuff that motivated me to do the rmt patch in the first place.

Just having added a toggle kinda subroutine in the rmtplayr to point to a different table in 15khz mode, for example, or for 16-bit sounds, made a lot of things a lot easier to do.

 

There is still a lot of the tuning notation missing however, because there was literally no space left for it.

 

The visual player I have been playing with for some time now may get all that stuff at some point, but it being entirely 6502 based makes things a lot harder, because too much cpu cycles will ultimately get wasted, and memory is definitely not infinite either.

 

But surely, it does run on the real thing, so that works for now, lol

Being able to turn it into an editor that runs on the machine would be awesome, but I don't think I could be able to do that sort of stuff, at least, not for a really long time as I learn how to code by experimenting with things.

 

So for now, we have either rmt hacks, or we need to fuck around any available tool like RMT2LZSS to be able to get certain things possible.

Link to comment
Share on other sites

On 8/11/2021 at 1:54 AM, ivop said:

There seems to be a 7th function, C6502_Intialise(). Probably that's related to the sa_c6502.dll.

Don't know how that ended up in the sa_pokey.dll that is distributed with RMT 1.28. It is overridden by sa_c6502.dll anyway. And the source code does not match the DLL that comes with 1.28.

Quote

Edit: I can't promise an Altirra Pokey DLL, its code is too intertwined with Altirra itself, but a sound-only reimplementation in C based on Phaeron's documentation and code might be possible. First create a skeleton that outputs a sine wave, and prints debug data to stderr for each function.

Turned out not to be that difficult. Install binutils-mingw-w64-i686, gcc-mingw-w64-i686, and mingw-w64-i686-dev.

 

pokey.c

#include <stdio.h>
#include <stdint.h>

void __declspec(dllexport) Pokey_Initialise(int *argc, char *argv[]) {
    fprintf(stderr, "%s: argc=%i\n", __func__, argc);
}

void __declspec(dllexport) Pokey_SoundInit(uint32_t freq17,
                                           uint16_t playback_freq,
                                           uint8_t num_pokeys) {
    fprintf(stderr, "%s: freq17=%u playback_freq=%u num_pokeys=%u\n",
            __func__, freq17, playback_freq, num_pokeys);
}

void __declspec(dllexport) Pokey_Process(uint8_t *sndbuffer,
                                         const uint16_t sndn) {
//    fprintf(stderr, "%s: sndn=%u\n", __func__, sndn);
}

uint8_t __declspec(dllexport) Pokey_GetByte(uint16_t addr) {
    fprintf(stderr, "%s: addr=%u\n", __func__, addr);
    return 0;
}

void __declspec(dllexport) Pokey_PutByte(uint16_t addr, uint8_t byte) {
//    fprintf(stderr, "%s: addr=%u byte=%u\n", __func__, addr, byte);
}

void __declspec(dllexport) Pokey_About(char** name,
                                       char** author,
                                       char** description ) {
    *name        = (char*) "Bleh bleh bleh";
    *author      = (char*) "Dracula";
    *description = (char*) "I never say that!";
}

compile with:

export STRIP="-s"
i686-w64-mingw32-gcc -o sa_pokey.dll -shared pokey.c $STRIP -Wl,--subsystem,windows

Observations so far:

 

- Pokey_Process() and Pokey_PutByte() are very verbose, hence they are commented out in the example

- The Pokey engine runs constantly, even if there is no song playing.

- The sndn buffer length is not constant.

- BUG1 RMT initializes Pokey_SoundInit only once(!) with the NTSC clock speed (Pokey_SoundInit: freq17=1789790 playback_freq=44100 num_pokeys=2)

- BUG2 RMT always initializes 2 pokeys and writes to both, even if the song is mono(!).

- Pokey_Initialise never gets any arguments (Pokey_Initialise: argc=0)

 

More to come.

 

BUG1 is pretty severe BTW, because it resamples PAL songs with NTSC resampling parameters. This is hard to fix in the DLL itself.

 

BUG2 is partially related to that. Radek probably thought it was easier to just play mono songs on both the left and the right channel, but that differs from the standalone 6502 player in mono mode. You can indeed sometimes hear left and right interference with mono songs in RMT, because the writes are several cycles apart.

 

Edit: Here's more. The PutByte() function only takes effect after the next Process() is called. This can delay the PutByte effect by sndn/44100 seconds, which is audible.

Pokey_Process: sndn=1748
Pokey_Process: sndn=1752
Pokey_Process: sndn=1804
Pokey_Process: sndn=1750
Pokey_Process: sndn=1746
Pokey_Process: sndn=1752
Pokey_Process: sndn=1804
et cetera ....

Conclusion: RMT + sa_pokey.dll is not cycle exact, and will never be. Unless, maybe, a new sa_c6502.dll is created, too, that comunicates the exact cycle when the PutByte() is done to the sa_pokey.dll library with functions that were not part of the original API.

 

Edit2:

blehblehbleh.thumb.png.76034b653b82f73b074af5ddd26fabc6.png

Edited by ivop
  • Like 4
  • Thanks 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...