Presentation is loading. Please wait.

Presentation is loading. Please wait.

Beyond the Beep Sequencer-Controlled Music Synthesis for 8-bit Apple II’s Michael Mahon

Similar presentations


Presentation on theme: "Beyond the Beep Sequencer-Controlled Music Synthesis for 8-bit Apple II’s Michael Mahon"— Presentation transcript:

1 Beyond the Beep Sequencer-Controlled Music Synthesis for 8-bit Apple II’s Michael Mahon http://home.comcast.net/~mjmahon

2 The Apple II speaker (and cassette output) Can only toggle “1-bit output” Can’t choose “polarity”

3 Simple Sound Double-frequency timing loop  Squarewaves (beep, etc.) Actual frequency timing loop  Non-50% duty cycles, timbre (Red Book) Infinitely-clipped 1-bit sound  Distorted speech and music (Hex Dump Reader, Audex, etc.)

4 Complex Sound Ultrasonic timing loop: Software DAC Variable duty cycle pulses  Electric Duet (4 duty cycles = 2-bit precision)  Software Automatic Mouth (?)  DAC522 (32 duty cycles = 5-bit precision)

5 DAC Timing Constraints 11kHz = 92 Apple II cycles/sample  1/92cy = 11.092kHz, +67Hz, +0.6% Apple II timing resolution = 1 cycle 4 cycles required to flip speaker  Requires 8 cycles per pulse  4-cycle minimum pulse width  6-cycle practical minimum pulse width Sound amplitude =  width / period  32/46 = 70% of squarewave volume

6 DAC522 Pulse Generators  46 cycles  46 cycles 937 9 99 3888 3977 4066 31 03 02 01 00 Sample value 

7 32 separate pulse generators  Each generator: Is aligned at a fixed offset on consecutive pages Generates two 6..37-cycle pulses in 92 cycles Counts samples to advance envelope pointer Fetches next sample and sets vector Tests for end of note Vectors to next generator  Computation is distributed between pulse edges DAC522 Two 46-cycle pulse periods, 5-bit precision Pulse frequency of 22kHz is (almost) inaudible

8 Other Issues Starting and stopping without “pops”  Solution: Never stop! “Ramp” waves to start and stop at 0 level Only end a note when sample value is 0..3 Generate continuous 0-level pulses –6 cycles every 46 cycles Generating many/long sounds at 11kB/second  Solution: Direct Digital Synthesis Resample wavetables on-the-fly Use envelope table for dynamics

9 Voice Envelope (Banjo) Wave shape and amplitude change with time Changes diminish with time Wave can usually be compressed significantly

10 Voice Compression Just 10 wave pages can represent a banjo 1 2 3 4 5 6 7 8 9 0.1.2 seconds.3.4.5 Envelope page:

11 Actual Voice Wave Pages Negative envelope has been subtracted Samples have been rounded to 5 bits (32 levels) 1 2 3 1 2 3

12 DAC522 Generator Code Generate pulse Generate pulse 2 Advance envelope Compute next sample Test for end of note 0840: 8D 30 C0 >41 rgen0 sta spkr ; <=== start time: 0 0843: EA >42 nop ; Kill 2 cycles 0844: 8D 30 C0 >43 sta spkr ; <==== stop time: 6 0847: EA >44 nop ; Kill 2 cycles 0848: EA >45 nop ; Kill 2 cycles 0849: EA >46 nop ; Kill 2 cycles 084A: EA >47 nop ; Kill 2 cycles 084B: 08 >48 php ; Kill 7 cycles 084C: 28 >49 plp 084D: E6 ED >50 inc scount ; Compute envelope 084F: F0 01 >51 beq *+3 ; If =, branch to iny 0851: A5 >51 dfb $A5 ; "lda $C8" to skip iny 0852: C8 >51 iny 0853: 18 >52 clc 0854: A5 EC >53 lda frac ; Compute next sample 0856: 65 FE >54 adc freq 0858: 85 EC >55 sta frac 085A: 8D 30 C0 >56 sta spkr ; <=== start time: 46 085D: 8A >57 txa 085E: 8D 30 C0 >58 sta spkr ; <==== stop time: 52 0861: 6D FF 00 >59 adca freq+1 0864: AA >60 tax 0865: B1 06 >61 lda (env),y ; Next sample page 0867: 8D 6C 08 >62 sta :ptr+2 086A: BD 00 00 >63 :ptr ldaa 0*0,x ; Fetch sample. 086D: 8D 7C 08 >64 sta :sw0+2 0870: AD 10 C0 >65 lda AKD 0873: C5 EF >66 cmp key ; Key changed? 0875: F0 03 >67 beq :sw0 ; -No, keep playing. 0877: 4C 77 10 >68 jmp newkey ; -Yes, handle it. 087A: 4C 40 08 >69 :sw0 jmp rgen0 ; Switch to rgen, T = 89

13 A2 DMS II / DMS Drummer II Single-voice multi-timbral real-time wavetable synthesizers Support up to 8 different “instruments” (one at a time)  Voice is represented as a set of single-cycle waveshapes selected by a table representing the envelope of the voice. Voice waves resampled on-the-fly to desired note pitch  Frequency = Integer.fraction sample index increment Wavetable waveforms start and end at zero amplitude to minimize pops “Resting” or idling sound is the zero-level pulse train

14 A2 DMS II Help Screen

15 DMS Drummer II Sequencer

16 DMS Drummer II Performance

17 Controlling the Synthesizers (the end test) A2 DMS II  Keyboard control  “Playback” control  Serial port control DMS Drummer II  Internal sequencer control (“drum machine”)  Keyboard control  Serial port control Serial port control allows external MIDI control

18 Questions and discussion...


Download ppt "Beyond the Beep Sequencer-Controlled Music Synthesis for 8-bit Apple II’s Michael Mahon"

Similar presentations


Ads by Google