MultiPSG version of AKG player

What is Arkos Tracker? Forums Arkos Tracker forum Feature requests MultiPSG version of AKG player

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #30162
    bukem
    Participant

    Can we get MultiPSG version of AKG player for Z80. Currently only AKY version of player supports ZX Spectrum Next or TruboSound. Unfortunately due to AKY player design the MultiPSG tracks that use noise on multiple channels are distorted when playing on ZX Spectrum Next.

    #30163
    Targhan
    Keymaster

    Hi,

    The AKG is not really meant to support multiPsg, because it will be simply too slow. On a “normal” 8-bit computer, this would be not be usable in a game or a demo, so I simply don’t think it is worth the trouble.

    Now I really don’t understand why there would be noise problems with AKY. In case you don’t know (sorry if you do), using noise on multiple channels on the SAME PSG may sound strange, because the same value of noise is used on all the channels using noise (the PSG only has one noise generator). But if you tell me that using two channels of noise of TWO DIFFERENT PSGs provokes “distortion”, then there may a problem in the player (which would be unlikely, as it is had been well tested, but hey, no one’s perfect :)).

    Or is it a problem with the Spectrum Next hardware itself? I have used 9-channel songs on our Playcity hardware on CPC, and never had any problem.

    #30167
    bukem
    Participant

    Hi

    The piece I’m talking about is using noise on channels 1, 3 (sporadically) and 6 (PSG1 and PSG2) through half of the song and 1 and 9 (PSG1 and PSG3) the other half. I’ll try to get it rearranged and will do some more tests on Next. Anyways thanks a lot for the reply and explanation Targhan.

    #30188
    bukem
    Participant

    OK, I’ve found the problem, it was really silly, the PSGs had default frequency set to 1 MHz (CPC) instead of 1.77 for ZX Spectrum Next. My bad, sorry for the trouble.

    BTW I know that it’s a long stretch but would you reconsider making AKG player for ZX Spectrum Next at least? While at 3.5MHz the AKY player takes ~25 scanlines (for 9 channels song), but at 28MHz it’s just ~3 scanlines. The AKG player would seem perfectly viable it that case.

    #30189
    Targhan
    Keymaster

    Glad it works fine.

    Can you tell me why you’d need the AKG player for SpecNext? If you use AKY, you only waste a bit of more memory, but doesn’t the SpecNext has more?

    #30190
    Targhan
    Keymaster

    … The AKG certainly takes more than 25 scanlines for a 9 channels song. I would say a bit more even for a 3 channels song! I wish it were than fast :).

    #30192
    bukem
    Participant

    Yeah, the Next has either 1MB or 2MB (but the 2MB is more common I guess), so it’s plenty of space. The reason I would like to have Multi-PSG AKG is that it’s a full blown player that support natively the effects and subsongs but more importantly the samples. Next has four 8-bit DACs and we can use DMA to feed it with samples, currently only mono (one DAC), but there is a chance that in future it will be possible to stream samples with DMA to two DACs (stereo). If I’m not mistaken, only AKG player could do that?

    #30193
    Targhan
    Keymaster

    The AKG is not, on a normal 8-bit system, suited for complex sound effects such as high quality samples. AKY is better for that, because it’s much faster. On CPC we can play digidrums with the AKG, but if I wanted to play “real” samples” along with music, I would use AKY.

    Right now, AKG does NOT play sample, simply because it would be too slow.

    #30195
    bukem
    Participant

    How do I play samples with AKY. Is there example that you could point me to? I guess that I need to write the part that feeds the samples through DMA to DAC but I have to hook up into AKY player (btw DMA on ZX Spectrum Next supports prescalar so frequency domain can be managed easily)

    #30196
    Targhan
    Keymaster

    That’s the whole point. My players don’t play samples, because playing sample is always very specific to the machine. On CPC, we would OUT on the PSG, and wait a specific amount of NOPs before making the OUT again, in a loop. We can do that because on CPC, we don’t have a DMA, and each instruction has the same duration, always. This is not the case of other machines.

    You’re talking about a DMA, which is specific to the SpecNext. I’m sorry but I cannot help you about how to program it, since the only thing I know about the SpecNext is how to address the PSGs!

    But this should be easy. Basically:
    – Play a frame of the AKY player, normally.
    – Detects if a sample must be played. You can use the Events for that.
    – If a sample must be played, send the sample data (or continue the previous sample, if any) to the DMA.
    – Wait for the next frame flyback and restart!

    As for the samples, AT2 can export samples for you in 4 bits, if that’s what your DMA requires.

    One problem I think about, I guess your DMA send the samples to one of the channels where the music is playing. Maybe this won’t be a problem, but if you feel the sample has a bad quality, this may be because the music “overlaps” with the sample for a few scanlines. Ideally, the sample channel should be untouched by the AKY player, when a sample is played.

    First tell if it it’s working as it is, and we’ll find a way to bypass the AKY PSG access when a sample is present. This shouldn’t be difficult at all!

    #30197
    bukem
    Participant

    I can do the DMA part, no problem. I was just asking how I can hook up my sample player code to AKY/AKG player to get the necessary info like sample number to be played and octave.

    But this should be easy. Basically:
    – Play a frame of the AKY player, normally.
    – Detects if a sample must be played. You can use the Events for that.
    – If a sample must be played, send the sample data (or continue the previous sample, if any) to the DMA.
    – Wait for the next frame flyback and restart!

    OK, so I have to use Events to pass the info about sample to be played and the octave.

    One problem I think about, I guess your DMA send the samples to one of the channels where the music is playing. Maybe this won’t be a problem, but if you feel the sample has a bad quality, this may be because the music “overlaps” with the sample for a few scanlines. Ideally, the sample channel should be untouched by the AKY player, when a sample is played.

    The SpectNext has four 8-bit DACs (Digital Audio Converters) in addition to 3 PSG. So I can send 8-bit samples using DMA to one of the DAC and AKY/AKG player will not overlap at all because it’s using PSGs and not DACs. In future it should be possible (I hope) to send samples to two DACs to get the stereo sample sound.

    Thanks for the help Targhan!

    #30198
    Targhan
    Keymaster

    Ah ok, you want to use “real” samples directly from the notes. This is problematic because there is no “notes” in AKY!! AKY only handles registers!

    Then you have to use AKG, your have no choice. Sorry if I was misleading, but I wasn’t sure about what you wanted. If you’re in a hurry you can check the source, it’s quite easy to know when a note is read. Then transmit that to your DMA player and it should be easy! Especially since your DMA are not using the PSG’s channels!

    The only thing I’m note sure about is how the exported will export the “sample” instrument… When playing them, the AKG “should” play “silence”, ideally. I’ll try to check that soon :).

    #30199
    Targhan
    Keymaster

    Damn, you cannot use the AKG directly because it only manages 3 channels. You *could* have 3 players (each playing one PSG, you could split your songs into 3 by deleting a PSG in the SOng Properties…)

    Ok, we’re a bit in trouble here :). The sample support is rather inexistent in the players because no one was really interested into it (except for digidrums). The AKG **format** *support* the sample instruments, but if you have one sample played, it will crash because it will try to interpret the instrument data as PSG instrument. The player does NOT support the sample format…

    I certainly don’t have time to change the players right now, but I can provide guidance if you want.

    I think the simplest way is the following (it doesn’t mean it is simple):
    – Export as AKY the whole song, 9 channels. The sample are not played.
    In a copy of the song:
    – Keep only the sample instrument of the song, delete the notes that use the other instruments (use the “delete notes” in the “wrench” icon at the top right of the pattern viewer).
    – Replace the sample instruments with PSG instruments (simple ones, we don’t care).
    – Export this song as 3*AKG (one per PSG).
    – Use the AKG player to get all the notes of the previously-sample instruments (See the PLY_AKG_Channel{channelNumber}_Note label in the source, this is where the notes are read).
    – Build an array with each note+instrument per channel.

    … You can use this to play the samples on your DMA!!!

    I’m sorry, this is highly complicated! But the player simply don’t handle that for the moment, I’m deeply sorry.

    #30200
    bukem
    Participant

    You’ve nothing to be sorry for. Thank you for the amazing tool and all the info.

    #30361
    eric
    Participant

    @targhan could you please add a kind of export or some comments in a .akg file, about samples being played?

    like: <frame_number> <sample_nb> <freq> <voice> ?

    also, with a more generic variant of that, ie:

    <frame_number> <instr_nb> <note> <voice>, we are not too far of a rudimentary midi export

    thanks

Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.