CPCWiki forum

General Category => Programming => Topic started by: arnoldemu on 18:42, 25 January 10

Title: AYC player
Post by: arnoldemu on 18:42, 25 January 10
I need some help with the AYC player.

Some questions:
1. After the YM data is compressed into a form the AYC player can use, there is a list of 2 possible choices for each of the AY registers. I am free to choose the one which is smallest.. but does this mean the music playback will not be exact? I don't really understand why I need to make a choice here.

2. I've got the source in ascii form and I can build it and play some music. What is the maximum maximum memory required for the decompress buffer?

3. I need to modify it so that I can tell it to poke values into my own buffer. I will then send values to AY myself. Can anyone give me any hints about how I can modify the player to do this?


Thanks
Title: Re: AYC player
Post by: Grim on 19:55, 25 January 10
Quote1. After the YM data is compressed into a form the AYC player can use [...]
As far as I remember, you can choose between two sizes for the decompression buffers, #100 or #400 bytes long. It will affect the compression ratio (a larger buffer usually gives better ratio) and memory footprint of the player.

Quote2. What is the maximum maximum memory required for the decompress buffer?
With #400 bytes long buffer for each AY-registers, that's 14Kb (14 registers).

Quote3. Can anyone give me any hints about how I can modify the player to do this?
Just had a quick look at the source and... it really looks like a cryptic piece of Z80 assembly :)

The player generates a speed-code that send values to the AY3 (near label PLAYREG). You can find the code-pattern for the speed-code from labels MODELE to MO2_END.

I think the easiest solution would be to figure out how the speed-code works (especially how it handles the buffer addresses to fetch it's data) and hook your custom routine at label PLAYREG.
Title: Re: AYC player
Post by: RockRiver on 13:05, 02 June 11
Needed assembler help to play AYC files with TSP...

AYC is the standard in Chiptune inside a real CPC...

-The player: Dual Module Player (http://cpc-power.com/index.php?page=detail&num=5251) by Hermol / CPCRULEZ (http://cpcrulez.fr/applications_music.htm)
-Util in 32bit system to YM2AYC conversion: YMcruncher (http://cpcrulez.fr/zip/index.php?download=0206xx594d4372756e636865725f77696e646f77735f302e382e7a6970) by F-key (http://revivalcpc.free.fr/ressources/fichiers/outils/YMCruncher.html)

-And a "new" player AYC capable: TSP - The Soundtrakker Player (http://tj.gpa.free.fr/html/product/tools.htm) by Tom et Jerry/GPA (http://tj.gpa.free.fr/html/coding/rip_zik.htm), [can show files, time, playlist...] Good looking graphical interface... AY channels led meter...

TSP needs special header to recognize AYC files:  (I'm not a coder, only a musician, I can not make it :( ...
Some coder can easily make a generic header to "paste" inside WinAPE or WinCPC maxam assembler at the begining of an AYC file... please I don't understand nothing of this:

from tsp.dsk readme.txt file:
                   >>>> The Soundtrakker Player 1.4 <<<<

                     T&J du GPA (c) 1994, 1997, 2003 !

What is a generic music ?
-------------------------
Looking at new music files (like AYC musics), I have addedd the possibility to
read them if their INIT and PLAY addresses are in the first six bytes with
JUMP instructions (&C3 xx xx &C3 xx xx).
It is not quite technical, but that is better than nothing.

What is a TSP/TSP 128 music ?
-----------------------------
This new kind of file gives TSP the capability to play many more commercial
musics than the 'generic' one. Unfortunately, it is more complex to create,
that seems after all logical. Machine code knowledges are welcome...

A TSP file is basically a generic music, with a special header. It can be
loaded in the main memory (like a generic music) or in the extended
memory. In this case, TSP uses the ALTERNATE mode (OUT &7F00,&C2), that
creates a second 64kb ram with the extended memory. So it is possible to
play musics in the video memory or in the system memory (&A67B-&BFFF)
without any problem.

Another great interest of this kind of file, TSP can plays all the tunes
in a file (many commercial music files have more than one tune).

Here is a complete explanation about the header datas of a .MZL file (
default extension of a TSP file). Take an aspirin first !


Bytes 0 to 2 : hexadecimal string  &54 &53 &50 ( = TSP !)

Byte 3       : memory area where to load the music file :

              &C0 = file is loaded in the main memory (&0040 - &9300)
              &C5 = file is loaded in the extended memory bank &C5
              &C7 = file is loaded in the extended memory bank &C7

Byte 4       : number of musics in the file (1 to xx)
Byte 5       : default music to play

Bytes 6 and 7   : INIT address of the music
Bytes 8 and 9   : PLAY address of the music
Bytes 10 and 11 : original loading address of the music
Bytes 12 and 13 : original length of the music

Bytes 10 to 13 are not used by TSP to play the music. They are displayed when
the music is played in the information window.

Important !!! All these values are in hexadecimal !

The following bytes (at last bytes 14 and 15) are used to store musics duration
in minutes/seconds. These informations are used by the "playlist" mode.

After this list of word(s), TSP is looking for a piece of code (decrunching
routine or instructions like LDIR... ). If you don't need to call a routine
to organize the music in memory, you must put the value &C9 (RETURN in machine
code).

After this routine, there is at last the music code ! If you want to crunch
the music file, I recommand you Turbo Cruncher from Elmsoft.


Let's have a look back on the fourth byte of the header, this is REALLY
important :

- &C0 value  : TSP read the loading addresse of the file and load it in the
                main memory. Nothing special.

- &C5 value  : the file is ALWAYS loaded in &4000 in the second extended
                memory bank. The music is played with a little routine
                in &40. The free memory area for your music is &0100-&3FFF
                and &8000-&FFFF.

- &C7 value  : the file is ALWAYS loaded in &C000 in the fourth extended
                memory bank. The music is played with a routine in &BE80.
                The free memory area for your music is &0040-&BE7F.

For the two last values, there will be always a routine that organizes the
music in memory.

When the program call the INIT address of a music, it sends the number
of the music to play in the register A (number of the music - 1). If the
init code needs another information, you must program a little piece of
code that will make the link between TSP and the music code.

Limit :
*******
A TSP file can have a maximum length of &4000 bytes. If the file is too big,
pack it !



Header messages
---------------
Tsp can read little message in the file headers. Nice to know who has
composed the nice music you listen.. If you wanna make you own compilations
with headers :

        Bytes &4D to &4F : Id string "TsP"
        Bytess &50 to &7F : message (no ASCII char lower than 32 or upper
                            than 127).

The way to calculte a music duration
-------------------------------------
Listen the music with TSP and note the value of the timer when the music starts
again or stops.

Example : consider a file with one tune of 2 minutes 30 seconds. The result to
put in your .MZL file or your playlist is :

                       byte 14 : 2 (2 minutes)
                       byte 15 : &1E (30 seconds in hexadecimal)

Please note that in a TSP music file, values are always in hexadecimal !
Title: Re: AYC player
Post by: redbox on 13:23, 02 June 11
Quote from: RockRiver on 13:05, 02 June 11
Some coder can easily make a generic header to "paste" inside WinAPE or WinCPC maxam assembler at the begining of an AYC file... please I don't understand nothing of this:


Well, you could do it with some DEFB/DEFW commands which will 'poke' the necessary codes into memory and this can be assembled with WinApe, Maxam etc.



org &7FF0                  ; &8000 - &10 (length of header)


defb &54, &53, &50         ; TSP header start
defb &C0                   ; Reads memory address (from AYC file) and loads it there
defb &01                   ; number of tunes in music file
defb &01                   ; default tune to play
defw &8000                 ; INITalise music address (from AYC file information)
defw &8030                 ; PLAY music address (from AYC file information)
defw &8000                 ; Loading address of music to display in tracker
defw &2000                 ; Length of music to play in tracker
defb &02                   ; Length of music in minutes
defb &1E                   ; Length of music in seconds
defb &C9                   ; End of header

;... AYC file...

Title: Re: AYC player
Post by: arnoldemu on 14:29, 02 June 11
Quote from: RockRiver on 13:05, 02 June 11
TSP needs special header to recognize AYC files:  (I'm not a coder, only a musician, I can not make it :( ...
Some coder can easily make a generic header to "paste" inside WinAPE or WinCPC maxam assembler at the begining of an AYC file... please I don't understand nothing of this:
Are you using windows?

I think all you want is an automatic way to generate a cpc file in a dsk...

e.g. arkos tracker->dsk (with a "default player" that can play it on cpc and see it running)?
Title: Re: AYC player
Post by: arnoldemu on 14:31, 02 June 11
Quote from: Grim on 19:55, 25 January 10

The player generates a speed-code that send values to the AY3 (near label PLAYREG). You can find the code-pattern for the speed-code from labels MODELE to MO2_END.

In the end I did patch these MODELE functions to do my own code and it worked, but in the end I didn't need to use that code ;)
Title: Re: AYC player
Post by: RockRiver on 10:21, 04 June 11
Thanks a lot for the answers.

My CPC system  still not able to run AYC files (with a new little header) inside Tom et Jerry's "The Soundtrakker Player". [This is the name of the program I don't want to play soundtrakker files but AYC ones... ]

That's my way of working, something is wrong?

- read info of AYC (bin) file in a header info reader.
load 0000
exec 0000

- "open" (disassemble AYC file with WinCPC's asembler option) in which memory Adress?? 0000? 8000? 4000?

- then I put "Redbox's header" or this other? for AYC like TomEtJerry readme.txt says for "generic" music:
               
                org &xxxx             ; which adress?

                defb &C3                   
                defw &xxxx            ;   which adress of INIT?               
                defb &C3                   
                defw &xxxx           ;   which adress of PLAY?
               
                 ; then AYC file

Now TsP recognizes the file but don't play nothing.... I'm trying with diferent memory adresses... here I'm lost

Maybe the AYC is compressed and don't work for that? I need decompress it first?
Disassembler with WinCPC is a good option?, another software?
I write an email to Tom et Jerry, and waiting an answer.

If I put winCPC disassembled ASM file in WinCPC Assembler for make a file BIN direct in the PC with write "*.bin". WinCPC assembler show errors... don't understand winCPC file... because some "  : " symbols behind  " ; "

Sorry for my assembler ignorance, these are my first steps... Thanks for your patience. I need go to study assembler soon.
Title: Re: AYC player
Post by: TomEtJerry on 19:14, 05 June 11
Hello,

That's a really nice surprise for me to discover that people still try to use TSP :-).

Well, Rockriver, your problem is quite simple. When you crunch an YM file with Madram's tool or with Fkey's YMcruncher , the output file has only datas. To use the music with TSP, you have to link it with the AYC player.

You will find in this message a image file that includes a Basic tool that do this little boring job. The final file is located in &2000, uses the ram area &1000 to &1FFF for buffering purposes. TSP detects it as "Generic" and can play it without any problem :-).

You only have to create MZL files when you want to play with Tsp binary music with more than one tune, or if the music uses unusual memory area (like video ram for example :-) ).

Yours.

T&J/GPA
Title: Re: AYC player
Post by: RockRiver on 13:11, 08 June 11
TomEtJerry, with your little basic program -LinkAYC.bas now I can transform and play AYC files with your MegaSoftware  8) CPC Music Player: The Soundtrakker Player (http://tj.gpa.free.fr/html/product/tools.htm)

You are my Hero!!!

Thanks all for your interest.

Now I want to put titles and autor like Spectrum's AYplayer SpeccAY on CPC... with *.MZL files we could... I start trying to make a header like Redbox's one to put titles... I am a disaster on Assembler...
(http://www.worldofspectrum.org/projectay/pics/speccyplayer.gif)Coming to a Screen, near you:
(http://www.grimware.org/lib/exe/fetch.php/documentations/software/soundtrakker/thirdparty/stk.tsp.v1.4.png)
Powered by SMFPacks Menu Editor Mod