Jump to content

Photo

TIATracker module for batari Basic

batari Basic TIATracker module

23 replies to this topic

#1 mksmith ONLINE  

mksmith

    Star Raider

  • 67 posts
  • Location:Melbourne, Australia

Posted Tue Jan 22, 2019 8:11 PM

Welcome to the TIATracker module for batari Basic allowing you to play TIATracker music in your Atari 2600 VCS game.

What is TIATracker
TIATracker is a tool created by Kylearan for making Atari VCS music on the PC and a new sound routine for the VCS. It features ADSR envelopes, up to 7 melodic and 15 percussion instruments, customizable pitch guides for optimizing the number of in-tune notes, a size-optimized and configurable replayer routine and much more.

More information is available here

Example
Refer to file TIATrackerPlayer.bas in the module for a full example of incorporating your TIATracker music into your batari Basic game.

Known issues
None

Titlescreen Kernal
I've added it to my titlescreen in Tower of Rubble and works great.
 
Downloads
v1.1 - 20190125
Fixed an issue where the tiatracker source include could not be inserted anywhere except at the end of the code (or bank 6 for DPC+) due to Unresolved Symbol List compilation errors in batari Basic (via dasm).
Attached File  TIATrackerPlayer.v1.1.20190125.zip   31.09KB   17 downloads
Older releases
v1.0 - 20190123
Initial release
Attached File  TIATrackerPlayer.20190123.zip   30.89KB   26 downloads
 
 
Instructions
The following outlines how to add the TIATracker module to batari Basic and incorporate your music. If you are having issues refer to the example for assistance.
 
batari Basic
1. Copy the tiatracker folder into the root of your batari Basic game folder

2. Copy the content of file tiatracker/tiatracker_batari_variables.bas into your variable definitions of your batari Basic source.

3. Add the following to your batari Basic source (either at the bottom of your file or bank depending on your requirements):
 

 rem include the tiatracker source
 asm
 include "tiatracker/tiatracker.asm"
end

4. In the initalisation of your screen add the following to initialise the tracker:
 

 rem initialise tiatracker
 gosub tiatrackerinit

5. In your screen loop, after the drawscreen call add the following:
 

 rem play track
 gosub tiatrackerplay

 
 
TIATracker
1. Create your music or get someone to do the hard work!

2. Select File > Export track data to dasm... from the menu. On the Save As dialog locate your tiatracker/track folder in your batari Basic game folder, enter a filename of 'track' and click the Save button to export your music.

3. In file tiatracker/track/track_variables.asm remove the Permanent and Temporary variables from the file (otherwise you will receive a compilation error). Note: This will need to be done each time you export your data.


Edited by mksmith, Sat Jan 26, 2019 8:43 PM.


#2 Muddyfunster OFFLINE  

Muddyfunster

    Moonsweeper

  • 282 posts

Posted Wed Jan 23, 2019 9:15 AM

I've tried the standalone example code, that works great with my tia tracker file once the proper changes are made for the variables etc.

 

As a quick test, I tried to integrate the code into an existing program.  I usually use bank 2 for title screens, so I've stripped out the title screen code in Bank 2

 

I added the variables required in to bB - compiles, no issues.

 

When I add the code to initialise and call the tracker it refuses to compile with an unresolved symbol list, oddly pointing at the title setup label.

rem *****************************************************
 bank 2
 rem ***************************************************** 
title_setup

 rem initialise tiatracker
 gosub tiatrackerinit
title_loop

 drawscreen
 gosub tiatrackerplay

 goto title_loop

 asm
 include "tiatracker/tiatracker.asm"
end

This is the compiler output

--- Unresolved Symbol List
27.title_setup           0000 ????         (R )
28.title_setup           0000 ????         (R )

 free ram: 0
 DPC free RAM= 603
   35 bytes of ROM space left in bank 1
 Music player size:  $e9
 Track size:  $4bd
   851 bytes of ROM space left in bank 2
   302 bytes of ROM space left in bank 3
   585 bytes of ROM space left in bank 4
   1909 bytes of ROM space left in bank 5
   35 bytes of ROM space left in bank 6
   1310 bytes of ROM space left in graphics bank

If I move the code to the end of bank 2, then every other label gets flagged as unresolved.

 

Probably something I'm doing wrong, need to play with it some more.

 

[edit] forgot to add, I have other code also sharing bank2 but there is enough space as you can see from the compile output.


Edited by Muddyfunster, Wed Jan 23, 2019 9:19 AM.


#3 Muddyfunster OFFLINE  

Muddyfunster

    Moonsweeper

  • 282 posts

Posted Wed Jan 23, 2019 9:16 AM

glad to hear it's working with titlescreen kernel, I was thinking I'd have to write a separate titlescreen as a trade off.

 

did you keep everything in the same bank? must be a tight squeeze 



#4 Muddyfunster OFFLINE  

Muddyfunster

    Moonsweeper

  • 282 posts

Posted Wed Jan 23, 2019 11:21 AM

ok I think I've cracked it :)

 

Huge code move around needed though.



#5 Muddyfunster OFFLINE  

Muddyfunster

    Moonsweeper

  • 282 posts

Posted Wed Jan 23, 2019 12:34 PM

Also, great job figuring this out and sharing it MKSmith, really cool :)



#6 mksmith ONLINE  

mksmith

    Star Raider

  • Topic Starter
  • 67 posts
  • Location:Melbourne, Australia

Posted Wed Jan 23, 2019 2:35 PM

@Muddyfunster - glad you got it working!

I hadn't tried putting the code in another bank - maybe I should give that a try.

#7 mksmith ONLINE  

mksmith

    Star Raider

  • Topic Starter
  • 67 posts
  • Location:Melbourne, Australia

Posted Wed Jan 23, 2019 2:56 PM

@Muddyfunster
It doesn't appear to like having anything after the include - that appears to be the reason for the errors you encountered. I tried putting the code in bank 3 and call from bank 6 but received this same problem. Might be an interesting issue to fix...

I'll add that to the known issues.

Edited by mksmith, Wed Jan 23, 2019 2:57 PM.


#8 Muddyfunster OFFLINE  

Muddyfunster

    Moonsweeper

  • 282 posts

Posted Wed Jan 23, 2019 3:34 PM

Yep, it's kind of limited to bank 6 I think, from the ground up, when starting a project, that's totally fine. Right now, I'm playing code tetris to get things to fit :D

 

to be honest, its a good excuse for me to optimise my code at the same time so it's a good problem for me to work through.



#9 Muddyfunster OFFLINE  

Muddyfunster

    Moonsweeper

  • 282 posts

Posted Wed Jan 23, 2019 6:07 PM

Ok, here is a title tune integrated with title screen kernel, TIA Tracker player and Tyre Trax.

 

Great job on the notes by RushJet1 

 

@mksmith, again, nice job on figuring this out :)

 



#10 mksmith ONLINE  

mksmith

    Star Raider

  • Topic Starter
  • 67 posts
  • Location:Melbourne, Australia

Posted Thu Jan 24, 2019 7:31 AM

Pleasure mate - sounds great! Rushjet1 wipped that up very quick! Any secrets?



#11 mksmith ONLINE  

mksmith

    Star Raider

  • Topic Starter
  • 67 posts
  • Location:Melbourne, Australia

Posted Thu Jan 24, 2019 7:33 AM

Yep, it's kind of limited to bank 6 I think, from the ground up, when starting a project, that's totally fine. Right now, I'm playing code tetris to get things to fit :D

 

to be honest, its a good excuse for me to optimise my code at the same time so it's a good problem for me to work through.

 

I didn't get a chance to take a look today (hopefully in the next few days) - I think it might be the asm labels but not sure... Hopefully I can work it out!



#12 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 180 posts

Posted Thu Jan 24, 2019 10:14 AM

Awesome job getting it to play in bB at all!! Really looking forward to the missing link being found!!!

 

This was my best scenario I think, tried to put it in bank 2, only place it would fit

 

--- Unresolved Symbol List
0.__setup                0000 ????         (R )    
0._baws2                 0000 ????         (R )
_Shooting_Direction2_length ffffa395 ????             
_boss_Shooting_Direction_length ffffa38d ????             
wall_lumashift_length    ffff84ad ????             
rail_lumashift_length    ffff84a3 ????             
_My_Data2_length         ffff847c ????             
_Random_Y_Pos2_length    ffff632e ????             
rail_lumashift3_length   ffff632a ????             
_My_Data_3_length        ffff6326 ????             
_My_Data_4_length        ffff631d ????             
_My_Data_2_length        ffff6314 ????             
_My_Data_length          ffff630b ????             
musicData_length         ffff6240 ????             
_rail_lumashift2_length  ffff448b ????             
bawscolor_length         ffff2e00 ????             
mysprite0_length         ffff2d00 ????             
mysprite1_length         ffff2c00 ????             
mysprite2_length         ffff2b00 ????             
mytext111_length         ffff2a00 ????             
mytext222_length         ffff2900 ????             
mycolor_length           ffff2800 ????             
mycolor0_length          ffff2700 ????             
blinky_length            ffff26df ????             
GA_length                ffff26af ????             
ER_length                ffff269b ????             
error_length             ffff2687 ????             
error2_length            ffff267b ????             
playcolors_length        ffff266f ????             
0._wave                  0000 ????         (R )
0.__Bank_6               0000 ????         (R )
0.__Bank_3               0000 ????         (R )
31._reset                0000 ????         (R )
0.skipL04916             0000 ????         (R )
0.skipL04917             0000 ????         (R )
0.skipL04904             0000 ????         (R )
0.skipL04905             0000 ????         (R )
0.skipL04912             0000 ????         (R )
0.skipL04918             0000 ????         (R )
0.skipL05059             0000 ????         (R )
31.title_vblank          0000 ????         (R )
0._vblank                0000 ????         (R )
0.skipL05614             0000 ????         (R )
0.skipL05768             0000 ????         (R )
0.skipL05769             0000 ????         (R )
0.skipL05616             0000 ????         (R )
0.skipL05635             0000 ????         (R )
0.skipL05637             0000 ????         (R )
0.skipL05630             0000 ????         (R )
0.skipL05770             0000 ????         (R )
0.skipL05765             0000 ????         (R )
0.skipL05771             0000 ????         (R )
0.skipL05632             0000 ????         (R )
0.skipL05772             0000 ????         (R )
0.skipL05767             0000 ????         (R )
0.skipL05773             0000 ????         (R )
0.skipL05412             0000 ????         (R )
0.skipL03306             0000 ????         (R )
0.skipL03238             0000 ????         (R )
0.skipL02485             0000 ????         (R )
0.skipL02486             0000 ????         (R )
0.skipL03237             0000 ????         (R )
31.__Main_Loop           0000 ????         (R )
 
 

 

 

 

 

I love those drums, sounds just like the minimal 80's music I usually listen to  :thumbsup:



#13 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,863 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Thu Jan 24, 2019 1:54 PM

[Oops. Posted in wrong thread.]



#14 mksmith ONLINE  

mksmith

    Star Raider

  • Topic Starter
  • 67 posts
  • Location:Melbourne, Australia

Posted Thu Jan 24, 2019 3:32 PM

@Lillapojkenpåön
Yeah - thats the issue @Muddyfunster found above. The include currently needs to be at the end of either your code or last bank. Trying to find a solution :thumbsup: 

#15 mksmith ONLINE  

mksmith

    Star Raider

  • Topic Starter
  • 67 posts
  • Location:Melbourne, Australia

Posted Thu Jan 24, 2019 11:13 PM

Hi everyone,

I believe I have solved the issue of inserting the tiatracker include into anywhere within your code. An erroneous unused label was causing the problem (tt_Player SUBROUTINE). Let me know if you have any further issues.

#16 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 180 posts

Posted Fri Jan 25, 2019 10:46 AM

It compiles now but I still have to keep the includes at the bottom of the bank or else I get a black screen (3F 32K)

 

That's not a problem tho! This is sounding awesome!! Insane that the entire player and HUGE track is only 600 bytes bigger then my previous little bB jingle.



#17 mksmith ONLINE  

mksmith

    Star Raider

  • Topic Starter
  • 67 posts
  • Location:Melbourne, Australia

Posted Sat Jan 26, 2019 8:44 PM

It compiles now but I still have to keep the includes at the bottom of the bank or else I get a black screen (3F 32K)
 
That's not a problem tho! This is sounding awesome!! Insane that the entire player and HUGE track is only 600 bytes bigger then my previous little bB jingle.


Glad it's now working!

#18 Muddyfunster OFFLINE  

Muddyfunster

    Moonsweeper

  • 282 posts

Posted Sun Feb 3, 2019 9:46 AM

I've noticed what could be a problem / nuance with the bB playback.

 

If the TIA tracker track has speed set per pattern rather than globally, the playback speeds get a bit screwed up and it plays too fast compared to a regular compiled BIN of the TIA music.

 

I noticed the music that Rushjet1 provided for Tyre Trax was too fast compared to the compiled bin he sent. I was using the exact same tracker files but in bB it was playing too fast so I had to fiddle with with pattern speeds at the bottom of the trackdata file to slow things down a bit.

 

Ill post up a comparison later tonight


Edited by Muddyfunster, Sun Feb 3, 2019 9:47 AM.


#19 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 180 posts

Posted Mon Feb 4, 2019 10:18 PM

Did you change the track_variables.asm? It's exclusive to the tune, so is track_init.

 

I also think the variables it uses need to be consecutive

 

and that you have to reset all those variables correctly every time before jumping to the player, the init doesn't take care of all the variables only two in my case, so I added the rest

 

 lda #0
 sta tt_cur_pat_index_c0
 sta tt_cur_note_index_c0
 sta tt_timer
 sta tt_cur_note_index_c1
 
 
 sta tt_envelope_index_c0
 sta tt_envelope_index_c1
 sta tt_cur_ins_c0
 sta tt_cur_ins_c1
 
 sta player7x ; tt_ptr
 sta player8x ; tt_ptr
 
        lda #12
        sta tt_cur_pat_index_c1
 
The difference you heard could also be the PAL/NTSC difference, PAL plays slower.


#20 Muddyfunster OFFLINE  

Muddyfunster

    Moonsweeper

  • 282 posts

Posted Tue Feb 5, 2019 10:42 AM

 

Did you change the track_variables.asm? It's exclusive to the tune, so is track_init.

 

I also think the variables it uses need to be consecutive

 

and that you have to reset all those variables correctly every time before jumping to the player, the init doesn't take care of all the variables only two in my case, so I added the rest

 

 lda #0
 sta tt_cur_pat_index_c0
 sta tt_cur_note_index_c0
 sta tt_timer
 sta tt_cur_note_index_c1
 
 
 sta tt_envelope_index_c0
 sta tt_envelope_index_c1
 sta tt_cur_ins_c0
 sta tt_cur_ins_c1
 
 sta player7x ; tt_ptr
 sta player8x ; tt_ptr
 
        lda #12
        sta tt_cur_pat_index_c1
 
The difference you heard could also be the PAL/NTSC difference, PAL plays slower.

 

 

 

I was comparing NTSC to NTSC so it wasn't that.

 

the init file and the variables are all correct as are the variables in the bB program. I managed to reproduce the effect with 2 different tunes (both with their own settings). The only common factor is both tunes have variable pattern speeds not a global speed. On global speed tunes its not an issue and the tunes play the same as when run outside of bB



#21 mksmith ONLINE  

mksmith

    Star Raider

  • Topic Starter
  • 67 posts
  • Location:Melbourne, Australia

Posted Tue Feb 5, 2019 4:17 PM

Did you change the track_variables.asm? It's exclusive to the tune, so is track_init.
 
I also think the variables it uses need to be consecutive
 
and that you have to reset all those variables correctly every time before jumping to the player, the init doesn't take care of all the variables only two in my case, so I added the rest
 

 lda #0
 sta tt_cur_pat_index_c0
 sta tt_cur_note_index_c0
 sta tt_timer
 sta tt_cur_note_index_c1
 
 
 sta tt_envelope_index_c0
 sta tt_envelope_index_c1
 sta tt_cur_ins_c0
 sta tt_cur_ins_c1
 
 sta player7x ; tt_ptr
 sta player8x ; tt_ptr
 
        lda #12
        sta tt_cur_pat_index_c1

 
The difference you heard could also be the PAL/NTSC difference, PAL plays slower.


Lillapojkenpåön - is this something I should look to fix?

#22 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 180 posts

Posted Tue Feb 5, 2019 5:41 PM

Well track_init looks different depending on the tune, but if you clear all variables before the setup (which you allready do in your example) it will be allright.

Only way it could be more clearer is if you moved some of the variables you clear in START_RESTART to TITLE_SETUP

 

TITLE_SETUP
   a = 0 : b = 0 : c = 0 : d = 0 : e = 0 : f = 0 : g = 0 : h = 0 : i = 0 : j=0 : k=0
 
 rem initialise tiatracker
 gosub tiatrackerinit
 
 Otherwise if you did     if switchreset then goto TITLE_SETUP   they might not be cleared
 but now the information is in this thread so I don't think you have to change anything.


#23 Sprybug OFFLINE  

Sprybug

    Dragonstomper

  • 567 posts

Posted Tue Feb 5, 2019 9:06 PM

Oh, oh, oh!

THANK YOU!

I haven't checked back in a while and I saw this.

I was hoping someone would do this!

I've been using TiaTracker, but without any real way of importing the data into my Batari BASIC program, I shied away from it (also, one of the note values is incorrect and I have to fix it every time manually).

This will be fun to play around with.  I've been looking for an easier way to implement music into my games.  The traditional way with VBB's sound/music keyboard thing was really the only option, but was painfully slow and I had to manually keep track of what every little chunk meant, which made it hard to know what I was looking at exactly.



#24 mksmith ONLINE  

mksmith

    Star Raider

  • Topic Starter
  • 67 posts
  • Location:Melbourne, Australia

Posted Wed Feb 6, 2019 4:36 PM

@Lillapojkenpåön - great thanks. Will leave for now.

@Sprybug - no probs! It's a great product (for those who can create music!) and can help elevate batari Basic games to an even higher level for those of us who don't have the time to learn assembly (I can get by just enough to do this sort of stuff but not program a full game!)





Also tagged with one or more of these keywords: batari Basic, TIATracker, module

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users