ChanServ changed the topic of ##yamahasynths to: Channel dedicated to questions and discussion of Yamaha FM Synthesizer internals and corresponding REing. Discussion of synthesis methods similar to the Yamaha line of chips, Sound Blasters + clones, PCM chips like RF5C68, and CD theory of operation are also on-topic. Channel logs: https://freenode.irclog.whitequark.org/~h~yamahasynths
andlabs has quit [Read error: Connection reset by peer]
andlabs has joined ##yamahasynths
balrog has quit [Quit: Bye]
balrog has joined ##yamahasynths
<cr1901_modern>
ValleyBell: Do you know any tools that allow you to write your own VGM commands to a file quickly and then compile them into a small VGM for testing?
<Wohali>
cr1901_modern: sorry, got ill. will try and get the emails out over the long weekend
<cr1901_modern>
Wohali: No worries :)! Feel better!
<ValleyBell>
I usually just use a hex editor though.
<ValleyBell>
It's easy if you set the EOF offset to 0.
<andlabs>
I forget what I did for the sansan VGMs
<andlabs>
but I did use some sort of vgm to text thing for that one
<andlabs>
that was ages ago
nukeykt has joined ##yamahasynths
mofh has quit [Remote host closed the connection]
_whitelogger has joined ##yamahasynths
bofh_ has joined ##yamahasynths
bofh_ is now known as mofh
cr1901_modern has quit [Ping timeout: 246 seconds]
cr1901_modern has joined ##yamahasynths
cr1901_modern1 has joined ##yamahasynths
cr1901_modern has quit [Ping timeout: 246 seconds]
<cr1901_modern1>
ValleyBell: Hmmm fair
cr1901_modern1 has quit [Quit: Leaving.]
cr1901_modern has joined ##yamahasynths
<cr1901_modern>
nukeykt: The internal sine table for OP* is 10 bits. But is the phase accumulator also 10 bits w/ an "increment enable", or are there extra bits which are discarded when reading out a sine table entry
<nukeykt>
PG is 20 bit on OPN(OPM?) and 19 bit on OPL. 10 MSB bits go to sine LUT other bits are ignored
<cr1901_modern>
okay thanks. I'm trying to rederive the analog equivalent FM synthesis equations for the OPN/M and I ran into a snag
<cr1901_modern>
When a modulator operator's output is at its positive peak, it will be equal to 0x1fff (14 bit signed output).
<cr1901_modern>
are the lower 4 bits of the operator output discarded when calculating the phase that gets sent to the sine table (to generate carrier output)?
<cr1901_modern>
Okay I think yes, the lower 4 bits are discarded
<cr1901_modern>
I made a mistake somewhere. But I don't understand how a 14-bit signed output is fed back into a 10-bit input without dropping 4 bits somewhere
<cr1901_modern>
but that only works for operators w/o feedback
<cr1901_modern>
Anyways, since the sine LUT is 10 bits, and operator output is 14 bits, discarding 3 MSB makes sense because sin(t) = sin(t + 2*pi). 1024 corresponds to 2*pi
<cr1901_modern>
nukeykt: Alright, I'll be explicit what I'm trying to calculate
<cr1901_modern>
Given that the phase generator of an operator is incrementing at a certain rate (increment by "n" per sample, "n" isn't really important here), I've empirically verified that the modulation part of the operator input will increment at a maximum of 4 times faster than the phase generator (TL=0)
<cr1901_modern>
I'm trying to figure out where the "4" multiplier comes from
<cr1901_modern>
nukeykt: If you want the example I used, create an instrument with the following parameters:
<cr1901_modern>
algorithm 4, TL=127 for operators 2 and 4
<cr1901_modern>
for operators 1 and 3, AR=31, DR/SR/RR=0, MUL=1, TL=0
<cr1901_modern>
leave everything else alone
<cr1901_modern>
The following Python code results in a waveform with the same shape as the instrument above: https://imgur.com/OerZdMS
<cr1901_modern>
and I'm not sure where the 8*pi (4*2*pi) comes from
<nukeykt>
Maximum amplitude of operator is 8168, so (8162>>1)=4084 which is around 1024*4, i didn't quite understand your question tbh
<cr1901_modern>
nukeykt: Let me try again. You know the "traditional" equation for FM synthesis/phase modulation?
<cr1901_modern>
It looks something like this: f(t) = sin(2*pi*f_c*t + A(t)*sin(2*pi*f_m*t))
<cr1901_modern>
A(t) is ADSR function
<cr1901_modern>
f_c is carrier frequency, f_m is modulator frequency
<cr1901_modern>
does this ring a bell?
<nukeykt>
yeah
<cr1901_modern>
So I'm going to simplify this equation.
<cr1901_modern>
since the shape of the output is all I care about, the actual valus of f_c and f_m don't matter
<cr1901_modern>
still make sense?
<cr1901_modern>
Or rather, are my simplifications reasonable
<nukeykt>
oh yeah, got it
<cr1901_modern>
The question I'm trying to answer is: If I set ADSR constant, and f_c = f_m, and TL=0, what's the value of "A"
<cr1901_modern>
Empirically, I know the answer is A=8*pi, but I'm having quite a bit of trouble deriving it
<superctr>
i think you should look at the datasheet
<superctr>
the multiplier setting affects the frequence for that operator
<cr1901_modern>
MUL=1 for our purposes
<superctr>
very simplified, Fop = Fch * mul + dt
<superctr>
the special case is that if MUL=0, it's 0.5 instead
<nukeykt>
Let me try to explain it. Operator output amplitude is 8168. LSB bit is dropped before it goes as modulator input (i.e amplitude is 4084 now). Sine lut is 10 bit, i.e 1024 is equal to 2*pi, so (4048/1024)*2*pi results to 8*pi. Does this make sense?
<cr1901_modern>
nukeykt: Yes, and now I remembering how I derived this in the first place
<cr1901_modern>
(Except I didn't know the LSB is dropped and nemesis' original diagram doesn't mention this)
<cr1901_modern>
nukeykt: If the maximum amplitude of the operator is 4084 after shifting, then it follows that to get to that value over a period of time, the operator output has to wrap the sine LUT 4 times
<cr1901_modern>
(since the sine LUT is only 10 bits)
<cr1901_modern>
by contrast, to reach the maximum value in the phase generator, the output needs to only reach the maximum of the sine LUT once
<cr1901_modern>
nukeykt: Is the LSB dropped if the operator goes out to the final accumulator, or does the accumulator "see" a 14-bit value?
<cr1901_modern>
oh wait... this doesn't apply for YM2612 nevermind
<nukeykt>
I've looked at YM2610 die shot once, and yeah it drops LSB
SceneCAT has joined ##yamahasynths
<cr1901_modern>
the YM2151 manual says the accumulator takes a 14-bit value in. Might be different between OPN and OPM
<nukeykt>
I guess MAME ym2151 have this properly emulated
<superctr>
MAME's ym2151 has some weird errors
<superctr>
for the most part it sounds correct
<superctr>
but some instruments sound different on real hardware
<cr1901_modern>
I'm still looking for the indication other than "common lore" that the LSB is dropped when an operator's output is used as an input
<cr1901_modern>
it's not in the YM2151 application manual, that's for sure :P
<nukeykt>
Probably some error in EG code or LFO code. Those are hardest part to get emulated properly. I once was writing cycle accurate ym2151 core but i could not figure out LFO logic and stuck
<superctr>
it looks like the other timer is clocked by the first
<nukeykt>
Meh, i don't remember, this code was written in 2017
<cr1901_modern>
I guess my question after all this is: I suspect dropping the LSB from the operator output when feeding it into the operator input was a deliberate design decision when planning out the silicon. Contrast to "dropping 4 MSBs".
<cr1901_modern>
I wonder why this choice was made.
<superctr>
save space? narrower bus
<cr1901_modern>
dropping 4MSBs has the same effect on bus width as "dropping 1LSB and 3MSBs" I think
<cr1901_modern>
At least Sunday is a good day to mull over pedantic shit like this
<cr1901_modern>
Just for my own information/the logs: The YM2608 gives enough info to calculate the width of the accumulator- it provides an equation to convert from frequency to keycode/f-number
<cr1901_modern>
the YM2151 docs, on the other hand, do _not_ have this info
<cr1901_modern>
YM2608 docs give enough info*
<cr1901_modern>
Anyone know whether it's possible to get in contact w/ the MAME ppl who originally wrote the YM2612 core? (cc: Sarayan) I am definitely curious how they figured out LSB of each operator output is dropped when used on another operator's input (and ditto for the YM2610 output accumulator)