Difference between revisions of "User:Kwerner/220C"
|Line 183:||Line 183:|
Reading up on diodes... old UIUC course notes, and [http://en.wikipedia.org/wiki/Diode_modelling#Shockley_diode_model].
Reading up on diodes... old UIUC course notes, and [http://en.wikipedia.org/wiki/Diode_modelling#Shockley_diode_model].
Revision as of 21:16, 22 May 2012
Interested in changing project topics. Contacted Plogue to see if I could help them with a circuit modeling project. They make a really cool project called ChipSounds, which "authentically emulates 15 vintage 8bit-era sound chips (on top of their variants), down to their smallest idiosyncrasies" in VST/AU/RTAS plugins. In addition to sounding really awesome, the research that goes into developing this product lines up quite well with my research interests (and interest in the compositional restraints, cool sounds, and retro cachet of chiptunes).
David Viens from Plogue responded! They are interested in having me work on an analog circuit modeling, and have suggested a few possible projects. They are currently developing a new plugin that also seems very cool. As a fan of old consumer synths and sound making devices, I noticed a lot of familiar circuits in their promo video (especially excited about the Casio SK-1, Speak&Math, and SNES)!
I've responded and let them know about the two projects that I'm most interested in.
I need to figure out the legal/intellectual property/&c. issues involved with doing a project for a company as coursework in a graduate class. Hoping to get this cleared up with Prof. Chafe (or other folks who are aware... Spencer? Jiffer?) in the class meeting today, so I can move forward in talks with Plogue and start doing some circuit modeling!
I'm starting to do some work on the Casio SK-1, modelling the analog portions of the circuits. What I worked on over the weekend:
I spent some time with the SK-1 service manual, to try to understand the big picture of what is going on, and which analog parts I might work on modeling. Pages 5, 8, and 9 of the service manual will be particularly relevant to what I'm about to discuss, I'll include scans of them with a few of my notes. My understanding of the signal flow of the analog portion of the circuit (the right half of the block diagram on Page 5) is that it comprises four parts.
1. The envelope/pitch mixing circuits (Page 8)...
...which each (there are 4) take in a "pitch signal" and "envelope signal," and combine them together. It looks like there could be all sorts of interesting stuff happening here, transistors T15 and T16 are working as a kind of two-quadrant multiplier, T17 "mixes" the two signals into a "sound signal", and the resistor and capacitor on the output ("to filter circuit") form a high-pass filter. The diodes and transistors could have some non-linear behavior, and the circuit in general seems to do something more interesting than merely multiplying a signal by an envelope.
Page 8 shows 3 example signals, what looks like an envelope (A), what looks like a signal (B), and what looks like a mix of the two (C). Interestingly, the "mix" does not seem to be a multiplication of (A) and (B) but an addition. However, (A) and (B) are not the same as the "pitch signal" and "envelope signal" that are being fed in the right side of the diagram.
To help understand this, I am brushing up on my SPICE, and building a model of this part of the circuit. Something that could help me would be a better understanding of the nature of the "pitch signal" and "envelope signal" that are being sent in. Question, have Plogue done any measurements of these, or could they otherwise advise?
2. The Change-over Circuit (Page 9)...
...which routes (with an analog switch controlled by pins KO15 and PO3 of the CPU, according to whether the keyboard is in auto-accompany mode or not, etc.) the "Melody or Bass sound signal" and "Melody or Chord sound signal" to the Bass Filter or Melody Filter and Chord Filter or Melody Filter, respectively. The "Melody or Obbligato sound signal" and "Melody sound signal" are always routed through the Melody Filter.
There could be something interesting going on in the analog switch, could be worth looking into (IC2 = TC50H4066). I'll be looking up a data sheet soon to start investigating this.
3. The Filter Circuits (Page 9)...
...which filter the Bass, Chord, and Melody portions of the signal with different filters, as well as the "Percussion sound signal" coming from the CPU (pin SC / 97 / "Analog percussion signal output" on the CPU). The Percussion, Bass, and Chord filters seem pretty simple (all resistors and capacitors), but the Melody filter has a transistor in it as well. The transistor seems to be acting as buffer or follower, again there could be some non-linear behavior worth investigating.
4. The Mixer...
.. which mixes all the signals together. There doesn't seem to be much info on this in the service manual, but an investigation of the circuit should reveal what is going on.
There is also the matter of the microphone or 1/8" jack inputs. I haven't look at this at all yet.
Some resources for SPICE, thanks to Jack Perng, Collin Raffel, and Robin Gareus for the tips.
Via Jack: LTSpice for Mac OSX
Via Collin: LTSpice - step by step
In class (Music 424) today, Jorge Herrera mentioned the work that David Yeh has done on analog circuit modeling. David did his thesis ("Digital Implementation of Musical Distortion Circuits by Analysis and Simulation") in 2009, and it seems very relevant to the modeling work I would like to do. I am looking forward to spending time on a close reading of David's work for next week.
Today I am reviewing my old Advanced DSP Seminar notes from first quarter. Prof. Dave Berners gave some good lectures on circuit discretization that will be helpful.
I am also going through the LTSpice tutorials. Here are the ones I went through today:
I made SPICE models of a simple passive lowpass and high pass filter to test it out (links coming soon). I also built models of the Percussion, Bass, Chord, and Melody filters of the SK-1. The first goal of building these circuits in SPICE is to understand portions of the circuit that I don't yet understand, and to confirm the behavior of parts of the circuit that I think I do understand. The percussion filter is a highpass filter, the bass and chord filters are bandpass filters (only one component varys between them, Resistors R27/28 are different values), and the melody filter is a different kind of bandpass filter.
Without taking into account non-ideal or non-linear behavior, the percussion, bass, and chord filters could be understood as linear systems (they only involve resistors and capacitors), and easily discretized (without actual circuit modeling). The transistor in the melody filter complicates it somewhat. If circuit modeling is to be employed, I need to start building a framework for accomplishing it, and do a few tests on simple circuits. I think I will try to do initial numerical models of passive lowpass and highpass filters. I also just read about some of the interesting non-linearities that capacitors may experience. The Wikipedia article explains (see "Non-ideal behavior").
Some inconsistencies in the Melody Filter circuit have popped up; page 5 (Filter Change-Over Circuit & Percussion Circuit) and page 28 (Main PCB Schematic Diagram) don't agree on a few details! The polarity of 3/4 of the capacitors is flipped, and the topology of the circuit is different. I tried to look at page 17 (PCB Top and Bottom View) to resolve this, but it is very difficult to read, and the capacitor polarity is not labelled for the capacitors I care about. I may need to resolve this discrepancy by opening up an actual SK-1...
In other chiptunes news, I just released an album of electronic music that includes some elements of chiptunes music. Perhaps it will shed some light on the reason for my interest in this research topic. Check it out: http://kurtjameswerner.bandcamp.com/
Note to self: check out linear companion model
Been working w/ pen and paper on deriving transfer functions of the filters. Once I get the linear behavior down, I can move onto thinking about trying to incorporating non-linearities. Been spending a lot of time with David Yeh's thesis, it is very helpful.
Bought an SK-1 off of eBay so I can open it up and examine the circuit (to reconcile the discrepancy in the melody filter circuit), and conduct a few of my own tests. The SK-1 I own already has been circuit bent... so I don't want to open it up for fear of damaging it, and the circuit behavior has been irrevocably changed!
I've finished a draft of my write-up on the Percussion Filter. It's long (13 pages), read at your peril. I'm moving on to developing transfer functions of the Chord and Bass Filters now. The Melody Filter still seems very complicated, I'm not sure how to approach the transistor.
It's time to figure out this transistor business, so I can work on the Melody Filter and the analog input stages (mic in, line in, etc). Note to self: transistor-like devices are expressed as nonlinear voltage-controlled current sources
I've finished a draft of my write-up on the Bass and Chord Filters. It's long (23 pages), read at your peril. My VST implementation seems to have some sort of problem with the Q parameterization. If Q gets above ~4.5, the filter blows up. I'll need to look into this.
Had a good conversation with prof. Berners today about the loads on the output of my filters (R_L), and about transistors.
About the loads: So, one of the questions that was left hanging at the end of my previous write up was the value of the load on each circuit. For the first round of analysis, I have been assuming that it is appropriate to break the circuit apart into sub-circuits, and assume that they are very stiff at their outputs (that is, they are not affected by the other sub-circuits at their outputs). So, there are a few related things that need to be addressed. First, are the circuits stiff at their outputs? Do they affect one another, or can they be safely separated? Prof. Berners recommends writing up all of the filters in a SPICE model, then testing each circuit to see if it behaves in the same way under two conditions: in isolation, or in combination with the other circuits (with their own inputs held constant). I will be working on this tomorrow. If it turns out it is appropriate to treat the circuits as independent, it is necessary to find out an appropriate value for the load resistors (they will be removed if the circuits are actually connected).
About the transistors: Transistors are very complicated! Dave introduced me to the Hybrid-pi model, a simple small-signal model for how transistors work. I am going to try to apply it to my analyses of the Melody Filter, the Envelope/Pitch Mixing Circuit, and the input gain stage (of the sampler, David Viens is really interested in this part of the circuit, so I'm going to try to take a look at it too, once I have time). I'm still having a hard time understanding what is going on in the Melody Filter, but hopefully just modeling it blind will work. Actually, the Envelope/Pitch Mixing Circuit is starting to make sense, after prof. Berners spent some time looking at it with me. It seems to be a sort of differential transistor amplifier (the two transistors hooked together) and a follower. I am going to do a write-up on this, because even though I am starting to understand it conceptually, I need to actually develop some equations. Doing a write-up on this will be my next project (along with figuring out if the filters can be separated).
Briefly presented what I'm working on in class today. Francois pointed out that the differential transistor amplifier that has me somewhat stumped is just like the one in the famous Moog Ladder filter. A lot of work has been done on digital models of this famous filter, prof. Chafe and Francois specifically mentioned work by Tim Stilson and prof. Julius Smith. A quick google search reveals a lot of published work. Thanks, guys!
I will read up on these papers, hopefully that will help me understand the differential transistor amplifier and thus, the Envelope / Pitch Mixing Circuit.
The SK-1 came in the mail. It powered up fine and appears to be working. Now I will be able to do some measurements once it is necessary, especially figuring out the nature of the signals going into the Envelope / Pitch Mixing Circuit.
After a long weekend of Maker Faire-ing, it's time to get back to work! On the TO DO list for today: reading up and possibly starting some modeling of the differential transistor amplifier portion of the Pitch / Envelope mixing circuit, and determining whether or not it is appropriate to separate all of the filters into sub-circuits, and if so, what the output load on each should be.
Tim Stinchcombe's own paper on the Moog adder Filter has a very helpful treatment of the differential (long-tailed) transistor pair, I have adapted his treatment to get some equations describing the differential pair sub circuit within the Pitch / Envelope Mixing Circuit. Now, it will be necessary to find equations for the voltage at the bases of transistors T15 and T16 (corresponding to V1 and V2 in Tim's treatment). This will come from an analysis of the resistor-capacitor network that takes the Pitch Signal as its input. Hopefully, my analysis of the Percussion filter will be helpful here - the circuits look very similar, and I should be able to adapt my analysis. Also, an equation for the current from the collector to the emitter of transistor T17 ("I" in Tim's treatment) is needed. I'll need to figure out a transfer function for the sub-circuit with all the diodes that takes the Envelope Signal as its input.
It seems like the Envelope Signal may not exactly look like an envelope, but like a an envelope multiplied by a waveform. Possibly controlling the spectrum, since it is multiplied by the Pitch Signal (a sine wave?). Doing some sort of wave shaping or AM (Amplitude Modulation, at audio rates). It appears to have the same fundamental frequency as the Pitch Signal!
Reading up on diodes... old UIUC course notes, and .
How to copy circuits from many documents into one in LTSpice . Thanks, snarky internet person. After spending a lot of time re-reading old course notes on diodes, doing some schematic drawing, and taking a first stab at the math, I'm back to looking at the filter circuits to see if it is appropriate to separate them.