Playing SID music on AY??

Hello.

Some time ago, with occasion of another thread, I was asking about possibility of making a very certain thing - a SID emulator for Spectrum with AY.

Like I wrote before, they made it on Atari Xl/XE (with CPU of 1,72Mhz speed).
They play C64 music from SID files with usage of their CPU and POKEY (a chip not similar to SID at all).

However it still sounds like that:
http://mister_beep.republika.pl/SID_music_on_ATARI_XL.mp3
Recorded from real Atari 800XL. No EQ, no compression, no anything.

Here is the program itself: http://drac030.krap.pl/sidplay100.zip

This is how it looks like:
Sidplay.png

...and a thing I haven't before: THE SOURCE of XL/XE SID Player for POKEY:
http://sources.pigwa.net/files/programy/sidplaye06_beta.zip


Is it possible to "translate" the code for Z80 with AY?

Regards,
MB
Post edited by Mister Beep on
ZX Spectrum 48K BEEPER Music:
http://mister_beep.republika.pl/
«134

Comments

  • edited November 2010
    Well, both Atari and C64 has the same CPU. Even if the assume that we connected actual SID to ZX (doable for sure), SID files contains 6502 code, which should be executed in order to play music. Interpreter-based emulation is out of question, it will be really slow, the only option is recompilation at loading stage. This will require much more memory than original code, and much more complex 'emulation' (recompilation) code.

    Translating SID data to AY is different question. Do you really want to hear SID music which had 4 waveforms, variable duty cycle, filter, ring modulation, etc. in three square tones?

    I should note that it is possible to make experimental translation 'offline', through dumping SID register writes from C64, and translating this data by custom PC tool to AY dump. I could say right now, the result will be not as impressive as with POKEY, which has more features than AY in some areas, though with lower quality (8-bit dividers if you need more than two channels).
  • edited November 2010
    Shiru wrote: »
    Even if the assume that we connected actual SID to ZX (doable for sure), SID files contains 6502 code, which should be executed in order to play music. Interpreter-based emulation is out of question...

    Sure? The thing has been done in the SAM computer. Yes, it has a 7MHz CPU, but the point is that the emulation works not just because of the speed, but because of the fact that the code for a SID player routine just runs for a brief period of time between each VR interrupt, to update SID registers. Then, it halts untill the next interrupt. So, as long as you can write a 6502 emulator that can execute the update part in less than 20ms, you can get the job done (at least, for a Spectrum connected to a real SID).
  • edited November 2010
    Sure for arbitrary SID file. I think, there is not much point to make a player for certain set of SIDs, because certain SIDs could be simply converted 'offline', even manually.

    I'm aware that player code takes only a fraction of frame. For SIDs with very fast player at 50hz the interpreter may work on 3.5 MHz Z80, but there are slower players, 100 and 200 Hz update rates, etc. You also have to do conversion to AY, which is not trivial, becuse SID has hardware volume envelopes, you need to recreate them in software.
  • edited November 2010
    Maybe with a fast enough CPU one could "emulate" the SID itself sampling it to the X bits you can achieve using the 3 AY channels playing samples in real time. This is, a soft-synth.
  • edited November 2010
    It is possible, of course, but take in account that Z80 at 12 MHz was only enough to emulate AY with low quality (on General Sound).
  • edited November 2010
    Nathan: that's what atarians did, exactly.

    But if Shiru says it's impossible to do on Z80, then it's a pity.

    Of course they still have only simple emulation without filters and other things.

    By the way, there is actually SID emulation on AY but it's on Atari ST (8 Mhz, Motorola).

    Maybe I could try to find sources of ST's emulator, if it would help.

    PS: Shiru, do you have the AY emulation on GeneralSound, in any TRD/SCL format? Just to listen to?
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
  • fogfog
    edited November 2010
    at vintage computer fare they had bbc micro (6502 also) with a sid chip added on.. it made me laugh to be honest.

    so maybe it would be possible to do with an add on card BUT there is the added complication of the cpu's being different.. atari / apple 2 / c64 / bbc are all the same cpu and the timings

    the thing with c64 playing 3 samples+ well thats only a recent thing.

    follin's work was done on a tantung.. and ported to all the machines.. sid / AY..

    much as david whittaker used an MSX if I recall
  • edited November 2010
    The AY emulator on GS was released with 3bit diskzine. It does not replace actual AY, because there is no way to intercept port writes from GS, so it only works with modified software. There is GSAYEm10 - the emulator itself, run it once, then it reboots the computer; and then there is PT3+69gs - ProTracker 3 adapted to the AY emulator. You'll need some PT3 music to load and play; and of course, you'll need an ZX Spectrum emulator with low-level GS emulation.
  • edited November 2010
    Shiru:

    *W*O*W*! It works!!
    I've heard from Jarek Adamski that such things are possible (we were considering making GS to play beeper songs) but I haven't knew there is an actual AY emulator on GS already. :)
    Impressive. :)

    Thanks for the information.

    Actually it makes some hope for SID emulation too. ;) ;)
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
  • edited November 2010
    This demo is well-known, actually. The sound is really cool, however, it has nothing common with the Commodore's SID. It is a music from Atari ST, where an effect of software modulation of square tone channels was named SID-effect because it's sound resembles some timbres possible on C64 SID. It is really far from actual C64 SID by sound features, and also at ZX it takes almost 100% of CPU time, making impossibe to do anything else at the same time, especially 6502 emulation.
  • edited November 2010
    Yes. Like Shiru mentioned, we're talking about possibility of making actual software-emulation of SID music, coming from C64, like they did on Atari 8bit, Commodore Plus/4 and Atari ST (the last one - with our own sound-chip).

    Still, Velesoft pointed out an interesting thing: they DID ported code/procedures from Atari ST into Z80/ZX.

    playsid.png

    In this case - maybe somebody could port their SID_Emul into ZX Spectrum? I still have no sources of ST's emul. But we will see.

    That's what I found in a TXT file of the program:

    _________________
    PlaySid ST/E/030 is a combinated SID (The C64 Soundprocessor) and 6502 CPU
    emulator. It replays 'PSID'-formatted music-files as known from the Amiga
    or the PC.
    The "Galway-Noise" has now been included as well as the correct
    handling of the replay-speed. Version 2.01 should play most of the tunes correctly (the Rob Hubbard
    tunes i found, wourk as far as i remember them by nearly 100%.
    The ST-version works at 12KHz
    _________________


    Hehe, and I like this fragment ;)

    "'PlaySid ST(E)' was not written to honour SID or the C64. SID was a capable,
    but ordinary processor. Nobody would talk about it today without the
    achievements of the few inventive pioneers of chip-music. Every soundchip
    needs a talented musician to show its full capability. I have listened to
    innumerable SID-musics and about three quarts of them were crap. The best
    equipment could not change them into good music. So this player is dedicated
    to the pioneers of chip-music, who inspired the musicians on all following
    generations of soundprocessors."


    Still - worth to have on Spectrum too.
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
  • edited November 2010
    Spectrum is not in any way comparable with ST 030. It has no power to emulate SID chip with really poor quality and no power to emulate 6502 fast enough in order to run players from SID files - doing both twice as impossible.

    Code ported from ST in digiSID works similar to beeper or digital players for ZX, it is way much easier task than emulation of actual sound chip or CPU.
  • edited November 2010
    Actually ST and F030 are different computers, where ST has Motorola 68000 CPU (8Mhz) and Falcon has Motorola 68030 (16Mhz). However it's only a technical matter and if you say Spectrum cannot run SID emulator then I take it.
    (With regret ;) ).
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
  • edited November 2010
    Just a thought. One way of getting the music data across for this would be to use SIDDump. This basically logs the SID registers of a playing song into a text file of frame updates. A pretty reasonable compression scheme could be applied on the output. (about 18 registers, not all of which are updated each frame) As a test I just wrote a quick export converter & playback routine for c64 this morning.

    A while back Aleksi Eeben wrote a SID emulator for the Vic-20, obviously this is in 6502 again but as it's a pure software emulation (exporting to a 4-bit stream) there might be some useful info in the source.
  • edited November 2010
    SID emulator for Vic-20 is really cool. Something like this is doable on ZX, but with registers dump only, and not (noticeable) better. SID files playing is maybe possible in this fashion: non-realtime emulation of player code, dumping the register output in RAM with some compression for limited time (a loooong precalc), and then playing this. In any case, 128K with AY is a must.
  • edited November 2010
    Shiru wrote: »
    SID emulator for Vic-20 is really cool. Something like this is doable on ZX, but with registers dump only, and not (noticeable) better. SID files playing is maybe possible in this fashion: non-realtime emulation of player code, dumping the register output in RAM with some compression for limited time (a loooong precalc), and then playing this. In any case, 128K with AY is a must.

    Hi guys,

    to me, what is the use of passively playing existing SID tunes? It is like to use 10% of SID capabulities on ZXS once it is connected to ZXS.

    Years ago, I was also dreaming of connecting SID to ZX, but purely with intention of having some tracker directly for SID and AY together, and then we would have six channel music of unique sound.

    So if we connect the SID to ZXS, than please think of writing a tracker software for it so that we get the best out of SID.

    Would such a tracker be realisable?
    As for the hardware itself, is it realisable to connect SID to ZXS?


    Hood
  • edited November 2010
    In this thread only SID 'emulation' was discussed. I've mentioned connection of actual SID just for example that there is two complex task involved, one is sound emulation and other is 6502 code execution.

    It is possible to connect the SID and make a tracker. It is 99.9999% impossible to find a man who able and want to do that.
  • edited November 2010
    Shiru wrote: »
    In this thread only SID 'emulation' was discussed. I've mentioned connection of actual SID just for example that there is two complex task involved, one is sound emulation and other is 6502 code execution.

    It is possible to connect the SID and make a tracker. It is 99.9999% impossible to find a man who able and want to do that.

    Hi Shiru,

    first of all, it is honour for me to have here someone from the exCCCP sceene, who is giving us the latest info from exCCCP scene and is discussing with us in English.

    I think that coding for SID would be just like any ordinary coding (sending bytes to SID in order to make it playing), but I agree, to fing someone who is willing to do such tracker- almost impossible.

    Maybe if such SID interface is built and will be spread amongst people, some of powerful ex Soviet group will come with some SID tracker. So first the SID interface must be build with some user purpose with it.


    Hood
  • edited November 2010
    From my experience with TFM device, probability that someone from ex USSR would make any tracker for SID is zero. There could be a few hundreds KBs of flame on forums, but no one will do anything. There are TS, TSFM, even SAA from SamCoupe already available - and only two trackers for TS, just because one was started in 1990s, and other was made from PT3, which is not that difficult (just second set of channels). Also, people on russian ZX scene don't like something new generally - they want AY and nothing more, because other is 'crappy Sega sound', 'crappy C64 sound' etc. Many of them also don't like beeper, because it is 'crappy 48K sound'.

    Also, there are ways to make AY+SID music without producing any new hardware and software, it is enough to very few ones who want to make such music. The ways range from using ZX and C64 separately and then syncronize the output (as Yerzmyey did) to using crosstrackers and VSTi.
  • edited November 2010
    Shiru wrote: »
    From my experience with TFM device, probability that someone from ex USSR would make any tracker for SID is zero. There could be a few hundreds KBs of flame on forums, but no one will do anything. There are TS, TSFM, even SAA from SamCoupe already available - and only two trackers for TS, just because one was started in 1990s, and other was made from PT3, which is not that difficult (just second set of channels). Also, people on russian ZX scene don't like something new generally - they want AY and nothing more, because other is 'crappy Sega sound', 'crappy C64 sound' etc. Many of them also don't like beeper, because it is 'crappy 48K sound'.

    Also, there are ways to make AY+SID music without producing any new hardware and software, it is enough to very few ones who want to make such music. The ways range from using ZX and C64 separately and then syncronize the output (as Yerzmyey did) to using crosstrackers and VSTi.

    You are probably right Shiru. So I had better go down to the earth:))))

    Hood
  • edited November 2010
    Returning to the main topic, personally I'd go in the direction pointed by 4mat - register dumps, and so on. Anyway, the most simple methode for the CPU would be OK. I really don't think it will sound worse than on XL.
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
  • edited November 2010
    Mister Beep, glad to tell you, the thing you want actually has been made for MSX (MSX1 with disk drive and 128K RAM are minimal requirements) this year. It emulates 6510 to play standart SID files and translates the output to AY. It works with certain SID files, as we discussed here, but at least it really works with some, on Z80 with 3.58 MHz and additional WAIT state per M1 cycle in whole RAM (slower than ZX).

    As I've supposed, the sound is not really interesting and is 'flat', because it lacks any of SID features, but anyway, I'm very impressed that it has been done even as is. It is also means it is possible to play the same SID files that this program supports on actual SID connected to MSX; and it is possible to do the same on ZX. I guess, it is also possible to make limited SID sound chip emulation on GS, with better quality than VIC-20 SID emulator has, however don't think this would be that impressive.
  • oboobo
    edited November 2010
    The MSX player is just a port of my SAM SID player, with the conversion to AY rather than driving a real SID chip. It sounded like this thread had different goals, so I didn't think to mention it earlier!

    The core player is only 4K, but it does rely on the full 64K address space being RAM, which would limit it to +2A/+3. That's mainly due to the 65xx emulation, though C64 SID tunes can be based at almost any address too. Using Jimmy's 65xx core would allow it to be run on 128/+2 machines, but the speed hit would reduce the list of tunes that could be played in real time. 48K support would further limit the playable tunes, even if the native SID player code was relocated.

    The Speccy should have enough speed to play at least some tunes in real time, though I've never tried it. It does depend on the playback frequency and the amount of frame time needed by each tune. Basic AY mapping could probably be done with look-up tables, to give you what the MSX player does. Anything fancier won't be possible in real time, though you could still use the player to pre-buffer SID register data for playback in some nicer way.

    Real SID chip playback would be nicer, especially if the chip could be (optionally) memory mapped at D4xx instead of using I/O. That would remove the need for memory write trapping checks in the 65xx core and give it a speed boost.

    The original player source code is available on my site, so free free to have a hack...
  • edited November 2010
    Nice one there Obo :) it shouldn't be too difficult to reuse the MSX code and do an AY SID player (altough limited as you said) for +2A/+3 :) I wish I had some time, but currently not. Anyone up to the task ?
  • edited November 2010
    ..its quiet here, isn't it?...!!!!
  • edited November 2010
    Well, I ment possibility of making emulation of SID but since seems like it's impossible to make 2 emulations at once - SID and their CPU, then I give up (with grief).

    Maybe my first 'optymistique' attitude came from my experiences from Atari XL - with their 1,7 Mhz CPU they managed to play Spectrum's beeper tunes, even these 8chanels ones.
    But maybe it's more simple, I wouldn't know about coding.
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
  • edited November 2010
    Personally I'd still go with using register logging to avoid emulating the CPU altogether. As there are software emulations of the SID already listed in the thread surely the audio part is more important to get started on than the data part? When I was writing an AY player on the c64, being able to start on the audio immediately was the appeal.
  • edited November 2010
    Maybe my first 'optymistique' attitude came from my experiences from Atari XL - with their 1,7 Mhz CPU they managed to play Spectrum's beeper tunes, even these 8chanels ones.
    You should remember, 6502 is quite different, so it's performance is not so much worse, as it could look from clock frequency numbers. You know, shortest operations on Z80 take 4 clocks, and could take up to ~20 clocks, while shortest operation on 6502 is 2 clocks and longest is 7. And it is not the only difference.
  • edited November 2010
    Shiru wrote: »
    You should remember, 6502 is quite different, so it's performance is not so much worse, as it could look from clock frequency numbers. You know, shortest operations on Z80 take 4 clocks, and could take up to ~20 clocks, while shortest operation on 6502 is 2 clocks and longest is 7. And it is not the only difference.

    I see. And that's what I actually heard several times before, I admit.
    But what would you say about 4mat's words (coding is not my cup of tea, you now).
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
Sign In or Register to comment.