It is currently Mon Dec 17, 2018 2:52 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 52 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: Mon Sep 03, 2018 12:00 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7025
Location: Canada
So I knew for a long time that both the VRC7 and 5B had some amplifier stuff to be worked out, and it's been on my list to investigate for a long time. I've run a few tests today that had interesting results. I haven't really fully analyzed them, but I thought I should share in case anyone has any good ideas for how to approach testing this stuff.

All mentioned test ROMs are here on github.


1. VRC7 seems to have flat clipping that begins at slightly less than 2x the full volume of 1 channel. This means if I play 2 channels at the loudest volume, there will be some distortion.

The clip_vrc7 test ROM creates a sine wave instrument, plays it on 1 channel at full volume, then 2 at once, then 3 at once, etc. In this recording we can see clipping begins on the bottom part of the wave only at 2x (an internal bias?), and then clipping on both ends at 3x and higher. Finally a triangle wave is overlaid to demonstrate that this clipping only applies to the VRC7 portion of the sound, the input audio appears to be passed through unharmed.

Recording is attached.


2. 5B is much stranger. I don't know how to describe what this is doing. I don't think there is clipping, but there seems to be some sort of compression effect?

The clip_5b test ROM creates 3 squares at 110, 220, 440hz, plays them together at volumes 9,A,B,C where they seem to mix together normally / linearly. Next it starts from 0 and gradually increases volume to 15 for each channel in turn. For the first channel, we see very nice 3db steps like expected, but the very last step to volume 15 isn't quite as wide. As the next two channels fade themselves in, the overall volume does increase a bit, but it seems to be squashed. Finally an APU triangle is overlaid at ~470Hz. This triangle is audible, but when I cut off the 5B squares, suddenly its volume grows? It seems to take about 30ms to reach its full volume after the loud squares have left.

Attachment:
triangle_returns.png
triangle_returns.png [ 5.22 KiB | Viewed 3955 times ]


So, this is a bit bizarre. I guess this is some sort of compressor, but how should I go about trying to test it and properly replicate its behaviour?

Kinda mad at myself for not digging into this sooner. I noticed the compressed look of Gimmick's audio when I recorded its soundtrack a while back, and I even adjusted the log tables in NSFPlay's 5B simulation to match the squashed volumes 15 and 14.5 I had seen in testing (yes, a real hack job for sure). Had a note to go back for it later, but my priorities had been elsewhere for a few years...

(Also, I made a revision to my audio survey test for 5B. Since the output seems reliably linear for a single channel below volume 15, I replaced the full volume test with volume 12. This also meant a revision to the new 'mixe' chunk I'd proposed, but hopefully nobody's actually using it yet.)

Wanted to stack 3 squares of the same pitch in-phase, but being able to phase reset on the 5B continues to elude me. I thought I could get it by setting the period registers to 0 or 1 to get them in a short loop and then setting the final pitch on all 3 very quickly would do it, but this didn't work like I thought it would (phases still seemed "random"). Kinda curious about how they're actually implemented internally... has there been a decap / analysis of the AY at any point?


3. It appears that it's actually possible to reset the VRC7 LFO!

lidnariq asked on the wiki what the $E000:6 audio disable bit did. I did an initial test and found that it silenced the audio, and setting that bit appeared to "clear" the custom instrument (not sure what the "clear" values are, since I can't read it back) and any playing tones. Clearing that bit makes it operate again.

Today I tried playing an instrument with tremolo following such a toggle, though, and discovered that it was reliably playing with the same tremolo phase every time!

So, that's not very useful for playing music (since you're basically flipping the whole unit off and on), but I think if I put this into the VRC7 Tuner I might be able to make better progress on the patches that use tremolo/vibratio, since their free-run nature has always made them very difficult to compare with.

I'm not sure how long it takes to go into effect. The lfo_vrc7 test waits about a frame between setting the bit and clearing it, and then another frame before playing the note. (I was being conservative.) My guess is that the delay we use for other VRC7 writes is probably about how long it takes, but at least I've discovered that it can be done.


None of this really matters for Lagrange Point or Gimmick!, since they don't use loud volumes like this. Even homebrew doesn't usually use VRC7/5B at their loudest since they overpower it anyway. This is "subtle" stuff in terms of utility, not really a big problem if an emulator is missing it, but we still want to know don't we? ^_^

(Also, in case anyone is wondering, I haven't seen an effect like this on the other 4 expansions, so I don't think there's any worry of discovering something like this with any of those.)


Attachments:
File comment: source code and ROMs for clip_5b, since I will revise the test on github later
clip_5b_v1.zip [3.1 KiB]
Downloaded 134 times
File comment: full recording of clip_5b test
clip_5b.zip [3.3 MiB]
Downloaded 133 times
File comment: full recording of clip_vrc7 test
clip_vrc7.zip [927.69 KiB]
Downloaded 135 times


Last edited by rainwarrior on Mon Sep 03, 2018 11:35 am, edited 2 times in total.
Top
 Profile  
 
PostPosted: Mon Sep 03, 2018 12:27 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7833
Location: Seattle
rainwarrior wrote:
2. 5B is much stranger. I don't know how to describe what this is doing. I don't think there is clipping, but there seems to be some sort of compression effect?
We do know that there's an amplifier inside the 5B. I'd be a little surprised if it's got a compressor on it, since it has an external resistor, but... your evidence is really pretty inarguable.

Quote:
So, this is a bit bizarre. I guess this is some sort of compressor, but how should I go about trying to test it and properly replicate its behaviour?
Well, the time constant from the recording shows its recovery time, right?

You should be able to switch high-volume things on and off at some rate sufficiently faster than that to figure out its minimum gain. And given the minimum gain, you can figure out the maximum gain. And ... what other properties are there to a compressor? Knee, gain, compression ratio, attack and decay times?

Quote:
has there been a decap / analysis of the AY at any point?
The same Sean Riddle who helped with the M50805 decap took pictures of an AY-3-8910 here.

MAME's source mentions some analysis from decaps, as well as links to two more decaps beyond Sean Riddle's above, in its AY-3-8910 emulation.

Quote:
lidnariq asked on the wiki what the $E000:6 audio disable bit did. I did an initial test and found that it silenced the audio, and setting that bit appeared to "clear" the custom instrument (not sure what the "clear" values are, since I can't read it back) and any playing tones. Clearing that bit makes it operate again.
If it is the same as the YM2413's /InitialClear input, that part's documentation claims it clears all the registers.


Top
 Profile  
 
PostPosted: Mon Sep 03, 2018 3:24 am 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1786
Location: Gothenburg, Sweden
Not understanding anything about die analysis... so this might be redundant, but I think we can safely narrow down the range of possible compressor topologies to one of these.

-feedback VCA (voltage controlled amplifier) - very straightforward, cheap, simple, often the goto solution. Seems probable. Self-adjusting based on output rather than input. Ratio, attack and decay is a function of the signal and cannot be strictly defined. An approximation in emulation can still be good enough.
-feedforward VCA - also straightforward, not much more complex than the feedback variant. Often applied when you want precise ratio, attack and decay. but this is a relatively cheap consumer product - who cares? but if this topology was used, that's also good news for emulation - it could be potentially very precise.
-feedback diode bridge (as simple as it gets, potentially passive) - if badly matched (probably our case), they will produce a DC offset to the signal. If overdriven (not necessarily the case), they can cause distortion on 3rd harmonics. For this reason, simple diode bridges-as-compressors were largely abandoned in studio-grade equipment two decades before the famicom hit the market, but that doesn't necessarily mean it wasn't ever used again where fidelity was of no importance or where audio levels could be predicted, such as in a consumer product.

In your waveform snapshot, it looks like we have a dissipating DC offset in the release stage. This might be in favour of the third option, but honestly i know to little about EE to be able to verify/falsify. Is there any other way a dc offset component could be momentarily added to the mix like that?

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Mon Sep 03, 2018 9:10 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7025
Location: Canada
Thanks for the suggestions and thoughts. Here's day 2's update. (source code)

1. noise_vrc7

A recording of APU noise $3 (56kHz) against a high feedback "white noise" patch for VRC7. The lowpass filter for VRC7 is very clear here. A bit of highpass too I think. (Can analyze later.)

2. noise_5b

A recording of APU noise $3 (56kHz) against equivalent 5B noise (also 56kHz, same 32 CPU cycle count). Both are passing through the same filters here, and compared to the "unaltered" 2A03 noise in the VRC7 noise test above you can see evidence of a highpass, but no significant lowpass I think? (More to analyze later.)

3. clip_5v version 2

This one's more complicated to describe. I've created a table of 42 volumes, most of them roughly 1dB apart as a theoretical linear sum of the 3 channels. (0-7 apart are 3dB apart, but after that they're close to 1dB apart each, the last few are a little off from that ideal, there's an ODS with the source computing the theoretical linear sum of them all that I'll use to compare against the compressor output later when I analyze this.)

  • Step 1: Set volume of the 3 registers to output each of those 42 levels as DC. Then pop back to 0.
  • Step 2: Use a cycle counted square wave at each of those 42 levels.
  • Step 3: Step 1 with APU triangle throughout. (Shows compression release.)
  • Step 4: Step 2 with APU triangle throughout. (Shows compression release.)
  • Step 5: Full volume cycle counted tone on and off.
  • Step 6: Step 5 with APU triangle throughout.

A few notes on the compressor so far:

- The triangle indicates that compression is not affected by the slow DC offset. Assuming it applies after the highpass filter. (Step 3)
- The onset of compression seems to apply very immediately, judying by the effect on the triangle. (Final pop in step 3.)
- When the tones start to be compressed, they get extra compression at the offset, then widen out as the highpass brings them closer to 0. I theorize that the compressor is based on the peak signal after the highpass filter applies. (Later half of step 2.)
- Negative magnitude seems as effective as positive magnitude for triggering compression. (Final pop in step 3 as a positive step, step 4 onsets as negative, saw other onsets from negative in other revisions of this test I didn't publish too.)

Later I'm going to measure all the tones in step 2 and chart them against the theoretical linear mix. That should help find a suitable compression curve. We can measure the triangle's return to full volume to understand the release timing of the compressor (especially from step 6).

I think that might actually be enough to adequately describe this? Anyone have any thoughts?

I've never studied or tried to build an analog compressor, so I'm a little out of my element on my usual goal of trying to imagine what the simplest possible implementation looks like, but the stuff I mentioned above seems like it should be plausible from a relatively simple circuit? The compressor seems to roughly turning that exponential 1dB progression into a linear one just above volume 14 (31th volume in the progression), though I haven't yet charted it thoroughly. Is an approximate log to linear adjustment like that reasonable to implement?


One followup, I was asking about AY decap just because I didn't understand why I couldn't reset phase, but the MAME implementation I think makes it clear where my understanding of the results was wrong. I was trying to put them at a high frequency with the hope that when I switched to low frequency they'd restart the next wave slowly. However, the timer counter inside the AY is just a count of when to flip the bit, not a timer for the whole waveform. So, and given change could happen on either bit, so the phase wasn't random, it was randomly inverted. (This was borne out to be true by reviewing my earlier attempt.) MAME also answers my question about what period 0 does (i.e. same as period 1), which I'd assumed but was nice to have a confirmation. (This is wrong in NSFPlay's inheritend YM2149 emulation too.)


Attachments:
File comment: recording of clip_5b version 2 (mp3 for file size constraints, sorry)
clip_5b_v2.zip [1.5 MiB]
Downloaded 134 times
File comment: recording of noise_5b
noise_5b.zip [1.06 MiB]
Downloaded 133 times
File comment: recording of noise_vrc7
noise_vrc7.zip [1.04 MiB]
Downloaded 133 times


Last edited by rainwarrior on Tue Sep 04, 2018 10:03 am, edited 1 time in total.
Top
 Profile  
 
PostPosted: Tue Sep 04, 2018 2:04 am 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1786
Location: Gothenburg, Sweden
Quote:
Negative magnitude seems as effective as positive magnitude for triggering compression.


A typical compressor will pick up the signal as a so-called side-chain, rectify it so that all peaks have the same polarity, so the amplifier can act correctly on both poles. And it is common that it is then smoothed out with at least one slew limiting circuit to create an even control voltage to be used to diminish the amplification. It also sort of counteracts any DC offset here by averaging the peaks, if any plausible DC offset wasn't already counteracted/avoided altogether. Anyway, the slew limiter is responsible for attack and decay. A more elaborated compressor will have two different slew limiters for rising and falling signals (so you can set attack and decay separately) The capacitor will have some effect on the slew.

This article illustrates it:
http://www.audiotechnology.com.au/wp/in ... ide-chain/

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Tue Sep 04, 2018 4:57 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7025
Location: Canada
Here's some measured results from yesterday's test.

A graph of the predicted linear mix levels vs measured:
Attachment:
clip_5b_lin.png
clip_5b_lin.png [ 19.92 KiB | Viewed 3786 times ]

The same graph with logarithmic scale on both axes, cropping out some of the lower left to show the more interesting part where it diverges:
Attachment:
clip_5b_log.png
clip_5b_log.png [ 24.82 KiB | Viewed 3786 times ]

The linear mix prediction seems to match extremely well up to and including volume 14. Anything higher than that appears to be affected by compression. The measured levels were taken after the onset/highpass had settled into a symmetrical wave, so from the compressor's perspective I think it's should represent a map from a negative or positive peak that's 50% of the peak to peak difference. (As mentioned before, the onsets are more compressed, and widen back out as the highpass shifts it back to centre.)

On the logarithmic graph I threw an exponential trend line on the data points from (14,0,0) to (15,15,15). That seems to be a roughly 2.6:1 compressor if we assume a hard knee? I think the actual dB curve might be a little less straight, with the dB compression radio gradually increasing past the threshold.

As for my question about compressors, thanks for the link FrankenGraphics, though for the most part it doesn't really address the parts of this I don't understand. Like I understand that a compressor normally has an attack/release, a compression ratio, a hard or soft knee. What I don't understand is what are the analog components needed to build one, and which variation of that is most sensible to embed in an ASIC like the 5B. I can find several articles mentioning that there's variations like tube / optical / solid state / VCA / feed-back / feed-forward / etc. but I'm having a harder time finding information about the actual compression characteristics that belong to each of these.

I know it's normal for a compressor to work with both positive and negative peaks, I only mentioned the polarity because I didn't think it should be assumed as a given in this particular case, because the pre-filtered output of the 5B only lies on one side of 0. I don't know who designed this, or why they wanted a compressor in it, but skipping a rectifier seemed like a plausible possibility, so I wanted to explicitly rule it out.

Here's a digital model that these results seems to be conjuring for me:
Code:
1. A = PCM input signal
2. H = highpass(A)               ; will be used as pre-gain output, and input to the compressor sidechain
3. S = clamp(abs(H) - threshold) ; rectify H and cut off signal below threshold
4. C = lowpass(S)                ; lowpass S to generate the gradual release (will try to estimate this curve from recording later)
5. O = H * (1 - func(C))         ; output attenuates H based on strength of C, func() here is a placeholder for some approriate curve

I'm assuming there isn't a separate highpass for the compressor's control sidechain because the attack seems to be instant and match the output so closely, for similar reason I'd want to assume the lowpass is probably a very simple 1st order filter? (I'll probably need so spend some time thinking about this / experimenting, not sure if my intuition is correct here.) The remaining question is what kind of curve goes into "func" there, presumably some <1 constant raised to the power of the sample from C.

The biggest open question for me is the hard/soft knee thing. I'm assuming that there is a "typical" kind of soft knee curve that results naturally from a simple analog circuit. Is a hard knee easier or harder to make, or is there a simple/common wait to implement one? I can measure stuff as best I can and try to replicate it, but it would be nice to have a sound theory for what kind of curve I should be looking for here. (I'll try to find myself a suitable reference on compressor design... I found this one which seems pretty good so far. This article doesn't have much detail but there are some tantalizing graphs of a real analog compressor.)

...though, given the amount of data I have to work with and the amount of error there seems to be due to probably a bunch of intervening factors (in particular the assumption that all 3 channels mix equally and linearly) maybe it's splitting a little bit too fine a hair trying to determine the difference between a soft and hard knee here.


Top
 Profile  
 
PostPosted: Tue Sep 04, 2018 7:55 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7025
Location: Canada
Was trying to find information and ran across this PDF and I had to laugh.
Attachment:
compressor_filter_characterization.jpg
compressor_filter_characterization.jpg [ 100.66 KiB | Viewed 3762 times ]


Top
 Profile  
 
PostPosted: Wed Sep 05, 2018 2:05 am 
Offline
User avatar

Joined: Wed Feb 13, 2008 9:10 am
Posts: 667
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
A similar effect is present in SMS2, where one resistor value on the chip output is not quite right and cause flattening out of the highest levels due to way output mixing and buffering works inside the chip.

Stock : http://www.tmeeco.eu/SMS/PSGbadLevels.jpg
Ideal/with corrected resistor value : http://www.tmeeco.eu/SMS/PSGgoodLevels.jpg

_________________
http://www.tmeeco.eu


Top
 Profile  
 
PostPosted: Wed Sep 05, 2018 7:07 am 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1786
Location: Gothenburg, Sweden
Quote:
What I don't understand is what are the analog components needed to build one


I hope i'm not wasting your time with this. I don't think you don't need to know the intricacies to make a "lazy" emulation that basically yields the same result to your ear.

Exactly what components, and in what configuration, really depends on what topology we're looking at, and i'm not too well read on all of them. So the following goes for what i do know. I'll just list some building blocks that are common.

A few concepts first that informs the rest.
-An amplifier consists at least of one or two transistors.
-A so-called operational amplifier is really a whole block of more specific amplifiers with different tasks.
-A diode and a transistor is based on the same technology (semi conduction), except diodes consist only of a passive channel and your sole mode of definition is in what direction you put it and exactly what semi-conductive material you're using, while a transistor will have an extra lead which can modify the operation of said channel.

To build a gain reducer:
At the very core, to reduce gain you need an "inverting amplifier". It will subtract one signal from the other and output the difference. This is where the (negative) feedback comes in (which you will sum with the input, while the other input is tied to ground). If both input and feedback are 1:1, gain is *0. If no feedback is provided, gain is *1. The balance is done with two resistors, one on the direct input and one on the feedback. They are joined post-resistors. The formula is -feedbackresistor/inputresistor. Again the amp will, as the name implies, invert the polarity of the signal (hence the -), so is common to place two amplifiers in a daisychain to revert it if phase is important.

Typically the job of the second amp is just to pass the input to the output with unmodified gain and just revert the phase, but since you already have two amps in place... maybe the first is used for setting the volume and the second is used for some compression, since it is there anyway.

Now, i've only built this kind of circuit with whole OpAmp IC:s (operational amplifiers). Doing a differential amplification with these looks like this:
Image

...but iirc you can build one discretely with just two "common emitter" transistors and three resistors, not counting any output buffer measures taken or such. You can look up "differential amplifier" if you want to look into it. Depending on case, you might not need extra buffer amplifiers.

A super simple/hacky way to create a threshold for gain reduction/compression (and i don't know if it was used here) is to pass the feedback through a diode. The diode must reach over a certain voltage to "break down" and start conducting. It also introduces a voltage drop, which means gain can't really be reduced to 0, but that's not what we are doing here anyway. IF this method was used, note that there'd be *some* variance on exactly what voltage the diode will conduct, from die to die. It probably also needs to be a diode with a low breakdown voltage since, i assume, audio voltage levels are quite small even within the cartridge synth? (it is generally good to keep them high. studio audio has a pvp of 1.7, consumer audio outputs 0.45, modular synthesizers anything between 5 and 12 haha. the typical silicon diode breaks at 0.7 and the typical germanium diode breaks at 0.3 - these aren't as common in consumer electronics and are more or less extinct today. You can make your audio level match the breakdown voltage by adding a "voltage divider" circuit).

About building the simplest possible compressor in the world:
For a fully passive diode bridge compressor, all you need is really 7 resistors, 4 diodes and 2 capacitors, just to point out how simple it can get. That is a little academical - you still need an active buffer stage for the signal to keep the intended volume and impedance. I'm not sure of its applicability here since i don't know how you'd add a threshold to this passive scheme, but those resistors would at least let you define ratio, attack and decay. There probably is a way to introduce a threshold, and i just don't know about it.

About building a full VCA compressor and why it probably isn't what we want:
A full-sized VCA circuit will first use two inverting amps (= 4 transistors and some resistors) to produce a control voltage (which you can easily bias or gain control in itself via the specifics of the VCA block), which can then be used to in turn to gain-control another OpAmp pair that is solely responsible for the end volume (how much goes to audio out, and how much goes down the drain). This volume is fed back into the VCA block for partial self correction in a compressing circuit.

Note that the purpose of a full-blown VCA is to be able to provide easy means to control the amount of gain reduction. You might not need all its bells and whistles. A lot of the hobbyist schematics you'll find are unnecessarily feature-heavy for our purposes even when they're labeled simple, because they're designed by someone who wanted some specific interface in the first place. Like being able to voltage control the ratio, threshold, knee or whatever. All we want to do is voltage control the volume and that's it.

Rectifiers:
All a rectifier does is nullify the negative swing. And all it takes is a diode. This is more elaborately called half wave rectification.
But if you add together two rectified signals (one for each pole), you get both polar peaks on the same 0-maxV pole. This is called full wave rectification.
It looks like this.

Partly because of the choppyness introduced by the diodes' breakdown voltage, a smoothing capacitor is used. and/or you can use germanium diodes, which have a lower breakdown voltage.

A VCA block will need this for producing a control voltage out of the rectified, smoothed signal.

I've mentioned diode bridges twice in this post. Note that their applications are different. One is to be a compressor in itself, the other is to precondition a source material for the VCA.



I'm just wondering why they might've intentionally wanted a compressor. Maybe they were worried about overdrive or just general loudness? On the other hand, the APU squares can get too loud compared to the rest as it already is. Maybe it's just a fluke effect or a hacky "well, we might aswell".

_________________
http://www.frankengraphics.com - personal NES blog


Last edited by FrankenGraphics on Wed Sep 05, 2018 7:38 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Sep 05, 2018 7:33 am 
Offline

Joined: Fri Sep 30, 2016 8:57 pm
Posts: 94
well, i came to post the paper that i've used in the past when making compressors for DSP projects and it looks like you've already found it.

i don't think you should be worrying too much about the actual analog components, that's an incredibly difficult question when compared to the relatively simple question of how to create a black-box effect that gives similar results.


Top
 Profile  
 
PostPosted: Wed Sep 05, 2018 10:16 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7025
Location: Canada
FrankenGraphics, I'm sorry to say but I don't need an explanation of what the difference between a diode and a transitor is, or how a standard op-amp circuit works, what a rectifier is, etc. I tried to say this, but maybe I didn't make it clear I'm not asking for a primer in circuits from the ground up, I'm asking only about compressors specifically. You went into great detail on things that I do know, and then very little detail on the things that I actually am having trouble finding good explanations of. (Despite it not really being what I was asking there was still some information in your post that was helpful to hear, so thank you for that anyway.)

Though also, my question is only indirectly how to build one, but more directly what the characteristics are of an analog compressor, i.e. what kind of response should I be looking to model. What I really want to know:

1. Is it practical to build an analog compressor in a mapper IC with an infinitely hard knee?
2. Is it practical to build an analog compressor in a mapper IC with a soft knee? What kind of response curve results from this?

I linked a PDF above that was a good article on DSP compressor design, but it's really about building practical digital compressors; it deliberately backs off from trying to model analog compressors. The one thing I'm most interested in knowing is how the compression curve is created in an analog sense, and that article instead just glues 3 segments together for the two log-linear portions and the soft knee portion. Yeah that's easy to do in a DSP but I want to know about the real curves that are used. I already know how to build a spline.

That second article I linked has some very interesting graphs of one particular type of analog compressor, and those curves are the closest thing to what I actually want to know most about it, but the graph is all this article has to tell me. Its last paragraph might be summarized as "there is no cookie-cutter approach to modeling of analog compressors", which seems fair enough. Maybe the reason I'm finding it hard to get information about this is because the resulting curves are actually the result of complicated interactions that are hard to model succinctly.

toggle switch wrote:
i don't think you should be worrying too much about the actual analog components, that's an incredibly difficult question when compared to the relatively simple question of how to create a black-box effect that gives similar results.
Well, what I was asking is whether there's some kind of standarad characteristics of compressors. Maybe there really isn't, or maybe there is but it's an advanced topic that's hard to find info about. What FrankenGraphics was answering about analog components isn't really what I was after; I just want to have some idea of what to model. It's not so much that I want to know the parts here, I want reference on their curves... like I'm not going to build 10 varieties of compressor to analyze their curves to understand this. Digital simulations might be easier, but like that first article I linked the approach seems to be more or less "build the curve you want" and not replicating the analog stuff.

FrankenGraphics wrote:
I'm just wondering why they might've intentionally wanted a compressor. Maybe they were worried about overdrive or just general loudness? On the other hand, the APU squares can get too loud compared to the rest as it already is. Maybe it's just a fluke effect or a hacky "well, we might aswell".
I find it pretty baffling, myself. The thing TmEE posted about a bad mix in an SMS2 looks like the kind of thing that would happen by accident. This compression effect feels more deliberate to me.


...anyhow, all of that is maybe kinda moot because I'd come to the conclusion (like toggle switch was suggesting) that a simpler model is probably good enough to get uncannily close anyway. We can put a pin in the my question about compressors, which might have been summarized as "is there a standard response curve for analog compressors that I should be looking for?" and the answer seems to be "no" on the fine details level, but "yes" on the very coarse detail level I already knew going in.

So, yesterday I came up with a rough hard knee approximation. I'm still working on the release characteristics so I wasn't going to post again until I had more on that too but here:
Attachment:
clip_5b_hard.png
clip_5b_hard.png [ 25.89 KiB | Viewed 3685 times ]

Here's a threshold set 1dB above volume 14 (or 7dB above volume 12), with a compression ratio of 2.7:1 dB. (The graph units are in dB, theoretical input on X, measured output on Y.)

That's probably a better model than whatever I'd have to do to simulate the real analog curve, and probably close enough that we would never be able to tell the difference by ear anyway.


Last edited by rainwarrior on Wed Sep 05, 2018 10:53 am, edited 2 times in total.

Top
 Profile  
 
PostPosted: Wed Sep 05, 2018 10:27 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7833
Location: Seattle
rainwarrior wrote:
1. Is it practical to build an analog compressor in a mapper IC with an infinitely hard knee?
I suspect the answer is no, because there are basically no parts with a V-I curve that has a sharp corner without having a complete discontinuity (e.g. DIAC)
Quote:
2. Is it practical to build an analog compressor in a mapper IC with a soft knee? What kind of response curve results from this?
I don't know enough to really be able to answer the question of whether a VCA can be given a nice transfer curve like this. I kinda suspect the answer is that analog compressors weren't usually defined in this piecewise linear way.


Top
 Profile  
 
PostPosted: Wed Sep 05, 2018 10:51 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7025
Location: Canada
Yeah, that was more or less my intuition about it. No graph I could find of a vintage compressor response looked like 2 straight lines, or 2 straight lines with a circular curve, like all the basic compressor theory stuff seems to teach.

What I saw in some graphs that I could find were two mostly-linear regions (in dB scale), a knee that is not really very symmetrical, and then eventually on the extreme high end the curve takes off again. I can see how this would be idealized as a 3 piece spline for a theoretical model, and in practical terms it's probably a very usable model... but there's some big simplifications being made here.


Top
 Profile  
 
PostPosted: Wed Sep 05, 2018 11:13 am 
Offline
Formerly WheelInventor

Joined: Thu Apr 14, 2016 2:55 am
Posts: 1786
Location: Gothenburg, Sweden
Sorry to have missed the point of your inquiry so badly! No, i think you made it clear - i should just have taken the time to read it twice.

Quote:
Is it practical to build an analog compressor in a mapper IC with an infinitely hard [my edit: or soft] knee?

Maybe. It's an anachronism, but THATcorp (which specialize in compressor-on-a-chip:s) mention and show super-hard knees and soft knees in their freely available design note PDF:s (which differ from ordinary spec sheets in that they actually want people with varied EE experiences to use their IC:s by explaining stuff in layman terms). I haven't read much of it, but it might be worth a look.
From a quick glance, this document seems to explain the schematic differences between soft-knee and hard-knee. There are more design note PDF:s like this from THATcorp.

For the "on an IC" part, you could probably make the whole thing out of standard MOSFETs for transistors which had been widely available for a long time by then (the 6502 itself being obvious proof). Since they're not current driven, but rather voltage potential driven, they have very little load on the supply while being turned on, which we want on a cartridge device especially. Switching on and off rapidly is wasteful, but that's not what we do here. I don't remember all the characteristics of the MOSFET, but iirc the forward drop is insignificant which should mean you potentially need less buffering which could equal a simpler schematic. The "coloured character" of FET compressors in studios shouldn't apply. We're not dealing with the vast dynamic range of a natural recording, nor the subtle quality of a physical instrument.

(Beyond that, i don't really know what differs in a VCA vs a FET studio compressor/limiter on a schematic level, other than FETs being the specific transistors in use. But i suspect not a lot/the specifics of each compressor product being more different? Studio equipment companies have always been keen on blowing things like these out of proportion for the sake of branding/product presentation, and in the end - for the studio engineer, unlike the game PCB engineer - it's the musical applications that matter).


Quote:
I find it pretty baffling, myself. The thing TmEE posted about a bad mix in an SMS2 looks like the kind of thing that would happen by accident. This compression effect feels more deliberate to me.

Had the threshold been a bit lower, it could maybe have been used for a pleasant kick+bass ducking effect. But this feels like an anachronism too.

Or wait - maybe it is supposed to make SFX:s punch through better and music resume more nicely? If transients for music and rythm is just below, but transients for SFX above, this should leave some space and make the music fade in a bit, rather than resume abruptly, as per normal. The threshold still seems a little too high set for my personal taste, but i could see that being the feature request that motivated the inclusion of a compressor with a bit of a release.

_________________
http://www.frankengraphics.com - personal NES blog


Last edited by FrankenGraphics on Wed Sep 05, 2018 12:19 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Sep 05, 2018 12:18 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7025
Location: Canada
That's a neat document. I must admit though, I get to page 6 with Figure 8 having a really nice graph of its "soft knee", but then I try to find how this curve is defined and... "Figure 8 shows the result of a SPICE simulation". Ha ha. Still it is nice to verify what I'd gathered that an analog soft knee will have its compression gradually tend to infinity, even if it's got a more-or-less flat ratio for a little while, and seems like it might be a usable enough model of the circuit. (...in contrast to the link I posted to a graph of an optical compressor; those seem to blow out at the high end instead?)

I posted a more easily defined hard knee model above though, and in practice I think that's probably what I'm going to want to implement anyway... once I get the release worked out the next step is to write a compressor implementation for NSFPlay. If I can think of a practical way to do the more "analog" style I might go for it.

FrankenGraphics wrote:
Or wait - maybe it is supposed to make SFX:s punch through better and music resume more nicely?

Well, it could be used to increase the contrast of a loud SFX against the music without increasing the overall volume... but in the actual case of Gimmick!, no I don't think it is doing this. The SFX volumes are really no louder than those used for the music anyway.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group