Take the 2-minute tour ×
Sound Design Stack Exchange is a question and answer site for sound engineers, producers, editors, and enthusiasts. It's 100% free, no registration required.

for a project, I am trying to generate a sound by directly accessing a loudspeaker. I can send a one-bit signal to the speaker and I know how to generate simple sounds by controlling the frequency (due to the rectangular pattern of my curve, it sounds very artificial, but that does not matter).

I would like to do chords, too, though. It must be possible to generate those. What is the general idea behind doing polyphonic sounds with a simple speaker?

So how do I need to go about this if I can only control this one bit stream? Thanks in advance.

UPDATE: I now have four signals, freq(3) down to freq(0) that all carry a frequency. For each of them, I have a signal SE (for "sound enable"), which tells me whether that signal is currently active. I achieve that by a simple "AND", so that every signal is always zero if the corresponding SE signal is zero and that it mirrors the actual frequency when SE is set to one.

So, the remaining problem: How do I connect the four signals? Connecting them with "OR" is probably not good, because with four signals the output will almost always be one. Any suggestions?

share|improve this question
This is actually a fairly interesting task considering most music these days is in 16-32bit - do keep us posted! –  SeanBlake Jul 15 '11 at 17:53
This is something I know nothing about, but googling "dyad frequency 1 bit" (dyad = two notes) I came across some potenitally relevant material and a possible second angle of attack "john chowning fm algorithm" –  horatio Jul 15 '11 at 21:18
@horatio: Any links? –  Franz Jul 15 '11 at 22:13
So how exactly do you create your signals – all by software, with arbitrary bit sequences? What are the highest possible sample rates? –  leftaroundabout Jul 16 '11 at 16:30
@leftaroundabout: I'm using a Spartan 3 board, programmed with VHDL. –  Franz Jul 16 '11 at 17:56
show 8 more comments

migrated from avp.stackexchange.com Jan 27 at 15:03

This question came from our site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation.

2 Answers

You might want to look at some of the theory behind additive synthesis - this Wikipedia article simplifies some of it. It is definitely do-able.

Of course, using a single bit (ie speaker at position 0 or position 1) will add in some interesting harmonics which will vary depending on the maximum rate of change of your speaker cone and the maximum rate of change of your signal)

As it happens I couldn't find much in the way of examples, however there is this project which may be what you are after.

share|improve this answer
Thanks, I will try this and report back. –  Franz Jul 15 '11 at 22:12
What about now? I edited the question. –  Franz Jul 18 '11 at 15:05
add comment
up vote 4 down vote accepted

Thanks for an interesting question! This kept me awake for a while.

It is definitely possible to generate chords even if all you have is a one-bit signal to the speaker. Many games for the ZX Spectrum (3.5 MHz, 8 bit CPU, 1 bit speaker) did this in the 80's.

There are a few techniques I can think of:

  1. Just generate (sine, square etc.) waves of different frequencies and add their values together. After adding them, downconvert to 1 bit. It becomes distorted but not always as bad as you might think.

  2. Add dither (noise) to the samples before downconverting to 1 bit. It makes the quantization noise less audible, but generates other noise. In theory, the dither noise should be more pleasing to the ears than the quantization noise, but it's a matter of taste. When you're downconverting to 1 bit, all theory goes out the window. :-)

  3. Arpeggiate. That is play the notes of the chords in quick succession. 20 milliseconds per note gives the perfect 80's feel to it.

I experimented with those techniques. Here's the result: http://www.librador.com/data/onebit.wav. Here I used the noise as a percussion effect.

I used a sampling frequency of 22050 Hz. The higher the frequency the better you can make it sound, but it uses more CPU of course. If have a fast CPU you should be able to raise the sampling frequency so much that the dithering noise won't be audible, and then you should be able to generate what is practically 8 bit sounds or more.

share|improve this answer
Well, my waves are not sinus waves (they're rectangular, basically) and it is not easy to do. I am not using a computer, but rather a Spartan 3 board. Shall I simply connect the two frequencies with a bit-wise OR? –  Franz Jul 16 '11 at 11:10
@Franz: you could maybe implement a simple dithering by switching between an AND and an OR of both signals very quickly and randomly. –  leftaroundabout Jul 16 '11 at 16:35
@Franz Sure, you can sum up square waves instead of sine waves. I tried both and I couldn't hear much of a difference, as the end result is a square wave in any case. But much of the nice sound I got was when I altered the relative amplitudes of the audio channels (different decay speeds for each channel gives a nice effect). Adding two binary digits and right shifting is the same as a logical AND, i.e. (a+b)>>1 == (a&b). –  Martin Vilcans Jul 16 '11 at 22:18
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.