Thursday, December 31, 2020

Best of HN 2020



from Hacker News https://ift.tt/3pvxgPU

Why Do We Dream? A New Theory on How It Protects Our Brains

When he was two years old, Ben stopped seeing out of his left eye. His mother took him to the doctor and soon discovered he had retinal cancer in both eyes. After chemotherapy and radiation failed, surgeons removed both his eyes. For Ben, vision was gone forever.

But by the time he was seven years old, he had devised a technique for decoding the world around him: he clicked with his mouth and listened for the returning echoes. This method enabled Ben to determine the locations of open doorways, people, parked cars, garbage cans, and so on. He was echolocating: bouncing his sound waves off objects in the environment and catching the reflections to build a mental model of his surroundings.

Echolocation may sound like an improbable feat for a human, but thousands of blind people have perfected this skill, just like Ben did. The phenomenon has been written about since at least the 1940s, when the word “echolocation” was first coined in a Science article titled “Echolocation by Blind Men, Bats, and Radar.”

How could blindness give rise to the stunning ability to understand the surroundings with one’s ears? The answer lies in a gift bestowed on the brain by evolution: tremendous adaptability.

Whenever we learn something new, pick up a new skill, or modify our habits, the physical structure of our brain changes. Neurons, the cells responsible for rapidly processing information in the brain, are interconnected by the thousands—but like friendships in a community, the connections between them constantly change: strengthening, weakening, and finding new partners. The field of neuroscience calls this phenomenon “brain plasticity,” referring to the ability of the brain, like plastic, to assume new shapes and hold them. More recent discoveries in neuroscience suggest that the brain’s brand of flexibility is far more nuanced than holding onto a shape, though. To capture this, we refer to the brain’s plasticity as “livewiring” to spotlight how this vast system of 86 billion neurons and 0.2 quadrillion connections rewires itself every moment of your life.

Neuroscience used to think that different parts of the brain were predetermined to perform specific functions. But more recent discoveries have upended the old paradigm. One part of the brain may initially be assigned a specific task; for instance, the back of our brain is called the “visual cortex” because it usually handles sight. But that territory can be reassigned to a different task. There is nothing special about neurons in the visual cortex: they are simply neurons that happen to be involved in processing shapes or colors in people who have functioning eyes. But in the sightless, these same neurons can rewire themselves to process other types of information.

Mother Nature imbued our brains with flexibility to adapt to circumstances. Just as sharp teeth and fast legs are useful for survival, so is the brain’s ability to reconfigure. The brain’s livewiring allows for learning, memory, and the ability to develop new skills.

In Ben’s case, his brain’s flexible wiring repurposed his visual cortex for processing sound. As a result, Ben had more neurons available to deal with auditory information, and this increased processing power allowed Ben to interpret soundwaves in shocking detail. Ben’s super-hearing demonstrates a more general rule: the more brain territory a particular sense has, the better it performs.

Recent decades have yielded several revelations about livewiring, but perhaps the biggest surprise is its rapidity. Brain circuits reorganize not only in the newly blind, but also in the sighted who have temporary blindness. In one study, sighted participants intensively learned how to read Braille. Half the participants were blindfolded throughout the experience. At the end of the five days, the participants who wore blindfolds could distinguish subtle differences between Braille characters much better than the participants who didn’t wear blindfolds. Even more remarkably, the blindfolded participants showed activation in visual brain regions in response to touch and sound. When activity in the visual cortex was temporarily disrupted, the Braille-reading advantage of the blindfolded participants went away. In other words, the blindfolded participants performed better on the touch-related task because their visual cortex had been recruited to help. After the blindfold was removed, the visual cortex returned to normal within a day, no longer responding to touch and sound.

But such changes don’t have to take five days; that just happened to be when the measurement took place. When blindfolded participants are continuously measured, touch-related activity shows up in the visual cortex in about an hour.


What does brain flexibility and rapid cortical takeover have to do with dreaming? Perhaps more than previously thought. Ben clearly benefited from the redistribution of his visual cortex to other senses because he had permanently lost his eyes, but what about the participants in the blindfold experiments? If our loss of a sense is only temporary, then the rapid conquest of brain territory may not be so helpful.

And this, we propose, is why we dream.

In the ceaseless competition for brain territory, the visual system has a unique problem: due to the planet’s rotation, all animals are cast into darkness for an average of 12 out of every 24 hours. (Of course, this refers to the vast majority of evolutionary time, not to our present electrified world.) Our ancestors effectively were unwitting participants in the blindfold experiment, every night of their entire lives.

So how did the visual cortex of our ancestors’ brains defend its territory, in the absence of input from the eyes?

We suggest that the brain preserves the territory of the visual cortex by keeping it active at night. In our “defensive activation theory,” dream sleep exists to keep neurons in the visual cortex active, thereby combating a takeover by the neighboring senses. In this view, dreams are primarily visual precisely because this is the only sense that is disadvantaged by darkness. Thus, only the visual cortex is vulnerable in a way that warrants internally-generated activity to preserve its territory.


In humans, sleep is punctuated by rapid eye movement (REM) sleep every 90 minutes. This is when most dreaming occurs. (Although some forms of dreaming can occur during non-REM sleep, such dreams are abstract and lack the visual vividness of REM dreams.)

REM sleep is triggered by a specialized set of neurons that pump activity straight into the brain’s visual cortex, causing us to experience vision even though our eyes are closed. This activity in the visual cortex is presumably why dreams are pictorial and filmic. (The dream-stoking circuitry also paralyzes your muscles during REM sleep so that your brain can simulate a visual experience without moving the body at the same time.) The anatomical precision of these circuits suggests that dream sleep is biologically important—such precise and universal circuitry rarely evolves without an important function behind it.

The defensive activation theory makes some clear predictions about dreaming. For example, because brain flexibility diminishes with age, the fraction of sleep spent in REM should also decrease across the lifespan. And that’s exactly what happens: in humans, REM accounts for half of an infant’s sleep time, but the percentage decreases steadily to about 18% in the elderly. REM sleep appears to become less necessary as the brain becomes less flexible.

Of course, this relationship is not sufficient to prove the defensive activation theory. To test it on a deeper level, we broadened our investigation to animals other than humans. The defensive activation theory makes a specific prediction: the more flexible an animal’s brain, the more REM sleep it should have to defend its visual system during sleep. To this end, we examined the extent to which the brains of 25 species of primates are “pre-programmed” versus flexible at birth. How might we measure this? We looked at the time it takes animals of each species to develop. How long do they take to wean from their mothers? How quickly do they learn to walk? How many years until they reach adolescence? The more rapid an animal’s development, the more pre-programmed (that is, less flexible) the brain.

As predicted, we found that species with more flexible brains spend more time in REM sleep each night. Although these two measures—brain flexibility and REM sleep—would seem at first to be unrelated, they are in fact linked.

As a side note, two of the primate species we looked at were nocturnal. But this does not change the hypothesis: whenever an animal sleeps, whether at night or during the day, the visual cortex is at risk of takeover by the other senses. Nocturnal primates, equipped with strong night vision, employ their vision throughout the night as they seek food and avoid predation. When they subsequently sleep during the day, their closed eyes allow no visual input, and thus, their visual cortex requires defense.

Dream circuitry is so fundamentally important that it is found even in people who are born blind. However, those who are born blind (or who become blind early in life) don’t experience visual imagery in their dreams; instead, they have other sensory experiences, such as feeling their way around a rearranged living room or hearing strange dogs barking. This is because other senses have taken over their visual cortex. In other words, blind and sighted people alike experience activity in the same region of their brain during dreams; they differ only in the senses that are processed there. Interestingly, people who become blind after the age of seven have more visual content in their dreams than those who become blind at younger ages. This, too, is consistent with the defensive activation theory: brains become less flexible as we age, so if one loses sight at an older age, the non-visual senses cannot fully conquer the visual cortex.

If dreams are visual hallucinations triggered by a lack of visual input, we might expect to find similar visual hallucinations in people who are slowly deprived of visual input while awake. In fact, this is precisely what happens in people with eye degeneration, patients confined to a tank-respirator, and prisoners in solitary confinement. In all of these cases, people see things that are not there.

We developed our defensive activation theory to explain visual hallucinations during extended periods of darkness, but it may represent a more general principle: the brain has evolved specific circuitry to generate activity that compensates for periods of deprivation. This might occur in several scenarios: when deprivation is regular and predictable (e.g., dreams during sleep), when there is damage to the sensory input pathway (e.g., tinnitus or phantom limb syndrome), and when deprivation is unpredictable (e.g., hallucinations induced by sensory deprivation). In this sense, hallucinations during deprivation may in fact be a feature of the system rather than a bug.

We’re now pursuing a systematic comparison between a variety of species across the animal kingdom. So far, the evidence has been encouraging. Some mammals are born immature, unable to regulate their own temperature, acquire food, or defend themselves (think kittens, puppies, and ferrets). Others are born mature, emerging from the womb with teeth, fur, open eyes, and the abilities to regulate their temperature, walk within an hour of birth, and eat solid food (think guinea pigs, sheep, and giraffes). The immature animals have up to 8 times more REM sleep than those born mature. Why? Because when a newborn brain is highly flexible, the system requires more effort to defend the visual system during sleep.

Since the dawn of communication, dreams have perplexed philosophers, priests, and poets. What do dreams mean? Do they portend the future? In recent decades, dreams have come under the gaze of neuroscientists as one of the field’s central unsolved mysteries. Do they serve a more practical, functional purpose? We suggest that dream sleep exists, at least in part, to prevent the other senses from taking over the brain’s visual cortex when it goes unused. Dreams are the counterbalance against too much flexibility. Thus, although dreams have long been the subject of song and story, they may be better understood as the strange lovechild of brain plasticity and the rotation of the planet.

For more information:

Sign up for Inside TIME. Be the first to see the new cover of TIME and get our most compelling stories delivered straight to your inbox.

Thank you!

For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.



from Hacker News https://ift.tt/3htlkLv

Reverse Engineering Source Code of the Biontech Pfizer Vaccine: Part 2

All BNT162b2 vaccine data on this page is sourced from this World Health Organization document.

This is a living page, shared already so people can get going! But check back frequently for updates.

In short: the vaccine mRNA has been optimized by the manufacturer by changing bits of RNA from (say) UUU to UUC, and people would like to understand the logic behind these changes. This challenge is quite close to what cryptologists and reverse engineering people encounter regularly. On this page, you’ll find all the details you need to get cracking to reverse engineer just HOW the vaccine has been optimized.

I thought this would just be a fun puzzle, but I have just been informed that figuring out the optimization procedure & documenting it is tremendously important for researchers around the world, as this would help them design code for proteins and vaccines.

So, if you want to help vaccine research, do read on!

The leader board

Here are the current best entrants to the optimization algorithm:

Please send updates to bert@hubertnet.nl or @PowerDNS_Bert.

BioNTech

We should all be very grateful that BioNTech has shared this data with us. And of course we should also be grateful to the many many researchers and lab workers that worked for decades to bring the state of the art to the point that such a vaccine could be developed. It is marvelous.

Because it is so marvelous, I want to understand everything about the vaccine. I wrote a page Reverse Engineering the source code of the BioNTech/Pfizer SARS-CoV-2 Vaccine that describes in some detail what is in the mRNA of the vaccine. It helps to read this page before continuing, I promise you it will be interesting.

The post left open some questions however, and this is where it gets fascinating.

The codon optimization

The vaccine contains RNA code for a very slightly modified copy of the SARS-CoV-2 S protein.

The RNA code of the vaccine itself however is highly modified from the viral original! This has been done by the manufacturer, based on their understanding of nature.

And from what we understand, these modifications make the vaccine much much more effective. It would be a lot of fun to understand these modifications. It might for example explain why the Moderna vaccine needs 100 micrograms and the BioNTech vaccine only 30 micrograms.

Here is the beginning of the S protein in both the virus and the BNT162b2 vaccine RNA code. Exclamation marks denote differences.

Virus:   AUG UUU GUU UUU CUU GUU UUA UUG CCA CUA GUC UCU AGU CAG UGU GUU
Vaccine: AUG UUC GUG UUC CUG GUG CUG CUG CCU CUG GUG UCC AGC CAG UGU GUU
               !   !   !   !   ! ! ! !     !   !   !   !   !            

RNA is a string (literally) of RNA characters, A, C, G and U. There is no physical framing on there, but it makes sense to analyse it in groups of three.

Each group (called a codon) maps to an amino acid (denoted by a capital letter). A string of amino acids is a protein. Here is what that looks like:

Virus:   AUG UUU GUU UUU CUU GUU UUA UUG CCA CUA GUC UCU AGU CAG UGU GUU
          M   F   V   F   L   V   L   L   P   L   V   S   S   Q   C   V
Vaccine: AUG UUC GUG UUC CUG GUG CUG CUG CCU CUG GUG UCC AGC CAG UGU GUU
               !   !   !   !   ! ! ! !     !   !   !   !   !            

Here we can see that while the codons are different, the amino acid version is the same. There are 4*4*4 codons but only 20 amino acids. This means you can typically change every codon into one of two others, and still code for the same amino acid.

So in the second codon, UUU was changed to UUC. This is a net addition of one ‘C’ to the vaccine. The third codon changed from GUU to GUG, which is a net addition of one G.

It is known that a higher fraction of G and C characters improves the efficiency of an mRNA vaccine.

Now, if that was all there was to it, this could be the end of this page. “The algorithm is change codons so we get more G and C in there”. But then we meet the 9th codon which changes CCA to CCU.

Throughout the ~4000 characters of the vaccine, this happens many times.

Our challenge

The goal is: find an algorithm that modifies the ‘wild type’ RNA code into the BNT162b2 one. Because everyone would like to understand how to turn viral RNA into an effective vaccine. The algorithm does not need to reproduce the exact RNA code of course, but it would be super nice if it came up with something very similar, while also being brief.

To help you, I have provided the data in a number of forms, as described on the GitHub page.

Note that in these files the U mentioned above appears as a T. U and T are the RNA and DNA manifestations of the same information.

The easiest place to start might be the ‘side-by-side.csv‘ file. This lists the original and modified version of each codon, side by side:

abspos,codonOrig,codonVaccine
0,ATG,ATG
3,TTT,TTC
6,GTT,GTG
...
3813,TAC,TAC
3816,ACA,ACA
3819,TAA,TGA

There is also an equivalency table that shows wich codons can be interchanged without changing the amino acid output. Please find this in codon-table-grouped.csv. There is also a visual version here.

A sample algorithm

On the GitHub repository you can find 3rd-gc.gp.

This implements a simple strategy that works like this:

  • If a virus codon already ended on G or C, copy it to the vaccine mRNA
  • If not, replace last nucleotide in codon by a G, see if the amino acid still matches, if so, copy to the vaccine mRNA
  • Try the same with a C
  • Otherwise copy as is

Or in golang:

// base case, don't do anything
our = vir

// don't do anything if codon ends on G or C already
if(vir[2] == 'G' || vir[2] =='C') {
        fmt.Printf("Codon ended on G or C already, not doing anything.")
} else {
        prop = vir[:2]+"G"
        fmt.Printf("Attempting G substitution, new candidate '%s'. ", prop)
        if(c2s[vir] == c2s[prop]) {
                fmt.Printf("Amino acid still the same, done!")
                our = prop
        } else {
                fmt.Printf("Oops, amino acid changed. Trying C, new candidate '%s'. ", prop)
                prop = vir[:2]+"C"
                if(c2s[vir] == c2s[prop]) {
                        fmt.Printf("Amino acid still the same, done!")
                        our=prop
                } 
                
        }

}

This achieves a rather poor 53.1% match with the BioNTech RNA vaccine, but it is a start.

When you design your algorithm, be sure to only base your choices on the virus RNA. Do not peak into the BioNTech RNA!

If you have achieved a score beyond 53.1% please email a link to your code to bert@hubertnet.nl (or @PowerDNS_Bert and I’ll put it on the leader board at the top of this page!

Things that will help

As with every form of reverse engineering or cryptanalysis, it helps to understand what we are looking at.

GC ratio

We know that one goal of the ‘codon optimization’ is to get more Cs and Gs into the vaccine version of the RNA. However, there is also a limit to that. In DNA, which is also used to manufacture the vaccine, G and C bind together strongly, to the point that if you put too many of these ‘nucleotides’ in there, the DNA will no longer be replicated efficiently.

So some modifications may actually happen to manage down the GC percentage of a stretch of DNA if it was getting too high.

I tweeted about this earlier.

Codon optimization

Some codons are rare in human DNA, or in certain cells. It may be that some codons are replaced by other ones simply because they are more frequently used by some cells.

I tweeted about this earlier.

RNA folding

We’ve been looking at codons up to here. The RNA itself however does not know about codons, there are no markers that say where a codon begins and ends. The first codon on a protein however is always ATG (or AUG in RNA).

RNA curls up into a shape. This shape might help evade the immune system or it might improve translation into amino acids. This only depends on the sequence of RNA nucleotides and not on specific codons.

You can submit RNA sequences to this server of the Institute for Theoretical Chemistry at the University of Vienna and it will fold RNA for you. This is a very advanced server that does meticulous calculations.

This Wikipedia page describes how this works.

It may be that some optimizations improve folding.

I am also told that this paper by Moderna (another mRNA vaccine manufacturer) may be relevant: mRNA structure regulates protein expression through changes in functional half-life.



from Hacker News https://ift.tt/350MowN

Are you a “harbinger of failure”? (2015)

Diet Crystal Pepsi. Frito Lay Lemonade. Watermelon-flavored Oreos. Through the years, the shelves of stores have been filled with products that turned out to be flops, failures, duds, and losers.

But only briefly filled with them, of course, because products like these tend to get yanked from stores quickly, leaving most consumers to wonder: Who exactly buys these things, anyway?

Now a published study co-authored by two MIT professors answers that question. Amazingly, the same group of consumers has an outsized tendency to purchase all kinds of failed products, time after time, flop after flop, Diet Crystal Pepsi after Diet Crystal Pepsi. The study calls the people in this group “harbingers of failure” and suggests they provide a new window into consumer behavior.

“These harbingers of failure have the unusual property that they keep on buying products that are taken from the shelves,” says MIT marketing professor Catherine Tucker, co-author of a paper detailing the study’s results.

Significantly, Tucker adds, these star-crossed consumers can sniff out flop-worthy products of all kinds.

“This is a cross-category effect,” Tucker explains. “If you’re the kind of person who bought something that really didn’t resonate with the market, say, coffee-flavored Coca-Cola, then that also means you’re more likely to buy a type of toothpaste or laundry detergent that fails to resonate with the market.”

And while strong initial sales of products normally seem like a good thing, the research reveals that is not always the case — not if it’s the harbingers of failure who are rushing out to purchase those products.

“It’s not just how many people are buying them, it’s how many of the right people are buying them and how many of the wrong people aren’t buying them,” says Duncan Simester, an MIT marketing professor and another co-author of the study.

“Usually when you’re doing market research, the common wisdom is that people liking your product is a good thing,” Tucker adds. “But what we’ve done in this research is identify a group of people who you really want to [have] hate your product. And that changes the paradigm of market research.”

What were they thinking?

The paper detailing the study’s results is published in the Journal of Marketing Research. The co-authors are Simester, who is the Nanyang Technological University Professor of Marketing at the MIT Sloan School of Management; Tucker, the Sloan Distinguished Professor of Management at MIT Sloan; Eric Anderson, a professor of marketing at Northwestern University’s Kellogg School of Management; and Song Lin, an assistant professor at Hong Kong University of Science and Technology’s business school.

The study itself draws upon two large data sets from a large chain of convenience stores that reaches across the U.S. One data set consists of weekly aggregate transactions from 111 store branches, from January 2003 to October 2009. The other data set consists of individual-level transaction data from November 2003 to November 2005.

All told, the researchers ended up examining 77,744 customers who purchased 8,809 new products between 2003 and 2005, and then tracking the aggregate data longer to see how well those products fared. They defined a failed product as one pulled from stores less than three years after its introduction; only about 40 percent of the new products survived that long.

In a key part of the study, the researchers studied consumers whose purchases flop at least 50 percent of the time, and saw pronounced effects when these harbingers of failure buy products. When the percentage of total sales of a product accounted for by these consumers increases from 25 to 50 percent, the probability of success for that product decreases by 31 percent. And when the harbingers buy a product at least three times, it’s really bad news: The probability of success for that product drops 56 percent.

But what explains the consumer behavior of the harbingers of failure?

“You could think of it as preference for risk,” Simester says. “People who are more willing to take a risk on an unusual product are more willing to take a risk in multiple categories.”

The researchers also examined and ruled out other possible explanations of the phenomenon. For instance: The harbingers are not evidently any more tired or distracted than anyone else when choosing products.

“It’s not the case that these people are buying goods at 2 in the morning, or something like that,” Tucker says. “They’re not inattentive. Systematically, they are able to identify these really terrible products that fail to resonate with the mainstream.”

A result that “may end up changing management practice”

Other scholars in the field say the study has fresh insights and is methodologically solid. Christophe Van den Bulte, a professor at The Wharton School of the University of Pennsylvania, who was involved in the review process for the paper, says it “documents a new phenomenon” and as such “may end up changing actual management practice.” He also notes that the finding is “robust to several variations in how the data are analyzed.”

Van den Bulte adds that the study opens up a series of future research issues, including how much the phenomenon applies to other product categories and how to further explain what guides the actions of these hapless consumers.

For their part, the researchers are continuing to pursue related research and are interested in looking at how widely the “harbingers of failure” pattern holds in a variety of areas, from everyday shopping to financial markets.

“We’re certainly thinking about whether this is a much more general result than people simply buying new products,” says Simester — who, when pressed about dubious products he himself has bought, admits to having once purchased a supposedly self-cleaning cat litter box that failed to function.

And Tucker, for her part, admits that yes, she used to drink Crystal Pepsi.

“This paper may be slightly autobiographical,” Tucker acknowledges.



from Hacker News https://ift.tt/1kgbOvU

How to write good prompts: using spaced repetition to create understanding

As a child, I had a goofy recurring daydream: maybe if I type just the right sequence of keys, the computer would beep a few times in sly recognition, then a hidden world would suddenly unlock before my eyes. I’d find myself with new powers which I could use to transcend my humdrum life.

Such fantasies probably came from playing too many video games. But the feelings I have when using spaced repetition systems are strikingly similar. At their best, these systems feel like magic.This guide assumes basic familiarity with spaced repetition systems. For an introduction, see Michael Nielsen, Augmenting Long-term Memory (2018), which is also the source of the phrase "makes memory a choice." Memory ceases to be a haphazard phenomenon, something you hope happens: spaced repetition systems make memory a choice. Used well, they can accelerate learning, facilitate creative work, and more. But like in my childhood daydreams, these wonders unfold only when you press just the right sequence of keys, producing just the right incantation. That is, when you manage to write good prompts.

Spaced repetition systems work only as well as the prompts you give them. And especially when new to these systems, you're likely to give them mostly bad prompts. It often won’t even be clear which prompts are bad and why—much less how to improve them. My early experiments with spaced repetition systems felt much like my childhood daydreams: prodding a dusty old artifact, hoping it’ll suddenly spring to life and reveal its magic.

Happily, prompt-writing does not require arcane secrets. It's possible to understand somewhat systematically what makes a given prompt effective or ineffective. From that basis, you can understand how to write good prompts. Now, there are many ways to use spaced repetition systems, and so there are many ways to write good prompts. This guide aims to help you create understanding in the context of an informational resource like an article or talk. By that I mean writing prompts not only to durably internalize the overt knowledge presented by the author, but also to produce and reinforce understandings of your own, understandings which you can carry into your life and creative work.

For readers who are new to spaced repetition, this guide will help you overcome common problems that often lead people to abandon these systems. In later sections, we'll cover some unusual prompt-writing perspectives which may help more experienced readers deepen their practice.If you don't have a spaced repetition system, I'd suggest downloading Anki and reading Michael's aforementioned essay. Our discussion will focus on high-level principles, so you can follow along using any spaced repetition system you like. Let's get started.

The central role of retrieval practice

No matter the application, it’s helpful to remember that when you write a prompt in a spaced repetition system, you are giving your future self a recurring task. Prompt design is task design.

If a prompt “works,” it’s because performing that task changes you in some useful way. It’s worth trying to understand the mechanisms behind those changes, so you can design tasks which produce the kind of change you want.

The most common mechanism of change for spaced repetition learning tasks is called retrieval practice. In brief: when you attempt to recall some knowledge from memory, the act of retrieval tends to reinforce those memories.For more background, see Roediger and Karpicke, The Power of Testing Memory (2006). Gwern Branwen's article on spaced repetition is a good popular overview. You’ll forget that knowledge more slowly. With a few retrievals strategically spaced over time, you can effectively halt forgetting. The physical mechanisms are not yet understood, but hundreds of cognitive scientists have explored this effect experimentally, reproducing the central findings across various subjects, knowledge types (factual, conceptual, procedural, motor), and testing modalities (multiple choice, short answer, oral examination).

The value of fluent recall isn't just in memorizing facts. Many of these experiments tested students not with parroted memory questions but by asking them to make inferences, draw concept mapsSee e.g. Karpicke and Blunt, Retrieval Practice Produces More Learning than Elaborative Studying with Concept Mapping (2011); and Blunt and Karpicke, Learning With Retrieval-Based Concept Mapping (2014)., or answer open-ended questions. In these studies, improved recall translated into improved general understanding and problem-solving ability.

Retrieval is the key element which distinguishes this effective mode of practice from typical study habits. Simply reminding yourself of material (for instance by re-reading it) yields much weaker memory and problem-solving performance. The learning produced by retrieval is called the “testing effect” because it occurs when you explicitly test yourself, reaching within to recall some knowledge from the tangle of your mind. Such tests look like typical school exams, but in some sense they’re the opposite: retrieval practice is about testing your knowledge to produce learning, rather than to assess learning.

Spaced repetition systems are designed to facilitate this effect. If you want prompts to reinforce your understanding of some topic, you must learn to write prompts which collectively invoke retrieval practice of all the key details.

We'll have to step outside the scientific literature to understand how to write good prompts: existing evidence stops well short of exact guidance. In lieu of that, I’ve distilled the advice in this guide from my personal experience writing thousands of prompts, grounded where possible in experimental evidence.

For more background on the mnemonic medium, see Matuschak and Nielsen, How can we develop transformative tools for thought? (2019).This guide is an example of what Michael Nielsen and I have called a mnemonic medium. It exemplifies its own advice through spaced repetition prompts interleaved directly into the text. If you're reading this, you've probably already used a spaced repetition system. This guide's system, Orbit, works similarly.If you have an existing spaced repetition practice, you may find it annoying to review prompts in two places. As Orbit matures, we'll release import / export tools to solve this problem. But it has a deeper aspiration: by integrating expert-authored prompts into the reading experience, authors can write texts which readers can deeply internalize with relatively little effort. If you're an author, then, this guide may help you learn how to write good prompts both for your personal practice and also for publications you write using Orbit. You can of course read this guide without answering the embedded prompts, but I hope you'll give it a try.

These embedded prompts are part of an ongoing research project. The first experiment in the mnemonic medium was Quantum Country, a primer on quantum computation. Quantum Country is concrete and technical: definitions, notation, laws. By contrast, this guide mostly presents heuristics, mental models, and advice. The embedded prompts therefore play quite different roles in these two contexts. You may not need to memorize precise definitions here, but I believe the prompts will help you internalize the guide's ideas and put them into action. On the other hand, this guide's material may be too contingent and too personal to benefit from author-provided prompts. It's an experiment, and I invite you to tell me about your experiences.

One important limitation is worth noting. This guide describes how to write prompts which produce and reinforce understandings of your own, going beyond what the author explicitly provides. Orbit doesn't yet offer readers the ability to remix author-provided prompts or add their own. Future work will expand the system in that direction.

Properties of effective retrieval practice prompts

Writing good prompts feels surprisingly similar to translating written text. When translating prose into another language, you’re asking: which words, when read, would light a similar set of bulbs in readers’ minds? It’s not a rote operation. If the passage involves allusion, metaphor, or humor, you won’t translate literally. You’ll try to find words which recreate the experience of reading the original for a member of a foreign culture.

When writing spaced repetition prompts meant to invoke retrieval practice, you’re doing something similar to language translation. You’re asking: which tasks, when performed in aggregate, require lighting the bulbs which are activated when you have that idea “fully loaded” into your mind?

The retrieval practice mechanism implies some core properties of effective prompts. We'll review them briefly here, and the rest of this guide will illustrate them through many examples.

These properties aren't laws of nature. They're more like rules you might learn in an English class. Good writers can (and should!) strategically break the rules of grammar to produce interesting effects. But you need to have enough experience to understand why doing something different makes sense in a given context.

Retrieval practice prompts should be focused. A question or answer involving too much detail will dull your concentration and stimulate vague retrievals, leaving some bulbs unlit. Unfocused questions also make it harder to check whether you remembered all parts of the answer and to note places where you differed. It’s usually best to focus on one detail at a time.

Retrieval practice prompts should be precise about what they're asking for. Vague questions will elicit vague answers, which won’t reliably light the bulbs you’re targeting.

Retrieval practice prompts should produce consistent answers, lighting the same bulbs each time you perform the task. Otherwise, you may run afoul of an interference phenomenon called “retrieval-induced forgetting”This effect has been produced in many experiments but is not yet well understood. For an overview, see Murayama et al, Forgetting as a consequence of retrieval: a meta-analytic review of retrieval-induced forgetting (2014).: what you remember during practice is reinforced, but other related knowledge which you didn’t recall is actually inhibited. Now, there is a useful type of prompt which involves generating new answers with each repetition, but such prompts leverage a different theory of change. We'll discuss them briefly later in this guide.

SuperMemo's algorithms (also used by most other major systems) are tuned for 90% accuracy. Each review would likely have a larger impact on your memory if you targeted much lower accuracy numbers—see e.g. Carpenter et al, Using Spacing to Enhance Diverse Forms of Learning (2012). Higher accuracy targets trade efficiency for reliability.Retrieval practice prompts should be tractable. To avoid interference-driven churn and recurring annoyance in your review sessions, you should strive to write prompts which you can almost always answer correctly. This often means breaking the task down, or adding cues.

Retrieval practice prompts should be effortful. It’s important that the prompt actually involves retrieving the answer from memory. You shouldn’t be able to trivially infer the answer. Cues are helpful, as we’ll discuss later—just don’t “give the answer away.” In fact, effort appears to be an important factor in the effects of retrieval practice.For more on the notion that difficult retrievals have a greater impact than easier retrievals, see the discussion in Bjork and Bjork, A New Theory of Disuse and an Old Theory of Stimulus Fluctuation (1992). Pyc and Rawson, Testing the retrieval effort hypothesis: Does greater difficulty correctly recalling information lead to higher levels of memory? (2009) offers some focused experimental tests of this theory, which they coin the "retrieval effort hypothesis." That’s one motivation for spacing reviews out over time: if it’s too easy to recall the answer, retrieval practice has little effect.

Achieving these properties is mostly about writing tightly-scoped questions. When a prompt’s scope is too broad, you’ll usually have problems: retrieval will often lack a focused target; you may produce imprecise or inconsistent answers; you may find the prompt intractable. But writing tightly-scoped questions is surprisingly difficult. You’ll need to break knowledge down into its discrete components so that you can build those pieces back up as prompts for retrieval practice. This decomposition also makes review more efficient. The schedule will rapidly remove easy material from regular practice while ensuring you frequently review the components you find most difficult.

Now imagine you’ve just read a long passage on a new topic. What, specifically, would have to be true for you to say you “know” it? To continue the translation metaphor, you must learn to “read” the language of knowledge—recognizing nouns and verbs, sentence structures, narrative arcs—so that you can write their analogues in the translated language. Some details are essential; some are trivial. And you can't stop with what's on the page: a good translator will notice allusions and draw connections of their own.

So we must learn two skills to write effective retrieval practice prompts: how to characterize exactly what knowledge we’ll reinforce, and how to ask questions which reinforce that knowledge.

A recipe for chicken stock

Our discussion so far has been awfully abstract. We'll continue by analyzing a concrete example: a recipe for chicken stock.

A recipe may seem like a fairly trivial target for prompt-writing, and in some sense that's true. It's a conveniently short and self-contained example. But in fact, my spaced repetition library contains hundreds of prompts capturing foundational recipes, techniques, and observations from the kitchen. This is itself an essential prompt-writing skill to build—noticing unusual but meaningful applications for prompts—so I'll briefly describe my experience.

I'd cooked fairly seriously for about a decade before I began to use spaced repetition, and of course I naturally internalized many core techniques and ratios. Yet whenever I was making anything complex, I'd constantly pause to consult references, which made it difficult to move with creativity and ease. I rarely felt "flow" while cooking. My experiences felt surprisingly similar to my first few years learning to program, in which I encountered exactly the same problems. With years of full-time attention, I automatically internalized all the core knowledge I needed day-to-day as a programmer. I'm sure that I'd eventually do the same in the kitchen, but since cooking has only my part-time attention, the process might take a few more decades.

I started writing prompts about core cooking knowledge three years ago, and it's qualitatively changed my life in the kitchen. These prompts have accelerated my development of a deeply satisfying ability: to show up at the market, choose what looks great in that moment, and improvise a complex meal with confidence. If the sunchokes look good, I know they'd pair beautifully with the mustard greens I see nearby, and I know what else I need to buy to prepare those vegetables as I imagine. When I get home, I already know how to execute the meal; I can move easily about the kitchen, not hesitating to look something up every few minutes. Despite what this guide's lengthy discussion might suggest, these prompts don't take me much time to write. Every week or two I'll trip on something interesting and spend a few minutes writing prompts about it. That's been enough to produce a huge impact.

At a decent restaurant, even simple foods often taste much better than most home cooks’ renditions. Sautéed vegetables seem richer; grains seem richer; sauces seem more luscious. One key reason for this is stock, a flavorful liquid building block. Restaurants often use stocks in situations where home cooks might use water: adding a bit of steam to sautéed vegetables, thinning a purée, simmering whole grains, etc. Stocks are also the base of many sauces, soups, and braises.

Stock is made by simmering flavorful ingredients in water. By varying the ingredients, we can produce different types of stock: chicken stock, vegetable stock, mushroom stock, pork stock, and so on. But unlike a typical broth, stock isn’t meant to have a distinctive flavor that can stand on its own. Instead, its job is to provide a versatile foundation for other preparations.

One of the most useful stocks is chicken stock. When used to prepare vegetables, chicken stock doesn’t make them taste like chicken: it makes them taste more savory and complete. It also adds a luxurious texture because it’s rich in gelatin from the chicken bones. Chicken stock takes only a few minutes of active time to make, and in a typical kitchen, it’s basically free: the primary ingredient is chicken bones, which you can naturally accumulate in your freezer if you cook chicken regularly.

Recipe

  • 2lbs (~1kg) chicken bones
  • 2qt (~2L) water
  • 1 onion, roughly chopped
  • 2 carrots, roughly chopped
  • 2 ribs of celery, roughly chopped
  • 4 cloves garlic, smashed
  • half a bunch of fresh parsley
  1. Combine all the ingredients in a large pot.
  2. Bring to a simmer on low heat (this will take about an hour). We use low heat to produce a bright, clean flavor: at higher temperatures, the stock will both taste and look duller.
  3. Lower heat to maintain a bare simmer for an hour and a half.
  4. Strain, wait until cool, then transfer to storage containers.

Chicken stock will keep for a week in the fridge or indefinitely in the freezer. There will be a cap of fat on the stock; skim that off before using the stock, and deploy the fat in place of oil or butter in any savory cooking situation.

This recipe can be scaled up or down to the quantity of chicken bones you have. The basic ratio is a pound of bones to a quart of water. The vegetables are flexible in choice and ratio.

Variations

For a more French flavor profile, replace the celery with leeks and add any/all of bay leaves, black peppercorns, and thyme. For a deeper flavor, roast the bones and vegetables first to make what’s called a “brown chicken stock” (the recipe above is for a “white chicken stock,” which is more delicate but also more versatile).

What to do with chicken stock

A few ideas for what you might do with your chicken stock:

  • Cook barley, farro, couscous and other grains in it.
  • Purée with roasted vegetables to make soup.
  • Wilt hearty greens like kale, chard, or collards in oil, then add a bit of stock and cover to steam through.
  • After roasting or pan-searing meat, deglaze the pan with stock to make a quick sauce.

To organize our efforts, it’s helpful to ask: what would it mean to “know” this material? I’d suggest that someone who “knows” this material should:

  • know how to make and store chicken stock
  • know what stock is and (at least shallowly) understand why and when it matters
  • know the role and significance of chicken stock, specifically
  • know some ways one might use chicken stock, both generally and with some specific examples
  • know of a few common variations and when they might be used

Some of this knowledge is factual; some of it is procedural; some of it is conceptual. We’ll see strategies for dealing with each of these types of knowledge.

But understanding is inherently personal. Really “knowing” something often involves going beyond what’s on the page to connect it to your life, other ideas you’re exploring, and other activities you find meaningful. We’ll also look at how to write questions of that kind.

If you're a vegetarian, I hope you can look past the discussion of bones: choosing this example involved many trade-offs.In this guide, we’ll imagine that you’re an interested home cook who’s never made stock before. Naturally, if you're an experienced cook, you'd probably need only a few of these prompts. And of course, if you don't cook at all, you'd write none of these prompts! Try to read the examples as demonstrations of how you might internalize a resource deeply without much prior fluency.

To demonstrate a wide array of principles, we’ll treat this material quite exhaustively. But it’s worth noting that in practice, you usually won’t study resources as systematically as this. You’ll jump around, focusing only on the parts which seem most valuable. You may return to a resource on a few occasions, writing more prompts as you understand what's most relevant. That’s good! Exhaustiveness may seem righteous in a shallow sense, but an obsession with completionism will drain your gumption and waste attention which could be better spent elsewhere. We'll return to this issue in greater depth later.

Writing prompts, in practice

Iterative prompt-writing

This guide aspires to demonstrate a wide variety of techniques, so I've deliberately analyzed the chicken stock recipe quite exhaustively. But in practice, if you were examining a recipe for the first time, I certainly wouldn’t recommend writing dozens of prompts at once like we've done here. If you try to analyze everything you read so comprehensively, you’re likely to waste time and burn yourself out.

Those issues aside, it's hard to write good prompts on your first exposure to new ideas. You’re still developing a sense of which details are important and which are not—both objectively, and to you personally. You likely don’t know which elements will be particularly challenging to remember (and hence worth extra reinforcement). You may not understand the ideas well enough to write prompts which access their “essence”, or which capture subtle implications. And you may need to live with new ideas for a while before you can write prompts which connect them vibrantly with whatever really matters to you.

All this suggests an iterative approach.

Say you’re reading an article that seems interesting. Try setting yourself an accessible goal: on your first pass, aim to write a small number of prompts (say, 5-10) about whatever seems most important, meaningful, or useful.

I find that such goals change the way I read even casual texts. When first adopting spaced repetition practice, I felt like I "should" write prompts about everything. This made reading a chore. By contrast, it feels quite freeing to aim for just a few key prompts at a time.As Michael Nielsen notes, similar lightweight prompt-writing goals can enliven seminars, professional conversations, events, and so on. I read a notch more actively, noticing a tickle in the back of my mind: “Ooh, that’s a juicy bit! Let's get that one!”

If the material is fairly simple, you may be able to write these prompts while you read. But for texts which are challenging or on an unfamiliar topic, it may be too disruptive to switch back and forth. In such cases it’s better to highlight or make note of the most important details. Then you can write prompts about your understanding of those details in a batch at the end or at a suitable stopping point. For these tougher topics, I find it’s best to focus initially on prompts about basic details you can build on: raw facts, terms, notation, etc.

Books are more complicated: there are many kinds of books and many ways to read them. This is true of articles, too, of course, but books amplify the variance. For one thing, you're less likely to read a book linearly than an article. And, of course, they're longer, so a handful of prompts will rarely suffice. The best prompt-writing approach will depend on how and why you're reading the book, but in general, if I'm trying to internalize a non-fiction book, I'll often begin by aiming to write a few key prompts on my first pass through a chapter or major section.

For many resources, one pass of prompt-writing is all that’s worth doing, at least initially. But if you have a rich text which you're trying to internalize thoroughly, it’s often valuable to make multiple passes, even in the first reading session. That doesn’t necessarily mean doubling down on effort: just write another handful of apparently-useful prompts each time. For a vivid account of this process in mathematics, see Michael Nielsen, Using spaced repetition systems to see through a piece of mathematics (2019).With each iteration, you’ll likely find yourself able to understand (and write prompts for) increasingly complex details. You may notice your attention drawn to patterns, connections, and bigger-picture insights. Even better: you may begin to focus on your own observations and questions, rather than those of the author. But it’s also important to notice if you feel yourself becoming restless. There’s no deep virtue in writing a prompt about every detail. In fact, it’s much more important to remain responsive to your sense of curiosity and interest.

Piotr Wozniak, a pioneer of spaced repetition, has been developing a system he calls incremental reading which attempts to actively support this kind of iterative, incremental prompt writing.If you notice a feeling of duty or completionism, remind yourself that you can always write more prompts later. In fact, they’ll probably be better if you do: motivated by something meaningful, like a new connection or a gap in your understanding.

Let’s consider our chicken stock recipe again for a moment. If I were an aspiring cook who had never heard of stock before, I’d probably write a few prompts about what stock is and why it matters: those details seem useful beyond the scope of this single recipe, and they connect to happy dining experiences I’ve had. That’s probably all I’d do until I actually made a batch of stock for myself. At that point, I’d know which steps were obvious and which made me consult the recipe. If I found I wanted to make stock again, I’d write another batch of prompts to recall details like ingredient ratios and times. I'd try to notice places where I found myself straining, vaguely aware that I'd "read something about this" but unsure of the details. As I used my first batch of stock in subsequent dishes, I might then write prompts about those experiences. And so on.

Litmus tests

While you’re drafting prose, a spell checker and grammar checker can help you avoid some simple classes of error. Such tools don't yet exist for prompt-writing, so it’s helpful to collect simple tests which can serve a similar function.

False positives: How might you produce the correct answer without really knowing the information you intend to know?

Discourage pattern matching. If you write a long question with unusual words or cues, you might eventually memorize the shape of that question and learn its corresponding answer—not because you’re really thinking about the knowledge involved, but through a mechanical pattern association. Cloze deletions seem particularly susceptible to this problem, especially when created by copying and editing passages from texts. This is best avoided by keeping questions short and simple.

Avoid binary prompts. Questions which ask for a yes/no or this/that answer tend to require little effort and produce shallow understanding. I find I can often answer such questions without really understanding what they mean. Binary prompts are best rephrased as more open-ended prompts. For instance, the first of these can be improved by transforming it into the second:

Q. Does chicken stock typically make vegetable dishes taste like chicken?

A. No.

Q. How does chicken stock affects the flavor of vegetable dishes? (according to Andy's recipe)

A. It makes them taste more "complete."

Improving a binary prompt often involves connecting it to something else, like an example or an implication. The lenses in the conceptual knowledge section are useful for this.

False negatives: How might you know the information the prompt intends to capture but fail to produce the correct answer? Such failures are often caused by not including enough context.

It’s easy to accidentally write a question which has correct answers besides the one you intend. You must include enough context that reasonable alternative answers are clearly wrong, while not including so much context that you encourage pattern matching or dilute the question’s focus.

For example, if you've just read a recipe for making an omelette, it might feel natural to ask: “What’s the first step to cook an omelette?” The answer might seem obvious relative to the recipe you just read: step one is clearly “heat butter in pan”! But six months from now, when you come back to this question, there are many reasonable answers: whisk eggs; heat butter in a pan; mince mushrooms for filling; etc.

One solution is to give the question extremely precise context: “What’s the first step in the Bon Appetit Jun ’18 omelette recipe?” But this framing suggests the knowledge is much more provincial than it really is. When possible, general knowledge should be expressed generally, so long as you can avoid ambiguity. This may mean finding another angle on the question; for instance: “When making an omelette, how must the pan be prepared before you add the eggs?”

False negatives often feel like the worst nonsense from school exams: "Oh, yes, that answer is correct—but it's not the one we were looking for. Try again?" Soren Bjornstad points out that a prompt which fails to exclude alternative correct answers requires that you also memorize “what the prompt is asking.”

Revising prompts over time

It’s often tough to diagnose issues with prompts while you're writing them. Problems may become apparent only upon review, and sometimes only once a prompt's repetition interval has grown to many months. Prompt-writing involves long feedback loops. So just as it's important to write prompts incrementally over time, it’s also important to revise prompts incrementally over time, as you notice problems and opportunities.

In your review sessions, be alert to feeling an internal “sigh” at a prompt. Often you’ll think: “oh, jeez, this prompt—I can never remember the answer.” Or “whenever this prompt comes up, I know the answer, but I don’t really understand what it means.” Listen for those reactions and use them to drive your revision. To avoid disrupting your review session, most spaced repetition systems allow you to flag a prompt as needing revision during a review. Then once your session is finished, you can view a list of flagged prompts and improve them.

The analogy to sentences is drawn from Matuschak and Nielsen, How can we develop transformative tools for thought? (2019).Learning to write good prompts is like learning to write good sentences. Each of these skills sometimes seems trivial, but each can be developed to a virtuosic level. And whether you're writing prompts or writing sentences, revision is a holistic endeavor. When editing prose, you can sometimes focus your attention on a single sentence. But to fix an awkward line, you may find yourself merging several sentences together, modifying your narrative devices, or changing broad textual structures. I find a similar observation applies to editing spaced repetition prompts. A prompt can sometimes be improved in isolation, but as my understanding shifts I'll often want to revise holistically—merge a few prompts here, reframe others there, split these into finer details. If you've attempted the exercises, you may notice that it's easier to revise across question boundaries when composing multiple questions in the same text field. As an experiment, I've written almost all new prompts in 2020 as simple "Q. / A." lines (like the examples in this guide) embedded in plaintext notes, using an old-fashioned text editor instead of a dedicated interface. I find I prefer this approach in most situations. In the future, I may release tools which allow others to write prompts in this way.Unfortunately, most spaced repetition interfaces treat each prompt as a sovereign unit, which makes this kind of high-level revision difficult. It's as if you're being asked to write a paper by submitting sentence one, then sentence two, and so on, revising only by submitting a request to edit a specific sentence number. Future systems may improve upon this limitation, but in the meantime, I've found I can revise prompts more effectively by simply keeping a holistic aspiration in mind.

In this guide, I've analyzed an example quite exhaustively to illustrate a wide array of principles, and I've advised you to write more prompts than might feel natural. So I'd like to close by offering a contrary admonition.

I believe the most important thing to "optimize" in spaced repetition practice is the emotional connection to your review sessions and their contents. It's worth learning how to create prompts which effectively represent many different kinds of understanding, but a prompt isn't worth reviewing just because it satisfies all the properties I've described here. If you find yourself reviewing something you don't care about anymore, you should act. Sometimes upon reflection you'll remember why you cared about the idea in the first place, and you can revise the prompt to cue that motivation. But most of the time the correct way to revise such prompts is to delete them.

Another way to approach this advice is to think about its reverse: what material should you write prompts about? When are these systems worth using? Many people feel paralyzed when getting started with spaced repetition, intrigued but unsure where it applies in their life. Others get started by trying to memorize trivia they feel they "should" know, like the names of all the U.S. presidents. Boredom and abandonment typically ensue. The best way to begin is to use these systems to help you do something that really matters to you—for example, as a lever to more deeply understand ideas connected to your core creative work. With time and experience, you'll internalize the benefits and costs of spaced repetition, which may let you identify other useful applications (like I did with cooking). If you don't see a way to use spaced repetition systems to help you do something that matters to you, then you probably shouldn't bother using these systems at all.

Further reading

These resources have been especially useful to me as I've developed an understanding of how to write good prompts:

For more perspectives on this and related topics, see:

Acknowledgements

My thanks to Peter Hartree, Michael Nielsen, Ben Reinhardt, and Can Sar for helpful feedback on this guide; to the many attendees of the prompt-writing workshops I held while developing this guide; and to Gwern Branwen and Taylor Rogalski for helpful discussions on prompt-writing which informed this work. I'm particularly grateful to Michael Nielsen for years of conversations and collaborations around memory systems, which have shaped all aspects of how I think about the subject.

This guide (and Orbit, its embedded spaced repetition system) were made possible by a crowd-funded research grant from my Patreon community. If you find my work interesting, you can become a member to get ongoing behind-the-scenes updates and early access to new work.

Licensing and attribution

This work is licensed under CC BY-NC 4.0, which means that you can copy, share, and build on this essay (with attribution), but not sell it.

In academic work, please cite this as:

Andy Matuschak, "How to write good prompts: using spaced repetition to create understanding", https://ift.tt/2KUPuvn, San Francisco (2020).



from Hacker News https://ift.tt/385X6El

Shigeru Miyamoto Wants to Create a Kinder World

In 1977, Shigeru Miyamoto joined Nintendo, a company then known for selling toys, playing cards, and trivial novelties. Miyamoto was twenty-four, fresh out of art school. His employer, inspired by the success of a California company named Atari, was hoping to expand into video games. Miyamoto began tinkering with a story about a carpenter, a damsel in distress, and a giant ape. The result, Donkey Kong, débuted in 1981. Four years later, Miyamoto had turned the carpenter into a plumber; Mario, and the Super Mario Bros. franchise, had arrived. But Miyamoto wanted more. Tired of linear, side-scrolling mechanics, he yearned to conjure the open world and carefree adventures of his childhood in Sonobe, a town just west of Kyoto. In 1986, Nintendo released The Legend of Zelda.

By 1993, when the journalist David Sheff published “Game Over: How Nintendo Zapped an American Industry, Captured Your Dollars, and Enslaved Your Children,” Miyamoto was widely considered the most important video-game designer in history. Although he benefits from the fact that most games are made by sprawling teams, which require a figurehead to whom players can attribute credit (or blame), he remains a nearly legendary figure. His games have sold hundreds of millions of copies; he played a major role in designing the Wii; he’s as much Nintendo’s mascot as the characters he’s created. (Rumors that he might retire have had an immediate effect on the company’s stock price.) But though he’s become famous, the idea that Miyamoto is doing much “zapping” is laughable. For one thing, he’s always shunned the shooting games that now dominate the medium. His aim, which he pursues with a strict, almost fanatical devotion, is to elicit joy.

Miyamoto turned sixty-eight in November. He’s been linked to Walt Disney since the early days of his career, and those comparisons are set to continue; Miyamoto is currently overseeing the design and installation of Super Nintendo World, a half-billion-dollar theme park at Universal Studios in Osaka. Because of his mystique, Nintendo tends to keep Miyamoto away from the media; as Nick Paumgarten wrote in his Profile, from 2010, securing an audience is “a little like trying to rescue Princess Toadstool.” But, a few days after Miyamoto’s birthday, I had a rare chance to speak to him at length, over Zoom—and he was willing to show more of the man behind the mascot than expected. In doing so, he revealed how deeply he has considered the discipline of game design and how much he has tried to move it forward. Our conversation has been edited for length and clarity.

I believe congratulations are in order. Happy birthday. Are you an easy person to buy gifts for?

I actually don’t buy a lot of gifts for other people, which means I find it hard to receive gifts. Maybe it’s difficult for people to choose things to give me. I received a birthday cake at Universal Studios when I was there this week, along with this T-shirt. [Points at his black shirt, emblazoned with the logo for Super Nintendo World.]

O.K. Whereabouts are you right now?

I’m in my house in Kyoto, not at Universal Studios, as the background suggests.

Kyoto has been home to Nintendo’s offices for more than a hundred years. It has become a site of pilgrimage for some people. In my mind, it has the aura of Willy Wonka’s Chocolate Factory: a secretive building full of marvellous inventors working on things that will delight us. Am I close here?

Once you get inside the building, it is a little like you’ve described. But on the outside, it’s very simple and clean, just a simple square building. Some people have even likened the reception area to a hospital waiting room. It’s kind of serene.

When you get past the reception area, does the environment help inspire the kind of creativity for which Nintendo is known?

Well, like I say, the building is simple. The staff can bring in any toys or action figures they like, but we have a system whereby designers switch desks according to whatever project they’re working on. Because there are no fixed placements, people don’t have that many personal belongings around them. I think, if a child were to visit and look at the space, it might seem a bit boring? The unique creative work takes place within each person. It doesn’t require a unique-looking environment. Obviously, we have all the equipment to do our work: motion-capture studios, sound studios. And we have a well-lit cafeteria, too, with good food.

You’ve been working at Nintendo for four decades now. What still excites you about going into the office?

It’s not the environment that makes me want to go so much as the fact that, over the weekend, I still spend a great deal of time thinking about games. By Monday, I’m usually excited to get back to work. To that end, I sometimes send e-mails over the weekend, which people don’t appreciate.

What was the last idea that made you feel that way?

Recently, I’ve been very involved with Universal Studios in Osaka, planning the attractions that are going to be there and putting the final touches on the rides. I’ve also been involved with making mobile games. Since I’m able to test and play these games easily at home, on the weekend, by Monday, I usually have a long list of things I want to try out and explore.

Super Mario Bros. is thirty-five years old this year. Half a lifetime. How does that make you feel?

Soon after Super Mario became famous, someone told me that I had reached the status of Walt Disney. I remember pointing out that, at the time, Mickey Mouse was more than fifty years old, while Mario had only been around for two or three years. So there was a lot to catch up on. I do believe that the quality of something hinges on whether or not it’s sought several decades after its creation. Walt Disney didn’t create everything that Disney put out, but the idea that a company could make these long-lasting symbols—that’s something I’ve admired. We’re finally at a point where people who played with Nintendo’s characters as children are playing with those same characters with their children. That longevity is special.

Do you have children or grandchildren?

Yes, I have two children and one grandchild.

I ask because, when I was growing up—and I think this was probably something that happened in a lot of schools—there was a kid who boasted that his dad worked for Nintendo, and nobody believed him. For your children, not only was it actually true, but they also shared their father with Super Mario. Did their friends ever doubt them?

I don’t think my children cared too much about my occupation, to be honest. Even with their friends, once in a while, a major fan comes to visit us, but most of the time we’ve been able to just hang out as a family. They’ve certainly never felt pressure to follow a certain path or to be a certain way. At home, I’m a normal dad. I don’t think that they have felt any undue burden because of who their father is.

In lockdown, millions of parents have been trying to insure that their kids maintain a healthy relationship to video games—not playing for too long, and so on. How did you negotiate these things with your own children?

Kids feeling like they can’t stop playing because the game is so fun—that’s something that I can understand and sympathize with. It’s important for parents to play the games, to understand why the child can’t quit until reaching the next save point, for example. In terms of my own kids, I’ve been fortunate in that they’ve always had a good relationship with video games. I’ve never had to restrict them or take games away from them.

It’s important to note that, in our household, all the video-game hardware belonged to me, and the children understood that they were borrowing these things. If they couldn’t follow the rules, then there was an understanding that I could just take the machine away from them. [Laughs.] When it was good weather outside, I would always encourage them to play outside. They played a lot of Sega games, too, by the way.

Really? Did you ever feel jealous about them playing a rival’s games?

[Laughs.] Not jealous so much as inspired to try harder, so that they preferred the ones I made.

Which Sega games did they enjoy?

They liked the driving games. Out Run. They also played a lot of Space Harrier.

Now, the other day, I had the chance to play with my grandchild. He was playing a Nintendo game called Captain Toad, and his eyes were shining; he was really into the experience. So I could see how a parent might be concerned about how immersed their child can become in a game. But, in my game design, I always want to encourage a relationship between a parent and child that is fundamentally nurturing. I was helping my grandchild navigate the 3-D world inside the game, and I could see the 3-D structure being built inside this five-year-old’s head. I thought, This could help his growth as well.

I believe in video games as a medium, and believe they can often tell us things about ourselves that are different from the insights offered by literature or film. There’s also a part of me that recognizes they can occupy a bit too much space in a person’s life. They are demanding and alluring; the obsession they inspire can squeeze out important things. Your job, usually, is to keep players engaged. Do you ever feel a tension between that role and the responsibility of putting things into the world that don’t diminish people?



from Hacker News https://ift.tt/38kOQPE

The Design of the Roland Juno Syntheziser's Oscillators

This article is a comprehensive guide to the Roland Juno's digitally-controlled analog oscillators (DCOs). I fell in love with the Juno early in my synthesizer journey and I've spent the last year or so doing research on its design so that I could create my own Juno-inspired DCO, Winterbloom's Castor & Pollux.

Juno logo

This article will cover a little history of the Juno, discuss the theory of operation behind digital-controlled oscillators, analyze the circuit designs for the Juno 6/60 & the Juno 106, and discuss practical aspects of using DCOs. This article is somewhat lengthy and there is a lot of information here. I've tried my best to make this approachable for anyone with basic electronics knowledge, so if you feel confused or overwhelmed please reach out and I'll be more than happy to include more details or change something so that it's easier to understand.

A little history

Roland introduced the incredible Juno-6 and nearly identical Juno-60 in 1982. The Juno was a 6-voice polyphonic synthesizer that was an incredible value considering its array of features.

A photo of the Juno-60

The Juno notably featured digitally-controlled analog oscillators. The DCO was designed to overcome them the tuning instability of the usual voltage-controlled oscillators (VCOs) in contemporary polyphonic synthesizers. The DCOs operate with the same fundamental analog circuitry but differ in that they are controlled by a microcontroller. This imparted a unique sound to the Juno series and one that's become a favorite of many musicians.

A photo of the Juno 160

Roland followed with the Juno-106 in 1984. It offered some feature upgrades over its predecessor such as pitch bend, modulation, and support for a new thing called MIDI. It still used the same digitally-controlled oscillator concept from the 6 & 60, but its implementation is a little bit different.

This article will discuss and analyze both designs, but before getting into the nitty-gritty details let's take a look at the overall sound generation design of the Juno. Also, this article will refer to these three synthesizers - the 6, 60, and 106 - as the Juno, but note that this isn't necessarily applicable to later models.

An overview of the Juno's sound generation

The Juno has six voices. Each voice has a single oscillator that can generate three different waveforms. These oscillators are controlled by the microcontroller. Here's a block diagram that should help visualize the different parts at play:

A block diagram of a DCO-based synth

Sound generation starts with a square wave controlled by the microntroller and then goes through a series of waveshapers which generates a ramp/sawtooth waveform, a sub waveform (which is a square wave at half the frequency), and a pulse waveform. The frequency of the clock determines the frequency/note that the oscillator plays.

This is in contrast to a common design for a voltage-controlled oscillator (VCO) where a CPU isn't required. Instead, it uses analog circuitry to create a control voltage which determines the oscillator's frequency:

A block diagram of a VCO-based synth

Now that you've got a high-level overview of the sound generation inside of these synthesizers, let's take a deeper look at the components involved in sound generation.

The ramp generator

Before jumping into the difference between DCOs and VCOs it's useful to discuss the similarities. As shown in the block diagrams above several designs for VCOs and the Juno DCOs are designed around a ramp generator (sometimes referred to as a ramp core) which creates a sawtooth (ramp) waveform:

A sawtooth waveform

The ramp generator is the beginning of how an oscillator turns a frequency input signal into the various useful waveforms that are used to make musical sounds. For a VCO, the frequency input signal is a control voltage, hence "voltage-controlled". For a DCO, the frequency input signal is a digital clock, hence "digitally-controlled".

The difference in the type of input signal has a significant impact on the circuit design. Before getting into those differences, let's look at the heart of the ramp generator that's shared between both designs: the integrator.

The integrator

An integrator is a electronic circuit that performs the mathematical operation of Integration. This is a fancy word from calculus but don't be afraid- it's actually pretty straightforward in practice.

The purpose of an integrator is to produce an output signal that changes (increase or decreases) at a rate corresponds to the magnitude and duration of the input signal. In this case the input and output signals are both voltage. If you apply a constant voltage to an integrator, it will create a consistent increase or decrease in the output voltage over time (a ramp):

An ideal integrator

More voltage means that the ramp will have a steeper slope. This is going to be helpful in generating a sawtooth waveform- the integrator ramp produces exactly one cycle of a sawtooth waveform. The trick is getting it to restart so that it creates a repeating (or periodic) sawtooth waveform.

You can create an integrator using an op-amp integrator circuit:

A basic op-amp integrator circuit

The op-amp integrator is based on the idea that if you apply a voltage to a capacitor it takes some time to charge, in fact, it will charge at a rate that is proportional to the input voltage which sounds a lot like integration! Without going into too much op-amp theory, you can just assume that the integrator circuit will produce a voltage that increases or decreases at a rate determined by the input voltage and the values of R and C. The values of R and C determine the RC constant of the integrator - or put more simply, how long it takes the circuit to charge up. Remember this concept because it comes into play a lot in this article.

You can play around this with interactive illustration to see how changing the voltage, resistance, or capacitance changes the output of the integrator:

The formula used to determine the output voltage of an integrator with a constant input voltage at a given time is:

Vout = -(Vin / (R * C)) * time

Before going further, there are some interesting and noteworthy properties of the integrator's behavior to be aware of:

  • First, notice that there are three ways of changing the steepness of the output's slope: changing the capacitance, changing the resistance, or changing the voltage. Making the voltage higher will charge the capacitor more quickly and increase the steepness of the slope. Making the resistance or capacitance lower will also cause the capacitor to charge more quickly and will increase the steepness of the slope.
  • Second, the output is inverted - a positive input voltage creates a downward slope and a negative input voltage creates an upward slope. This will come into play when we look at the difference between the Juno-6/60 design and the Juno-160 design.
  • Third, notice that with steeper slopes the output will saturate (stop increasing or decreasing). This is because a real op amp doesn't have an infinite amount of voltage to output and the capacitor can't hold an infinite amount of charge, so when either the output voltage is beyond the op amp's power supply or the capacitor can't hold any more charge the output voltage will saturate.

At this point you should hopefully have a good grasp on how an op-amp integrator forms a ramp from a constant input voltage. So now we'll see how to change the circuit so that instead of a single slope it generates a repeating (periodic) sawtooth waveform.

A straightforward solution is to just start the circuit over - reset it. That'll start the ramp back at zero and let it start rising (or falling) again. If you keep resetting at regular intervals the circuit will keep generating ramps and which form cycles of the sawtooth waveform.

But what does it mean to reset a circuit? Well, it means to put it back into its initial state. Think about what changes in the integrator circuit over time: the charge of the capacitor. When the circuit first starts the capacitor has no charge and the output voltage is zero, but, as time goes on the capacitor charges more and more. So resetting the circuit means discharging the capacitor.

The easiest way to discharge a capacitor is to short it: connect its two leads together so there's nothing blocking it from discharging. You can do that by putting a little switch in the circuit:

An op-amp integrator with a switch to discharge the capacitor

When the switch is open the integrator behaves the same as before - its output goes up or down depending on the input voltage. When the switch is closed, it creates a circuit that connects the capacitor's leads and allows it to discharge:

An op-amp integrator with a switch to discharge the capacitor

Once the switch is opened again the integrator starts over and beings ramping its output again.

Try out the little simulation below - press start to let the capacitor charge for a little bit and then press close switch to reset it:

Take notice that when you press the button at consistent intervals the output is a sawtooth waveform and its frequency is determined by how often you press the button and reset the capacitor.

Obviously there isn't any synthesizers out there that require you to manually tap a switch at the desired note's frequency! So instead of requiring a person to press a switch this circuit should take some form of frequency input signal and use it to electronically close the switch.

The switch is the easy part - there's a well-known component that can act as an electronically-controlled switch: the transistor. So, the ramp generator will use a transistor in place of the switch:

An op-amp integrator with a transistor to discharge the capacitor

Note that I am explicitly not specifying which kind of transistor (PNP, NPN etc)- which one you choose depends on a few other factors so for now I'll keep it abstract. Notice that there's also a new resistor there between the capacitor and the transistor. This is generally a low-value resistor and it's just there to limit the current that goes through the transistor when the capacitor discharges as too much current could damage the transistor.

So now the circuit has a means of electronically resetting the capacitor. The next step is to create a circuit that takes a frequency input signal and turns it into a reset signal to control the transistor. This is the point where VCOs and DCOs diverge, as up until now their theory has been the same but the form of the frequency input signal and the way the it's used is vastly different between the two. The next few sections will explore the different approaches taken by VCO and DCO designs to control the transistor and the capacitor, and therefore, the frequency of the sawtooth waveform.

The analog voltage-controlled oscillator

Although the point of this article is to explore DCO design, it's worthwhile to spend some time examining the operating principles behind a VCO. This analysis will provide some insight into certain aspects of the DCO's design.

The analog VCO design uses a control voltage as its frequency input signal. Creating this control voltage is pretty complicated and it's a bit too much to discuss here, but you should know that the control voltage generation circuitry is temperature sensitive- once the instrument warms up the oscillators will be out of tune! This is one of the motivating factors behind the DCO's design.

The VCO routes the control voltage right into the ramp generator's input voltage:

A complete VCO

The idea is that increasing the ramp generator's input voltage will cause the capacitor to charge more quickly- something you have already experienced with the interactive integrator animation.

The next step is resetting the ramp generator using the transistor. There isn't an immediately obvious way to use the control voltage to drive the transistor. However, increasing the control voltage increases the slope of the ramp. We could add a circuit that watches the output of the ramp generator and resets it using the transistor once it gets to a specific output level:

An illustration of resetting at a specific output level

A higher control voltage would mean the ramp reaches the target voltage faster and therefore gets reset more often and leads to a higher frequency.

You can implement that kind of circuit using a comparator:

A comparator

A comparator, well, compares! It takes two voltages: an input voltage and a threshold voltage. When the input voltage is below the threshold voltage, the comparator outputs a low voltage. However, if the input voltage instead is above the threshold voltage then the comparator will output a high voltage. You can play around with that here:

Note that this is a high-level ideal comparator and real ones require a little more work to use.

You can add a comparator to watch the output voltage of ramp generator and reset the circuit by turning on the transistor once the output is beyond the desired amplitude voltage. When the transistor turns on, the capacitor discharges and the ramp generator's output voltage will eventually fall below the comparator's threshold voltage and it'll turn the transistor back off- allowing the cycle to start over. Take a look at this circuit and animation:

A complete VCO

Hey, look at that- a sawtooth, finally!

This is now a working voltage-controlled oscillator circuit. Play around with the control voltage in the animation and note that as the control voltage increases so does the waveform's frequency.

But why is that the case? And how do you determine the exact frequency that a control voltage will produce? And inversely, how do you determine the appropriate control voltage for a given frequency?

Remember that the control voltage is used to directly charge the capacitor. Think about what happens as the control voltage increases:

  1. The capacitor will change faster,
  2. Which causes the integrator's ramp to rise faster,
  3. Which will cause the output voltage to rise faster,
  4. And therefore it will reach comparator's reference voltage faster,
  5. Which will cause the transistor to be switched on and off faster,
  6. Which finally causes an increase in frequency.

So now you know how the control voltage increases the frequency but you still need to know how to calculate the frequency given the voltage and vice-versa. Remember that there are three factors that influence how long it takes the capacitor to charge: the capacitance, the resistance, and the input voltage. The ramp generator section gave this formula for calculating an op-amp integrator's output voltage:

Vout = -(Vin / (R * C)) * time

This can be re-arranged to solve for charge time and therefore the frequency. Since charge time is considered the period of the waveform and frequency is the reciprocal of a period:

time = -(C * R * Vout) / Vin
frequency = 1 / time

If you select the component values for R and C and pick a desired output amplitude then you can plug those into the equation and you'll have the formula for determining frequency given a control voltage. In this case, I chose 200kΩ, 1nF, and -12V (don't worry about these values too much, I'll cover how to pick these values later):

C = 200kΩ
R = 1nF 
Vout = -12V

def frequency_for_control_voltage(Vin):
  time = -(C * R * Vout) / Vin
  frequency = 1 / time
  return frequency

You can use this interactive calculator to try out different control voltages and see how they map to frequencies:

More usefully you can calculate the inverse- the voltage needed for a specific frequency- by re-arranging the formula to solve for time (and therefore frequency):

time = 1 / frequency
Vin = -(C * R * Vout) / time

& plugging in the same values gives you the function:

C = 200kΩ
R = 1nF 
Vout = -12V

def control_voltage_for_frequency(frequency):
  time = 1 / frequency
  Vin = -(C * R * Vout) / time
  return Vin

& again, here's a handy-dandy interactive calculator:

Okay, at this point that's all you really need to know about VCOs before taking a look at DCOs. Of course, this article has left out all of the hairy details of practical VCOs so consider this a very simplified VCO that's really just here to help illustrate the differences between a VCO and a DCO. If you want to learn more about building VCOs you can take a look at this tutorial, this great series of videos, or this excellent book.

Alright, let's review. The key takeaways from VCOs are:

  1. The VCO's frequency input signal is a control voltage. The control voltage determines how quickly the integrator's capacitor charges, and therefore, the frequency.
  2. The VCO's amplitude is always constant because the ramp's output level is used to determine when to reset the circuit.

The digitally-controlled analog oscillator

The biggest problem with the VCO design is that the control voltage that determines the frequency is generated by a complex circuit that is very sensitive to temperature drift and manufacturing tolerances. This means that the generated control voltage might not match up to exactly to what it should be for the desired note and it'll end up sounding out of tune. What's worse is that even if you adjust for this you'll need to re-adjust as the instrument gets warmer!

With DCOs a different scheme is used to control the frequency. Unlike the analog VCO approach where a control voltage determines the frequency, a DCO's frequency is controlled by a digital clock signal. A digital clock signal is a square wave that operates at a specific frequency. In order to play different notes a microcontroller is used to change the frequency of the clock signal.

So how can you connect this incoming clock signal to the ramp core and control the frequency? Remember back to the basic ramp generator schematic:

An op-amp integrator with a transistor to discharge the capacitor

For now, assume that the input voltage to the comparator is some constant voltage. The transistor is really the key component in determining the frequency - how often it turns on and resets the circuit determines the frequency. The clock signal is a series of on/off periods so you could use that to turn the transistor on and off for each cycle of the clock.

If you were to connect the clock straight to the transistor then things wouldn't work quite right. Since the clock stays high for half of its cycle, that means that the transistor would stay on for half as cycle as well and the capacitor wouldn't be able to charge for half of the time:

A dco with the clock directly connected, showing an output that's flat for half of the time

So there has to be some circuit between between the clock and the transistor that makes sure the transistor is only turned on for a very short period of time during the clock cycle to let the capacitor discharge.

The RC differentiator

You can build a circuit that detects sharp changes in an input signal- like the rising or falling edge of a clock- and outputs short voltage spikes. This circuit is called an RC differentiator. That's a fancy word but it's a really simple circuit. Check out the circuit below and the animation to see its effect on the clock input:

A schematic showing an RC differentiator transforming a clock signal into spikes

The differentiator turns the clock's square wave (in purple) into a series of voltage spikes (in teal) when there is a rising or falling edge on the clock signal. Notice that if you change the resistance or capacitance the spikes last a shorter or longer amount of time. While I won't discuss exact values just yet, the general idea is that the spikes should last just long enough to discharge the capacitor. If the spikes last too long, then transistor will be on for too long and the output would distort the start of each waveform cycle. If the pulse is too short, the capacitor won't completely discharge which will cause an unwanted inconsistences and offsets in the resulting waveform:

Illustration of two bad waveforms from an incorrect differentiator

In practice, the RC constant of the differentiator should slightly greater than the RC constant of the ramp generator's discharge circuit:

Illustration highlighting the discharge circuit

So RCdifferentiator > RCdischarge. There are two reasons for this. The first is that the circuit needs to completely discharge the capacitor in order for the waveshape to be correct. Having the differentiator's RC constant slightly higher gives a bit more room for error because real-world component values vary. The second reason is that the transistor doesn't turn on until the base-to-emitter voltage, VBE is greater than its rated base-to-emitter saturation voltage, VBE(sat). For most common transistors, VBE(sat) is somewhere between 0.6 Volts and 0.7 Volts. Since the spikes from the differentiator quickly rise and then decrease exponentially there is some time during the spike where its voltage is too low to turn the transistor on. This visualization of the differentiator's output shows when the transistor would be on in red:

A basic DCO

The following schematic adds the clock input through the differentiator to control the transistor. Remember to assume that the integrator's input voltage is some constant voltage:

Schematic of the DCO with the RC differentiator added

Finally, there is a sawtooth waveform on the output! Note that there is also a resistor between the differentiator and the transistor - it's there to limit the current so that the capacitor doesn't discharge all of its energy at once and overload the transistor.

Here's an interactive animation of the DCO's output:

There is an obvious difference between DCO's output and the VCO's output: The DCO's amplitude varies across its frequency range. Lower frequencies have a higher amplitude (and are therefore louder) and higher frequencies have a lower amplitude (and are therefore quieter). In the extreme cases the lower frequencies clip (saturate the op-amp's output) leading to distortion, and the higher frequencies become inaudible. The next section will cover why this happens and how to accomplish an even amplitude across the DCO's range.

But before that, take a moment to review. You've now learned the theory behind both VCOs and DCOs. The key takeaways from DCOs are:

  1. The DCO's frequency is controlled by a clock signal that determines how often the transistor switches on.
  2. The DCO's amplitude decreases as frequency increases and therefore the DCO sounds quieter at higher frequencies unless there's some sort of compensation.

Amplitude compensation

The last section demonstrated a working DCO but with a critical flaw: its volume gets lower as frequencies get higher. This isn't very useful for a musical oscillator, so there needs to be some scheme that increases the amplitude as the frequency gets higher. This is called amplitude compensation.

Remember that throughout the DCO section I said to assume that the integrator's input voltage was constant. This is the reason why the amplitude problem exists. Because the input voltage is constant, the integrator's capacitor is ramping at a constant rate regardless of the clock frequency. At lower frequencies it charges too quickly and the waveform gets clipped. At higher frequencies it charges too slowly and therefore doesn't have enough time to get up to the desired amplitude before the clock resets the circuit.

In a practical DCO the integrator's input voltage can't be constant because the circuit needs to increase the voltage to increase the rate of the capacitor's charge. In the VCO design, a control voltage was connected to the integrator's input voltage and was used to increase how fast the capacitor charges. The DCO can use the same idea, however, instead of the control voltage being created by complicated analog circuitry it will be generated by the microcontroller using a digital-to-analog converter (DAC). Here's the schematic with the DAC added:

Schematic of a DCO with a DAC added

The microcontroller sends more voltage through the DAC as the oscillator plays increasing frequencies. This will cause the capacitor to charge more quickly and make the waveform's amplitude consistent across the oscillator's range of frequencies. The exact voltage needed varies, but a good formula to get the approximate charge voltage needed for a given note is:

max_frequency = 5kHz
note_frequency = 880 Hz
target_voltage = 12V

charge_voltage = target_voltage * note_frequency / max_frequency

The DCO design is now quite different from the VCO in terms of the way it's controlled. The microcontroller has to send two separate inputs into the oscillator to control its frequency and amplitude. While this might seem complicated, remember that the VCO has to be fed by complicated and temperature-sensitive circuitry. The microcontroller is capable of controlling the frequency of a DCO with a much higher degree of accuracy compared to the VCO and the requirement to control the amplitude as well is a reasonable trade-off. It also matters that the amplitude doesn't need to be very accurate because our ears are more sensitive to differences in pitch than differences in volume.

A practical DCO - The Juno 160 design

Now that we've covered the theory of operation for a DCO let's take a look at and analyze an actual DCO. The DCO schematic developed in the last section isn't far off from the Juno-160's design, so let's take a look at that:

Schematic of a DCO with values added

Here's an interactive animation of the Juno-106 oscillator's output:

That's a good looking sawtooth waveform! Of course, this little animation is not an accurate simulation of the circuit- the real waveform has some nice analog oddities.

Using the understanding of the operating principles learned so far let's break down the component values in the circuit and figure out what they mean for how this DCO will behave:

  • The RC differentiator has an RC constant of 10kΩ × 270pF = 2.7μs. The clock signal is 5 Volts. This means the transistor will remain on for about 5.3μs out of each waveform cycle.
  • The transistor is a NPN transistor so it will turn on during the rising edge of the clock. This is because an NPN transistor needs a positive base voltage and the RC differentiator will create a positive voltage spike when the clock changes from low to high.
  • The integrator's discharge circuit has an RC constant of 2.2kΩ * 1nF = 2.2μs. Notice that this follows the rule of thumb mentioned earlier - the differentiator's RC constant is slightly higher than the discharge circuit's. If taken in isolation the discharge circuit will leave just 9% of the voltage on the integrator's capacitor when the differentiator circuit turns the transistor on for 5.3μs. However, since the op amp's output and the DAC's output create a voltage across the capacitor while it is discharging it will discharge a little more quickly.
  • The integrator's RC constant is 200kΩ × 1nF = 0.2ms. That's equivalent to 5 kHz. This effectively sets the maximum operating frequency of the oscillator. 5 kHz is a great choice considering the highest note on a piano, C8, is 4,186 Hz.
  • At the maximum operating frequency of 5 kHz the transistor will only be on for 2.7μs / 0.2ms = 1.35% of the waveform's cycle, so there won't be any issues with the transistor being on for too long and causing distortion.
  • The voltage coming out of the DAC is inverted, so there is a negative charge voltage being fed into the integrator. If you remember back to the integrator, it also inverts - a positive input voltage creates a falling slope and a negative input voltage makes a rising slope. So the Juno-160 uses negative charge voltage to create a rising sawtooth waveform.

The information covered so far should also allow you to do this in reverse- that is you should be able to pick component values for a new DCO design. If you start by picking a maximum operating frequency (say, 5kHz) then you can use that to determine the integrator's RC constant:

RCintegrator = 1 / 5kHz
RCintegrator = 0.2ms

Any combination of resistance and capacitance that leads to that RC constant will work. The values used by the Juno-106, 200kΩ and 1nF, are perfectly fine. Now that you have the integrator's RC constant you can work out the differentiator's RC constant by applying the rule of thumb that is should be slightly more than the integrator's RC constant:

RCdifferentiator = RCintegrator * 1.2
RCdifferentiator = 2.7μs

Again the values used in the Juno-106, 10kΩ and 270pF, are perfectly fine. The remainder of the components can largely be determined through deduction or empirically through experimentation. While it's unlikely that you'll arrive at the perfect component values on the first try, this can at least give you a good idea of how you'd begin to pick these components from scratch.

That's pretty much the Juno-106 design. Here's a few more things that might be interesting to you:

  • The output voltage across the range can vary as much as 1 Volt, but that's fine- your ear won't really be able to tell the difference.
  • Because the Juno's DAC doesn't have a lot of resolution, the microcontroller can switch the integrator's resistor between 100kΩ, 200kΩ, and 399kΩ so that it has more control over the amplitude for lower frequencies.
  • The component values chosen here are actually picked from the Juno-60's service manual with the exception of the integrator's resistor and capacitor. The Juno-106's oscillators are on seperate voice card boards and the service manual doesn't list all of the values for the passives. While I'm not 100% sure on the values I picked here, I'm fairly certain I'm at least very close.
  • The microcontroller doesn't generate the clock signal directly, instead, it configures a set of programmable interval timers. The timers are clocked by an 8 MHz crystal oscillator.

The Juno-6 & 60 design

The Juno-6 & 60 share the same oscillator design. Here's what it looks like:

Schematic of the Juno 6 & 60 DCO

It's extremely similar to the Juno-106's design with one key difference: it outputs falling sawtooth waveform. This has some impact on the circuit:

  • The charge voltage is now positive. This is what leads to the falling waveform - the integrator creates a downward slope when given a positive input.
  • The transistor is now a PNP transistor. This is because the falling sawtooth output is from 0V to -12V, so the collector side of the transistor will be more negative than the emitter side. A PNP transistor is used so that the transistor can be forward biased with a negative collector-to-emitter voltage. This also means that the switch turns on during the falling edge of the clock signal because the PNP transistor requires that the base be more negative than the emitter and the differentiator produces a negative voltage spike on falling clock edges.

It's very similar to the Juno-106's, but here's an interactive animation of the Juno-6 & 60's oscillator output:

Some other interesting things about the Juno-6 & 60 implementation are:

  • The Juno-6 & 60 don't use a crystal oscillator to drive the clock used for the oscillators. It instead uses an analog LC oscillator that generates a 1 MHz to 3.5 MHz master clock and is divided down by the same programmable interrupt timers that the Juno-106 uses. The reason it's variable is because the Juno-6 & 60 apply pitch bend and LFO by modifying the frequency of the master clock. The Juno-106 has the CPU calculate that instead.
  • The exact transistor used is the 2SA1015. It's a pretty unexceptional transistor and was likely just chosen for cost - most of the transistors in the Juno are this transistor or the complementary NPN 2SC1815. Basically any general-purpose BJT can be used here - I used a 2N3906 for my experiments.
  • The op-amps used are TL08x, a very common general-purpose op-amp. Back in the day, the TL08x series had higher noise than the TL07x series. That's no longer true and the modern amps are practically identical. If you were designing a new DCO and wanted to select a fancier, modern op-omp you might consider something like the the OPA164x.

Waveshapers

The Juno's oscillators can can output more than just a sawtooth waveform- they can also output a pulse waveform with variable pulse width and a "sub" waveform which is a square waveform at half of the input frequency.

Illustration of the various Juno waveforms

The Juno 6, 60, & 160 all generate these waveforms the same way. The sub waveform is the easiest. Since it's a square waveform that's half the clock frequency, the clock input is sent through a D-type Flip-Flop configured as a simple divide-by-two circuit:

The schematic for the sub waveform using a divide-by-two circuit

The pulse waveform is slightly more involved because the Juno allows you to vary the pulse width:

A pulse waveform with various pulse widths

A clever way to generate a pulse wave with variable pulse width is to use the sawtooth output and our old friend the comparator:

The circuit for creating a variable-pulse waveform from a sawtooth waveform

The Juno uses a standard TL08x op-amp as an inverting comparator. The comparator compares the sawtooth wave against an adjustable voltage and switches its output from on to off when the sawtooth rises above that voltage. If the voltage is at 50% of the range, then the pulse-width will be 50% because the comparator will switch halfway through the waveform. If the voltage is higher, then the comparator will remain on for a longer period of time and therefore the pulse width will be higher. If the voltage is lower, the comparator will remain on for a shorted period of time and the pulse width will be lower. This is a little easier to understand with an animation:

And that's about it! ✨

Resources and further reading

Thank you for reading through this very long post. I sincerely hope it was useful and educational. Here are some resources you might want to take a look at for further reading:



from Hacker News https://ift.tt/3o67AZI