Song speed modification

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #30234
    johnlobo
    Participant

    Hi,

    Is there a way to speed up, or down, a song while it’s been played with AKG player??

    Regards,
    John.

    #30235
    Targhan
    Keymaster

    Yes, check out the PLY_AKG_CurrentSpeed label. It holds the current speed (if you’re using the RAM player, simply overwrite the value in A with the speed (1 is the fastest, the highest value, the slower). If you’re using the ROM player, simply overwrite in PLY_AKG_CurrentSpeed.

    #30456
    tagwato
    Participant

    Hi,
    I’ve been doing some experiments with songs in MSX, recently.
    Was able to include a background song in this game:
    FlappyBird 4 MSX
    The game has some logic to adjust its speed based on VDP interrupt frequency (50hz or 60hz).
    I’m calling PLY_AKG_PLAY once in every interruption and this gives accurate speed for one of the above frequencies but not for the other (music slows down or go faster, depending on the VDP clock of the emulated MSX machine).
    So, I’d like to know what’s the best solution to assure that the song plays at uniform “speed”:
    – Should I dynamically set PLY_AKG_CURRENTSPEED in accordance with the VDP clock, or should I do something else?

    By the way, thanks for your awesome work!

    #30457
    Targhan
    Keymaster

    Hi,

    It’s not really possible to be accurate at 50hz when the screen flyback is 60hz, if you’re synchronized to the screen flyback! And it is not the responsibility of the player to do that actually, it’s up to you :).

    The speed setting is clearly not accurate enough, and cannot be, as it only indicate how many frames must be spent on each “line” in the music.

    I don’t know the MSX timer capabilities, but if you want to play a 50hz song, you must play one frame, wait for 5/6th of the flyback, and loop… This is probably very hard to do, as you have your game to manage…

    I think there is nothing you can do but accept that your music will be faster on a 60hz screen.

    #30495
    Targhan
    Keymaster

    Nice work. If you “hear” that simply changing the song speed makes the job, then it’s perfect! I didn’t think it would be accurate enough, but to honest I never had to manage such 50/60hz problems! Well done.

    #30506
    thegeps
    Participant

    hi, it’s simple to fix playback for 50hz/60hz
    if your song is composed at 50hz and you want to play it at 60hz (but at right speed) you have to use a counter and skip a frame every six.
    I did it in Freedom Fighter and it works like a charm.
    At the beginning of your code you have to check msx frequency and set a variable according to it then, in your vblank:

    ld a,(freq)
    or a
    jp nz,not_ntsc
    ld a,(frame_count)
    inc a
    cp 6
    jp z,skip
    ld (frame_count),a
    not_ntsc:
    call PLY_AKG_PLAY ;call music player
    ret
    skip:
    xor a
    ld (frame_count),a
    ret

    (obviously omitted push af/pop af if hooked in isr)

    #30507
    Targhan
    Keymaster

    I’m amazed that kind of trick really works without anyone hearing constant glitch! But hey, if you say so, it’s great :).

    #30508
    tagwato
    Participant

    Thanks @thegeps.

    Your solution seems to be effective and it’s much more concise than mine, here:
    https://github.com/tagwato/flappybird4msx/blob/master/fix50_60.asm

    Furthermore, the method you used can be generalized to other trackers/players.

    #30509
    thegeps
    Participant

    yep, it works like a charm (I used it in all my games, till now). It is a well known technique on MSX resource center forum (I learned it there)
    used it in my flappy bird clone too, you can play it online here:

    https://homebrew.file-hunter.com/index.php?id=fartypig

    so you can try it both with ntsc and pal machines

    #30513
    thegeps
    Participant

    Otherwise, if music is composed at 60Hz and you want to play it at right speed on 50Hz machimes, you have to call the player 2times the 6th frame

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