Audio synthesis by bitwise logical modulation by wstryder published on 2012-03-12T11:39:34Z Synthesising audio by bitwise logical modulation. Two sines waves are "added" together byt bitwise AND or OR or XOR, at different frequencies and different phase offset. The frequency of one or both sine waves is increased incrimentally on samples 2-8, producing a pretty cool effect. When the other wave is detuned very slightly (samples 9 -17), you get a fat morphing sound, which actually sounds almost decent. This is the one case of bitwise modulation that IMHO has the most musical potential. When the other wave frequency is set at sub audio ranges (1hz or 0.1hz in samples 26-35) you get a "talking" modulation type effect. Samples 18-21 are set a 5th apart, and some detuned slightly. Experimenting with different wave amplitudes and waveforms other than sine, will produce even more interesting results. Sine waves are used in this sample set to demonstrate some of the phenomenon outlined by <a href="http://www.acoustics.hut.fi/~jkleimol/">Jari Kleimola</a> in <a href="http://www.acoustics.hut.fi/dafx08/papers/dafx08_13.pdf">this paper</a>. Interesting read for those that want to know more about the science behind bitwise modulation. My personal finding is that with the right parameters and some imagination, bitwise modulation can produce some pretty bad ass sounds. Best of all, it is computationally very efficient, hence it is suitable for sound synthesis on small microcontrollers. More on that later :) According to Kleimola there is no explicit carrier/modulator relationship in bitwise modulation, however this does not mean that there can't be a perceived relationship. Also worth noting is that when the frequency and phase of both waves is identical, the XOR operand will produce zero output, where as the output of AND or OR will equal the source wave. This is also explained in more detail in Kleimola's paper. My samples were produced by a perl script, using the Audio::Wav module. All files are at a 44100 sample rate and 16 bit sample depth. Short pseudo code below: my $len = $seconds * $sample_rate; my $max_no = (2 ** $bits_sample) for my $pos (0..$len) { # Set OSC 1 my $time1 = ($pos/$sample_rate) * $hertz1; my $osc1 = sin($pi * $time1) * $max_no; # Set OSC 2 my $phaseOffset = ($sample_rate/$hertz2) * ( $phase/360 ); my $time2 = (($pos + $phaseOffset)/$sample_rate) * $hertz2; my $osc2 = sin($pi * $time2) * $max_no; my $bitwise; switch ($bitwiseOp) { case 0 { $bitwise = $osc1 & $osc2 } case 1 { $bitwise = $osc1 | $osc2 } case 2 { $bitwise = $osc1 ^ $osc2 } } $write->write( $bitwise ); } Genre Synthesis Contains tracks Binary Morning by wstryder published on 2012-03-12T17:02:22Z 55.05hz XOR 110hz 90deg 44100 16bits 16secs OSC glideOctave by wstryder published on 2012-03-12T11:39:34Z 55hz XOR 110hz 90deg 44100 16bits 16secs glide OSC2 octave by wstryder published on 2012-03-12T11:39:34Z 110hz AND 110hz 0deg 44100 16bits 8secs glide both andOctave by wstryder published on 2012-03-12T11:39:34Z 110hz AND 110hz 90deg 44100 16bits 8secs glide both octave by wstryder published on 2012-03-12T11:39:34Z
55.05hz XOR 110hz 90deg 44100 16bits 16secs OSC glideOctave by wstryder published on 2012-03-12T11:39:34Z
55hz XOR 110hz 90deg 44100 16bits 16secs glide OSC2 octave by wstryder published on 2012-03-12T11:39:34Z
110hz AND 110hz 0deg 44100 16bits 8secs glide both andOctave by wstryder published on 2012-03-12T11:39:34Z
110hz AND 110hz 90deg 44100 16bits 8secs glide both octave by wstryder published on 2012-03-12T11:39:34Z