The Yamaha YM3812 (aka OPL2) has an operation mode named composite sine mode (CSM), apparently designed for speech synthesis. Unfortunately I was unabled to find any documentation on what specifically this mode does and how the chip is programmed when in this mode.

Some hints I found online were:

  • the mode allows you to trigger multiple channels simulatenously using a timer
  • the mode allows you to program each oscillator individually

But no coherent picture of the programming model of composite sine mode obtains.

What does composite sine mode do and how do you program the chip when in this mode?

2 Answers 2


In short, the Composite Sine Mode is just a mode which allows triggering multiple channels simultaneously to start their sound generation. It just helps to turn on multiple channels at once, instead of the programmer having to separately turn on multiple channels. It is nothing fancy by itself, as all the sound generation parameters still need to be set by the user to do something useful with the CSM mode, such as speech synthesis.

The intended use of CSM mode is mainly for speech synthesis, where voices are simulated using 3 to 6 sine waves and pitch.

The mode exists because it allows all the channels/operators used for sine generation to be triggered to start simultaneously. Usually triggering a channel resets the phase accumulators of the operators it controls, which means that all the sine waves start with defined phase relation to each other. It will also trigger the envelope generators to start from attack phase.

The common trigger for the channels in CSM mode is the overflow of Timer 1, which will set the Key-On/Key-Off event for all the operators used for CSM.

So to use the CSM mode, basically the channels can't be used for other purposes, so they should be turned off before setting the CSM mode bit. Next the sound generation parameters such as pitch and envelope generation data of the wanted synthesized sound should be loaded, and finally the Timer 1 should be started with a value near the overflow at which time the channels are triggered. It is likely that the timer will keep retriggering the sounds each overflow so depending on if retriggering is needed or not the timer period should be set to required retrigger period or stopped to prevent retriggering.

The documentation fails to mention which channels are used for the CSM mode, so I can't currently provide more detailed information without further reverse-engineering.

  • 1
    Thank you for your answer. This adds more pieces to the puzzle.
    – fuz
    Commented Jan 17, 2022 at 11:00
  • Yeah, I implemented an OPLL (i.e. OPL2 with mostly fixed instruments) emulation a couple of years ago, and this is already more than I was able to find out about CSW mode at the time. Luckily Yamaha’s refusal to provide good documentation also means that programmers didn’t use CSW mode.
    – Tommy
    Commented Jan 18, 2022 at 0:16

Hard to give an easy answer, as this touches multiple areas, so here's just an overview of what CSM and speech is about.

The Yamaha FM Operator Type L (OPL)(2) (*1) is as great because it does not use some analogue circuits to create some sounds, like for example the C64's SID, but calculates sounds digital only to be turned into an analogue signal at the very end. This abstract approach - nowadays, with fast processors standard, allows the creation of a high number of operators, each acting like an independent sound channel. For CSM it's important that these can be operated as 9 generators of two sine signals (*2) each.

In CSM mode these are used to 'recreate' the complex sounds of speech as one theory, the sine wave synthesis, describes them: as a collection of pure sine waves.

The idea is, that a section of speech can be described as a set of sine waves, which would reassemble the frequencies the various parts of our speech tract creates for that sound. Since each sine can be described as a single number, one would only need a very low amount of data to encode such a section. At the same time, since the resulting signal is a rather complex one, allowing these sections to be way longer than what is needed for a full figured digital recording.

For somewhat acceptable (phone) quality a straight digitalization might need some 6k samples per second or about the 6 kByte/s. With sine wave synthesis each section could be as long as 20-50 ms while still creating acceptable speech quality. This means only 20-50 sets of sine arrays are needed per second. So, if for example a sample can be knocked down to 20 sine waves (or less), a second of speech is no longer 6k but only 0.4 to 1 kByte. Sounds like a great compression rate, doesn't it?

When it comes to encoding the method is called Linear Predictive Coding (LPC), which is all about encoding and recreating speech like sound using a low number of formants - in case of the OPL, these formants are simply the sine waves we talked about before. LPC is base of various codecs, used for digital phone services like various mobile or VoIP. Of course these use way more sophisticated methods than just selecting the 10 highest sine waves of a section.

And yes, LPC is what TI used as well for their speech chips, from Speak&Spell all the way to the 99/4 Speech Synthesizer. Although, their method of creation was even compactified than the use of sine waves.

For usage of the OPL, CSM means that believable speech can be created by feeding one set of sine values to all 9 generators and have it repeat them for maybe 50 ms before feeding the next table. A task quite solvable already for 8 bit micros.

*1 - OPL and OPL2 are for most parts the same, the OPL2 just added some more wave forms.

*2 - The whole base for the OPL is a ROM with data for a quarter sine wave

  • Thank you for this explanation of sine wave synthesis. Do you know any specifics of how CSM mode affects the way the OPL2 chip is programmed? Feeding different operator configurations into the chip every 50 ms seems to be something you can do without any special mode.
    – fuz
    Commented Jan 17, 2022 at 1:34
  • @fuz No, at least not good enough to give a thruout explanation. AFAIR setting the bit means that the same ADSR operators are applied to all channels. But please double check this against datasheets / programming manuals (And yes, I know, they are nowadays hard to come by).
    – Raffzahn
    Commented Jan 17, 2022 at 1:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .