Login
Back to forumReply to this topicGo to last reply

Posted By

Mozar​tkügel
on 2019-03-06
02:21:19
 TED Bubbly arpeggios and other music questions

I managed to get some sound out of the plus/4, but it didn't sound all that great. I couldn't find any documentation so far other than that there's registers for global volume and on/off + frequencies for two voices (and noise for the second voice).

I don't understand then how nice music and bubbly 'Commodore-like' arpeggios and the delay-like effects are done in some c16/Plus4 tunes I've heard. Is it two channels slightly out of sync to create that delay effect? Is it possible to somehow add filters with software or do I imagine and put more into the music than there is?

Some fabulous examples of what I mean:
adventures in time in game music (with delay-like effect):
https://youtu.be/jEv13vqpELY?t=25

pet's rescue intro music (with bubbly arpeggios):
https://youtu.be/o656g468TaI?t=57

Does anyone know / can anyone recommend what tracker would make sense using for the easiest possible 'integration' with CC65? TEDzakker or Knäcketräcker? Is it possible with either one to just export a song with player included and somehow integrate it into a CC65 program? If it's terribly complicated I might just go down the route of having some quite primitive music in the intro-screen of my game and then just sfx in the game levels.

Thanks in advance for any help!

Posted By

Luca
on 2019-03-06
05:15:04
 Re: TED Bubbly arpeggios and other music questions

Oh well, those two tunes by me have been composed in two different ways: Adventures In Time (In-game) has been composed straight in ASM by using TLCplay, Pets Rescue's Intro has been composed in Knaecketraecker. So, I guess it's just about composition's techniques happy If you wanna see how I did it, there's a zipped pack in the Pets Rescue page, with all the source files you can load and test on Knaecketraecker wink

Posted By

Doug
on 2019-03-06
05:23:23
 Re: TED Bubbly arpeggios and other music questions

Hi Mozartkügel,

When I did Icicle Works I just manually de-tuned the values to create some interesting effects, but the music in that game is woefully inadequate compared to what can be achieved today (I was just a kid back then!).

For my new game I'm using Knaeckertraecker (did I spell that right?). To be honest I'm stalled out on the music front right now, because I find the UI utterly impenetrable (that and a lack of musical ability on my part!). My son has volunteered to write some music, but he's in the same position regarding the UI. So I am stuck in that regard (unless I have any volunteers reading this willing to help me out with some KT tunes, or Degauss manages to find time to make the UI easier for a mere mortal to understand happy.

As for integrating the output of KT, I find it very easy. My weapon of choice is Kick-Assembler (which is utterly awesome IMHO), so I have a simple work flow: use KT to export a tune to ASM, which spits out a DASM file. I then process this file through a simple awk script that converts it into Kick ASM syntax, and then import that into the assembly flow. Job done. You could do the same to convert to CC65. The actual nuts of bolts of integrating the tunes into the code is trivial.

Cheers,
Doug

Posted By

Luca
on 2019-03-06
05:32:27
 Re: TED Bubbly arpeggios and other music questions

Doug do you have troubles in re-initialize any knaecketraecker's tune? Because I do have

Posted By

Doug
on 2019-03-06
05:36:31
 Re: TED Bubbly arpeggios and other music questions

Hey Luca, no I have no issues at all. But then I have a tweaked version of the player happy I fixed the replay issues and added volume fades too. Happy to share if you're interested (but its been converted from DASM to KickAss).

Posted By

Luca
on 2019-03-06
06:20:40
 Re: TED Bubbly arpeggios and other music questions

Doug wow, I'm very interested in the fixed player, probably we could simply put the fixed one (DASM) in the right folder and use the original Knaecketraecker with fixed filesave (.bin, .asm and .prg). Could you please describe the nature of the issues ravaging the reinitalization of the player?

Posted By

Doug
on 2019-03-06
07:57:32
 Re: TED Bubbly arpeggios and other music questions

Luca, the KT player relies heavily on self modifying code (don't we all!!?). So its critical to 'reset' all internal state in the player when switching songs. I took a brute force approach and manually analysed the code to identify all places in the code where dynamic changes were taking place, then reset them to their power-on state whenever kp_reset() (play a new song) is called. There aren't that many of them TBH, but you need to get them all! If you remind me how to upload files to this site I'll show you precisely what was done (there is some 'KickAss' dialect that you'll need to be familiar with, but its all pretty obvious).

Posted By

Luca
on 2019-03-06
10:30:45
 Re: TED Bubbly arpeggios and other music questions

Oh, this truly means that the kp_reset subroutine is actually not complete in any automodified address... We sounded various bells about that site uploader, but we still dunno how to fix it...but hey, it's a short subroutine to be directly changed into player_code.asm and enything will work fine, so you can simply copypaste it here, for all of us wink

Posted By

Doug
on 2019-03-06
15:25:19
 Re: TED Bubbly arpeggios and other music questions

Hey Luca, here you go:


kp_pattern_counter: .byte $00
kp_beat_counter: .byte $00

#import "player_const.asm"
#import "player_code.asm"
#import "player_frqtab.asm


/*
*****************************************
* Player Reset
* X/Y - address of song to play
*****************************************
*/
kp_reset: stx kp_zp0
sty kp_zp0+1
lda #$00
sta kp_zp1

/*
* Reset all internal state to power on default values
*/
ldx #kp_wipe-1
!loop: sta kp_tedwrite,x
dex
bpl !loop-

ldx #11-1
!loop: sta kp_track0.track_regist
sta kp_track1.track_regist
sta kp_track2.track_regist
dex
bpl !loop-

sta finalvol
sta kp_track0.vol_pos
sta kp_track1.vol_pos
sta kp_track2.vol_pos
sta kp_track0.vol_wait
sta kp_track1.vol_wait
sta kp_track2.vol_wait
sta kp_track0.osc_pos
sta kp_track1.osc_pos
sta kp_track2.osc_pos
sta kp_track0.osc_wait
sta kp_track1.osc_wait
sta kp_track2.osc_wait
sta kp_track0.kp_pat_wait
sta kp_track1.kp_pat_wait
sta kp_track2.kp_pat_wait

lda #$f
sta kp_track0.vol_mod0
sta kp_track0.vol_mod1
sta kp_track1.vol_mod0
sta kp_track1.vol_mod1
sta kp_track2.vol_mod0
sta kp_track2.vol_mod1

lda #<kp_insnil2
sta kp_track0.osc_adr_0
sta kp_track0.osc_adr_1
sta kp_track1.osc_adr_0
sta kp_track1.osc_adr_1
sta kp_track2.osc_adr_0
sta kp_track2.osc_adr_1

lda #>kp_insnil2
sta kp_track0.osc_adr_0+1
sta kp_track0.osc_adr_1+1
sta kp_track1.osc_adr_0+1
sta kp_track1.osc_adr_1+1
sta kp_track2.osc_adr_0+1
sta kp_track2.osc_adr_1+1

lda #<kp_volnil2
sta kp_track0.vol_adr_0
sta kp_track1.vol_adr_0
sta kp_track2.vol_adr_0

lda #>kp_volnil2
sta kp_track0.vol_adr_0+1
sta kp_track1.vol_adr_0+1
sta kp_track2.vol_adr_0+1
...


Here's how I encoded the track player into a KickAss macro and instantiated:



/*
*********************************************
* Macro to create a track instance
*********************************************
*/
.macro kp_trackinstance()
{
/*
* Process pattern data
*/
ldy kp_patpos: #$00

pat_next: lda kp_pat_wait
beq pat_waitdone
dec kp_pat_wait
jmp pat_end

pat_waitdone: lda kp_patadr_0: $1234,y
sta kp_zp1
iny
lda kp_patadr_1: $1234,y
iny

lsr
bcs bx1

bx0: lsr
bcs b10

/*
* Set song register
*/
b00: tax
lda kp_zp1
sta kp_song_registers_occ: $ffff,x
jmp pat_next

/*
* Set instrument
*/
b10: sta kp_pat_wait
ldx kp_zp1
lda kp_insmap_lo_occ: $ffff,x
sta osc_adr_0
sta osc_adr_1
lda kp_insmap_hi_occ: $ffff,x
sta osc_adr_0+1
sta osc_adr_1+1

lda kp_volmap_lo_occ: $ffff,x
sta vol_adr_0
lda kp_volmap_hi_occ: $ffff,x
sta vol_adr_0+1

lda #$00
sta osc_wait
sta osc_pos
sta vol_wait
sta vol_pos
jmp pat_next

bx1: lsr
bcs b11

/*
* Set track register
*/
b01: tax
lda kp_zp1
sta track_registers,x
jmp pat_next


/*
* rewind
*/
b11: ldy kp_zp1
jmp pat_next

pat_end: sty kp_patpos


/*
* Process oscillator control-data
* xxxxxxxx cnptwwww
*/
kp_track_ins: ldy osc_pos: #$00
lda osc_wait: #$00
beq osc_waitdone
dec osc_wait
jmp osc_end

osc_waitdone: lda osc_adr_0: kp_insnil2,y
sta osc_freq
iny
lda osc_adr_1: kp_insnil2,y
bpl osc_freqvalue

osc_jumpvalue: iny
and #%01111111
tay
jmp osc_waitdone

osc_freqvalue: iny
sta osc_flags
and #%00001111
sta osc_wait
sty osc_pos


/*
* Process volume-envelope data
* cwwwvvvv
*/
osc_end: ldy vol_pos: #$00
lda vol_wait: #$00
beq vol_waitdone
dec vol_wait
jmp vol_end

vol_waitdone: lda vol_adr_0: kp_volnil2,y
bpl vol_volvalue

vol_jumpvalue: and #%01111111
tay
jmp vol_waitdone

vol_volvalue: iny
tax
and #%00001111
sta osc_vol
txa
and #%01110000
lsr
lsr
lsr
lsr
sta vol_wait
sty vol_pos

/*
* Determine output value
*/
vol_end: ldx osc_freq
lda osc_flags
sta kp_out_flags
and #%00010000 /* transpose? */
beq notranspose

clc
txa
adc frq_mod0
tax
notranspose: stx kp_out_freq

lda osc_vol
beq noamp

clc
adc vol_mod0
sec
sbc #$0f
bpl noamp
lda #$00

noamp: sta kp_out_vol

bne hasvol /* If its zero, its off */
lda kp_out_flags
and #%10011111
sta kp_out_flags

hasvol: rts

/*
* Track registers
*/
track_registers:
kp_pat_wait: .byte $00
frq_mod0: .byte $00
frq_mod1: .byte $00
vol_mod0: .byte $0f
vol_mod1: .byte $0f
osc_freq: .byte $00
osc_vol: .byte $00
osc_flags: .byte $00

kp_out_flags: .byte $00
kp_out_freq: .byte $00
kp_out_vol: .byte $00
}

/*
* Track instances - code and data
*/
kp_track0: :kp_trackinstance()
kp_track1: :kp_trackinstance()
kp_track2: :kp_trackinstance()



If you want to see the whole thing I can post a link to the files on my google drive.

Doug

Posted By

Mozar​tkügel
on 2019-03-06
16:47:45
 Re: TED Bubbly arpeggios and other music questions

Thank you so much for the help and info Luca and Doug! And thanks guys for generously sharing your stuff freely for others to learn from.

Hahaa! Very nice Luca grin I love the music in Adventures In Time and the Pets Rescue intro theme! I haven't heard all of the other Pets Rescue music yet.

I tried out Knaecketraecker tonight with some Pets Rescue tunes and it's great! I'm quite a tracker noob, but of all the 4-5 trackers I've tried so far this was the easiest to get into and understand. For me the hardest thing by far here would be to create instruments of my own. I wonder if TED composers here would think it's ok to borrow some instruments from songs if credit is given in resulting game?

Doug I think we are in the opposite situation, I found Knaecketraecker to be quite easy to get into, but I'm super scared of not being able to get the Knaecketraecker songs / track player to work on CC65 grin

Posted By

Luca
on 2019-03-06
16:56:52
 Re: TED Bubbly arpeggios and other music questions

Credits for instruments? Naaah, even the tracker itself offers some initial instruments by default to promptly use into your tune. About me: still have to do something with TEDzakker, lov its features, and I'm gonna use it for the first time, I swear!

Doug, I'm copypasting your kp_init routine right now, in order to brutally substitute the original subroutine with yours and see what happens, thank you!

Posted By

Doug
on 2019-03-06
18:04:27
 Re: TED Bubbly arpeggios and other music questions

Mozartkügel I am jealous. I wish I could get my head around it!

Do not be afraid of getting the track player and tunes to work with CC65. I know that knaecketraecker exports to DASM, but DASM and CC65 are really close syntactically. A simple awk script can convert from one to the other. Once you've got that bit working you can forget about and just concentrate on making music.

Posted By

Luca
on 2019-03-07
02:06:39
 Re: TED Bubbly arpeggios and other music questions

...And of course it can't work that way. I was searching for a perfectly fitting substitute of the kb_init SUBROUTINE as shown in Knaecketraecker, in order to have a complete fix about initializing the music; this routine, I guess, shows some calls never seen before in the original code, probably added by you for the overall personal usage. For a moment, I was aware it could have been a simply change in the original tracker's player_code.asm file...

Posted By

Doug
on 2019-03-07
04:25:45
 Re: TED Bubbly arpeggios and other music questions

Hey Luca,

It should be equivalent. To be honest I did this a while ago, and can't even remember re-naming the entry point, but I guess I did. It should be functionally identical to kp_init, or the very least so close its a simple matter to change it back. For total clarity here is a link to the full changes that I made to the player:

https://drive.google.com/file/d/14vuc7vhZr786DMGhq2Z30_6lkWU92g1J/view?usp=sharing

Cheers,
Doug

Posted By

Luca
on 2019-03-07
06:21:34
 Re: TED Bubbly arpeggios and other music questions

Doug thank you. Ok, I've tried to convert back that slice of code to DASM in order to make it work in the tracker itself: I've erased the columns, I've converted the MACRO calls (with no brackets), fixed the comment lines, I tried to convert the rest, like the macro indexing arguments, but with no success at all. Simply, I'm not skilled enough for this. So, let' wait for the official fix from the original author Degauss happy

Posted By

Mozar​tkügel
on 2019-03-07
17:13:44
 Re: TED Bubbly arpeggios and other music questions

Hey thanks for encouraging me Doug I have "Learn how to add assembly routines to my project" high on my TODO-list. I've seen how it's done in some c64 project so it shouldn't be too hard when I need it. I'm a total assembly noob though, I've only enabled some sprites and changed some colors on the c64 screen in assembly so far. I'm sure you'd be able to conquer Knaecketraecker if you'd load up one of Lucas example songs and experiment a little bit while looking at MIK's manual: http://plus4world.powweb.com/forum/35837#36813 I do admit that it took me a couple of years from first encountering a tracker I needed to use, to actually give it the couple of nights I needed to learn the basics of it grin

Luca Yeah I need to check out TEDzakker too asap! Do you happen to know if TEDzakker has "issue-free" export? I really liked Knaecketraecker right away though, and many of the sounds in songs that I was going to borrow :> What is the bug/issue really all about, since you still had Knaecketraecker songs in Pets Rescue? Are the exports still usable although there's some song re-initialization issues? Did you hear anything from Degauss if he's going to look at it in the future? That would be fabulous of course happy

Posted By

Mozar​tkügel
on 2019-03-26
07:39:32
 Re: TED Bubbly arpeggios and other music questions

How is it possible that there is a volume control column in the instrument "box"/creator in Knaecketraecker? I thought there is only global volume control on TED, or are there separate volume controls for both channels? Otherwise I can't understand how you could tweak the volume on one instrument on the fly without messing up the other channel. :/

I only found this when I tried to search:

$FF11: Sound control register.
Bit 0-3 : Volume. Maximum value is 8.

Thankful for any info on this matter! happy

Posted By

Luca
on 2019-03-26
08:21:15
 Re: TED Bubbly arpeggios and other music questions

Knaecketraecker shows a weird issue when you try to reinitialize it after the first play. The author has just pointed out that his tracker was born to compose tunes for his own demos, and we all know that a demotune is generally played once. Once we tried to use those files for games, we got that strange difficult in correctly restart the music, so we searched for some automodifying value to be reset and got no success. Mad has preferred to completely reload the music in Pets Rescue when needed!

About the volume: the general volume is the instrument's one, but you can have modifications of the volume slope you've set in the instrument's table by setting further volume changes in the pattern editor; the resulting volume will be like having master and secondary volume on your wifi set, with the secondary volume (the pattern one) set as a percentage ($0-$0f = 0%-100%) of the current general volume. This makes the whole sound much more "human".

Posted By

Mozar​tkügel
on 2019-03-26
08:50:03
 Re: TED Bubbly arpeggios and other music questions

Thanks so much for the valuable info Luca!

Yeah it really makes a world of difference having dynamic sounds/instruments! I've noticed that for example old NES and Master System music often sound really stale to someone who grew up with the c64, because they seldom seem to edit any "instrument" parameters on the fly. It seems to have been mostly an european thing actually(?) Because most games on the 8-bit home computers that were popular over here almost always seem to utilize "dynamic instruments".



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024