Jump to content
IGNORED

Writing and/or Reading TI Music


Mike Harris

Recommended Posts

I just don't get it.

First you have something labelled as such.
       BYTE >03,>CA,>2F,>D1,>0C

I understand Assembly language on other systems such as

DB 003H,0CAH,02FH,0D1H,00CH

 

Would this be the same?

Then the basic idea of writing music and converting it to data.
My desire is to transfer or as you were TRANSLATE TI99/A to play on the Colecovision.
Sure, different chips but still an A, B or even a C# has an equivalent on both systems.

Thoughts, comments?
 

Link to comment
Share on other sites

It's doable, but tricky.

 

The method you are describing above is the ISR ROM method of playing music. It takes sound lists and plays back the notes accordingly. It has the advantage that you can just point the routine at a memory area and it will take care of the music for you on interrupts. The disadvantage is it's limited to 1/60 of a second for any given note, doing multiple voices is painful, and having anything other than square tones (no volume decay) requires manual work. It's good for sound effects, not so great for music.

 

For my CRPG, I wrote my own music player, using some of the structures that the late Bruce Harrison (Writer of the excellent "Art of Assembly" articles featured in MICROPendium magazine) did with his own TI company, which produced several disks of music. I've attached a sample of it below, which can be compiled in Editor/Assembler and executed. It features volume decay, and a relatively easy way to program in music via note lists for each voice through equates for the various lengths. The downside? It takes a LONG time to transcribe from sheet music.

 

Also, one annoying factor is that the TI sound chip just, well, isn't as good as the ones featured in slightly later machines. They synced the chip to the 3mhz clock, which means it can't really do base notes, and the total sound range is only about five octaves (10-bit or 1024 unique frequencies). Both the MSX and Colecovision, if I recall, offer a seven octave range and 12-bit frequencies.

MUSIC.asm

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

13 hours ago, Mike Harris said:

I just don't get it.

First you have something labelled as such.
       BYTE >03,>CA,>2F,>D1,>0C

I understand Assembly language on other systems such as

DB 003H,0CAH,02FH,0D1H,00CH

 

Would this be the same?

Then the basic idea of writing music and converting it to data.
My desire is to transfer or as you were TRANSLATE TI99/A to play on the Colecovision.
Sure, different chips but still an A, B or even a C# has an equivalent on both systems.

Thoughts, comments?
 

The sound chips are almost the same, so the raw bytes you send to the chips will work unchanged. But if you want to play "sound list" format on the Colecovision you need to create a player. This is not very difficult because the format is so simple.

Link to comment
Share on other sites

43 minutes ago, Asmusr said:

The sound chips are almost the same, so the raw bytes you send to the chips will work unchanged. But if you want to play "sound list" format on the Colecovision you need to create a player. This is not very difficult because the format is so simple.

That's cool..but what does the gibberish > mean?
It looks like a CPM command prompt.

And what is a Sound List?

Edited by Mike Harris
Link to comment
Share on other sites

10 minutes ago, Mike Harris said:

That's cool..but what does the gibberish > mean?
It looks like a CPM command prompt.

And what is a Sound List?

That's the TI form of "hexidecimal number". So >DF is like 0xdf in PC land. :)

 

A sound list is a list of sequential sound commands in a byte format that is interpreted by the ROM routine and played accordingly.

 

All lists are started with a byte count value of how many to process, not including the duration byte at the end.

 

There are commands to "Pass this frequency to voice #1", or "change the attenuation (volume) of voice #1 to this". There are also a few commands to redirect to a different area of memory for the next sound bit.

 

All of them are ended with a duration byte, which indicates how many 1/60 seconds to play. A duration of 0 is the null terminator for the list.

 

 

  • Like 1
Link to comment
Share on other sites

1 hour ago, Mike Harris said:

That's cool..but what does the gibberish > mean?
It looks like a CPM command prompt.

And what is a Sound List?

 

 

For understanding the low-level details of the SN76849 chip, check out the datasheet here:

 

http://www.primrosebank.net/computers/mtx/projects/mtxplus/data/SN76489.pdf

 

 

BYTE >03,>CA,>2F,>D1,>0C

Your sample, as interpreted by most sound list players, means:

 

03 number of sound chip command bytes

CA  or 1100 1010 : the first bit is set, so it is a command. The next bits are 100 which mean period of tone generator 3 (of 3). The last 4 bits, A, are part of the tone period.

2F  or 0010 1111 : the first bit is 0, so it  is a 2nd data byte for the last tone command.  Putting them together makes 2FA. (yeah, weird order)

D1 or 1101 0001: first bit set, so its a command. The next bits are 101 which mean volume of tone generator 3 (of 3). The last 4 bits, 0001, are volume (0 is loudest).

0C is the number of ticks (1/60th second) to wait until processing the next section. By convention, a 0 time means stop. (I think.)

 

The tone period n = 2FA is from a table we all use for musical frequencies. The frequency is from f = 111860.7813 / n

 

So f = 147 Hz, which is D below middle C (middle C is 262 in the usual table.)

 

The constant 111860 is from the input clock source. On the TI-99/4A it's derived from the video frequency, 3.579545 Mhz / 32.

2FA means one square wave cycle takes that many clock ticks.

 

 

 

 

A sound list is typically played by putting its address in >83CC and setting 1 at >83CE. The console interrupt routine sees that and starts playing it. 

(your code must have a loop that enables interrupts briefly.)

Reference: see Sound List on http://www.unige.ch/medecine/nouspikel/ti99/ints.htm 

 

 

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

16 hours ago, Mike Harris said:

I just don't get it.

First you have something labelled as such.
       BYTE >03,>CA,>2F,>D1,>0C

I understand Assembly language on other systems such as

DB 003H,0CAH,02FH,0D1H,00CH

 

Would this be the same?

Then the basic idea of writing music and converting it to data.
My desire is to transfer or as you were TRANSLATE TI99/A to play on the Colecovision.
Sure, different chips but still an A, B or even a C# has an equivalent on both systems.

Thoughts, comments?
 

@adamantyr rolled his own sound system.. I think we all do that eventually.

 

Here is one that I've worked with recently. It's pretty memory heavy, it's based on the old FORTI music system, but it makes music pretty easy to code (especially ripped from MIDI files.)

 

https://github.com/olsone/games/tree/master/9d9damashi

 

Note lists and volume envelopes are separate.

For example, see fugue.a99 which has three note lists (corresponding to 3 simultaneous voices). Format is note number, duration.

 

 
FUGUE3
 BYTE 63,36
 BYTE 0,12
 BYTE 63,132
 BYTE 0,12
 BYTE 51,48
...
FUGUE4
 BYTE 54,36
 BYTE 0,12
 BYTE 54,132
 BYTE 0,252
...
FUGUE5
 BYTE 58,36
 BYTE 0,12
 BYTE 58,132
 BYTE 0,255
 BYTE 0,249
 BYTE 70,12
...

 

The note numbers here are MIDI numbers where 60 is middle C. 0 is a rest.

48 here is the time in ticks. If duration is 255, add the next duration byte too.

My quarter note definition is 48. By default, 48 ticks is 48/60 seconds.

You can vary the tempo by adjusting the variable DEL. It makes time pass at the rate DEL/32.

 

 

The player is in music.a99

This contains some crappy volume envelopes like this one:

ORGAN3 byte 0,4,5,6,7,8,7,6,5,>81

Ignore the 0 byte.. the volume varies each tick, going softer from 4 to 7 and louder to 5. The >81 means loop to byte 1. This simulates what a real pipe organ does.


(Also, the variable DYN adjusts all volumes up or down.)

 

Music is started by code like this:

BL @FUGUE

; restart the fugue	
FUGUE 
    lwpi MUSWS1
	li   NTP,FUGUE3
	li   ATS,ORGAN3
    lwpi MUSWS2
	li   NTP,FUGUE4
	li   ATS,ORGAN3
    lwpi MUSWS3
	li   NTP,FUGUE5
	li   ATS,ORGAN3
    lwpi VDPWS
    mov  @SLOW,@DEL
    rt

 

This starts each of 3 voices playing with the ORGAN3 effect.

 

I spent about 15 minutes coding this fugue by ripping a MIDI file with midi2csv and Excel. The other music in there, coda.a99 was much more involved. They are still very basic though.

 

Oh yeah.. listen to the result at 

 

  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...