Looking for YM Format FULL documentation

All about chiptunes

Moderators: lotek_style, Mug UK, Moderator Team

sebdel
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 119
Joined: Fri Dec 30, 2005 9:29 am

Looking for YM Format FULL documentation

Postby sebdel » Mon Apr 16, 2018 11:33 am

Hi,

I'm late to the "drive an YM with an arduino" party, but I'm having a lot of fun right now. I got the basics working (playing an ym file), but now I would like to improve the sound quality and special effects support. My plan is to make full use of the arduino hardware, esp. the 3 programmable timers to emulate the MFP timers and implement as much advanced techniques as possible.
From what I can tell, the YM format official doc is here: http://leonard.oxg.free.fr/ymformat.html but this is rather short on details.
I got a bit more information there: https://github.com/skeezix/zikzak/blob/master/zik80/audio-gen/ym-file-format.txt, but that's still not enough to get proper digidrum support.
One question I have for example: What's the point of the virtual regsiters r15 and r16 if you also have the MFP TP and TC encoded in the leftover bits of regular registers ?
Other questions: How do you play digidrums anyway ? Just write 4 bits to the volume register at a given freq ?
How do you play Timer Synth (TS)? How come you can have DD and TS simultaneously at different freq ? Is sid effect even part of the YM format ? etc...

There must be some kind of doc somewhere right ? Alternatively, source code for a feature complete player would do :wink:

Any help appreciated !
Seb

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 998
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Looking for YM Format FULL documentation

Postby FedePede04 » Mon Apr 16, 2018 1:58 pm

hi
all the ym files that contain special FX like digi drums, sid ect. are hand made by leonard, he use reg 15 and 16 to trigger those FX. can't remember so much about his format. one way to play samples in YM mode is like you said change the volume using 4 bit samples.
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 4997
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Looking for YM Format FULL documentation

Postby simonsunnyboy » Mon Apr 16, 2018 3:51 pm

The YM format is known for not capturing sampled data correctly as it samples the registers at 50Hz, too slow for true digi sample replay.

Otherwise IMHO these are the most complrte descriptions I have seen sofar, esp. the one by skeezix. I doubt there are documents going even deeper.

If you find them, please post them here for reference.
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

sebdel
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 119
Joined: Fri Dec 30, 2005 9:29 am

Re: Looking for YM Format FULL documentation

Postby sebdel » Mon Apr 16, 2018 4:32 pm

Thank you guys. Right after I posted this, I found the source code for StSound. That's as good as it gets I'm afraid. God, I hate C++ so much (and I'm writing js code these days) :(

re: YM format limitations, I'm aware of them but like many hackers on the internet I just take the easy road. The time-to-first-bleep is just way better with ym ;)
Once everything works I'll consider sndh. I'll just stream the registers over serial in this case, so I'm not sure if the maximum refresh rate will allow all the fancy effects.

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 998
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Looking for YM Format FULL documentation

Postby FedePede04 » Mon Apr 16, 2018 4:42 pm

simonsunnyboy wrote:The YM format is known for not capturing sampled data correctly as it samples the registers at 50Hz, too slow for true digi sample replay.

Otherwise IMHO these are the most complrte descriptions I have seen sofar, esp. the one by skeezix. I doubt there are documents going even deeper.

If you find them, please post them here for reference.


you don't have the samples in the YM stream you have the digi drums as samples beside of the Ym stream.
you use reg 14 or reg 15 in the Ym stream to trigger the samples.

you can see it here.
http://leonard.oxg.free.fr/ymformat.html
Last edited by FedePede04 on Mon Apr 16, 2018 6:23 pm, edited 1 time in total.
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 998
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Looking for YM Format FULL documentation

Postby FedePede04 » Mon Apr 16, 2018 4:46 pm

sebdel wrote:Thank you guys. Right after I posted this, I found the source code for StSound. That's as good as it gets I'm afraid. God, I hate C++ so much (and I'm writing js code these days) :(

re: YM format limitations, I'm aware of them but like many hackers on the internet I just take the easy road. The time-to-first-bleep is just way better with ym ;)
Once everything works I'll consider sndh. I'll just stream the registers over serial in this case, so I'm not sure if the maximum refresh rate will allow all the fancy effects.


try look at this page, there is a lot of stuff about AY player, its nearly the same as the YM ST sound, i think he use to have some pascal code for it...
https://bulba.untergrund.net/emulator_e.htm
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 4997
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Looking for YM Format FULL documentation

Postby simonsunnyboy » Tue Apr 17, 2018 3:46 pm

FedePede04 wrote:
simonsunnyboy wrote:The YM format is known for not capturing sampled data correctly as it samples the registers at 50Hz, too slow for true digi sample replay.

Otherwise IMHO these are the most complrte descriptions I have seen sofar, esp. the one by skeezix. I doubt there are documents going even deeper.

If you find them, please post them here for reference.


you don't have the samples in the YM stream you have the digi drums as samples beside of the Ym stream.
you use reg 14 or reg 15 in the Ym stream to trigger the samples.

you can see it here.
http://leonard.oxg.free.fr/ymformat.html


That evolved format can'T be played back with a simple play routine then.
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 998
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Looking for YM Format FULL documentation

Postby FedePede04 » Tue Apr 17, 2018 3:59 pm

simonsunnyboy wrote:
FedePede04 wrote:
simonsunnyboy wrote:The YM format is known for not capturing sampled data correctly as it samples the registers at 50Hz, too slow for true digi sample replay.

Otherwise IMHO these are the most complrte descriptions I have seen sofar, esp. the one by skeezix. I doubt there are documents going even deeper.

If you find them, please post them here for reference.


you don't have the samples in the YM stream you have the digi drums as samples beside of the Ym stream.
you use reg 14 or reg 15 in the Ym stream to trigger the samples.

you can see it here.
http://leonard.oxg.free.fr/ymformat.html


That evolved format can'T be played back with a simple play routine then.


i don't know about the ST sound (YM) i have never done it, i have just read that leonard hand made all the YM files with samples, sid and sync buzzer included.
i have done something similar i am just using STE samples, and that routine is still pretty simple.
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

sebdel
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 119
Joined: Fri Dec 30, 2005 9:29 am

Re: Looking for YM Format FULL documentation

Postby sebdel » Tue Apr 17, 2018 4:51 pm

simonsunnyboy wrote:
FedePede04 wrote:
simonsunnyboy wrote:The YM format is known for not capturing sampled data correctly as it samples the registers at 50Hz, too slow for true digi sample replay.

Otherwise IMHO these are the most complrte descriptions I have seen sofar, esp. the one by skeezix. I doubt there are documents going even deeper.

If you find them, please post them here for reference.


you don't have the samples in the YM stream you have the digi drums as samples beside of the Ym stream.
you use reg 14 or reg 15 in the Ym stream to trigger the samples.

you can see it here.
http://leonard.oxg.free.fr/ymformat.html


That evolved format can'T be played back with a simple play routine then.


True but still easier than emulating half a ST. It also makes more sense in the context of AVR-YM players because you have actual HW, w/ real timer interrupts driving real YM registers. The YM format is descriptive, it just tells you how to setup your hardware. Anyway, I still plan to support sndh purely in 'stream the registers' mode.

User avatar
Foxie
Captain Atari
Captain Atari
Posts: 354
Joined: Wed Feb 03, 2016 7:12 pm

Re: Looking for YM Format FULL documentation

Postby Foxie » Thu Apr 19, 2018 8:24 pm

sebdel wrote:Other questions: How do you play digidrums anyway ? Just write 4 bits to the volume register at a given freq ?
How do you play Timer Synth (TS)?


I don't know about the YM format, but I can tell you how I play samples. I set a channel to the highest frequency (=0), tone enabled and noise disabled. Then I just write the four bit sample data to the volume register. For playing back 8 bit samples, you use all three channels simultaneously with a lookup table to find the right volumes.

I don't know much about SID effects either. I tried using sync buzzer by setting the envelope to highest speed and retriggering every timer interrupt. It works, but inflexible and not very good sound. The next slowest envelope speed is too slow to be useful. In FOXIE_YM, I'm doing SID waveforms by playing back a looped sample of the wave shape. You can approximate a sawtooth with only eight steps. The timer doesn't need to run very fast, only 8kHz for a 1kHz sawtooth. You can do various pulse waves with that technique.

If you want more than one SID waveform simultaneously it will be difficult. You could use two timers, but each interrupt service routine needs to be very fast. Otherwise one may block the other for too long and cause artifacts in sound.

I use this routine for my ISR, it takes about 150 cycles. It's about 19us, you can block another timer for that long without damaging the sound much.

Code: Select all

timer_d_isr_steps equ 8

timer_d_isr_mac MACRO
    move.l #$08000000,ym_base.w
    move.l #\1,timer_d_vector.w
    move.b #$ef,mfp_int_in_service.w
    rte
    ENDM

timer_d_isr:
    rsreset
.first:
    rs.b timer_d_isr_len
    timer_d_isr_mac .first+__RS
.second:
    rept timer_d_isr_steps-1
    rs.b timer_d_isr_len
    timer_d_isr_mac .first+__RS
    endr
.last:
    timer_d_isr_mac .first

timer_d_isr_len equ .second-.first


You self-modify the immediate data on the first instruction to change the wave shape.

sebdel
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 119
Joined: Fri Dec 30, 2005 9:29 am

Re: Looking for YM Format FULL documentation

Postby sebdel » Fri Apr 27, 2018 7:38 pm

Sorry for the late reply and thanks for all the details, this is the sort of things I'm looking for. I found that Gwem's tutorials about maxymizer were also invaluable in understanding all those advanced effects.
Lately I realized that if I want to drive the YM "perfectly", merely streaming registers from the PC won't cut it. There's just too much random variation when the PC is busy, even with a powerful PC, even for a 50Hz tune.
So, plan B, I will use the Arduino timers to reproduce the MFP interrupts. I'll also add a 32KB SPI RAM module to store the digidrums. So, even the hardware is not complete ;)
It's unfortunate that nobody produces ym files anymore. When/if this project works out as I intend, I'll see if I can turn sc68 in a ym6 generator :P


Social Media

     

Return to “Ym rockin'”

Who is online

Users browsing this forum: No registered users and 1 guest