aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pd/doc/1.manual/fig1.1.jpgbin6794 -> 0 bytes
-rw-r--r--pd/doc/1.manual/fig1.1.pngbin0 -> 1980 bytes
-rw-r--r--pd/doc/1.manual/fig1.2.jpgbin4361 -> 446 bytes
-rw-r--r--pd/doc/1.manual/fig1.3.jpgbin1056 -> 381 bytes
-rw-r--r--pd/doc/1.manual/fig1.4.jpgbin5965 -> 0 bytes
-rw-r--r--pd/doc/1.manual/fig1.4.pngbin0 -> 1154 bytes
-rw-r--r--pd/doc/1.manual/fig1.5.jpgbin6187 -> 180 bytes
-rw-r--r--pd/doc/1.manual/fig11.1.pngbin0 -> 5542 bytes
-rw-r--r--pd/doc/1.manual/fig11.2.pngbin0 -> 2887 bytes
-rw-r--r--pd/doc/1.manual/fig3.1.jpgbin1201 -> 425 bytes
-rw-r--r--pd/doc/1.manual/fig3.10.jpgbin2884 -> 180 bytes
-rw-r--r--pd/doc/1.manual/fig3.2.jpgbin2932 -> 180 bytes
-rw-r--r--pd/doc/1.manual/fig3.3.jpgbin2177 -> 403 bytes
-rw-r--r--pd/doc/1.manual/fig3.4.jpgbin2359 -> 611 bytes
-rw-r--r--pd/doc/1.manual/fig3.5.jpgbin2029 -> 180 bytes
-rw-r--r--pd/doc/1.manual/fig3.6.jpgbin2977 -> 408 bytes
-rw-r--r--pd/doc/1.manual/fig3.7.jpgbin2846 -> 105 bytes
-rw-r--r--pd/doc/1.manual/fig3.8.jpgbin1267 -> 295 bytes
-rw-r--r--pd/doc/1.manual/fig3.9.jpgbin5708 -> 180 bytes
-rw-r--r--pd/doc/1.manual/fig7.1.jpgbin2410 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig7.2.jpgbin7327 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig7.3.jpgbin2588 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig7.4.jpgbin3245 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig7.5.jpgbin2490 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig7.6.jpgbin7758 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig8.1.jpgbin2551 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig8.2.jpgbin2414 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig8.3.jpgbin2036 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig8.4.jpgbin3428 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig8.5.jpgbin5182 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig8.6.jpgbin7549 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig9.1.jpgbin15267 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig9.2.jpgbin17390 -> 77 bytes
-rw-r--r--pd/doc/1.manual/fig9.3.jpgbin38881 -> 77 bytes
-rw-r--r--pd/doc/1.manual/index.htm38
-rwxr-xr-xpd/doc/1.manual/pdmanual.css39
-rw-r--r--pd/doc/1.manual/x1.htm58
-rw-r--r--pd/doc/1.manual/x2.htm542
-rw-r--r--pd/doc/1.manual/x3.htm723
-rw-r--r--pd/doc/1.manual/x4.htm34
-rw-r--r--pd/doc/1.manual/x5.htm141
-rw-r--r--pd/doc/2.control.examples/22.sequencing.pd30
-rw-r--r--pd/doc/3.audio.examples/00.INTRO.txt43
-rw-r--r--pd/doc/3.audio.examples/01.PART1.sinewave.pd32
-rw-r--r--pd/doc/3.audio.examples/02.amplitude.pd37
-rw-r--r--pd/doc/3.audio.examples/03.line.pd55
-rw-r--r--pd/doc/3.audio.examples/04.line2.pd59
-rw-r--r--pd/doc/3.audio.examples/05.output.subpatch.pd30
-rw-r--r--pd/doc/3.audio.examples/06.frequency.pd60
-rw-r--r--pd/doc/3.audio.examples/07.frequency.mod.pd105
-rw-r--r--pd/doc/3.audio.examples/09.review.pd43
-rw-r--r--pd/doc/3.audio.examples/10.PART2.wavetables.pd104
-rw-r--r--pd/doc/3.audio.examples/11.wavetable.FM.pd147
-rw-r--r--pd/doc/3.audio.examples/12.tabread4.pd128
-rw-r--r--pd/doc/3.audio.examples/13.tabread4.interpolation.pd44
-rw-r--r--pd/doc/3.audio.examples/14.more.tabread.pd106
-rw-r--r--pd/doc/3.audio.examples/15.table.switching.pd127
-rw-r--r--pd/doc/3.audio.examples/16.table.spectrum.pd143
-rw-r--r--pd/doc/3.audio.examples/17.foldover.pd112
-rw-r--r--pd/doc/3.audio.examples/18.PART3.pulse.pd126
-rw-r--r--pd/doc/3.audio.examples/20.pulse.spectrum.pd136
-rw-r--r--pd/doc/3.audio.examples/21.more.pulses.pd138
-rw-r--r--pd/doc/3.audio.examples/26.additive.pd92
-rw-r--r--pd/doc/3.audio.examples/27.PART4.samplers.pd111
-rw-r--r--pd/doc/3.audio.examples/28.sampler.loop.pd124
-rw-r--r--pd/doc/3.audio.examples/30.sampler.scratch.pd175
-rw-r--r--pd/doc/3.audio.examples/31.sampler.nodoppler.pd180
-rw-r--r--pd/doc/3.audio.examples/32.sampler.transpose.pd207
-rw-r--r--pd/doc/3.audio.examples/33.sampler.oneshot.pd143
-rw-r--r--pd/doc/3.audio.examples/34.sampler.notes.pd321
-rw-r--r--pd/doc/3.audio.examples/35.qlist.txt147
-rw-r--r--pd/doc/3.audio.examples/35.sampler.poly.pd228
-rw-r--r--pd/doc/3.audio.examples/36.PART5.envelopes.pd90
-rw-r--r--pd/doc/3.audio.examples/37.adsr.pd34
-rw-r--r--pd/doc/3.audio.examples/38.envelope.dB.pd158
-rw-r--r--pd/doc/3.audio.examples/39.envelope.slew.pd102
-rw-r--r--pd/doc/3.audio.examples/40.envelope.pitch.pd209
-rw-r--r--pd/doc/3.audio.examples/42.PART6.analog.sequencer.pd133
-rw-r--r--pd/doc/3.audio.examples/43.monophonic.synth.pd135
-rw-r--r--pd/doc/3.audio.examples/44.sample.hold.pd160
-rw-r--r--pd/doc/3.audio.examples/45.envelope.follower.pd101
-rw-r--r--pd/doc/3.audio.examples/51.ring.modulation.pd153
-rw-r--r--pd/doc/3.audio.examples/53.delays.pd225
-rw-r--r--pd/doc/3.audio.examples/54.delay.loop.pd213
-rw-r--r--pd/doc/3.audio.examples/55.delay.variable.pd129
-rw-r--r--pd/doc/3.audio.examples/56.delay.pitchshift.pd226
-rw-r--r--pd/doc/3.audio.examples/57.delay.reverb.pd316
-rw-r--r--pd/doc/3.audio.examples/58.PART8.moreFM.pd132
-rw-r--r--pd/doc/3.audio.examples/59.packets.pd161
-rw-r--r--pd/doc/3.audio.examples/61.two.cosines.pd124
-rw-r--r--pd/doc/3.audio.examples/62.declickit.pd132
-rw-r--r--pd/doc/3.audio.examples/63.sweepable.FM.pd161
-rw-r--r--pd/doc/3.audio.examples/64.paf.pd234
-rw-r--r--pd/doc/3.audio.examples/65.paf.control.pd219
-rw-r--r--pd/doc/3.audio.examples/66.PART9.quartic.pd140
-rw-r--r--pd/doc/3.audio.examples/67.more.quartic.pd147
-rw-r--r--pd/doc/3.audio.examples/68.qlist.pd102
-rw-r--r--pd/doc/3.audio.examples/69.more.adsr.pd117
-rw-r--r--pd/doc/3.audio.examples/70.vibrato.pd158
-rw-r--r--pd/doc/3.audio.examples/71.adsr.sequenced.pd217
-rw-r--r--pd/doc/3.audio.examples/72.execution.order.pd127
-rw-r--r--pd/doc/3.audio.examples/73.control.blocksize.pd111
-rw-r--r--pd/doc/3.audio.examples/74.up.downsampling.pd191
-rw-r--r--pd/doc/3.audio.examples/A00.intro.pd10
-rw-r--r--pd/doc/3.audio.examples/A00.intro.txt9
-rw-r--r--pd/doc/3.audio.examples/A07.frequency.mod.pd141
-rw-r--r--pd/doc/3.audio.examples/A08.phase.mod.pd246
-rw-r--r--pd/doc/3.audio.examples/A08.review.pd (renamed from pd/doc/3.audio.examples/A09.review.pd)0
-rw-r--r--pd/doc/3.audio.examples/B05.tabread.FM.pd24
-rw-r--r--pd/doc/3.audio.examples/D01.envelope.gen.pd128
-rw-r--r--pd/doc/3.audio.examples/D02.adsr.pd62
-rw-r--r--pd/doc/3.audio.examples/D03.envelope.dB.pd118
-rw-r--r--pd/doc/3.audio.examples/D04.envelope.quartic.pd81
-rw-r--r--pd/doc/3.audio.examples/D05.envelope.pitch.pd (renamed from pd/doc/3.audio.examples/D04.envelope.pitch.pd)88
-rw-r--r--pd/doc/3.audio.examples/D05.envelope.portamento.pd148
-rw-r--r--pd/doc/3.audio.examples/D06.additive.pd92
-rw-r--r--pd/doc/3.audio.examples/D06.envelope.portamento.pd (renamed from pd/doc/3.audio.examples/41.envelope.portamento.pd)0
-rw-r--r--pd/doc/3.audio.examples/D07.additive.pd50
-rw-r--r--pd/doc/3.audio.examples/D07.sampler.notes.pd321
-rw-r--r--pd/doc/3.audio.examples/D08.table.spectrum.pd91
-rw-r--r--pd/doc/3.audio.examples/D09.shepard.tone.pd108
-rw-r--r--pd/doc/3.audio.examples/D09.table.spectrum.pd143
-rw-r--r--pd/doc/3.audio.examples/D10.risset.bell.pd109
-rw-r--r--pd/doc/3.audio.examples/D10.sampler.notes.pd263
-rw-r--r--pd/doc/3.audio.examples/D11.sampler.poly.pd (renamed from pd/doc/3.audio.examples/D08.sampler.poly.pd)148
-rw-r--r--pd/doc/3.audio.examples/D11.shepard.tone.pd110
-rw-r--r--pd/doc/3.audio.examples/D12.sampler.bis.pd203
-rw-r--r--pd/doc/3.audio.examples/E01.pulse.pd126
-rw-r--r--pd/doc/3.audio.examples/E01.spectrum.pd179
-rw-r--r--pd/doc/3.audio.examples/E02.just.say.pd152
-rw-r--r--pd/doc/3.audio.examples/E02.ring.modulation.pd197
-rw-r--r--pd/doc/3.audio.examples/E03.octave.divider.pd137
-rw-r--r--pd/doc/3.audio.examples/E03.pulse.spectrum.pd136
-rw-r--r--pd/doc/3.audio.examples/E04.difference.tone.pd45
-rw-r--r--pd/doc/3.audio.examples/E04.more.pulses.pd138
-rw-r--r--pd/doc/3.audio.examples/E05.chebychev.pd257
-rw-r--r--pd/doc/3.audio.examples/E05.pulse.width.mod.pd98
-rw-r--r--pd/doc/3.audio.examples/E06.exponential.pd335
-rw-r--r--pd/doc/3.audio.examples/E06.stereo.pd87
-rw-r--r--pd/doc/3.audio.examples/E07.envelope.mod.pd148
-rw-r--r--pd/doc/3.audio.examples/E07.evenodd.pd109
-rw-r--r--pd/doc/3.audio.examples/E08.even.odd.pd116
-rw-r--r--pd/doc/3.audio.examples/E08.phase.mod.pd (renamed from pd/doc/3.audio.examples/08.phase.mod.pd)168
-rw-r--r--pd/doc/3.audio.examples/E09.FM.spectrum.pd139
-rw-r--r--pd/doc/3.audio.examples/E09.bandlimited.pd166
-rw-r--r--pd/doc/3.audio.examples/E10.complex.FM.pd156
-rw-r--r--pd/doc/3.audio.examples/F01.PART7.filters.pd72
-rw-r--r--pd/doc/3.audio.examples/F01.pulse.pd82
-rw-r--r--pd/doc/3.audio.examples/F02.bandpass.pd146
-rw-r--r--pd/doc/3.audio.examples/F02.just.say.pd (renamed from pd/doc/3.audio.examples/19.just.say.pd)0
-rw-r--r--pd/doc/3.audio.examples/F03.filter.sweep.pd173
-rw-r--r--pd/doc/3.audio.examples/F03.pulse.spectrum.pd126
-rw-r--r--pd/doc/3.audio.examples/F04.filter.floyd.pd193
-rw-r--r--pd/doc/3.audio.examples/F04.waveshaping.pulse.pd133
-rw-r--r--pd/doc/3.audio.examples/F05.filter.noise.pd196
-rw-r--r--pd/doc/3.audio.examples/F05.ring.modulation.pd160
-rw-r--r--pd/doc/3.audio.examples/F06.packets.pd117
-rw-r--r--pd/doc/3.audio.examples/F06.ring.modulation.pd153
-rw-r--r--pd/doc/3.audio.examples/F07.packet.spectrum.pd (renamed from pd/doc/3.audio.examples/60.packet.spectrum.pd)0
-rw-r--r--pd/doc/3.audio.examples/F07.ssb.modulation.pd150
-rw-r--r--pd/doc/3.audio.examples/F08.two.cosines.pd70
-rw-r--r--pd/doc/3.audio.examples/F09.declickit.pd94
-rw-r--r--pd/doc/3.audio.examples/F10.sweepable.FM.pd152
-rw-r--r--pd/doc/3.audio.examples/F11.anharmonic.FM.pd126
-rw-r--r--pd/doc/3.audio.examples/F12.paf.pd226
-rw-r--r--pd/doc/3.audio.examples/F13.paf.control.pd164
-rw-r--r--pd/doc/3.audio.examples/G05.delay.reverb.pd156
-rw-r--r--pd/doc/3.audio.examples/H01.intro.filters.pd (renamed from pd/doc/3.audio.examples/46.PART7.filters.pd)0
-rw-r--r--pd/doc/3.audio.examples/H01.more.FM.pd132
-rw-r--r--pd/doc/3.audio.examples/H02.bandpass.pd (renamed from pd/doc/3.audio.examples/47.bandpass.pd)0
-rw-r--r--pd/doc/3.audio.examples/H02.packets.pd161
-rw-r--r--pd/doc/3.audio.examples/H03.filter.sweep.pd (renamed from pd/doc/3.audio.examples/48.filter.sweep.pd)0
-rw-r--r--pd/doc/3.audio.examples/H03.packet.spectrum.pd147
-rw-r--r--pd/doc/3.audio.examples/H04.filter.floyd.pd (renamed from pd/doc/3.audio.examples/49.filter.floyd.pd)0
-rw-r--r--pd/doc/3.audio.examples/H04.two.cosines.pd124
-rw-r--r--pd/doc/3.audio.examples/H05.declickit.pd132
-rw-r--r--pd/doc/3.audio.examples/H05.filter.noise.pd (renamed from pd/doc/3.audio.examples/50.filter.noise.pd)0
-rw-r--r--pd/doc/3.audio.examples/H06.sweepable.FM.pd161
-rw-r--r--pd/doc/3.audio.examples/H07.paf.pd234
-rw-r--r--pd/doc/3.audio.examples/H07.ssb.modulation.pd (renamed from pd/doc/3.audio.examples/52.ssb.modulation.pd)0
-rw-r--r--pd/doc/3.audio.examples/H08.paf.control.pd219
-rw-r--r--pd/doc/3.audio.examples/J01.quartic.pd140
-rw-r--r--pd/doc/3.audio.examples/J02.more.quartic.pd147
-rw-r--r--pd/doc/3.audio.examples/J10.waveshaping.pd133
-rw-r--r--pd/doc/3.audio.examples/K01.pulse.width.mod.pd (renamed from pd/doc/3.audio.examples/22.pulse.width.mod.pd)0
-rw-r--r--pd/doc/3.audio.examples/K02.stereo.pd (renamed from pd/doc/3.audio.examples/23.stereo.pd)0
-rw-r--r--pd/doc/3.audio.examples/K03.envelope.mod.pd (renamed from pd/doc/3.audio.examples/29.sampler.loop.smooth.pd)0
-rw-r--r--pd/doc/3.audio.examples/K04.even.odd.pd (renamed from pd/doc/3.audio.examples/24.even.odd.pd)0
-rw-r--r--pd/doc/3.audio.examples/K05.bandlimited.pd (renamed from pd/doc/3.audio.examples/25.bandlimited.pd)0
-rw-r--r--pd/doc/3.audio.examples/adsr2.pd110
-rw-r--r--pd/doc/3.audio.examples/output~.pd42
-rw-r--r--pd/doc/3.audio.examples/partial.pd127
-rw-r--r--pd/doc/3.audio.examples/reverb-echo.pd (renamed from pd/doc/3.audio.examples/echo.pd)11
-rw-r--r--pd/doc/3.audio.examples/sampvoice.pd193
-rw-r--r--pd/doc/3.audio.examples/sampvoice2.pd122
-rw-r--r--pd/doc/3.audio.examples/shepvoice.pd48
-rw-r--r--pd/doc/3.audio.examples/spectrum-partial.pd38
-rw-r--r--pd/doc/3.audio.examples/x.ps844
-rw-r--r--pd/doc/4.fft.examples/04.shifts.pd4
-rw-r--r--pd/doc/4.fft.examples/10.phaselockedvoc.pd8
-rw-r--r--pd/doc/4.fft.examples/11.pianorev.pd4
-rw-r--r--pd/doc/4.fft.examples/12.sinedecomposer.pd130
-rw-r--r--pd/doc/4.fft.examples/x.wavbin8864 -> 556 bytes
-rw-r--r--pd/doc/5.reference/acoustics.pd40
-rw-r--r--pd/doc/5.reference/acoustics~.pd81
-rw-r--r--pd/doc/5.reference/adc~_dac~.pd11
-rw-r--r--pd/doc/5.reference/append.pd44
-rw-r--r--pd/doc/5.reference/bag.pd27
-rw-r--r--pd/doc/5.reference/bang.pd13
-rw-r--r--pd/doc/5.reference/bang~.pd18
-rw-r--r--pd/doc/5.reference/biquad~.pd35
-rw-r--r--pd/doc/5.reference/block~-help.pd75
-rw-r--r--pd/doc/5.reference/bng.pd265
-rw-r--r--pd/doc/5.reference/bp~.pd40
-rw-r--r--pd/doc/5.reference/canvas.pd19
-rw-r--r--pd/doc/5.reference/change.pd23
-rw-r--r--pd/doc/5.reference/clip~.pd30
-rw-r--r--pd/doc/5.reference/cos~.pd32
-rw-r--r--pd/doc/5.reference/cputime.pd15
-rw-r--r--pd/doc/5.reference/delay.pd30
-rw-r--r--pd/doc/5.reference/delread~.pd33
-rw-r--r--pd/doc/5.reference/delwrite~.pd15
-rw-r--r--pd/doc/5.reference/drawnumber.pd35
-rw-r--r--pd/doc/5.reference/drawpolygon.pd41
-rw-r--r--pd/doc/5.reference/element.pd51
-rw-r--r--pd/doc/5.reference/env~.pd28
-rw-r--r--pd/doc/5.reference/fft~-help.pd14
-rw-r--r--pd/doc/5.reference/fft~.pd64
-rw-r--r--pd/doc/5.reference/float.pd18
-rw-r--r--pd/doc/5.reference/framp~.pd40
-rw-r--r--pd/doc/5.reference/gatom.pd32
-rw-r--r--pd/doc/5.reference/get.pd46
-rw-r--r--pd/doc/5.reference/getsize.pd41
-rw-r--r--pd/doc/5.reference/graph.pd13
-rw-r--r--pd/doc/5.reference/hdial.pd282
-rw-r--r--pd/doc/5.reference/help-metro.pd29
-rw-r--r--pd/doc/5.reference/hip~-help.pd48
-rw-r--r--pd/doc/5.reference/hip~.pd31
-rw-r--r--pd/doc/5.reference/hslider.pd303
-rw-r--r--pd/doc/5.reference/int.pd24
-rw-r--r--pd/doc/5.reference/key.pd24
-rw-r--r--pd/doc/5.reference/line.pd22
-rw-r--r--pd/doc/5.reference/line~-help.pd8
-rw-r--r--pd/doc/5.reference/line~.pd33
-rw-r--r--pd/doc/5.reference/lop~.pd31
-rw-r--r--pd/doc/5.reference/makefilename-help.pd52
-rw-r--r--pd/doc/5.reference/makefilename.pd17
-rw-r--r--pd/doc/5.reference/makenote.pd26
-rw-r--r--pd/doc/5.reference/math.pd60
-rw-r--r--pd/doc/5.reference/message.pd46
-rw-r--r--pd/doc/5.reference/midi.pd129
-rw-r--r--pd/doc/5.reference/moses.pd17
-rw-r--r--pd/doc/5.reference/my_canvas.pd243
-rw-r--r--pd/doc/5.reference/namecanvas.pd8
-rw-r--r--pd/doc/5.reference/netreceive.pd23
-rw-r--r--pd/doc/5.reference/netsend.pd55
-rw-r--r--pd/doc/5.reference/noise~.pd18
-rw-r--r--pd/doc/5.reference/numbox2.pd302
-rw-r--r--pd/doc/5.reference/openpanel.pd11
-rw-r--r--pd/doc/5.reference/operators.pd31
-rw-r--r--pd/doc/5.reference/osc~.pd58
-rw-r--r--pd/doc/5.reference/otherbinops.pd90
-rw-r--r--pd/doc/5.reference/pack.pd37
-rw-r--r--pd/doc/5.reference/pd.pd52
-rw-r--r--pd/doc/5.reference/phasor~.pd36
-rw-r--r--pd/doc/5.reference/pipe.pd41
-rw-r--r--pd/doc/5.reference/plot.pd58
-rw-r--r--pd/doc/5.reference/pointer.pd79
-rw-r--r--pd/doc/5.reference/poly.pd30
-rw-r--r--pd/doc/5.reference/print.pd13
-rw-r--r--pd/doc/5.reference/print~.pd18
-rw-r--r--pd/doc/5.reference/qlist.pd76
-rw-r--r--pd/doc/5.reference/random.pd19
-rw-r--r--pd/doc/5.reference/readsf~.pd48
-rw-r--r--pd/doc/5.reference/realtime.pd15
-rw-r--r--pd/doc/5.reference/receive.pd26
-rw-r--r--pd/doc/5.reference/route.pd80
-rw-r--r--pd/doc/5.reference/rsqrt~.pd32
-rw-r--r--pd/doc/5.reference/samphold~.pd34
-rw-r--r--pd/doc/5.reference/savepanel.pd12
-rw-r--r--pd/doc/5.reference/select.pd73
-rw-r--r--pd/doc/5.reference/send.pd26
-rw-r--r--pd/doc/5.reference/send~.pd32
-rw-r--r--pd/doc/5.reference/set.pd45
-rw-r--r--pd/doc/5.reference/setsize.pd54
-rw-r--r--pd/doc/5.reference/sigbinops.pd60
-rw-r--r--pd/doc/5.reference/sig~.pd20
-rw-r--r--pd/doc/5.reference/snapshot~.pd28
-rw-r--r--pd/doc/5.reference/soundfiler-help.pd19
-rw-r--r--pd/doc/5.reference/soundfiler.pd66
-rw-r--r--pd/doc/5.reference/spigot.pd21
-rw-r--r--pd/doc/5.reference/sqrt~.pd32
-rw-r--r--pd/doc/5.reference/stripnote.pd16
-rw-r--r--pd/doc/5.reference/struct.pd26
-rw-r--r--pd/doc/5.reference/sublist.pd10
-rw-r--r--pd/doc/5.reference/swap.pd20
-rw-r--r--pd/doc/5.reference/switch~.pd45
-rw-r--r--pd/doc/5.reference/tabosc4~.pd86
-rw-r--r--pd/doc/5.reference/tabplay~.pd66
-rw-r--r--pd/doc/5.reference/tabread.pd21
-rw-r--r--pd/doc/5.reference/tabread4~.pd43
-rw-r--r--pd/doc/5.reference/tabreceive~.pd6
-rw-r--r--pd/doc/5.reference/tabsend~.pd6
-rw-r--r--pd/doc/5.reference/tabwrite.pd21
-rw-r--r--pd/doc/5.reference/tabwrite~.pd30
-rw-r--r--pd/doc/5.reference/text.pd4
-rw-r--r--pd/doc/5.reference/textfile.pd59
-rw-r--r--pd/doc/5.reference/threshold~.pd31
-rw-r--r--pd/doc/5.reference/throw~.pd34
-rw-r--r--pd/doc/5.reference/timer.pd15
-rw-r--r--pd/doc/5.reference/toggle.pd273
-rw-r--r--pd/doc/5.reference/trigger.pd37
-rw-r--r--pd/doc/5.reference/unpack.pd28
-rw-r--r--pd/doc/5.reference/until.pd25
-rw-r--r--pd/doc/5.reference/value.pd30
-rw-r--r--pd/doc/5.reference/vcf~.pd35
-rw-r--r--pd/doc/5.reference/vdial.pd282
-rw-r--r--pd/doc/5.reference/vd~.pd19
-rw-r--r--pd/doc/5.reference/vline~-help.pd46
-rw-r--r--pd/doc/5.reference/vslider.pd302
-rw-r--r--pd/doc/5.reference/vu.pd247
-rw-r--r--pd/doc/5.reference/wrap~.pd26
-rw-r--r--pd/doc/5.reference/writesf~-help.pd20
-rw-r--r--pd/doc/5.reference/writesf~.pd27
-rw-r--r--pd/doc/5.reference/x_all_guis.pd20
-rw-r--r--pd/doc/6.externs/foo1.c37
-rw-r--r--pd/doc/6.externs/foo2.c49
-rw-r--r--pd/doc/6.externs/test-foo1.pd6
-rw-r--r--pd/doc/6.externs/test-foo2.pd8
-rw-r--r--pd/doc/7.stuff/data-structures/1.scalars.pd15
-rw-r--r--pd/doc/7.stuff/data-structures/2.getting.data.pd18
-rw-r--r--pd/doc/7.stuff/data-structures/3.setting.data.pd70
-rw-r--r--pd/doc/7.stuff/data-structures/4.append.pd8
-rw-r--r--pd/doc/7.stuff/data-structures/5.array.pd32
-rw-r--r--pd/doc/7.stuff/data-structures/6.file.pd39
-rw-r--r--pd/doc/7.stuff/data-structures/7.sequencer.pd103
-rw-r--r--pd/doc/7.stuff/data-structures/voice.pd178
-rw-r--r--pd/doc/7.stuff/tools/testtone.pd264
-rw-r--r--pd/doc/sound/bell.aiffbin312012 -> 277 bytes
-rw-r--r--pd/doc/sound/voice.wavbin124204 -> 220 bytes
-rw-r--r--pd/doc/sound/voice2.wavbin78194 -> 114 bytes
-rw-r--r--pd/extra/bonk~/help-bonk~.pd162
-rw-r--r--pd/extra/bonk~/makefile25
-rw-r--r--pd/extra/choice/help-choice.pd41
-rw-r--r--pd/extra/complex-mod~.pd28
-rw-r--r--pd/extra/expr~/README36
-rw-r--r--pd/extra/expr~/help-expr.pd231
-rw-r--r--pd/extra/expr~/makefile52
-rw-r--r--pd/extra/expr~/vexp.c422
-rw-r--r--pd/extra/expr~/vexp.h57
-rw-r--r--pd/extra/expr~/vexp_fun.c611
-rw-r--r--pd/extra/expr~/vexp_if.c420
-rw-r--r--pd/extra/fiddle~/fiddle~.c121
-rw-r--r--pd/extra/fiddle~/help-fiddle~.pd107
-rw-r--r--pd/extra/fiddle~/makefile25
-rw-r--r--pd/extra/loop~/help-loop~.pd66
-rw-r--r--pd/extra/loop~/makefile26
-rw-r--r--pd/extra/loop~/test-loop~.pd62
-rw-r--r--pd/extra/lrshift~/help-rlshift~.pd29
-rw-r--r--pd/extra/lrshift~/makefile26
-rw-r--r--pd/extra/paf~/help-paf~.pd166
-rw-r--r--pd/extra/pique/help-pique.pd33
-rw-r--r--pd/extra/rev2~.pd3
-rw-r--r--pd/src/build.bat42
-rw-r--r--pd/src/d_array.c32
-rw-r--r--pd/src/d_ctl.c11
-rw-r--r--pd/src/d_dac.c2
-rw-r--r--pd/src/d_filter.c37
-rw-r--r--pd/src/d_soundfile.c57
-rw-r--r--pd/src/d_ugen.c125
-rw-r--r--pd/src/g_all_guis.c76
-rw-r--r--pd/src/g_all_guis.h4
-rw-r--r--pd/src/g_array.c3
-rw-r--r--pd/src/g_bang.c43
-rw-r--r--pd/src/g_canvas.c77
-rw-r--r--pd/src/g_canvas.h8
-rw-r--r--pd/src/g_editor.c54
-rw-r--r--pd/src/g_graph.c34
-rw-r--r--pd/src/g_hdial.c41
-rw-r--r--pd/src/g_hslider.c40
-rw-r--r--pd/src/g_io.c7
-rw-r--r--pd/src/g_mycanvas.c40
-rw-r--r--pd/src/g_numbox.c38
-rw-r--r--pd/src/g_readwrite.c3
-rw-r--r--pd/src/g_rtext.c29
-rw-r--r--pd/src/g_scalar.c4
-rw-r--r--pd/src/g_template.c5
-rw-r--r--pd/src/g_text.c18
-rw-r--r--pd/src/g_toggle.c40
-rw-r--r--pd/src/g_vdial.c38
-rw-r--r--pd/src/g_vslider.c40
-rw-r--r--pd/src/g_vumeter.c38
-rw-r--r--pd/src/m_binbuf.c26
-rw-r--r--pd/src/m_class.c27
-rw-r--r--pd/src/m_glob.c53
-rw-r--r--pd/src/m_imp.h2
-rw-r--r--pd/src/m_pd.c7
-rw-r--r--pd/src/m_pd.h23
-rw-r--r--pd/src/m_sched.c201
-rw-r--r--pd/src/makefile134
-rw-r--r--pd/src/makefile.nt.bad92
-rw-r--r--pd/src/notes.txt45
-rw-r--r--pd/src/s_audio.c603
-rw-r--r--pd/src/s_audio_alsa.c328
-rw-r--r--pd/src/s_audio_jack.c350
-rw-r--r--pd/src/s_audio_mmio.c61
-rw-r--r--pd/src/s_audio_oss.c110
-rw-r--r--pd/src/s_audio_pa.c137
-rw-r--r--pd/src/s_freebsd.c3072
-rw-r--r--pd/src/s_inter.c12
-rw-r--r--pd/src/s_linux.c3087
-rw-r--r--pd/src/s_mac.c377
-rw-r--r--pd/src/s_main.c174
-rw-r--r--pd/src/s_midi.c194
-rw-r--r--pd/src/s_midi_mmio.c715
-rw-r--r--pd/src/s_midi_oss.c112
-rw-r--r--pd/src/s_midi_pm.c116
-rw-r--r--pd/src/s_nt.c1586
-rw-r--r--pd/src/s_path.c107
-rw-r--r--pd/src/s_portaudio.c197
-rw-r--r--pd/src/s_sgi.c433
-rw-r--r--pd/src/s_stuff.h56
-rw-r--r--pd/src/s_unix.c454
-rw-r--r--pd/src/u_main.tk637
-rw-r--r--pd/src/u_main.tk.test2686
-rw-r--r--pd/src/x_connective.c23
-rw-r--r--pd/src/x_gui.c16
-rw-r--r--pd/src/z.pd9
-rw-r--r--pd/src/z2.pd3
-rw-r--r--pd/src/z3.pd17
-rw-r--r--pd/src/z4.pd2
-rw-r--r--pd/src/z5.pd8
-rw-r--r--pd/src/z6.pd4
433 files changed, 11877 insertions, 37056 deletions
diff --git a/pd/doc/1.manual/fig1.1.jpg b/pd/doc/1.manual/fig1.1.jpg
deleted file mode 100644
index bfc76f64..00000000
--- a/pd/doc/1.manual/fig1.1.jpg
+++ /dev/null
Binary files differ
diff --git a/pd/doc/1.manual/fig1.1.png b/pd/doc/1.manual/fig1.1.png
new file mode 100644
index 00000000..a2399935
--- /dev/null
+++ b/pd/doc/1.manual/fig1.1.png
Binary files differ
diff --git a/pd/doc/1.manual/fig1.2.jpg b/pd/doc/1.manual/fig1.2.jpg
index c33c755c..e4428091 100644
--- a/pd/doc/1.manual/fig1.2.jpg
+++ b/pd/doc/1.manual/fig1.2.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig1.3.jpg b/pd/doc/1.manual/fig1.3.jpg
index caf29b2d..27bde2f0 100644
--- a/pd/doc/1.manual/fig1.3.jpg
+++ b/pd/doc/1.manual/fig1.3.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig1.4.jpg b/pd/doc/1.manual/fig1.4.jpg
deleted file mode 100644
index 28a29dc6..00000000
--- a/pd/doc/1.manual/fig1.4.jpg
+++ /dev/null
Binary files differ
diff --git a/pd/doc/1.manual/fig1.4.png b/pd/doc/1.manual/fig1.4.png
new file mode 100644
index 00000000..1dc8e037
--- /dev/null
+++ b/pd/doc/1.manual/fig1.4.png
Binary files differ
diff --git a/pd/doc/1.manual/fig1.5.jpg b/pd/doc/1.manual/fig1.5.jpg
index 4b01c59f..3b72fc7f 100644
--- a/pd/doc/1.manual/fig1.5.jpg
+++ b/pd/doc/1.manual/fig1.5.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig11.1.png b/pd/doc/1.manual/fig11.1.png
new file mode 100644
index 00000000..c8283cdb
--- /dev/null
+++ b/pd/doc/1.manual/fig11.1.png
Binary files differ
diff --git a/pd/doc/1.manual/fig11.2.png b/pd/doc/1.manual/fig11.2.png
new file mode 100644
index 00000000..1fcfd7e7
--- /dev/null
+++ b/pd/doc/1.manual/fig11.2.png
Binary files differ
diff --git a/pd/doc/1.manual/fig3.1.jpg b/pd/doc/1.manual/fig3.1.jpg
index f8348970..6024abe8 100644
--- a/pd/doc/1.manual/fig3.1.jpg
+++ b/pd/doc/1.manual/fig3.1.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig3.10.jpg b/pd/doc/1.manual/fig3.10.jpg
index 4625ce0c..29e31c7d 100644
--- a/pd/doc/1.manual/fig3.10.jpg
+++ b/pd/doc/1.manual/fig3.10.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig3.2.jpg b/pd/doc/1.manual/fig3.2.jpg
index 994d41c7..a91c0e2e 100644
--- a/pd/doc/1.manual/fig3.2.jpg
+++ b/pd/doc/1.manual/fig3.2.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig3.3.jpg b/pd/doc/1.manual/fig3.3.jpg
index 91cac54a..640cacd8 100644
--- a/pd/doc/1.manual/fig3.3.jpg
+++ b/pd/doc/1.manual/fig3.3.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig3.4.jpg b/pd/doc/1.manual/fig3.4.jpg
index e2f2fe53..62bfc517 100644
--- a/pd/doc/1.manual/fig3.4.jpg
+++ b/pd/doc/1.manual/fig3.4.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig3.5.jpg b/pd/doc/1.manual/fig3.5.jpg
index 9a79a2b3..875e2782 100644
--- a/pd/doc/1.manual/fig3.5.jpg
+++ b/pd/doc/1.manual/fig3.5.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig3.6.jpg b/pd/doc/1.manual/fig3.6.jpg
index fcbcf3da..76775b80 100644
--- a/pd/doc/1.manual/fig3.6.jpg
+++ b/pd/doc/1.manual/fig3.6.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig3.7.jpg b/pd/doc/1.manual/fig3.7.jpg
index 84dcd7f7..5cddde32 100644
--- a/pd/doc/1.manual/fig3.7.jpg
+++ b/pd/doc/1.manual/fig3.7.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig3.8.jpg b/pd/doc/1.manual/fig3.8.jpg
index ab03a207..66f3db82 100644
--- a/pd/doc/1.manual/fig3.8.jpg
+++ b/pd/doc/1.manual/fig3.8.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig3.9.jpg b/pd/doc/1.manual/fig3.9.jpg
index 6e9655c7..4097af46 100644
--- a/pd/doc/1.manual/fig3.9.jpg
+++ b/pd/doc/1.manual/fig3.9.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig7.1.jpg b/pd/doc/1.manual/fig7.1.jpg
index b677f6bd..643a155a 100644
--- a/pd/doc/1.manual/fig7.1.jpg
+++ b/pd/doc/1.manual/fig7.1.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig7.2.jpg b/pd/doc/1.manual/fig7.2.jpg
index 54690d0e..643a155a 100644
--- a/pd/doc/1.manual/fig7.2.jpg
+++ b/pd/doc/1.manual/fig7.2.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig7.3.jpg b/pd/doc/1.manual/fig7.3.jpg
index a3b70ed3..643a155a 100644
--- a/pd/doc/1.manual/fig7.3.jpg
+++ b/pd/doc/1.manual/fig7.3.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig7.4.jpg b/pd/doc/1.manual/fig7.4.jpg
index 88ba5b40..643a155a 100644
--- a/pd/doc/1.manual/fig7.4.jpg
+++ b/pd/doc/1.manual/fig7.4.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig7.5.jpg b/pd/doc/1.manual/fig7.5.jpg
index f9de4b3b..643a155a 100644
--- a/pd/doc/1.manual/fig7.5.jpg
+++ b/pd/doc/1.manual/fig7.5.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig7.6.jpg b/pd/doc/1.manual/fig7.6.jpg
index 5f24af7a..643a155a 100644
--- a/pd/doc/1.manual/fig7.6.jpg
+++ b/pd/doc/1.manual/fig7.6.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig8.1.jpg b/pd/doc/1.manual/fig8.1.jpg
index 57e59313..643a155a 100644
--- a/pd/doc/1.manual/fig8.1.jpg
+++ b/pd/doc/1.manual/fig8.1.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig8.2.jpg b/pd/doc/1.manual/fig8.2.jpg
index 1dd48cd9..643a155a 100644
--- a/pd/doc/1.manual/fig8.2.jpg
+++ b/pd/doc/1.manual/fig8.2.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig8.3.jpg b/pd/doc/1.manual/fig8.3.jpg
index 165c1c88..643a155a 100644
--- a/pd/doc/1.manual/fig8.3.jpg
+++ b/pd/doc/1.manual/fig8.3.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig8.4.jpg b/pd/doc/1.manual/fig8.4.jpg
index afc89a73..643a155a 100644
--- a/pd/doc/1.manual/fig8.4.jpg
+++ b/pd/doc/1.manual/fig8.4.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig8.5.jpg b/pd/doc/1.manual/fig8.5.jpg
index 6fa3d0d1..643a155a 100644
--- a/pd/doc/1.manual/fig8.5.jpg
+++ b/pd/doc/1.manual/fig8.5.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig8.6.jpg b/pd/doc/1.manual/fig8.6.jpg
index 2823e032..643a155a 100644
--- a/pd/doc/1.manual/fig8.6.jpg
+++ b/pd/doc/1.manual/fig8.6.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig9.1.jpg b/pd/doc/1.manual/fig9.1.jpg
index bab4b689..643a155a 100644
--- a/pd/doc/1.manual/fig9.1.jpg
+++ b/pd/doc/1.manual/fig9.1.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig9.2.jpg b/pd/doc/1.manual/fig9.2.jpg
index 88ef528c..643a155a 100644
--- a/pd/doc/1.manual/fig9.2.jpg
+++ b/pd/doc/1.manual/fig9.2.jpg
Binary files differ
diff --git a/pd/doc/1.manual/fig9.3.jpg b/pd/doc/1.manual/fig9.3.jpg
index ecb66004..643a155a 100644
--- a/pd/doc/1.manual/fig9.3.jpg
+++ b/pd/doc/1.manual/fig9.3.jpg
Binary files differ
diff --git a/pd/doc/1.manual/index.htm b/pd/doc/1.manual/index.htm
index 2d8bb4dd..c403ae99 100644
--- a/pd/doc/1.manual/index.htm
+++ b/pd/doc/1.manual/index.htm
@@ -1,15 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+
<HTML>
-<HEAD>
-<TITLE>Pd Documentation</TITLE>
-</HEAD>
-<BODY bgcolor="#ffffff">
-<SMALL>
-<div style="width:6.5in; margin-left:.5in">
-
-<CENTER>
-<FONT size=+5>
-<B>Pd Documentation</B><BR>
-</FONT></CENTER>
+ <HEAD>
+ <TITLE>Pd Documentation</TITLE>
+ <meta http-equiv="Content-Type" content="text/html">
+ <link rel="stylesheet" type="text/css" href="pdmanual.css" media="screen">
+ </HEAD>
+
+
+<BODY>
+
+<H1>Pd Documentation</H1>
+
<P>
This is the HTML documentation for Pd, a patchable environment for audio
analysis, synthesis, and processing,
@@ -91,10 +93,11 @@ can be found at:
<LI> <a href="x3.htm" name=s3> getting Pd to run </A>
<OL>
- <LI> <a href="x3.htm#s1.1">IRIX (SGI) </A>
- <LI> <a href="x3.htm#s1.2">Microsoft Windows </A>
- <LI> <a href="x3.htm#s1.3">Linux </A>
- <LI> <a href="x3.htm#s1.4">Mac OSX </A>
+ <LI> <a href="x3.htm"> Overview </A>
+ <LI> <a href="x3.htm#s1.1">Installing Pd in Microsoft Windows </A>
+ <LI> <a href="x3.htm#s1.2">Installing Pd in Linux </A>
+ <LI> <a href="x3.htm#s1.3">Installing Pd in MacOS X </A>
+ <LI> <a href="x3.htm#s1.4">Installing Pd in IRIX (SGI) </A>
<LI> <a href="x3.htm#s3"> graphics rendering using GEM </A>
<LI> <a href="x3.htm#s4"> The Pd command line </A>
<LI> <a href="x3.htm#s5"> dealing with files </A>
@@ -110,7 +113,7 @@ can be found at:
</OL>
-<!
+<!--
intro: what Pd is
guide to the documentation
other resources
@@ -154,9 +157,10 @@ can be found at:
bugs
+-->
->
</BODY>
</HTML>
+
diff --git a/pd/doc/1.manual/pdmanual.css b/pd/doc/1.manual/pdmanual.css
new file mode 100755
index 00000000..01d66ab2
--- /dev/null
+++ b/pd/doc/1.manual/pdmanual.css
@@ -0,0 +1,39 @@
+
+HTML {
+ background: #ffffff;
+ color: #000000;
+ font-family: Times, Times New Roman, serif;
+ font-size: 10pt;
+}
+BODY {
+ width: 6.5in;
+ margin-left: 0.5in
+}
+H1 {
+ font-size: 36pt;
+ text-align: center;
+}
+H2 {
+ font-size: 10pt;
+ text-align: center;
+}
+H3 {
+ font-size: 12pt;
+ text-align: left;
+}
+H4 {
+ font-size: 10pt;
+ text-align: left;
+}
+H5 {
+ font-size: 8pt;
+ text-align: left;
+}
+H6 {
+ font-size: 8pt;
+ text-align: left;
+}
+PRE {
+ font-size: 8pt;
+ text-align: left;
+}
diff --git a/pd/doc/1.manual/x1.htm b/pd/doc/1.manual/x1.htm
index 6a78040e..e46098cd 100644
--- a/pd/doc/1.manual/x1.htm
+++ b/pd/doc/1.manual/x1.htm
@@ -1,17 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+
<HTML>
-<HEAD>
-<TITLE>Pd Documentation 1</TITLE>
-</HEAD>
-<BODY bgcolor="#ffffff">
-<SMALL>
-<div style="width:6.5in; margin-left:.5in">
-
-<CENTER> <B>
-Pd Documentation chapter 1: introduction
-</B> </CENTER>
-<BR>
-<A href=index.htm#s1> back to table of contents </A>
- <BR><BR>
+ <HEAD>
+ <TITLE>Pd Documentation 1</TITLE>
+ <meta http-equiv="Content-Type" content="text/html">
+ <link rel="stylesheet" type="text/css" href="pdmanual.css" media="screen">
+ </HEAD>
+
+<BODY>
+
+<H2>Pd Documentation chapter 1: introduction</H2>
+
+<P>
+<A href="index.htm#s1"> back to table of contents </A>
+<BR><BR>
+</P>
+
+
<P>
This is the HTML documentation for the Pd computer program.
Pd is free and can be downloaded from the internet;
@@ -19,7 +24,7 @@ go to
<A href="http://www.crca.ucsd.edu/~msp/software.html">
http://www.crca.ucsd.edu/~msp/software.html</A>
to get it.
-<H4> <A name=s1> 1.1. guide to the documentation </A> </H4>
+<H3> <A name=s1> 1.1. guide to the documentation </A> </H3>
<P> Pd's documentation consists of:
@@ -63,7 +68,17 @@ patches in "7.stuff" might also be helpful.
<P>
To get started writing your own C extensions, refer to chapter 4 of this manual.
-<H4> <A name=s2> 1.2. other resources </A> </H4>
+<H3> <A name=s2> 1.2. other resources </A> </H3>
+
+<P> There is a new Pd community web site,
+<a href="http://www.pure-data.org/"> pure-data.org</a>, which aims to be the
+central resource for Pd, from documentation and
+downloads; to forums, member pages, a patch exchange.
+
+<P> There is a growing number of Pd-related projects hosted at
+<A HREF="http://pure-data.sf.net">SourceForge</A>. This is open to all Pd
+developers, and all are encouraged to join. Send an email to the pd-dev list,
+<A HREF="pd-dev[AT]iem.kug.ac.at">pd-dev[AT]iem.kug.ac.at</A>, to join.
<P>
Most of the interesting resources related to Pd show up on the Pd mailing list,
@@ -82,10 +97,10 @@ for people interested in graphics, there is a A 3D graphics rendering package,
named GEM, based on OpenGL, was written by Mark Danks, adapted to Linux by
Guenter Geiger, and is now maintained by Iohannes Zmoelnig. GEM runs on
Windows and Linux and probably will run with some coaxing on IRIX. You can get
-it from: <A href=http://iem.kug.ac.at/GEM>http://iem.kug.ac.at/GEM</A> .
+it from: <A href="http://iem.kug.ac.at/GEM">http://iem.kug.ac.at/GEM</A> .
<P> A video processing package, Framestein, is by Juha Vehvilainen. This runs
-on Windows only: <A href=http://framestein.org> http://framestein.org </A>.
+on Windows only: <A href="http://framestein.org"> http://framestein.org </A>.
<P>
Here are some more Pd links (in the order I found them): <BR>
@@ -98,8 +113,6 @@ Here are some more Pd links (in the order I found them): <BR>
Johannes M Zmoelnig</a><br>
<a href="http://iem.kug.ac.at/~math/pd/"> Norbert Math's Pd page</a> <br>
<a href="http://iem.kug.ac.at/iemlib/"> Thomas Musil's IEMLIB</a> <br>
-<a href="http://www.pure-data.org/"> jfm3's Pure Data FAQ and downloads</a>
-(also available in Japanese translation).<br>
<a href="http://iem.kug.ac.at/pdwiki/">
Nicolas Lhommet's WikiWikiWeb page for Pd</a><br>
<a href="http://iem.kug.ac.at/pdb/"> Norbert's searchable list of all known
@@ -109,8 +122,13 @@ Krzysztof Czaja's MIDI file support </a><br>
<a href="http://www.davesabine.com/media/puredata.asp?action=pddp">
David Sabine's Pd Documentation Project:
new, highly detailed help windows</a><br>
-<a href="http://www-ccrma/planetccrma/software/soundapps.html#pd">
+<a href="http://www-ccrma.stanford.edu/planetccrma/software/soundapps.html#pd">
Fernando Pablo Lopez's augmented Pd RPMs from Planet CCRMA</a><br>
+<a href="http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html">
+Cyclone - Krzysztof Czaja's Max compatibility library</a><br>
+On-line book project:
+<A HREF="http://www.crca.ucsd.edu/~msp/techniques.htm"
+<I> Theory and Techniques of Electronic Music </I> <br>
</BODY>
</HTML>
diff --git a/pd/doc/1.manual/x2.htm b/pd/doc/1.manual/x2.htm
index 334e6ae2..8d656a64 100644
--- a/pd/doc/1.manual/x2.htm
+++ b/pd/doc/1.manual/x2.htm
@@ -1,75 +1,85 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
<HTML>
-<HEAD>
-<TITLE>Pd Documentation</TITLE>
-</HEAD>
-<BODY bgcolor="#ffffff">
-<SMALL>
-<div style="width:6.5in; margin-left:.5in">
-
-<CENTER> <B>
-Pd Documentation chapter 2: theory of operation
-</B> </CENTER>
-<BR>
-<A href=index.htm#s2> back to table of contents</A>
- <BR><BR>
+ <HEAD>
+ <TITLE>Pd Documentation 2</TITLE>
+ <meta http-equiv="Content-Type" content="text/html">
+ <link rel="stylesheet" type="text/css" href="pdmanual.css" media="screen">
+ </HEAD>
+
+
+<BODY>
+
+<H2>Pd Documentation chapter 2: theory of operation</H2>
+
+<P>
+<A href="index.htm#s2"> back to table of contents</A>
+<BR><BR>
+</P>
+
<P>
<P> The purpose of this chapter is to describe Pd's design and how it is
supposed to work. Practical details about how to obtain, install, and run Pd
are described in the next chapter. To learn digital audio processing basics
-such as how to generate time-varying sounds that don't click or fold over, a
-good reference is Dodge and Jerse, <I> Computer Music </I>.
+such as how to generate time-varying sounds that don't click or fold over, try
+the on-line book,
+<A HREF="http://www.crca.ucsd.edu/~msp/techniques.htm"
+<I> Theory and Techniques of Electronic Music </I>.
-<H4> <A name=s1> 2.1 overview </A> </H4>
+<H3> <A name=s1> 2.1 overview </A> </H3>
-Pd is a real-time graphical programming environment for audio and graphical
+<P>Pd is a real-time graphical programming environment for audio and graphical
processing. It resembles the Max/MSP system but is much simpler and more
portable; also Pd has two features not (yet) showing up in Max/MSP: first,
via Mark Dank's GEM package, Pd can be used for simultaneous computer
animation and computer audio. Second, an experimental facility is provided
for defining and accessing data structures.
-<H4> <A name=s1.1> 2.1.1. the main window, canvases, and printout </A> </H4>
+<H3> <A name=s1.1> 2.1.1. the main window, canvases, and printout </A> </H3>
-When Pd is running, you'll see a main "Pd" window, and possibly one or more
+<P>When Pd is running, you'll see a main "Pd" window, and possibly one or more
"canvases" or "patches". The main Pd window looks like this:
-<P><CENTER>
- <IMG src="fig1.1.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig1.1.png" ALT="pd window">
+</P></CENTER>
<P> There are peak level and clip indicators for audio input and output; these
report peak levels over all input and all output channels. Note that DC
shows up as an input level; many cards have DC levels which show up in the
-50s. To see an RMS audio level, select "test audio and MIDI" from the help
-window. The main window display is intended only to help you avoid clipping
+50s. To see an RMS audio level, select "test audio and MIDI" from the Media
+menu. The main window display is intended only to help you avoid clipping
on input and output. You can turn the peak meters on and off using the
control at bottom left.
-<P> At bottom right is a control to turn audio processing on and off globally.
-Turning audio off does not relinquish the audio devices, it just stops the
-computation. The "audio" menu is also provided, with accelerators "Control-."
-to turn audio computation off and "Control-/" to turn it on. When audio is
-on, Pd is computing audio samples in real time according to whatever patches
-you have open (visible or not.)
+<P> At bottom right is a control to turn audio processing on and off
+globally. Turning audio off stops the computation and relinquishes any audio
+devices Pd is using. The "Media" menu is also provided, with accelerators
+"Control-." to turn audio computation off and "Control-/" to turn it on. When
+audio is on, Pd is computing audio samples in real time according to whatever
+patches you have open (whether they are visible or not).
<P> The DIO (Digital I/O) error indicator flashes if there is a synchronization
-error for audio input or output. Click there to see a list of recent errors.
-This indicator is normally red at startup, and will turn red whenever the
+error for audio input or output. (But note that on some platforms Pd doesn't
+find out about them. If you never see red, you're probably not seeing the
+truth.)
+Click the "DIO errors" button to see a list of recent errors.
+This indicator should turn red whenever the
computation runs late (so that the DAC FIFOs fill and/or the ADC FIFOs empty)
or if audio input and output are not running at the same rate. See
<a href="x3.htm#s2"> audio and MIDI support </A>.
<P> Pd documents are called "patches" or "canvases."
Each open document has one main window and any number of
-subwindows. The subwindows can be opened and closed but are always running
+sub-windows. The sub-windows can be opened and closed but are always running
whether you can see them or not. Here is a simple Pd patch:
-<P><CENTER>
- <IMG src="fig1.2.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig1.2.jpg" ALT="hello world patch">
+</P></CENTER>
-There are four <I> text boxes </I> in this patch: a number box (showing zero),
+<P>There are four <I> text boxes </I> in this patch: a number box (showing zero),
an object box showing "print," and two comments. The number box and the object
box are connected, the number box's output to the print box's input. Boxes may
have zero or more inputs and/or outputs, with the inputs on top and the outputs
@@ -80,7 +90,7 @@ Pd's printout appears on its standard output. Normally, you'll run Pd in a
"shell" or "terminal" window which you'll keep open to see any printout or
error messages.
-<H4> <A name=s1.2> 2.1.2. object boxes </A> </H4>
+<H3> <A name="s1.2"> 2.1.2. object boxes </A> </H3>
<P> Pd patches can have four types of boxes: <I> object, message, GUI, </I>
and <I> comment </I>.
@@ -89,29 +99,39 @@ divided into <I> atoms </I> separated by white space. The first atom specifies
what type of object Pd will make, and the other atoms, called <I> creation
arguments </I>, tell Pd how to initialize the object. If you type for example,
-<P><CENTER>
- <IMG src="fig1.3.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig1.3.jpg" ALT="object">
+</P></CENTER>
-the "+" specifies the <I> class </I> of the object.
+<P>the "+" specifies the <I> class </I> of the object.
In this case the object will be the kind that carries out addition,
-and the "13" initializes the amount to add. Atoms are either numbers or <I>
-symbols </I> like "+".
+and the "13" initializes the amount to add.
+
+<P> Atoms are either numbers or <I>
+symbols </I> like "+". Anything that is not a valid number os considered a
+symbol. Valid numbers may or may not have a decimal point (for instance, 12,
+15.6, -.456), or may be
+written in exponential notation (such as "4.5e6", which means "4.5 multiplied
+by 10 six times, i.e., 4500000). Negative exponentials divide by 10 (so
+that 1.23e-5 comes to 0.0000123).
-The text you type into an object box determines how
+<P> Non-valid numbers which are read as symbols
+include things like "+5" and "0..6" as well as words and names such as "Zack"
+or "cat". The symbols "gore", "Gore", and "GORE" are all distinct.
+
+<P> The text you type into an object box determines how
many and what kinds of inlets and outlets the object will have. Some
classes (like "+" always have a fixed arrangement of inlets and outlets,
and in the case of other classes, the inlets and outlets will depend on the
creation arguments.
-<P>
-Here for example is a simple MIDI synthesizer:
+<P>Here for example is a simple MIDI synthesizer:
-<P><CENTER>
- <IMG src="fig1.4.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig1.4.png" ALT="simple MIDI synthesizer">
+</P></CENTER>
-This patch mixes <I> control </I> objects (notein, stripnote, and ftom) with
+<P>This patch mixes <I> control </I> objects (notein, stripnote, and ftom) with
<I> tilde </I> objects osc~, *~, and dac~. The control objects carry out their
function sporadically, as a result of one or more type of <I> event </I>. In
this case, incoming MIDI note messages set off the control computation. The
@@ -125,53 +145,71 @@ acting as the interface between the two regimes, in that it takes control
messages to set its frequency but talks to "*~" using an audio signal. Audio
signals aren't sporadic; they are continuous streams of numbers. As a result
tilde objects act under very different rules from control objects. The audio
-portion of the patch is always running, whether MIDI messages arrive or not;
-the function of control computations is to insert calculations between the
-audio computation which may change audio computation parameters such as
-the frequency of an oscillator.
-
-<H4> <A name=s1.3> 2.1.3. message and GUI boxes </A> </H4>
-
-The border of a box tells you how its text is interpreted and how the box
-functions. Object boxes use the text to create objects when you load a
-patch. <I> Message </I> boxes interpret the text as a message to send whenever
-the box is activated (by an incoming message or with the mouse.) In the example
-below the message box, when clicked, sends the message "21" to an object
+portion of the patch is always running, whether MIDI messages arrive or not. On
+the other hand, the function of control computations is to insert calculations
+between the audio computation which may change audio computation parameters
+such as the frequency of an oscillator.
+
+<P> The connections in the patch (the lines between the boxes) are also of two
+types: control and signal. The type of connection depends on the outlet it
+comes from. Signal connections are represented by thicker lines than control
+connections; in the patch above, the two bottom conections are signal and the
+others are control. In general, a control connection may be made to a signal
+inlet; if numbers are sent over it they are automatially converted to
+signals. Signal connections may not be made to control inlets; some sort
+of explicit conversion must be specified.
+
+<H3> <A name="s1.3"> 2.1.3. message and GUI boxes </A> </H3>
+
+<P>The border of a box tells you how its text is interpreted and how the box
+functions. Object boxes (as in the previous example) use the text to create
+objects when you load a patch or type text onto a new one. If you retype the
+text in an object box, the old one is discarded and a new one is created, using
+the new creation arguments. The contents of an object box describe a message
+which is sent to Pd to create the object.
+
+<P> <I> Message </I> boxes interpret the text as a message to send whenever
+the box is activated (by an incoming message or with the mouse.) The message
+may be sent many times while the patch is running (as opposed to object boxes
+whose message is used once to create the object). Instead of going straight
+to Pd, the message box's message (or messages) go either to the box's outlet
+or to other specified receiving objects. In the example
+below, the message box, when clicked, sends the message "21" to an object
box which adds 13 to it.
-<P><CENTER>
- <IMG src="fig1.5.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig1.5.jpg" ALT="[message( --> [object] -> [number]">
+</P></CENTER>
-The third box shown is a GUI box. GUI boxes come in many forms including
-number boxes (as in this example), toggles, sliders, and so on. Whereas the
-appearance of an object or message box is static when a patch is running, a
-number box's contents (the text) changes to reflect the current value held by
-the box. You can also use a number box as a control by clicking and dragging
-up and down, or by typing values in it. (There are also shift- and alt-click
-actions; see <A href="x2.htm#s2.7"> getting help </A> to find out how to look
-this up).
+<P> The third box shown is a <I> GUI </I> ("graphical user interface") box. GUI
+boxes come in many forms including number boxes (as in this example), toggles,
+sliders, and so on. Whereas the appearance of an object or message box is
+static when a patch is running, a number box's contents (the text) changes to
+reflect the current value held by the box. You can also use a number box as a
+control by clicking and dragging up and down, or by typing values in it.
+(There are also shift- and alt-click actions; see <A href="x2.htm#s2.7">
+getting help </A> to find out how to look this up).
<P> You can also create a "symbol" box which is like a number box but deals
in symbols like "cat." You can type your own strings in (followed by "enter")
or use it to display strings which arrive as messages to its inlet.
-<H4> <A name=s1.4> 2.1.4. patches and files </A> </H4>
+<H3> <A name="s1.4"> 2.1.4. patches and files </A> </H3>
-When you save a patch to a file, Pd doesn't save the entire state of all the
+<P>When you save a patch to a file, Pd doesn't save the entire state of all the
objects in the patch, but only what you see: the objects' creation arguments
and their interconnections. Certain data-storage objects have functions for
reading and writing other files to save and restore their internal state.
-Pd finds files using a <I> path </I> which can be specified as part of Pd's
+<P>Pd finds files using a <I> path </I> which can be specified as part of Pd's
startup arguments. The path specifies one or more directories, separated by
colons (semicolons if you're using windows.) Most objects which can read files
search for them along the search path, but when Pd writes files they go to
the directory where the patch was found.
-<H4> <A name=s2> 2.2. editing Pd patches </A> </H4>
+<H3> <A name=s2> 2.2. editing Pd patches </A> </H3>
-<H4> <A name=s2.1> 2.2.1. edit and run mode </A> </H4>
+<H3> <A name=s2.1> 2.2.1. edit and run mode </A> </H3>
<P> A patch can be in edit or run mode; this really only affects how mouse
clicks affect the patch. In edit mode, clicking and dragging selects and
@@ -180,7 +218,7 @@ them messages which they react to in different ways. In run mode, number and
message boxes can be used as controls. Normally, when you are in a performance
you will stay in run mode; to change the patch you go to edit mode.
-<H4> <A name=s2.2> 2.2.2. creating boxes </A> </H4>
+<H3> <A name=s2.2> 2.2.2. creating boxes </A> </H3>
<P> You can create boxes (objects, messages, GUIs, and comments) using the
"put" menu. Note the handy accelerators. Object and message boxes are empty
@@ -192,34 +230,37 @@ place them.
(in the Edit menu) than to use the "Put" menu. If you select and duplicate
several items, any connections between them will be duplicated as well.
-<H4> <A name=s2.3> 2.2.3. the selection </A> </H4>
+<H3> <A name=s2.3> 2.2.3. the selection </A> </H3>
-Boxes in a Pd window may be selected by clicking on them. To select more
-than one object you may use shift-click or click "outside" and select all
-objects within a rectangle. You can't select lines, only boxes.
+<P>Boxes in a Pd window may be selected by clicking on them. To select more
+than one object you may use shift-click or click on a blank portion of
+the window and drag the cursor to select all objects within a rectangle.
-Clicking on an unselected object, message, or comment box makes the text
-active, i.e., ready to be text edited. If you select using the rectangle
-method, the text isn't activated. This affects whether further clicks will
-displace teh object or select text within it.
+<P>Clicking on an unselected object, message, or comment box makes the text
+active, i.e., ready to be text edited. (If you select using the rectangle
+method, the text isn't activated.) Once you've activated a text box, you
+may type into it (replacing the selected text) or use the mouse to change the
+selection.
-<H4> <A name=s2.4> 2.2.4. deleting, cutting, and pasting </A> </H4>
+<P> You may also select a single connection (patch cord) by clicking on it.
+You can't have connections and boxes selected simultaneously.
-If you select a box but don't activate the text in it, you can "delete" it
-by hitting the backspace key. You can "cut" "copy" and "paste" using menu
-items. Notice that pasting puts the new object(s) right down on top of the
-old ones.
+<H3> <A name=s2.4> 2.2.4. deleting, cutting, and pasting </A> </H3>
-The "duplicate" menu item performs a copy and paste with a small offset so you
-can see the new boxes. You can drag them together to a new place on the
-screen.
+<P>If you select a box, a connection, or several boxes, and if you haven't made
+any text active, you can "delete" the selection by hitting the backspace or
+delete key. You can also "cut" "copy" and "paste" using menu items. Notice
+that pasting puts the new object(s) right down on top of the old ones.
-You can cut and paste between windows within Pd but cut/paste isn't
-integrated with the OS in any way. Cut/copy/paste for text strings isn't
-implemented yet, although in Linux and Irix at least you can "X-paste" into
-and out of "text" dialogs (created with the "edit text" menu item.)
+<P>The "duplicate" menu item performs a copy and paste with a small offset so you
+can see the new boxes. You can drag them together to a new place on the screen.
-<H4> <A name=s2.5> 2.2.5. changing the text </A> </H4>
+<P>You can cut and paste between windows within Pd but cut/paste isn't
+integrated with the OS in any way. Cut/copy/paste for activated text in boxes
+isn't implemented yet, although in Linux and Irix at least you can "X-paste"
+into and out of "text" dialogs (created with the "edit text" menu item.)
+
+<H3> <A name=s2.5> 2.2.5. changing the text </A> </H3>
<P> To change a text item, you can select it and then edit the text. If you
only click once, the entire text is selected and your typing will replace
@@ -234,45 +275,56 @@ one box in sequence if you want.
<P> If you click a box and move the mouse without releasing the button this
displaces the entire box. If you wish to displace a box which is already
-sepected, first deselect the box by clicking outside it; otherwise you will be
+selected, first de-select the box by clicking outside it; otherwise you will be
selecting text instead of moving the box.
-<P> <I> The updated text only becomes part of the patch when you deselect the
-object. </I> Changing the text in an "object" box actually deletes the old
+<P> <I> The updated text only becomes part of the patch when you de-select the
+object. </I> Changing the text in an "object" box deletes the old
object and creates a new one; the internal state of the old one is lost.
-<H4> <A name=s2.6> 2.2.6. connecting and disconnecting boxes </A> </H4>
+<H3> <A name=s2.6> 2.2.6. connecting and disconnecting boxes </A> </H3>
-To make a connection between two boxes, click on any outlet of the first
-one, drag toward an inlet of the second one, and release. You can actually
+<P>To make a connection between two boxes, click on any outlet of the first
+one, drag toward an inlet of the second one, and release. You can
release the mouse button anywhere within the target object and the connection
will be made to the nearest inlet.
-Connections are broken simply by clicking on them (the cursor changes to an
-"X" when appropriate.)
+<P>Connections are broken by selecting them and using "cut" or the backspace
+or delete key.
+
+<H3> <A name=s2.7> 2.2.7. popup menu for properties, open, and help </A> </H3>
+
+<P> All the "clicking" mentioned above is done with the left mouse button.
+The right button, instead, gives a popup menu offering "properties," "open,"
+and "help".
+(For Macintosh users who may only have one button on their mouse,
+double-clicking is mapped to right-click.)
+
+<P> Selecting "help" on an object gets
+a Pd patch that demonstrates how to use it. "Help" for the canvas as a whole
+(right-clicking outside any object) gives a list of all built-in objects.
-<H4> <A name=s2.7> 2.2.7. Properties and help </A> </H4>
+<P> The "open" menu item is only enabled if you right-click on a subpatch
+(see below) and causes Pd to open it. Ordinary subpatches may also be opened
+by clicking on them, but for "graph-on-parent" ones, this is the only way to
+do it.
-<P> all the "clicking" mentioned above is done with the left mouse button.
-The right button, instead, gives a popup menu for "properties" and "help".
-Properties are enabled for number boxes and graphs (and in the future may
-be available for other things as well.) Selecting "help" on an object gets
-a Pd patch that demonstrates how to use it. "Help for the canvas as a whole
-(click outsize any object) gives a list of all built-in objects.
+<P> The "properties" dialog allows you to change certain settings of GUI
+objects, or of the patch itself (by clicking outside any box.)
-<H4> <A name=s2.7> 2.2.8. miscellaneous </A> </H4>
+<H3> <A name=s2.7> 2.2.8. miscellaneous </A> </H3>
<P> Control-q "quits" Pd, but asks you to comfirm the quit. To quit without
having to confirm, use command-shift-Q.
-<H4> <A name=s3> 2.3. messages </A> </H4>
+<H3> <A name="s3"> 2.3. messages </A> </H3>
<P> In Pd, objects intercommunicate by sending messages and/or audio signals.
Pd messages are sporadic, like MIDI messages or music N "Note cards."
-<H4> <A name=s3.1> 2.3.1. anatomy of a message </A> </H4>
+<H3> <A name="s3.1"> 2.3.1. anatomy of a message </A> </H3>
-Messages contain a selector followed by
+<P>Messages contain a selector followed by
any number of arguments. The selector is a symbol, which appears in the patch
as a non-numeric string with no white space, semicolons, or commas. The
arguments may be symbols or numbers. Numbers in Pd are kept in 32-bit floating
@@ -286,13 +338,13 @@ is checked against the receiver. If the receiver recognizes messages of that
selector, it carries out some corresponding action. For instance, here is a
"float" object:
-<P><CENTER>
- <IMG src="fig3.1.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig3.1.jpg" ALT="float object">
+</P></CENTER>
<P> The two rectangles at the top are usually both called "inlets" but
the one at the left directs incoming messages to the "float" object itself,
-whereas the one at the right directs messages to an auxilliary "inlet"
+whereas the one at the right directs messages to an auxiliary "inlet"
object. The float object proper (represented by the left-hand inlet) accepts
messages with selector "float" and "bang". The right-hand inlet takes only
the message selector "float". These two selectors, along with "symbol" and
@@ -304,16 +356,16 @@ which cannot be used as a selector. A single number is always given the
"float" selector automatically, and a message with a number followed by other
arguments is given the selector "list".
-<H4> <A name=s3.2> 2.3.2. depth first message passing </A> </H4>
+<H3> <A name="s3.2"> 2.3.2. depth first message passing </A> </H3>
<P> In Pd whenever a message is initiated, the receiver may then send out
further messages in turn, and the receivers of those messages can send yet
others. So each message sets off a tree of consequent messages. This tree is
executed in depth first fashion. For instance in the patch below:
-<P><CENTER>
- <IMG src="fig3.2.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig3.2.jpg" ALT="depth first message passing">
+</P></CENTER>
<P> the order of arrival of messages is either A-B-C-D or A-C-D-B. The "C"
message is not done until the "D" one is also, and the "A" is not done until
@@ -323,9 +375,9 @@ sorted right to left).
<P> Message-passing can give rise to infinite loops of the sort shown here:
-<P><CENTER>
- <IMG src="fig3.3.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig3.3.jpg" ALT="infinite message passing loop">
+</P></CENTER>
<P> Here the left-hand "+" can't finish processing until the right-hand one has
been sent the result "2", which can't finish processing that until the
@@ -333,26 +385,26 @@ left-hand one has been sent "3", and so on. Pd will print an error message
reporting a "stack overflow" if this happens.
<P> However, it is legal to make a loop if there is a "delay" object somewhere
-in it. When the "delay" receives a message it schedules a messsage for the
+in it. When the "delay" receives a message it schedules a message for the
future (even if the time delay is 0) and is then "finished;" Pd's internal
scheduler will wake the delay back up later.
-<H4> <A name=s3.3>
-2.3.3. hot and cold inlets and right to left outlet order </A> </H4>
+<H3> <A name="s3.3">
+2.3.3. hot and cold inlets and right to left outlet order </A> </H3>
<P> With few exceptions (notably "timer"), objects treat their leftmost
inlet as "hot" in the sense that messages to right inlets can result in output
messages. So the following is a legal (and reasonable) loop construct:
-<P><CENTER>
- <IMG src="fig3.4.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig3.4.jpg" ALT="hot and cold inlets">
+</P></CENTER>
-Here the "f" is an abbreviation for "float". Note that the "+ 1" output is
+<P>Here the "f" is an abbreviation for "float". Note that the "+ 1" output is
connected to the right-hand inlet of "f". This "cold" inlet merely stores the
value for the next time the "f" is sent the "bang" message.
-It is frequently desirable to send messages to two or more inlets of an object
+<P>It is frequently desirable to send messages to two or more inlets of an object
to specify its action. For instance, you can use "+" to add two numbers; but
to do it correctly you must make sure the right hand inlet gets its value
first. Otherwise, when the left hand side value comes in, "+" will carry out
@@ -365,9 +417,9 @@ single object. In this case it is indeterminate which order the two inlets will
receive their messages. Suppose for example you wish to use "+" to double a
number. The following is incorrect:
-<P><CENTER>
- <IMG src="fig3.5.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig3.5.jpg" ALT="incorrect inlet connection">
+</P></CENTER>
<P> Here, I connected the left inlet before connecting the right hand one (although
this is not evident in the appearance of the patch.) The "+" thus adds the
@@ -380,9 +432,9 @@ you connect these to inlets of a second object without crossing wires, the
second object will get its leftmost inlet last, which is usually what you
want. Here is how to use "trigger" to disambiguate the previous example:
-<P><CENTER>
- <IMG src="fig3.6.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig3.6.jpg" ALT="trigger to disambiguate">
+</P></CENTER>
<P> "Cold" (non-leftmost) inlets are almost universally used to store single
values (either numbers or symbols.) With the exception of "line" and "line~",
@@ -394,28 +446,29 @@ the order in which two messages are sent to a single "cold" inlet. In this
situation, since the messages are merged, the last value to be received is
the value that is used in the computation.
-<H4> <A name=s3.4> 2.3.4. message boxes </A> </H4>
+<H3> <A name="s3.4"> 2.3.4. message boxes </A> </H3>
Message boxes are text boxes in which you type a message. When the message
box is activated, either by clicking on it or sending something to its inlet,
the message or messages are sent, either to the message box's outlet or
elsewhere as specified.
-<P><CENTER>
- <IMG src="fig3.7.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig3.7.jpg" ALT="message boxes">
+</P></CENTER>
-The first of the message boxes above contains the single number 1.5; this
+<P>The first of the message boxes above contains the single number 1.5; this
message has an implicit selector of "float." The second is a list with three
numbers in it, and in the third, the selector is "my" and the two arguments are
the number 5 and the symbol "toes."
<P> Multiple messages may be separated by commas as shown:
-<P><CENTER>
- <IMG src="fig3.8.jpg">
-</CENTER><P>
-Here the three messages are the numbers 1, 2, and 3, and they are sent in
+<CENTER><P>
+ <IMG src="fig3.8.jpg" ALT="multiple messages in one box">
+</P></CENTER>
+
+<P>Here the three messages are the numbers 1, 2, and 3, and they are sent in
sequence (with no intervening time between them, as with the "trigger" object,
and having depth-first consequences so that whatever chain of actions depending
on "1" takes place before anything depending on "2" and so on.)
@@ -430,27 +483,27 @@ semicolon immediately redirects messages from the outlet to an object named
to "sue."
-<P><CENTER>
- <IMG src="fig3.9.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig3.9.jpg" ALT="semicolons to send messages">
+</P></CENTER>
-Certain other objects (Pd windows, for example, and arrays) have Pd names and
+<P>Certain other objects (Pd windows, for example, and arrays) have Pd names and
can be sent messages this way. Also, the special object "pd" is defined to
which you may send messages to start and stop DSP.
<P> You can put variables in message boxes as shown below:
-<P><CENTER>
- <IMG src="fig3.10.jpg">
-</CENTER><P>
+<CENTER><P>
+ <IMG src="fig3.10.jpg" ALT="variables in message boxes">
+</P></CENTER>
-Here, "$1", etc., refer to the arguments of the arriving message (and aren't
+<P>Here, "$1", etc., refer to the arguments of the arriving message (and aren't
defined if you send a "bang" message or if you click on the message box to
activate it.) Dollar sign variables are either numbers or symbols depending
on the incoming message; if symbols, you may even use them to specify variable
message selectors or destinations.
-<H4> <A name=s4> 2.4. audio signals </A> </H4>
+<H3> <A name="s4"> 2.4. audio signals </A> </H3>
<P>
Using Pd you can build audio patches which can synthesize musical sounds,
@@ -458,31 +511,25 @@ analyze incoming sounds, process incoming sounds to produce transformed
audio outputs, or integrate audio processing with other media. This section
describes how Pd treats audio signals.
-<H4> <A name=s4.1> 2.4.1. sample rate and format </A> </H4>
+<H3> <A name="s4.1"> 2.4.1. sample rate and format </A> </H3>
<P>
Pd's audio signals are internally kept as 32-bit floating point numbers, so
you have all the dynamic range you could want. However, depending on your
hardware, audio I/O is usually limited to 16 or 24 bits. Inputs all appear
between the values of -1 and 1; and output values will be clipped to that range.
-
-<P>
-Pd assumes a sample rate of 44100 unless you override this in Pd's command line.
-Pd doesn't check that this matches the sample rate of audio input or output,
-nor does Pd attempt to set your computer's audio sample rate to its own. If
-the audio system is running at the wrong sample rate, audio output will
-be transposed (you can check this using the "test audio and MIDI" patch; see
-the help menu).
+Pd assumes a sample rate of 44100 unless you override this (
+in Pd's command line or in the "audio setup" dialog).
<P>
Pd can read or write samples to files either in 16-bit or 24-bit fixed point
or in 32-bit floating point, in WAV, AIFF, or AU format, via the soundfiler,
readsf, and writesf objects.
-<H4> <A name=s4.2> 2.4.2. tilde objects and audio connections </A> </H4>
+<H3> <A name="s4.2"> 2.4.2. tilde objects and audio connections </A> </H3>
-Audio computations in Pd are carried out by "tilde objects" such as "osc~"
-whoswe names conventionally end in a tilde character to warn you what they
+<P>Audio computations in Pd are carried out by "tilde objects" such as "osc~"
+whose names conventionally end in a tilde character to warn you what they
are. Tilde objects can intercommunicate via audio connections. When audio
computation is turned on, or when you change the audio network while audio is
on, Pd sorts all the tilde objects into a linear order for running; then this
@@ -493,9 +540,7 @@ the audio network runs every 1.45 milliseconds.
an error to connect an audio outlet to a non-audio inlet or vice versa; usually
these errors are detected at "sort time" when audio is started or the network
changed with audio running. An object's leftmost inlet may accept both audio
-and messages; any other inlet is either one or the other. There is no quick
-way to tell whether an inlet or output is for audio or messages; consult the
-help window for the object.
+and messages; any other inlet is either one or the other.
<P>
The audio network, that is, the tilde objects and their interconnections,
@@ -508,7 +553,7 @@ nonlocal signal connections.
Your subpatches can have audio inlets and outlets via the inlet~ and outlet~
objects.
-<H4> <A name=s4.3> 2.4.3. converting audio to and from messages </A> </H4>
+<H3> <A name=s4.3> 2.4.3. converting audio to and from messages </A> </H3>
<P> If you want to use a control value as a signal, you can use the sig~ object
to convert it. The +~, -~, *~, /~, osc~, and phasor~ objects can be configured
@@ -520,9 +565,9 @@ but you can also sample a signal with tabwrite~ and then get access it via
tabread or tabread4 (note the missing tildes!). There are also analysis
objects, the simplest of which is "env~", the envelope follower.
-<H4> <A name=s4.4> 2.4.4. switching and blocking </A> </H4>
+<H3> <A name=s4.4> 2.4.4. switching and blocking </A> </H3>
-You can use the switch~ or block~ objects to turn portions of your audio
+<P>You can use the switch~ or block~ objects to turn portions of your audio
computation on and off and to control the block size of computation. There
may be only one switch~ or block~ object in any window; it acts on the entire
window and all of its subwindows, which may still have their own nested
@@ -541,20 +586,20 @@ interaction, or to reduce "block delay" in feedback algorithms. At the
own recursive filters.
<P> You can use switch~ to budget your DSP computations; for instance you might
-want to be able to switch between two synthesis algorithms. Put each algorithm
-in its own subpatch (which can have sub-sub patches in turn, for a voice bank
-for instance), and switch each one off as you switch the other one on. Beware
-of clicks; if you have a line~ controlling output level, give it time to ramp to
-zero before you switch it off or it will be stuck at a nonzero value for the
-next time it comes back on.
+want to be able to switch between two synthesis algorithms. To do this, put
+each algorithm in its own subpatch (which can have sub-sub patches in turn, for
+a voice bank for instance), and switch each one off as you switch the other one
+on. Beware of clicks; if you have a line~ controlling output level, give it
+time to ramp to zero before you switch it off or it will be stuck at a nonzero
+value for the next time it comes back on.
-<P> When a subpatch is switched off its audio outputs generate zeros; this costs a
-fairly small overhead; a cheaper way to get outputs is to use throw~ inside
-the switched module and catch~ outside it.
+<P> When a subpatch is switched off its audio outputs generate zeros; this
+costs a fairly small overhead; a cheaper way to get outputs is to use throw~
+inside the switched module and catch~ outside it.
-<H4> <A name=s4.5> 2.4.5. nonlocal signal connections </A> </H4>
+<H3> <A name=s4.5> 2.4.5. nonlocal signal connections </A> </H3>
-You may wish to pass signals nonlocally, either to get from one window to another, or
+<P>You may wish to pass signals non-locally, either to get from one window to another, or
to feed a signal back to your algorithm's input. This can be done using
throw~/catch~, send~/receive~, or delwrite~/delread~ pairs. Throw~ and catch~
implement a summing bus; throw~ adds into the bus and catch~ reads out the
@@ -580,15 +625,15 @@ sorted after your delwrite~. The only way to ensure this is to create the
delread~ after you created the delwrite~; if things get out of whack, just
delete and re-create the delread~.
-<H4> <A name=s5> 2.5. scheduling </A> </H4>
+<H3> <A name=s5> 2.5. scheduling </A> </H3>
-Pd uses 64-bit floating point numbers to represent time, providing sample
+<P>Pd uses 64-bit floating point numbers to represent time, providing sample
accuracy and essentially never overflowing. Time appears to the user
in milliseconds.
-<H4> <A name=s5.1> 2.5.1. audio and messages </A> </H4>
+<H3> <A name=s5.1> 2.5.1. audio and messages </A> </H3>
-Audio and message processing are interleaved in Pd. Audio processing is
+<P>Audio and message processing are interleaved in Pd. Audio processing is
scheduled every 64 samples at Pd's sample rate; at 44100 Hz. this gives a
period of 1.45 milliseconds. You may turn DSP computation on and off by
sending the "pd" object the messages "dsp 1" and "dsp 0."
@@ -605,7 +650,7 @@ simultaneously.
of zero. This delayed cascade happens after the present cascade has finished,
but at the same logical time.
-<H4> <A name=s5.2> 2.5.2. computation load </A> </H4>
+<H3> <A name=s5.2> 2.5.2. computation load </A> </H3>
<P> The Pd scheduler maintains a (user-specified) lead on its computations;
that is, it tries to keep ahead of real time by a small amount in order to be
@@ -615,7 +660,7 @@ href="x3.htm" name=s3>getting Pd to run </A>).
<P> If Pd gets late with respect to real time, gaps (either occasional or
frequent) will appear in both the input and output audio streams. On the
-other hand, disk strewaming objects will work correctly, so that you may use
+other hand, disk streaming objects will work correctly, so that you may use
Pd as a batch program with soundfile input and/or output. The "-nogui"
and "-send" startup flags are provided to aid in doing this.
@@ -623,13 +668,13 @@ and "-send" startup flags are provided to aid in doing this.
runs as a separate process. A flow control mechanism will be provided someday
to prevent this from causing trouble, but it is in any case wise to avoid
having too much drawing going on while Pd is trying to make sound. If a
-subwindow is closed, Pd suspends sending the GUI update messages for it;
+sub-window is closed, Pd suspends sending the GUI update messages for it;
but not so for miniaturized windows as of version 0.32. You should really
close them when you aren't using them.
-<H4> <A name=s5.3> 2.5.3. determinism </A> </H4>
+<H3> <A name=s5.3> 2.5.3. determinism </A> </H3>
-All message cascades that are scheduled (via "delay" and
+<P>All message cascades that are scheduled (via "delay" and
its relatives) to happen before a given audio tick will happen as scheduled
regardless of whether Pd as a whole is running on time; in other words,
calculation is never reordered for any real-time considerations. This is done
@@ -640,7 +685,7 @@ it. These time tags are guaranteed to be consistent with the times at which
timeouts are scheduled and DSP ticks are computed; i.e., time never decreases.
(However, either Pd or a hardware driver may lie about the physical time an
input arrives; this depends on the operating system.) "Timer" objects which
-meaure time intervals measure them in terms of the logical time stamps of the
+measure time intervals measure them in terms of the logical time stamps of the
message cascades, so that timing a "delay" object always gives exactly the
theoretical value. (There is, however, a "realtime" object that measures real
time, with nondeterministic results.)
@@ -648,12 +693,12 @@ time, with nondeterministic results.)
<P> If two message cascades are scheduled for the same logical time, they are
carried out in the order they were scheduled.
-<H4> <A name=s6> 2.6. semantics </A> </H4>
+<H3> <A name=s6> 2.6. semantics </A> </H3>
This section describes how objects in Pd are created, how they store data and
how object and other boxes pass messages among themselves.
-<H4> <A name=s6.1> 2.6.1. creation of objects </A> </H4>
+<H3> <A name=s6.1> 2.6.1. creation of objects </A> </H3>
The text in a box has a different function depending on whether it is a message,
atom (number/symbol), or object box. In message boxes the text specifies the
@@ -669,12 +714,12 @@ destroyed and the message is used to create the new one.
<P> The selector of the message (the first word in the message) is a selector
which Pd interprets to mean which type of object to create. Any message
-arguments (called "creation arguments") are used to parametrize the object
+arguments (called "creation arguments") are used to parameterize the object
being created. Thus in "makenote 64 250" the selector "makenote" determines
the class of object to create and the creation arguments 64 and 250 become the
initial velocity and duration.
-<H4> <A name=s6.2> 2.6.2. persistence of data </A> </H4>
+<H3> <A name=s6.2> 2.6.2. persistence of data </A> </H3>
Among the design principles of Pd is that patches should be printable, in the
sense that the appearance of a patch should fully determine its functionality.
@@ -696,7 +741,7 @@ changed.
if you are going to override them later; this is confusing to anyone who tries
to understand the patch.
-<H4> <A name=s6.3> 2.6.3. message passing </A> </H4>
+<H3> <A name=s6.3> 2.6.3. message passing </A> </H3>
Messages in Pd consist of a selector (a symbol) and zero or more arguments
(which may be symbols or numbers). To pass a message to an object, Pd first
@@ -711,7 +756,7 @@ determined by the selector of the creation message, i.e., the first atom of the
creation message which is usually a symbol.
<P> Each class comes with a fixed collection of messages it may be sent. For
-esxample, the "float" or "f" object takes "bang" and "float." These messages
+example, the "float" or "f" object takes "bang" and "float." These messages
are sent to "float" objects (objects whose class is float) via the leftmost,
hot inlet. (The right inlet is a separate, auxiliary object.) Objects of
class "float" respond to the message "bang" by outputting their current value,
@@ -722,7 +767,7 @@ messages by setting their value and then outputting it.
to messages it is sent, and may take "float" and "bang" messages, or others
in addition or instead of them.
-<H4> <A name=s6.4> 2.6.4. inlets and lists </A> </H4>
+<H3> <A name=s6.4> 2.6.4. inlets and lists </A> </H3>
The leftmost connection point at the top of most objects represents the object
itself. Any other dark rectangle is a separate object called an "inlet"
@@ -736,7 +781,7 @@ to the "list" message by distributing the arguments of the message to their
inlets, except for the first argument which is passed as a "float" or
"symbol" message to the object proper.
-<H4> <A name=s6.5> 2.6.5. dollar signs </A> </H4>
+<H3> <A name=s6.5> 2.6.5. dollar signs </A> </H3>
In message or object boxes, message arguments starting with a dollar sign
and a number (like "$1" or "$3-bazoo") are variables which are substituted
@@ -747,14 +792,14 @@ or other) that the message box is responding to. Thus, if a message box gets
"23 skidoo" and if it contains the text, "$2 until $1," out comes the message,
"skidoo until 23."
-<P> Object boxes contain text wwhich forms a message to be sent to Pd to create
+<P> Object boxes contain text which forms a message to be sent to Pd to create
and initialize the object. Here, $1, etc., are taken from the context in which
the patch was loaded. When the patch is a new document or opened from a file
the "$" variables are undefined. But if the patch is an abstraction (see the
next section) they are
-taked from the abstractions' creation arguments.
+taken from the abstractions' creation arguments.
-<P> Constructions such as "$1-x" are expanded by string concatentation. This
+<P> Constructions such as "$1-x" are expanded by string concatenation. This
is the mechanism for making local variables. In particular, $0 in an abstraction
is a counter which is guaranteed to be unique to that abstraction, so sends and
receives with names like "$0-bear" can be used as local send/receive pairs.
@@ -764,20 +809,26 @@ beginning of the symbol; so, for instance, "rats-$1" will not be expanded.
Occasionally you may want to have double or triple substitutions; this can
be done one stage at a time by nesting abstractions (with each subpatch
adding its own $-variable to the beginning of a symbol and passing that on
-as argument to a further anstraction.)
+as argument to a further abstraction.)
+
+<P> For example, if you want to get dog-food, dog-ears, and cat-food, for
+example, have an abstraction "a1" that invokes an abstraction "a2" twice, as
+"a2 $1-food" and "a2 $1-ears", and then in a third patch call a1 twice, as
+"a1 cat" and "a1 dog". Inside the four "a2" copioes, $1 will evaluate to
+"dog-food", "cat-food", "dog-ears", and "cat-ears".
-<H4> <A name=s7> 2.7. subpatches </A> </H4>
+<H3> <A name="s7"> 2.7. subpatches </A> </H3>
Pd offers two mechanisms for making subpatches, called "one-off subpatches"
and "abstractions." In either case the subpatch appears as an object box
in a patch. If you type "pd" or "pd my-name" into an object box, this creates
a one-off subpatch. For instance, in this fragment:
-<P><CENTER> <IMG src="fig7.1.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig7.1.jpg" ALT="subpatch"> </P></CENTER>
the box in the middle, if clicked on, opens the sub-patch shown here:
-<P><CENTER> <IMG src="fig7.2.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig7.2.jpg" ALT="open subpatch window"> </P></CENTER>
<P> The contents of the subpatch are saved as part of the parent patch, in
one file. If you make several copies of a subpatch you may change them
@@ -791,17 +842,17 @@ messages and audio in a subpatch inlet or outlet; they must be one or the other
exclusively. Inlets and outlets appear on the invoking box in the same left-to-right
order as they appear in the subpatch.
-<H4> <A name=s7.1> 2.7.1. abstractions </A> </H4>
+<H3> <A name="s7.1"> 2.7.1. abstractions </A> </H3>
<P> To make an abstraction, save a patch with a name such as "abstraction1.pd"
and then invoke it as "abstraction1" in an object box:
-<P><CENTER> <IMG src="fig7.3.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig7.3.jpg" ALT="abstraction"> </P></CENTER>
<P> Here we're invoking a separate file, "abstraction1.pd", which holds the
patch shown here (the border is the same as for the subpatch above):
-<P><CENTER> <IMG src="fig7.4.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig7.4.jpg" ALT="abstraction example"> </P></CENTER>
You may create many instances of "abstraction1" or invoke it from several
different patches; and changing the contents of "abstraction1" will affect all
@@ -830,17 +881,17 @@ a different time in an object box than in a message box. In an object box, the
"$" argument is expanded at creation time, and in a message box, at message
time.
-<H4> <A name=s7.2> 2.7.2. Graph-on-parent subpatches </A> </H4>
+<H3> <A name="s7.2"> 2.7.2. Graph-on-parent subpatches </A> </H3>
If you open the "properties" dialog for a subpatch or an abstraction, you can
check the "graph on parent" box to have the controls of the subpatch/abstraction
appear on the parent. For instance, here is an invocation of "abstraction2":
-<P><CENTER> <IMG src="fig7.5.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig7.5.jpg" ALT="graph-on-parent abstraction"> </P></CENTER>
where the patch "abstraction2.pd" contains:
-<P><CENTER> <IMG src="fig7.6.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig7.6.jpg" ALT="inside graph-on-parent abstraction"> </P></CENTER>
Here, the number box in the abstraction shows up on the box that invoked
the abstraction. The "graph on parent" flag is set in the abstraction
@@ -857,7 +908,7 @@ are sent to visible controls and/or arrays.
instead; so the number box in the sub-patch in the example above is the same
one as you see in the box. Only controls are made visible in this way
-<H4> <A name=s8> 2.8. numeric arrays </A> </H4>
+<H3> <A name=s8> 2.8. numeric arrays </A> </H3>
Linear arrays of numbers recur throughout the computer musician's bag of tricks,
beginning with the wavetable oscillator. The wavetable oscillator later was
@@ -880,7 +931,7 @@ two or more channels, use a separate array for each channel.
<P> Arrays are also useful as transfer functions, for example for nonlinear
distortion of an audio signal, or to map a control onto a synthesis parameter.
In situations like this one typically uses much shorter arrays, of no more
-than a few hundered elements. They are also useful for storing measured
+than a few hundred elements. They are also useful for storing measured
spectra derived from the fft~ objects, and probably for many other uses.
<P> Arrays usually appear within subpatches created to house them, whether
@@ -888,17 +939,17 @@ in "graph on parent" form (so that you see them within a rectangle drawn on
the containing patch), or as a regular subpatch (which you see as a text box.)
In the "graph on parent" form, an array appears as shown:
-<P><CENTER> <IMG src="fig8.1.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig8.1.jpg" ALT="array"> </P></CENTER>
<P> Arrays are indexed from 0 to N-1 where N is the number of points in the
array. You can read an array value using the tabread object:
-<P><CENTER> <IMG src="fig8.2.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig8.2.jpg" ALT="array indexing"> </P></CENTER>
Here we see that the third point of the array (index 2) has the value 0.4.
To write into the array you can use the tabwrite object:
-<P><CENTER> <IMG src="fig8.3.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig8.3.jpg" ALT="setting an value in an array"> </P></CENTER>
In this example, sending the message sets the third element to 0.5. (You
may also send the two numbers to the two inlets separately.)
@@ -907,7 +958,7 @@ may also send the two numbers to the two inlets separately.)
and to arrays. These may also be done using audio signals. For example,
the patch below creates a 440 Hz. tone with "array1" as a waveform:
-<P><CENTER> <IMG src="fig8.4.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig8.4.jpg" ALT="setting an array with a waveform"> </P></CENTER>
Here phasor~'s outputs a sawtooth wave, repeating 440 times per second, whose
output range is from 0 to 1. The multiplier and adder adjust the range from
@@ -924,7 +975,7 @@ and/or changed later using the "properties" dialog.
<P> If you select "properties" on an array in a graph, you two dialogs, one
for the array and one for the graph. The array dialog looks like this:
-<P><CENTER> <IMG src="fig8.5.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig8.5.jpg" ALT="array properties window"> </P></CENTER>
You may use this to change the name and size, in addition to another property,
"save contents". If "save contents" is selected, the array's values are stored
@@ -934,13 +985,13 @@ probably not wish to store them in the patch but as separate soundfiles. This
will be more efficient, and you may also then use a sound editor to modify them
outside Pd.
-<P> If you check "delete me" and then "OK", the array wil be deleted. This is
+<P> If you check "delete me" and then "OK", the array will be deleted. This is
an odd interface for deleting an object, and is only provided because Pd
lacks a mechanism for selecting arrays (so that "cut" could serve).
<P> The graph dialog (which also pops up) is shown here:
-<P><CENTER> <IMG src="fig8.6.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig8.6.jpg" ALT="graph properties"> </P></CENTER>
<P> The X bounds initially range from 0 to the number of points in the table
minus one (this is a good choice for arrays, although graphs holding other
@@ -951,9 +1002,9 @@ range from 0 to 20,000. Finally, you choose the screen size of the graph,
width and height, in screen pixels.
<P> Many other operations are defined for arrays; see the related patches
-in the tutorial (starting at 2.control/15.array.pd) for more possibliities.
+in the tutorial (starting at 2.control/15.array.pd) for more possibilities.
-<H4> <A name=s9> 2.9. Data structures </A> </H4>
+<H3> <A name=s9> 2.9. Data structures </A> </H3>
(Note: this section is adapted from an article submitted to ICMC 2002.)
<P> The original idea in developing Pd was to make a real-time computer music
@@ -982,7 +1033,7 @@ streams.
Here is one simple
example of a very short musical sketch realized using Pd:
-<P><CENTER> <IMG src="fig9.1.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig9.1.jpg" ALT="graphical score"> </P></CENTER>
The example, which only lasts a few seconds, is a polyphonic collection of
time-varying noise bands. The graphical ``score" consists of six objects, each
@@ -1006,7 +1057,7 @@ mechanism.
<P> Here is the template associated with the graphical objects
shown above:
-<P><CENTER> <IMG src="fig9.2.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig9.2.jpg" ALT="template for graphical score"> </P></CENTER>
Templates consist of a data structure definition (the "struct" object) and
zero or more drawing instructions ("filledpolygon" and "plot"). The "struct"
@@ -1039,14 +1090,14 @@ color is given as 0, or black. The second one plots "pitch" using the color
"voiceno" slot in the data structure, so that color will vary according to its
"voiceno" slot.
-<H4> <A name=s9.1> 2.9.1. Traversal </A> </H4>
+<H3> <A name="s9.1"> 2.9.1. Traversal </A> </H3>
<P> Pd objects are provided to traverse lists and arrays, and to address
elements of data structures for getting and setting. Here is a patch showing
how these facilities could be used, for example, to sequence the graphical
score shown above:
-<P><CENTER> <IMG src="fig9.3.jpg"> </CENTER><P>
+<CENTER><P> <IMG src="fig9.3.jpg" ALT="traversal example patch"> </P></CENTER>
<P> Pd has no built-in sequencer, nor even any notion that "x" values should be
used as a time axis. (However, a "sort" function is provided, which reorders
@@ -1055,7 +1106,7 @@ data collections as x-ordered sequences.) Recording sequences of events into
lists, and/or playing the lists back as sequences, are functionalities that the
user is expected to supply on top of Pd's offerings, which, it is hoped, would
allow those functionalities within a much larger range of possibilities, to
-include random reorderings of events, score following, self-modifying scores,
+include random re-orderings of events, score following, self-modifying scores,
reactive improvisation, and perhaps much more.
<P> Traversal of data is made possible by adding a new type of atom, "pointer",
@@ -1116,10 +1167,10 @@ Finally, the voice abstraction puts its audio output on a summing bus.
of objects (having different templates). In this way, an arbitrarily rich
personal "score language" can be developed and sequenced.
-<H4> <A name=s9.2> 2.9.2. Accessing and changing data </A> </H4>
+<H3> <A name=s9.2> 2.9.2. Accessing and changing data </A> </H3>
<P> In general, accessing or changing data is done via "pointers" to
-"scalars". Numbers and symbols withing scalars are accessed using the
+"scalars". Numbers and symbols within scalars are accessed using the
"get" object and changed, in the same way, using "set". Since lists
and arrays are composed of scalars, every actual number or symbol in a data
heap will be a number or symbol element of some scalar. To access them, it
@@ -1134,7 +1185,7 @@ a number, chases down the numbered, scalar, element of the named array field.
<P> To alter "float" or "symbol" elements of scalars is straightforward
using the "set" object, but arrays and lists can't be set by assignment;
-there is no suitable data type available withing messages. Lists could
+there is no suitable data type available within messages. Lists could
possibly be "settable" by passing pointers to other lists, but permitting this
would have required either automatically doing deep copies of data structures
to carry out the assignments, or else implementing a garbage collecting memory
@@ -1154,7 +1205,7 @@ Deletion is less flexible; the only operation is to delete an entire list.
it's not clear how to protect against stale pointers efficiently, except by
voiding the entire collection of pointers into a list.)
-<H4> <A name=s9.3> 2.9.3. Editing </A> </H4>
+<H3> <A name=s9.3> 2.9.3. Editing </A> </H3>
<P> The graphical score shown above can be edited by dragging breakpoints, or
by adding and deleting them, using mouse clicks. Also, entire objects or
@@ -1184,7 +1235,7 @@ previously existing ones are assumed to be new and are initialized.
<P> It can happen that two "struct" objects compete to define the same data
structure, or that the user reads in data from a file which expects a different
version of the structure, or alternatively, that the "struct" object for
-existing data objects disappears. For this reasn, Pd maintains a private
+existing data objects disappears. For this reason, Pd maintains a private
representation of the last active version of a "struct" until all
similarly named "structs," as well as all data using that "struct", have
disappeared. If the user introduces a new version of the "struct" and only
@@ -1195,7 +1246,7 @@ up belonging to two or more structures of the same name. The worst that can
happen is that data may lose their drawing instructions, in which case Pd
supplies a simple default shape.
-<H4> <A name=s9.4> 2.9.4. Limitations </A> </H4>
+<H3> <A name=s9.4> 2.9.4. Limitations </A> </H3>
<P> When examples get more complicated and/or dense than the one shown here, it
becomes difficult to see and select specific features of a data collection;
@@ -1220,3 +1271,4 @@ handling primitives and the graphical presentation and editing functions.
</BODY>
</HTML>
+
diff --git a/pd/doc/1.manual/x3.htm b/pd/doc/1.manual/x3.htm
index d34f70e8..c77f3571 100644
--- a/pd/doc/1.manual/x3.htm
+++ b/pd/doc/1.manual/x3.htm
@@ -1,37 +1,85 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+
<HTML>
-<HEAD>
-<TITLE>Pd Documentation 3</TITLE>
-</HEAD>
-<BODY bgcolor="#ffffff">
-<SMALL>
-<div style="width:6.5in; margin-left:.5in">
-
-<CENTER> <B>
-Pd Documentation chapter 3: Getting Pd to run
-</B> </CENTER>
-<BR>
-<A href=index.htm#s3> back to table of contents </A>
+ <HEAD>
+ <TITLE>Pd Documentation 3</TITLE>
+ <meta http-equiv="Content-Type" content="text/html">
+ <link rel="stylesheet" type="text/css" href="pdmanual.css" media="screen">
+ </HEAD>
+
+
+<BODY>
+
+<H2>Pd Documentation chapter 3: Getting Pd to run</H2>
+
+<P>
+<A href="index.htm#s3"> back to table of contents </A>
<BR><BR>
+</P>
-Pd runs under Irix, Microsoft Windows, Linux, and Mac OS 10.2 (Jaguar).
+<P>Pd runs under Irix, Microsoft Windows, Linux, and MacOS 10.2 (Jaguar).
How to get Pd up and running depends on your operating system,
but the overall strategy is the same.
You must first get and install it, and
then untangle whatever problems arise in handling audio and MIDI input
and output, and finally get Pd to meet its real-time obligations reliably.
+<P> Installation instructions are platform-specfic; the following four
+sections
+will describe what to do for various operating systems you might have.
In case of trouble also consult the Pd mailing list archive on
<A href="http://iem.kug.ac.at/mailinglists/pd-list/">
http://iem.kug.ac.at/mailinglists/pd-list/</A>
, which often has late-breaking news about configuration problems and solutions.
+The rest of this section describes how to get audio and MIDI to work.
+<P>
+To test audio and MIDI, start Pd and select "test Audio and MIDI" from the
+"Media" menu. You should see a window like this:
+
+<CENTER><P>
+ <IMG src="fig11.1.png" ALT="test tone patch">
+</P></CENTER>
+
+<P> First, try to get Pd to play a sine wave over your speakers. The "TEST
+TONE" control at top left turns this on and off. Normally, all the output
+channels are turned on so that when you turn the tone on (to a soft -40 dB or a
+louder -20 dB) you should get output on the first six of your output channels.
+(If you have fewer than six output channnels open, the extra
+channels aren't played; and if you have more, this particular patch won't
+use them.)
+
+<P> If there's anything wrong, the most likely outcome is that you will hear
+nothing at all. This could be for any of at least three reasons: Pd might
+have failed to open the audio device; the audio card's output volume might
+be set to zero; or your audio system might not be set to amplify the computer
+output.
+
+<P> The number boxes labeled "AUDIO INPUT" show the levels of incoming
+audio, in dB, with 100 being maximum. (Incoming signals may clip at
+RMS levels below 100; for instance, a sinusoid clips at about 97 dB.)
+Any DC present in the input (such as you get with cheap audio hardware)
+will show up as level unless you turn on the "input hipass" toggle
+at right; then the DC component is filtered out before metering.
+
+<P> To test the quality of audio input and output, turn on "monitor"
+(also at right) which causes the inputs to be played to the outputs at
+unit gain. You should hear a faithful, non-distored copy of whatever is
+sent through the patch.
+
+<P> It is easy to get two copies of Pd running by accident; on most machines
+only one at a time may be inputting and outputting sound. (Some copy of Pd
+might have audio or MIDI devices open and prevent the copy you're trying to use
+from getting access to them.) Having extra
+copies of Pd around will also eat CPU cycles uselessly.
<P>
You may be interested in getting only audio output or audio input, or
you may need both to run simultaneously. By default, Pd will try to run
both, but if you don't need either input or output, you may find that Pd
runs more reliably, or at least more efficiently, with the unused direction
-turned off. This is controlled by Pd's command line flags.
+turned off. This may be specified in Pd's command line flags or using the
+"audio settings" dialog panel.
<P>
Depending on your application you will have a more or less stringent latency
@@ -43,141 +91,66 @@ inevitable occasions where the CPU runs off to service some different task
from Pd. How small this latency can be chosen depends on your OS and your
audio driver.
-<P>
-To test audio and MIDI, start Pd and select "test Audio and MIDI" from the
-"help" menu.
-
<P> TIP: If Pd starts up but you get distortion or glitches in the audio
output, this could be either because the "audio I/O buffer" isn't big enough,
or else because the CPU load of the patch you're running is too great for the
machine you have, or else because the ADC and DAC are out of sync or even at
different sample rates. To test for the first possibility, try increasing the
-"-audiobuf" parameter in the command line (but see also under your OS below.)
-For the second, start up your favorite performance monitor program; and for the
-third, try starting Pd up with ADCs disabled.
-
-<P> Here are instructions for getting and installing Pd for the four
-operating systems it runs on: IRIX, MS Windows, Linux, and Max OSX.
-
-<H4> <A name=s1.1> 3.1. IRIX (SGI machines) </A> </H4>
-
-<P> (NOTE: as of release 0.35 I haven't had an IRIX machine to compile
-Pd on. Soeren Bovbjerg has kindly compiled 0.35 and 0.36 for IRIX;
-you can find these at
-<A href=http://www.cvmt.dk/~sb/> http://www.cvmt.dk/~sb/. </A>)
-
-<P> Download Pd, which will be a "tar.Z" file. You can unpack this by
-typing "zcat [name].tar.Z | tar xf -" to a shell. This creates a directory
-named "pd".
-
-<P>
-Starting with release 0.25, Pd should come in "n32" and "o32" versions.
-"o32" is the default and will run on IRIX 5.x and up. "n32" runs faster,
-but only on 6.x and up. Also, "externs" have to be updated for n32. The
-"pd" executable (bin/pd in the distribution) is a symbolic link to either
-"pd-o32" or "pd-n32."
-
-<P> NOTE: "externs" appear to be broken in the N32 version... I'm not sure
-how long this has been true. If you want to use external objects, you have
-to use the O32 version.
-
-<P>
-Please note that the path to the Pd executable program can't contain
-space characters; don't put it in a directory named "Program Files"
-for example.
-
-<P>
-If for example you put Pd in ~, the executable program
-will be ~/pd/bin/pd. The program looks at its command line to
-figure out where it is, so it's best to invoke Pd by its full pathname.
-You should always invoke Pd from a Unix shell because many important
-messages appear on the standard error.
-
-<P>
-The simplest way to invoke Pd is to
-make an alias in your ".cshrc" file (assuming you use the "c" shell) such as:
-<PRE>
-
- alias pd ~/pd/bin/pd
-
-</PRE>
-(assuming your Pd distribution landed in ~, for example).
-
-<P>
-Pd will open the "default" audio input and output devices, without regard
-for whether they are in sync or not. This will be bad if they aren't; use
-the "-noadc" or "-nodac" flag to disable either the input or output. Pd is
-supposed to handle up to 8 channels of audio in and/or out. (But at least
-one user had to recompile Pd on his Onyx to get 8 channels working.)
-
-<P>
-As to MIDI, Pd simply attempts to open all available MIDI devices for input and
-output, which is probably very bad on anything more recent than my Indy. If
-any MIDI ports fail to open either for input or output, all MIDI is disabled.
-
-<P> Pd has not been fixed to request real-time priority from Irix; it will
-compete with all other processes on your machine for CPU time.
-
-<H5> Audio and MIDI in IRIX </H5>
-
-<P>
-Pd takes command line arguments to set the number of input and output channels
-and the sample rate. These don't affect the SGI's audio settings, which you
-have to set separately using the "audio panel." Pd does detect the audio
-sample rate if you don't specify one on the command line.
-
-<P>
-On SGI machines, you have to work to get MIDI running. Before you start Pd, verify
-that least one MIDI port is configured open. Pd opens the FIRST MIDI port
-that's open. You might want to get rid of the "software" MIDI port if you're
-running 6.x. On Indys, the usual practice is to open serial port number 2
-because some systems configure port 1 as "console" by default. You can use the
-GUI if you want, or else just type
-<PRE>
-
- startmidi -d /dev/ttyd2
-
-</PRE>
-to get port 2 speaking MIDI, and
-<PRE>
-
- stopmidi
-
-</PRE>
-to stop it. You can test whether MIDI is configured by typing,
-<PRE>
-
- ps -dafe | grep midi
-
-</PRE>
-and looking for "startmidi" processes.
-<P>
-It's a good idea to connect your serial port to your MIDI interface before
-typing the "startmidi" command, not afterward, at least in 5.x. We use the
-Opcode Studio 3 interface but in principle any Mac-compatible one should work.
-
-<P>
-The O2 apparently has RS232 ports, not RS422. I think SGI's web site says
-something about how to deal with this.
-
-<H4> <A name=s1.2> 3.2. Microsoft Windows </A> </H4>
-
-<P> Pd is compiled under NT, but shoould work under any version of Windows
-since 95. Pd will appear as a "zip" file. Unzip this, creating a directory
-such as \pd. (You can put it wherever you like but the path should have no
-spaces in it; so "Program Files" would be a bad place.)
+audio latency in the command line or the "audio settings" dialog (but see also
+under your OS below.) For the second, start up your favorite performance
+monitor program; and for the third, try starting Pd up with ADCs disabled.
+
+<P> In addition to the "test audio and MIDI" patch, the "Media" menu
+contains items for controlling audio and MIDI settings. The first two
+items, "Audio on" and "Audio off", open or close the audio devices and
+start or stop Pd's audio computation.
+
+<P> If there is a choice of
+audio API to make, the Media menu will display them. (On Linux, they are
+OSS, ALSA, and Portaudio; on Windows, you get MMIO and ASIO). More information
+about the APIs appears in the sections below.
+
+<P> Next is the "Audio settings..." menu item, which opens a dialog like this:
+
+<CENTER><P>
+ <IMG src="fig11.2.png" ALT="audio settings dialog">
+</P></CENTER>
+
+The exact choices you get depend on the operating system and API. The sample
+rate controls both audio output and input. The audio throughput delay is
+the nominal amount of time, in milliseconds, that a sound coming into the
+audio input will be delayed if it is copied through Pd straight to the
+output. Naturally you would like this to be as small as possible, but,
+depending on OS, API, and even the specific choice of audio hardware, there
+will be a limit to how small you can make this. You can typically get
+10 msec on linux (and lower still if you use special tricks), 30 msec on Mac
+OSX, and 60 msec on Windows (but note that there might be ways that a
+patient Windows user can reduce this).
+
+<P> Next you get a choice of input and output device. If you want to open
+more than one, hit "use multiple devices" and you'll be allowed up to 4
+in and 4 out. Each audio device is 2 channels by default, but you may
+specify more if your hardware supports it.
+
+<H3> <A name=s1.1> 3.1. Installing Pd in Microsoft Windows </A> </H3>
+
+<P> Pd is compiled under NT, but should work under any version of Windows since
+95. Pd will appear as a self-extracting archive (a ".exe" file). Run this and
+select a destination directory when prompted, such as "\pd" or "Program
+Files\pd".
<P>
-If for example you put Pd in C:\pd, the executable program will be
-C:\pd\bin\pd. You can simply adjust your path to include C:\pd\bin and just
-invoke "pd" in a command prompt window. You can also make a "command prompt"
-shortcut to start Pd.
+If for example you put Pd in "C:Program Files\pd", the executable program will be
+"C:Program Files\pd\bin\pd". You can simply adjust your path to include
+C:\pd\bin and then
+invoke "pd" in a command prompt window. You can also make a shortcut to the
+executable program (left-click on it and drag to the desktop, for example.)
<P> Pd requires "TCP/IP networking" to be turned on. This doesn't mean you
have to be on a real network, but simply that Pd actually consists of two
-programs that make a "network link" to intercommunicate.
+programs that make a "network link" (locally) to intercommunicate.
-<H5> The vanishing window </H5>
+<H4> The vanishing window </H4>
<P> Pd is a "command line" program. Most error and diagnostic
messages from Pd appear on the command prompt window Pd runs from.
@@ -189,31 +162,39 @@ print an error and exit. You won't see this error unless you arrange for the
to do this is to make a "batch" file ("run.bat", say) containing the Pd
command line.
-<H5> Audio in Microsoft Windows </H5>
+<H4> Audio in Microsoft Windows </H4>
<P>
You can ask for a list of audio and MIDI devices by typing
"pd -listdev"; you can then specify which audio and MIDI device to use.
Type "pd -help" (or make any mistake) to get the syntax for specifying
-which device to use.
+which device to use. You can modify the Pd shortcut (or batch file) to
+set these.
<P>
-Most PC sound cards seem to have MIDI built in; you don't seem to have to
-do anything special to get Pd to send and receive MIDI. You can list and
-choose MIDI devices in the same way as audio.
+Alternatively, (and especially when just starting out) you can experiment
+with different audio configurations using the "audio settings"
+item in the Media menu.
+
+<P>
+You can list and
+choose MIDI devices in the same way as audio; note that, by default, MIDI
+input is disabled in Windows (because it's possible to hang up some MIDI
+devices if Pd exits unexpectedly).
<P>
MIDI timing is very poor if you are using simultaneous audio input and output;
if you suppress either audio input or output things will improve somewhat under
NT; you can apparently get the jitter down to ~40 msec. On W95 performance is
simply terrible. W98, with either audio input or output suppressed, offers
-fairly good MIDI timing (~5 msec jitter) but crashes occasionally.
+fairly good MIDI timing (~5 msec jitter). The "first edition" used to crash
+occasionally; this might be fixed in the "second edition".
<P> Some NT and W98 drivers greet you with a constant trail of "resyncing
audio" messages. Sometimes you can fix this by invoking Pd with the "-noresync"
flag.
-<H5> ASIO </H5>
+<H4> ASIO </H4>
<P> As of version 0.35 Pd supports ASIO. Invoke Pd as "pd -asio" and, if
needed, specify "-sounddev" (etc.) flags to specify which device (see
@@ -222,58 +203,19 @@ from the default (256 samples) and "-audiobuf" in milliseconds. Pd will
round this down to a power of two buffers, each of "-blocksize" in sample
frames.
-<P> Using an RME Hammerfall, and specifying "-audiobuf 5 -blocksize 32" I
-was able to get about 7 milliseconds of throughput delay (as measured by
-the latency-measurement patch in 7.stuff/tools.) As always, you can specify
-"-channels" to any even number up to the maximum (32, I think) or can specify
-channel count separately for input and output (-inchannels and -outchannels).
-
-<H5> The special joys of Windows 95 </H5>
-
-<P>
-On Windows 95 you can expect a hard time. Every user who tries it seems to
-encounter a new problem. The best way to run Pd is to get into the "MSDOS
-Prompt" program and type \pb\bin\pd to it (or whatever the path ends up being.)
-You can probably put pd's "bin" directory in your path so that you just type
-"pd" to the prompt.
-
-<P>
-You don't want to run Pd from the "run" menu because if it fails to start up
-the window holding the error message will disappear instantly. Ditto for
-clicking on "batch files" or on the Pd executable itself.
-
-<P>
-The most common reason Pd might fail to start up in W95 is not having
-"networking" turned on. Pd is actually two programs that establish an IP
-interconnection. Beware that this sometimes fools Windows into calling your
-ISP for no reason.
-
-<P>
-It is often necessary to specify a huge audio buffer to get steady audio
-output in W95; see the command line arguments below.
-
-<H4> <A name=s1.3> 3.3. Linux </A> </H4>
+<H3> <A name=s1.2> 3.2. Installing Pd in Linux </A> </H3>
<P> What to do depends on which flavor of Linux you are running (e.g., Debian
or Red Hat). The instructions here should work for Pd 0.33 and up regardless of
-your situation. (If not, you can read the Pd mailing list archives for
-recent problems; if you have found a new problem you're welcome to post it
+your situation. (If not, you can read the Pd mailing list archives for
+recent problems; if you have found a new problem you're welcome to post it
to the list.)
-<P> Before you start, you might want to check that you have the resources Pd
-needs. The main things you need are the C compiler, X windows (including
-the X development package for Pd to link against) and TK. If you're running
-Redhat or Mandrake 7.x or up, I think these are all present by default.
-The RedHat X client developer "RPM" package is called XFree86-devel.
-
-<P> You don't absolutely have to have the X server package running; you can run
-Pd on the microprocessor in your refrigerator as long as it can connect to an X
-server on another machine.
-
-<P> If you're running RedHat you might want to use RPM to install Pd. For
-other linux distributions, download the "tar.gz" version and compile it.
+<P> If you're running RedHat or Mandrake you might want to use RPM to install
+Pd. For other linux distributions, download the "tar.gz" version and compile
+Pd.
-<H5> Getting Pd as an RPM </H5>
+<H4> Getting Pd as an RPM </H4>
<P> Download Pd, perhaps from
<a href="http://www.crca.ucsd.edu/~msp/software.html">
@@ -288,7 +230,13 @@ the directory containing the file, and type the command,
<P> (substituting the real file name.) Then you should be able to type "pd"
to a shell and watch the Pd main window appear.
-<H5> Getting Pd as a .tar.gz </H5>
+<H4> Getting Pd as a .tar.gz </H4>
+
+<P> Before you start, you might want to check that you have the resources Pd
+needs. The main things you need are the C compiler, X windows (including
+the X development package for Pd to link against) and TK. If you're running
+Redhat or Mandrake 7.x or up, I think these are all present by default.
+The RedHat X client developer "RPM" package is called XFree86-devel.
<P>
Download Pd, perhaps from
@@ -300,20 +248,22 @@ the directory containing the file, and type the command,
<PRE>
zcat pd-linux-033.tar.gz | tar xf -
</PRE>
-which creates a directory named "pd". I do this from my home directory.
+<P>which creates a directory named "pd". I do this from my home directory.
Next, compile it. "CD" to pd and read the INSTALL.txt, or else just cd
to "pd/src" and type
+<P>
<BR> ./configure
<BR> make depend
<BR> make
+</P>
<P> You can pass flags to "configure" to customize your compilation:
<PRE>
- To enable ALSA 0.9x (the latest one), add "--enable-alsa".
- To enable the older ALSA 0.5x, add "--enable-old-alsa".
- To enable Ritsch's RME 9652 driver, add --enable-rme".
+ To enable debugging (and losing code optimization) add "--enable-debug".
+ To enable ALSA 0.9x or up, add "--enable-alsa".
+ To use Portaudio version 19 (experimental), add "--enable-portaudio".
To put Pd in /usr/bin instead of /usr/local/bin, add "--prefix=/bin".
</PRE>
@@ -322,18 +272,20 @@ to "pd/src" and type
<P> Alternatively, as superuser, you can run "make install" after "make depend"
and then anyone on your system can just type "pd" to run it.
-<H5> Testing audio and MIDI. </H5>
+<H4> Testing audio and MIDI. </H4>
<P>
Next try audio. We want to know whether audio output works, whether audio
-input works, and whether they work simultaneously. First run "aumix" to
-see audio input and output gains and which device is "recording".
+input works, and whether they work simultaneously. First run "aumix" (or
+any newer audio mixer app) to
+check audio input and output gains and learn which input (mic; line;
+etc.) is "recording".
Then test audio output by running
<PRE>
pd -noadc
</PRE>
-and selecting "test audio and MIDI" from the "help" menu. You should see a
-patch. Turn on the test tone and listen. Do the usual where's-the-signal
+<P>and selecting "test audio and MIDI" from the "Media" menu. You should see
+a patch. Turn on the test tone and listen. Do the usual where's-the-signal
business.
<P>
@@ -341,7 +293,7 @@ Then quit Pd and test audio input via
<PRE>
pd -nodac
</PRE>
-Re-open the test patch and hit "meter"; look at the levels. 100 dB is a
+<P>Re-open the test patch and hit "meter"; look at the levels. 100 dB is a
hard clip; arrange gains so that the input signal tops out around 80 or 90,
but no higher.
@@ -352,12 +304,12 @@ hand there's no complaint, and if the audio test patch does what you want, you
might wish to experiment with the "-audiobuffer" flag to see what values of
audio latency your audio system can handle.
-<H4> Audio hardware in Linux </H4>
+<H3> Audio hardware in Linux </H3>
<P>
Be forewarned: installing and testing audio and MIDI drivers in Linux can take
days or weeks. There apears to be no single place where you can get detailed
-information on Linux audio.
+information on Linux audio.
<P>
Depending on your hardware and software, you might or might not be able to
@@ -375,20 +327,10 @@ releases. You can get ALSA from
<a href="http://www.alsa-project.org/">
http://www.alsa-project.org/</A> .
-<P>
-(There is also a commercial version of the OSS drivers which costs $30 (slightly
-more for certain audio cards.) Hit
-
- <a href="http://www.opensound.com/">
- http://www.opensound.com/</A> .
-
-These might be easier to use than the free OSS drivers, but I've never tried
-them.)
-
<P> ALSA is able to emulate OSS, so that you can usually run Pd using the
default "OSS" settings even if it's actually ALSA that's running.
-<H5> Installing and configuring FREE OSS </H5>
+<H4> Installing and configuring FREE OSS </H4>
<P>
OSS is really a collection of loadable device drivers. The commands
@@ -409,14 +351,16 @@ soundlow 1 [sound] 0
aic7xxx 23 2
</PRE>
-then OSS is running, and if all you see is:
+
+<P>then OSS is running, and if all you see is:
+
<PRE>
eepro100 3 1 (autoclean)
aic7xxx 23 2
</PRE>
-then it isn't. You can turn OSS off by running "rmmod" repeatedly, starting
+<P>then it isn't. You can turn OSS off by running "rmmod" repeatedly, starting
with "opl3" (or whatever) so as not to remove any module before you remove
all the modules that depend on it. In the above listing, "opl3*" is device
dependent and you might see different names.
@@ -440,7 +384,7 @@ alias sound-slot-1 es1371
</PRE>
-Here the two sound cards are the (motherboard resident) i810 driver and an
+<P>Here the two sound cards are the (motherboard resident) i810 driver and an
ensoniq es1371.
<P> In RedHat at least, the "sndconfig" program tries to automatically search
@@ -452,14 +396,14 @@ often not the one you want to use!
two, but the majority of drivers, even for new sound cards, only
support "block." Pd makes "block" the default.
-<H5> ALSA (Advanced Linux Sound Architecture) </H5>
+<H4> ALSA (Advanced Linux Sound Architecture) </H4>
<P> ALSA is newer, hence less stable and harder to use, than OSS.
Alsa comes in a "finished" version (0.5.x) and a
different, redesigned, "beta" version, 0.9. Installing ALSA can be tricky
and/or confusing.
-<P> As of version 0.37 Pd works only with 0.9.x versions.
+<P> As of version 0.37 Pd works only with 0.9.x versions.
The RPM version of Pd is compiled for 0.9.x.
<P> By default, Pd uses OSS. If you are running ALSA, Pd will use ALSA's OSS
@@ -470,7 +414,7 @@ to be used, include the "-alsa" flag in the command line.
flag. So, for instance, "-alsadev 3" means your third card, counting from
one. You can also specify it the ALSA way: "-alsadev hw:3,0".
-<H5> Which sound card? </H5>
+<H4> Which sound card? </H4>
<P>
Here's a rundown on my experiences with sound cards so far. See
@@ -483,24 +427,17 @@ I/O ports and one SPDIF. There is a "baby hammerfall" also, which I think is
the "9632." DO NOT CONFUSE THE 9652/9632 WITH OTHER RME BOARDS WHICH MIGHT
NOT WORK WITH PD.
-<P> Guenter Geiger has an OSS driver for Hammerfall for 2.4 kernels (such as
-RedHat 7.1 and up). You have to download and compile it:
-
- <A HREF=http://gige.xdv.org/pages/rme>
- http://gige.xdv.org/pages/rme </A>.
-
-<P> You must then run Pd using the "-32bit' flag, because this uses a
-non-standard extension of OSS to 32 bit samples.
-
-<P> Hammerfalls now have an ALSA driver; from what I hear
-it won't work yet with Pd. I was unable to install the ALSA driver on the
-two machines I tried ("no such device").
+<P> Hammerfalls now have an ALSA driver; aapparently, it works well to install
+this and then run Pd using OSS emulation. (Unfortunately, this will only give
+you 16 bit resolution. Maybe the also "plug" device will work better; I
+haven't tried this.)
<H6> MIDIMAN </H6>
-Midiman sells devices with between 4 and 12 analog channels in and out, for
-which there are ALSA drivers. It seems to work fine with the old ALSA driver
-(0.5). I'm running mine in Alsa 0.9 beta 10. The driver name is "ice1712".
+<P>Midiman sells PCI devices (delta 44, 66, 1010, and 1010LT)
+with between 4 and 10 channels in and out, for
+which there are ALSA drivers.
+I'm running mine in Alsa 0.9 beta 10. The driver name is "ice1712".
<P> Alsa provides an "envy24control" program (in "utils". You should run
this and check that your ice1712's sync source is internal if you have no
@@ -509,33 +446,35 @@ but don't take it for granted...
<H6> i810/i815 </H6>
-In RedHat 7.0, motherboards with native i810 audio systems don't work in
+<P>In RedHat 7.0, motherboards with native i810 audio systems don't work in
full duplex (they crash linux). Either run Pd -noadc or else (better) install
ALSA.
-<H4> <A name=s1.4> 3.4. Macintosh OSX </A> </H4>
+<H3> <A name="s1.3"> 3.3. Installing Pd in Macintosh OSX </A> </H3>
-Pd version 0.35 and up support Macintosh OSX, although there are still some
-problems. You can always just download
-the sources and compile it yourself, or (easier)
+<P>Pd version 0.35 and up support Macintosh OSX, although there are still some
+problems. You can always just download
+the sources and compile them yourself, or (easier)
find a MacOSX-style "package". The first package was put together by Adam
-Lindsay and can be found on
-<A href=http://homepage.mac.com/atl/sw>
-http://homepage.mac.com/atl/sw</A>. The package simply installs itself
-and you needn't follow the directions below.
-
-<H5> To install on OSX from source: </H5>
+Lindsay and can be found on
+<A href="http://homepage.mac.com/atl/sw">
+http://homepage.mac.com/atl/sw</A>. The package simply installs itself
+and you needn't follow the directions below.
+</P>
+<H4> To install on OSX from source: </H4>
-Whether you've downloaded the source or the "package" you can
-always compile Pd for yourself, whether to make your own improvements, or
+<P>
+Whether you've downloaded the source or the "package" you can
+always compile Pd for yourself, whether to make your own improvements, or
possibly so that you can get the newest version before it shows up compiled for
-Mac OS X.
+Mac OS X.
<P> To be able to compile Pd, you must have installed Tcl/Tk
-specifically in
-/Applications/Wish Shell.app
-and /Library/Frameworks/Tk.framework and /Library/Frameworks/Tcl.framework.
+specifically in
+/Applications/Wish Shell.app
+and /Library/Frameworks/Tk.framework and /Library/Frameworks/Tcl.framework.
+
<P> First download and install TK for OSX
(http://sourceforge.net/projects/tcl/). Get a recent one compiled for
OSX, by chasing through "latest file releases", and finding a "download"
@@ -547,9 +486,13 @@ on your system.
<P> For old versions of Tcl/Tk you also had to get the "h" files from XFree86
and put them in
/usr/X11R6/include. You can download just the H files from:
-<pre>
- http://www.crca.ucsd.edu/~msp/x.tgz
-</pre>
+
+<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<CODE>
+<A HREF="http://www.crca.ucsd.edu/~msp/x.tgz">http://www.crca.ucsd.edu/~msp/x.tgz</A>
+</CODE>
+
+<P>
(the individual files seem to have adequate copyright notices so that
I can just redistribute them.) ((I hope this is no longer necessary but I
notice people keep downloading these files anyway, so I'll leave them there
@@ -559,19 +502,19 @@ a while longer until I'm sure they're not needed.))
such as ~/pd-0.35-test17 , cd to pd-0.36-0/src, type "./configure"
and "make". Then type ~/pd-0.36-0/bin/pd to a shell and enjoy!
-<P> If you wish you can put the line,
+<P> If you wish you can put a line such as,
<pre>
alias pd ~/pd/bin/pd
</pre>
-in the file, ~/.tcshrc, so that you can later just type "pd" to a shell. (The
+<P>in the file, ~/.tcshrc, so that you can later just type "pd" to a shell. (The
shell only reads the ~/.tcshrc file on startup, so this won't take effect in
any existing shells unless you specially type
<pre>
source ~/.tcshrc
</pre>
-to them.)
+<P>to them.)
<P> In some cases you have to explicitly give "-soundindev" and "-soundoutdev"
flags for Pd to open audio correctly; "pd -listdev" should show you the
@@ -587,9 +530,113 @@ I think you just download the OSX driver and follow directions.
pd -midiindev 1 -midioutdev 2
</pre>
-to get MIDI working.
+<P>to get MIDI working.
+
+<H3> <A name=s1.4> 3.4. Installing Pd in IRIX (SGI machines) </A> </H3>
+
+<P> (NOTE: as of release 0.35 I haven't had an IRIX machine to compile
+Pd on. Soeren Bovbjerg has kindly compiled 0.35 and 0.36 for IRIX;
+you can find these at
+<A href="http://www.cvmt.dk/~sb/"> http://www.cvmt.dk/~sb/ </A>.)
+
+<P> Download Pd, which will be a "tar.Z" file. You can unpack this by
+typing "zcat [name].tar.Z | tar xf -" to a shell. This creates a directory
+named "pd".
+
+<P>
+Starting with release 0.25, Pd should come in "n32" and "o32" versions.
+"o32" is the default and will run on IRIX 5.x and up. "n32" runs faster,
+but only on 6.x and up. Also, "externs" have to be updated for n32. The
+"pd" executable (bin/pd in the distribution) is a symbolic link to either
+"pd-o32" or "pd-n32."
+
+<P> NOTE: "externs" appear to be broken in the N32 version... I'm not sure
+how long this has been true. If you want to use external objects, you have
+to use the O32 version.
+
+<P>
+If for example you put Pd in ~, the executable program
+will be ~/pd/bin/pd. The program looks at its command line to
+figure out where it is, so it's best to invoke Pd by its full pathname.
+You should always invoke Pd from a Unix shell because many important
+messages appear on the standard error.
+
+<P>
+The simplest way to invoke Pd is to
+make an alias in your ".cshrc" file (assuming you use the "c" shell) such as:
+</P>
+<PRE>
+
+ alias pd ~/pd/bin/pd
+
+</PRE>
+<P>(assuming your Pd distribution landed in ~, for example).
+
+<P>
+Pd will open the "default" audio input and output devices, without regard
+for whether they are in sync or not. This will be bad if they aren't; use
+the "-noadc" or "-nodac" flag to disable either the input or output. Pd is
+supposed to handle up to 8 channels of audio in and/or out. (But at least
+one user had to recompile Pd on his Onyx to get 8 channels working.)
+
+<P>
+As to MIDI, Pd simply attempts to open all available MIDI devices for input and
+output, which is probably very bad on anything more recent than my Indy. If
+any MIDI ports fail to open either for input or output, all MIDI is disabled.
-<H4> <A name=s3> 3.5. graphics rendering using GEM </A> </H4>
+<P> Pd has not been fixed to request real-time priority from Irix; it will
+compete with all other processes on your machine for CPU time.
+
+<H4> Audio and MIDI in IRIX </H4>
+
+<P>
+Pd takes command line arguments to set the number of input and output channels
+and the sample rate. These don't affect the SGI's audio settings, which you
+have to set separately using the "audio panel." Pd does detect the audio
+sample rate if you don't specify one on the command line.
+
+<P>
+On SGI machines, you have to work to get MIDI running. Before you start Pd, verify
+that least one MIDI port is configured open. Pd opens the FIRST MIDI port
+that's open. You might want to get rid of the "software" MIDI port if you're
+running 6.x. On Indys, the usual practice is to open serial port number 2
+because some systems configure port 1 as "console" by default. You can use the
+GUI if you want, or else just type
+<PRE>
+
+ startmidi -d /dev/ttyd2
+
+</PRE>
+
+<P>to get port 2 speaking MIDI, and
+
+<PRE>
+
+ stopmidi
+
+</PRE>
+
+<P>to stop it. You can test whether MIDI is configured by typing,
+
+<PRE>
+
+ ps -dafe | grep midi
+
+</PRE>
+
+<P>and looking for "startmidi" processes.
+
+<P>
+It's a good idea to connect your serial port to your MIDI interface before
+typing the "startmidi" command, not afterward, at least in 5.x. We use the
+Opcode Studio 3 interface but in principle any Mac-compatible one should work.
+
+<P>
+The O2 apparently has RS232 ports, not RS422. I think SGI's web site says
+something about how to deal with this.
+
+
+<H3> <A name=s3> 3.5. graphics rendering using GEM </A> </H3>
<P>
GEM, originally by Mark Danks but now supported by Iohannes Zmoelnig, is essentially an extension of Pd that allows you to do OpenGL programming
@@ -598,9 +645,9 @@ into Pd for audio. Find out more from
<a href="http://iem.kug.ac.at/~zmoelnig/index.html"> Johannes's page</a>.
-<H4> <A name=s4> 3.6. The Pd command line </A> </H4>
+<H3> <A name=s4> 3.6. The Pd command line </A> </H3>
-Pd is a "command line" program. The best way to run it is from your
+<P>Pd is a "command line" program. The best way to run it is from your
"terminal emulator," "shell," or "MSDOS prompt." The command line is:
<PRE>
@@ -609,33 +656,40 @@ Pd is a "command line" program. The best way to run it is from your
</PRE>
-although you may have to specify a path so your command interpreter can find
-Pd (OS dependent.) Possible options include:
+<P>although you may have to specify a path (such as "~/pd/bin/pd" or
+"C:\program files\pd\bin\pd") so your command interpreter can find
+Pd. Possible options include:
<PRE>
audio configuration flags:
--r <n> -- specify sample rate
+-r &lt;n&gt; -- specify sample rate
+-audioindev ... -- sound in device list; e.g., "2,1" for second and first
+-audiooutdev ... -- sound out device list, same as above
+-audiodev ... -- specify both -audioindev and -audiooutdev together
-inchannels ... -- number of audio in channels (by device, like "2" or "16,8")
-outchannels ... -- number of audio out channels (by device)
-channels ... -- specify both input and output channels
--audiobuf <n> -- specify size of audio buffer in msec
--blocksize <n> -- specify audio I/O block size in sample frames
--sleepgrain <n> -- specify number of milliseconds to sleep when idle
+-audiobuf &lt;n&gt; -- specify size of audio I/O buffer in msec
+-blocksize &lt;n&gt; -- specify audio I/O block size in sample frames
+-sleepgrain &lt;n&gt; -- specify number of milliseconds to sleep when idle
-nodac -- suppress audio output
-noadc -- suppress audio input
-noaudio -- suppress audio input and output (-nosound is synonym)
--listdev -- list audio and MIDI devices
--audioindev ... -- sound in device list; e.g., "2,1" for second and first
--audiooutdev ... -- sound out device list, same as above
--audiodev ... -- specify both -audioindev and -audiooutdev together
+-listdev -- list audio and MIDI devices
(linux specific audio:)
--frags <n> -- specify number of audio fragments (defeats audiobuf)
--fragsize <n> -- specify log of fragment size ('blocksize' is better...)
--stream -- use stream mode audio (e.g., for es1370 audio cards)
--alsa -- use ALSA audio drivers
--alsadev <n> -- ALSA device # (counting from 1) or name: default hw:0,0
+-frags &lt;n&gt; -- specify number of audio fragments (defeats audiobuf)
+-fragsize &lt;n&gt; -- specify log of fragment size ('blocksize' is better...)
+-oss -- use ALSA audio drivers
+-alsa -- use ALSA audio drivers
+-pa -- use portaudio (experimental version 19)
+-alsadev &lt;n&gt; ----- obsolete: use -audiodev
+-32bit ---- (probably obsolete) -- use 32 bit OSS extension
+
+(Windows specific audio:)
+-mmio -- use MMIO drivers and API
+-asio -- use ASIO drivers and API
MIDI configuration flags:
-midiindev ... -- midi in device list; e.g., "1,3" for first and third
@@ -646,85 +700,73 @@ MIDI configuration flags:
-nomidi -- suppress MIDI input and output
general flags:
--path <path> -- add to file search path
--open <file> -- open file(s) on startup
--lib <file> -- load object library(s)
--font <n> -- specify default font size in points
+-path &lt;path&gt; -- add to file search path
+-helppath &lt;path&gt; -- add to help search path
+-open &lt;file&gt; -- open file(s) on startup
+-lib &lt;file&gt; -- load object library(s)
+-font &lt;n&gt; -- specify default font size in points
-verbose -- extra printout on startup and when searching for files
--d <n> -- specify debug level
+-version -- don't run Pd; just print out which version it is
+-d &lt;n&gt; -- specify debug level
-noloadbang -- suppress all loadbangs
-nogui -- suppress starting the GUI
-guicmd "cmd..." -- substitute another GUI program (e.g., rsh)
-send "msg..." -- send a message at startup (after patches are loaded)
-rt or -realtime -- use real-time priority (needs root privilege)
--frags <n> -- specify number of audio fragments (defeats audiobuf)
--fragsize <n> -- specify log of fragment size ('blocksize' is better...)
--blocksize <n> -- specify audio I/O block size in sample frames
--stream -- use stream mode audio (e.g., for es1370 audio cards)
--alsa -- use ALSA audio drivers
--alsadev <n> -- ALSA device # (counting from 1) or name: default hw:0,0
+</PRE>
-(MS Windows specific audio:)
--resync -- resynchronize audio (default if more than 2 channels)
--noresync -- never resynchronize audio I/O (default for stereo)
--asio -- use ASIO audio driver (and not the 'MMIO' default)
+<P>Here are some details on some of the audio, MIDI, and scheduler options (but
+see also the next section on file management.)
-MIDI configuration flags:
--midiindev ... -- midi in device list; e.g., "1,3" for first and third
--midioutdev ... -- midi out device list, same format
--nomidiin -- suppress MIDI input
--nomidiout -- suppress MIDI output
--nomidi -- suppress MIDI input and output
+<H4> multiple devices. </H4>
-general flags:
--path <path> -- add to file search path
--open <file> -- open file(s) on startup
--lib <file> -- load object library(s)
--font <n> -- specify default font size in points
--verbose -- extra printout on startup and when searching for files
--d <n> -- specify debug level
--noloadbang -- suppress all loadbangs
--nogui -- suppress starting the GUI
--guicmd "cmd..." -- substitute another GUI program (e.g., rsh)
--send "msg..." -- send a message at startup (after patches are loaded)
--rt or -realtime -- use real-time priority (needs root privilege)
-
-</PRE>
+<P> You can specify multiple MIDI input and output devices. For example,
+"pd -midiindev 3 -midioutdev 4,2" asks for the third MIDI input device and the
+fourth and second MIDI output device.
-Here are some details on some of the audio and MIDI options (but see also the
-next section on file management.)
+<P> Audio device selection is similar, except that you can also specify
+channels by device: "-audioindev 1,3 -inchannels 2,8" will try to open device 1
+(2 channels) and device 3 (8 channels.)
-<H5> sample rate </H5>
+<H4> sample rate. </H4>
-The sample rate controls Pd's logical sample rate which need not be that of
+<P>The sample rate controls Pd's logical sample rate which need not be that of
the audio input and output devices. If Pd's sample rate is wrong, time will
flow at the wrong rate and synthetic sounds will be transposed. If the output
and input devices are running at different rates, Pd will constantly drop frames
to re-sync them, which will sound bad. You can disable input or output if this
is a problem.
-<H5> audio buffer size </H5>
+<H4> audio buffer size, block size, and sleep grain. </H4>
-You can specify an audio buffer size in milliseconds, typically between 10 and
+<P>You can specify an audio buffer size in milliseconds, typically between 10 and
300, depending on how responsive your OS and drivers are. If this is set too
low there will be audio I/O errors ("data late"). The higher the value is,
on the other hand, the more throughput delay you will hear from the audio
and/or control inputs (MIDI, GUI) and the audio coming out.
-<P> In Linux and Windows, you can also specify the audio block size in sample
-frames (but in Windows, this is only effective when using ASIO).
+<P> You can also specify the audio block size in sample
+frames. This is 64 by default (except for MMIO for which it's 256), and may
+be 64, 128, or 256.
-<H5> MIDI devices </H5>
-<P> You can specify multiple MIDI input and output devices. For example,
-"pd -midiindev 3 -midioutdev 4,2" asks for the third MIDI input device and the
-fourth and second MIDI output device. The "channel message" midi objects in Pd
+<P> The "sleepgrain" controls how long (in milliseconds) Pd sleeps between
+periods of computation. This is normally the audio buffer divided by 4, but
+no less than 0.1 and no more than 5. On most OSes, ingoing and outgoing MIDI
+is quantized to this value, so if you care about MIDI timing, reduce this to 1.
+
+<H4> MIDI </H4>
+
+<A> The "channel message" midi objects in Pd
such as notein or pgmout will take channels 1-16 to mean the first open MIDI
port, 17-32 the second one, and so on. The midiin, sysexin, midiout objects
give you a separate inlet to specify which of the open MIDI port numbers
you want.
+<P> System exclusive MIDI message inupt and output is theoretically supported
+in version 0.37 but has not been tested.
+
<P> In Linux, if you
ask for "pd -midioutdev 1" for instance, you get /dev/midi0 or /dev/midi00
(or even /dev/midi). "-midioutdev 45" would be /dev/midi44. In NT, device
@@ -732,26 +774,45 @@ number 0 is the "MIDI mapper", which is the default MIDI device you selected
from the control panel; counting from one, the device numbers are card
numbers as listed by "pd -listdev."
-<H4> <A name=s5> 3.7. dealing with files </A> </H4>
+<H3> <A name="s5"> 3.7. dealing with files </A> </H3>
-Pd has a search path feature; you specify the path on the command line
+<P>Pd has a search path feature; you specify the path on the command line
using the "-path" option. Paths may contain any number of files. If you
specify several files in a single "-path" option they're separated by colons
-in unix or semicolons in NT. When Pd searches for an abstraction or an
+in unix or semicolons in NT.
+
+<P> You can see and edit the path while Pd is running using the "path..."
+item in the "File" menu. The path must be correctly set before you load
+a patch or it may fail to find abstractions, etc., that are needed to
+construct the patch.
+
+<P>When Pd searches for an abstraction or an
"extern" it uses the path to try to find the necessary file. The "read"
messages to qlists and arrays (aka tables) work the same way. NO SPACES MAY
APPEAR ANYWHERE IN THE SEARCH PATH, e.g., "c:\my nonsense\goobers" won't
work.
+<P> Path entries may be relative to the patch directory; for instance,
+if your path has an item, "../sound", and your patch is in "my stuff/all mine",
+then Pd will look in "my stuff/sound". Spaces should be OK in the path to
+the patch, but not in the path entry (../sound) itself. This is useful if
+you have a patch and supporting files (even a supporting snapshot of pd)
+that you want to distribute or carry around together.
+
+<P> Regardless of path, Pd should look first in the directory containing
+the patch before searching down the path. (However, sometimes, for
+reasons I can't explain yet, you have to put the entry "." in the
+search path for this to happen, as least within linux!)
+
<P> Filenames in Pd are always separated by (unix-style) forward slashes, even
if you're on Windows (which uses backslashes). This is so that patches can be
ported more easily between operating systems. On the other hand, if you
specify a filename on the command line (as in "pd -path c:\pdlib") the file
separator should agree with the operating system. <BR>
-<P> If a filename in a patch has any "/" characters in it, the "path" is not
-used; thus, "../sounds/sample1.wav" causes Pd only to look relative to the
-directory containing the patch. (You may also invoke externs that way.)
+<P> If a filename specified in a patch has any "/" characters in it, the "path"
+is not used; thus, "../sounds/sample1.wav" causes Pd only to look relative to
+the directory containing the patch. (You may also invoke externs that way.)
<P> As of version 0.35, there may be spaces in the path to Pd itself; also,
the "openpanel" and "savepanel" objects can handle spaces. But still not
diff --git a/pd/doc/1.manual/x4.htm b/pd/doc/1.manual/x4.htm
index 5fe5d25d..faaf2f48 100644
--- a/pd/doc/1.manual/x4.htm
+++ b/pd/doc/1.manual/x4.htm
@@ -1,20 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+
<HTML>
-<HEAD>
-<TITLE>Pd Documentation</TITLE>
-</HEAD>
-<BODY bgcolor="#ffffff">
-<SMALL>
-<div style="width:6.5in; margin-left:.5in">
-
-<CENTER> <B>
-Pd Documentation chapter 4: writing Pd objects in C
-</B> </CENTER>
-<BR>
-<H5> <A href=index.htm#s4> back to table of contents </A></H5>
- <BR><BR>
+ <HEAD>
+ <TITLE>Pd Documentation 4</TITLE>
+ <meta http-equiv="Content-Type" content="text/html">
+ <link rel="stylesheet" type="text/css" href="pdmanual.css" media="screen">
+ </HEAD>
+
+
+<BODY>
+
+<H2>Pd Documentation chapter 4: writing Pd objects in C</H2>
+
<P>
+<A href="index.htm#s4"> back to table of contents </A>
+<BR><BR>
+</P>
-You can write your own objects that you and others can use in their Pd
+<P>You can write your own objects that you and others can use in their Pd
applications. You can write them in C or (if you're smart and brave) in C++ or
FORTRAN.
@@ -27,7 +30,7 @@ first in the directory containing the patch, then in directories in its
"path." Pd will then add whatever object is defined there to its "class list,"
which is the set of all Pd classes you can use. If all this works, Pd then
attempts again to create the object you asked for, this time perhaps
-sucessfully. There is no difference between an object defined this way and an
+successfully. There is no difference between an object defined this way and an
object built into Pd.
<P> Once you load a new object into Pd, it's there for the duration of your Pd
@@ -54,6 +57,5 @@ or bad DLL." Simply recompile Pd under 5.x and the problem goes away. Externs
compiled under 5.x and 6.x are binary compatible; it's just the compilation
that's sensitive.
-
</BODY>
</HTML>
diff --git a/pd/doc/1.manual/x5.htm b/pd/doc/1.manual/x5.htm
index 0b18cf1a..ac7b6e5a 100644
--- a/pd/doc/1.manual/x5.htm
+++ b/pd/doc/1.manual/x5.htm
@@ -1,26 +1,87 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+
<HTML>
-<HEAD>
-<TITLE>Pd Documentation</TITLE>
-</HEAD>
-<BODY bgcolor="#ffffff">
-<SMALL>
-<div style="width:6.5in; margin-left:.5in">
-
-<CENTER> <B>
-Pd Documentation chapter 5. current status
-</B> </CENTER>
-<P>
-This section tracks changes in Pd's current implementation.
-<BR>
-<H5> <A href=index.htm#s5> back to table of contents </A></H5>
+ <HEAD>
+ <TITLE>Pd Documentation 5</TITLE>
+ <meta http-equiv="Content-Type" content="text/html">
+ <link rel="stylesheet" type="text/css" href="pdmanual.css" media="screen">
+ </HEAD>
+
+<BODY>
+
+<H2>Pd Documentation chapter 5. current status</H2>
+
+<P>
+<A href="index.htm#s5"> back to table of contents </A>
+<BR><BR>
+</P>
+
+<P>This section tracks changes in Pd's current implementation.</P>
+
+<H3> <A name="s2"> 5.1. release notes </A> </H3>
+
+<P> ------------------ 0.37 --------------------------
+
+<P> Pd is finally fixed so that it can open and close audio and MIDI devices
+on-the-fly (previously it opened them once at startup and hogged them until
+Pd quit). Starting DSP causes audio devices to be opened, and
+stopping it closes them.
+There are dialog panels in the "Media" menu (which used to be called
+"Audio") for choosing audio and MIDI settings. The "path" also can be changed
+on the fly via a dialog in the "File" menu.
+
+<P> A "vline" object acts like "line" but to sub-sample accuracy. See
+the audio example, C04.control.to.signal.pd (and/or chapter 3 of
+<A HREF="http://www.crca.ucsd.edu/~msp/techniques.htm"
+<I> Theory and Techniques of Electronic Music </I> ).
+
+<P> The block~/switch~ object now takes a "set" message to dynamically change
+block size, etc.
+
+<P> The makefilename object takes a "set" message to set the "pattern". You
+can use this to kludge multiple substitutions (as shown in the help file).
+
+<P> The writesf~ object got an update and a better help window. It now should
+be able to write 32bit floating-point WAV soundfiles. The file's sample rate
+is now set "correctly".
+
+<P> Various improvements were made in audio I/O to improve stability and
+reduce latency.
+
+<P> Jack support should work for Mac OSX (it appears as a separate API).
+Linux is offering experimental portaudio V19 support (but Mac and Window/ASIO
+are still based on PA V18.)
+
+<P> The fiddle~ object (in extra) has an "npoints" method to set the analysis
+window size dynamically.
+
+<P> (windows) Pd is now distributed as a self-extracting archive.
+
+<P> (windows) url files in the help directories are opened correctly.
+
+<P> (Mac) the arrow keys should now be fixed.
+
+<P> (linux) The "configure" script should be better at finding TK in various
+distributions (debian users previously had to use a special configure script.)
+
+<P> (developers) Pd now exits cleanly from its main loop instead of bailing
+out. A mutex protects Pd's data so it can be accessed from other threads.
+(Thomas Grill's improvements.)
+
+<P> (developers) The "savefunction" and "dialog" widget behaviors
+were replaced by a better mechanism (class_setsavefn() and
+class_setpropertiesfn()). THey're declared in m_pd.h so you don't have to
+include the (unstable) g_canvas.h to get them.
+
+<P> (developers) Better flag handling in the IEM GUIs (g_toggle.c, etc) should
+compile with fewer warnings and be more portable.
-<H4> <A name=s2> 5.1. release notes </A> </H4>
<P> ------------------ 0.37-test 1 --------------------------
<P> The MacOSX version now prioritizes itself effectively (thanks to
gert@test.at (v93r)) via Adam Lindsay). Adam has made a proper MacOSX
-"package" for Pd; see <A href=http://homepage.mac.com/atl/sw>
+"package" for Pd; see <A href="http://homepage.mac.com/atl/sw">
http://homepage.mac.com/atl/sw</A>.
<P> A bug was fixed in readsf~/writesf~ (things were coming out in the wrong
@@ -50,8 +111,6 @@ See the way "extras" is organized.
as an abstraction and reloads them. This unfortunately has the side effect of
making all the containing windows visible, but it's better than nothing.
-
-
<P> ------------------ 0.36-1 -------------------------------
<P> "print" now queries you for a file to save the postscript to.
@@ -106,7 +165,7 @@ be fixed.
<P> An experimental new feature called graph-on-parent allows subpatches and abstractions to show
GUI features; so, for instance, you can make an oscillator with a number box to
-control the frewuency. This is described in section 2.7.2 of the HTML
+control the frequency. This is described in section 2.7.2 of the HTML
documentation and an example is shown in 7.stuff/synth1/.
<P> Spaces are allowed in pathnames to Pd and to patches; however, the "path"
@@ -128,7 +187,7 @@ all conformed to the next-oldest one, and so on. You can alter the contents of
a "struct" and all the associated data will be modified to fit the new
structure definition. Data are persistent, i.e., saved with the containing
patch. You can copy and paste data between patches. If you save data to a file
-explicityly, you can read it into another patch and the data are conformed
+explicitly, you can read it into another patch and the data are conformed
automatically to the new data structures.
<P> A new version of Thomas Musil's GUI objects was merged in.
@@ -154,7 +213,7 @@ up the HTML documentation. This doesn't work in Windows or Mac land yet.
<P> In Linux, the "-32bit" flag was added, which you must now use if
running Guenter's OSS RME Hammerfall driver. (This was necessary because
-OSS went and used the same "bit" for a different purpose, so taht Pd tried
+OSS went and used the same "bit" for a different purpose, so that Pd tried
to open some other cards in 32bit mode inappropriately.)
<P> In Linux, MIDI is now opened "-NODELAY" ... this makes the OSS Creative
@@ -178,13 +237,13 @@ MMIO. If "resync" is on, whenever the audio input and output seem out
of whack the audio driver resynchronizes all input and output devices;
otherwise the situation is simply ignored. "Noresync" is probably best for
consumer stereo cards (and is the default if you're running only 2 channels in
-and out). If you're runnimg more than 2 channels in either direction, the
+and out). If you're running more than 2 channels in either direction, the
default is "resync".
<P> In soundfiler's read method, if you specify "-maxsize", that implies
"-resize" (as it ought to.)
-<P> You can use $1-stlye names for arays and tables.
+<P> You can use $1-style names for arrays and tables.
<P> Pd will now refuse to make duplicate connections between objects.
@@ -251,8 +310,8 @@ the Pd release so Thomas won't have to publish patches to Pd anymore. I
didn't take the graphical inlets and outlets for reasons explained elsewhere,
but Thomas might decide to continue supplying them on a patch basis.
-<P> Many new examples were added to the "2.control" amd expecially
-"3.audio" example patches. A list of differences batween Max/MSP and Pd
+<P> Many new examples were added to the "2.control" and especially
+"3.audio" example patches. A list of differences between Max/MSP and Pd
now appears at the end of this section.
<P> Finally, I fixed Pd to notice window iconification and suspend graphical
@@ -265,13 +324,13 @@ updates for iconified windows.
<P> I incorporated Krzysztof Czaja's menuclose bug fix in g_canvas.c.
-<P> (lunix) the configure script is more rational.
+<P> (Linux) the configure script is more rational.
<P> the qlist and pack objects were fixed to handle reentrancy correctly.
<P> Pd now complains about running out of memory (before it dies.) I intend
to provide advance warning and automatically back out of loading patches that
-woudl run out of memory, but that's not in place yet.
+would run out of memory, but that's not in place yet.
<P> Typing into a message box sometimes left you with lines from the output
pointing to the wrong location. Fixed.
@@ -297,19 +356,19 @@ port, 17-32 the second one, and so on. The midiin, sysexin, midiout objects
give you a separate inlet to specify which of the open MIDI port numbers
you want.
-<P> (linux only) By default, Pd now reads and write audio in "block mode."
+<P> (Linux only) By default, Pd now reads and write audio in "block mode."
Previously you have to specify "-frags" and/or "-fragsize" to get this.
As of this version you have to specify "-streammode" to get the opposite,
streaming mode. This mode seems only to work with a small number of sound
cards, notably Ensoniq ens1370 and ens1371.
-<P> (linux only) Also, "-fragsize" is replaced with a more convenient
+<P> (Linux only) Also, "-fragsize" is replaced with a more convenient
"-blocksize" which you specify in sample frames. It defaults to 64 which is
Pd's audio computation block size but may be larger or smaller. Typically you
would specify "-audiobuf" and "-blocksize" and Pd will compute "-frags" for
you; but you can also specify "-frags" explicitly.
-<P> (linux only) OSS and ALSA audio support are improved. You can now talk to
+<P> (Linux only) OSS and ALSA audio support are improved. You can now talk to
RME9652 using Guenter's OSS driver; this is different from the "-RME" support
which uses Winfried's older driver. Other multichannel OSS drivers might now
work as well. Pd also seems to work with ALSA 0.9 Beta 4; I've tested this
@@ -334,8 +393,8 @@ question of how a reduced-accuracy version should be named.
window. The phase vocoder example doesn't use framp~ and I had forgotten
what it did until Guenter dug it back up.
-<P> (linux only) I finally got around to incorporating Guenter's autoconf
-stuff, and learned about rpms. Major new linux releases will probably be
+<P> (Linux only) I finally got around to incorporating Guenter's autoconf
+stuff, and learned about RPM. Major new Linux releases will probably be
in .tar.gz and .rpm formats; "test" releases will probably just be in .tar.gz.
I also fixed it so that the installation prefix is overridden if you invoke
pd by its full pathname, so that you can still use compilations with
@@ -345,7 +404,7 @@ installation prefixes before you actually install them.
by Ross Bencina and Phil Burk. I couldn't discover any way this would ever
outperform the old "multimedia" API Pd uses. So the release contains the sources,
but you have to recompile Pd to use directX. Use "makefile.nt.portaudio". Only
-1 or 2 channels of audio are supported. THe interesting thing is that the same
+1 or 2 channels of audio are supported. The interesting thing is that the same
code will run on Macintosh. There are a couple of other obstacles to a
MacOS port of Pd though; it's hard to predict when this will be feasible.
@@ -391,7 +450,7 @@ if Pd is run "-verbose".
<BR> <BR>
<P> ------------------ 0.32 PATCH 2, 3, 4 -------------------
-<P> Hassled more with font size differnces between NT and Linux, and updated
+<P> Hassled more with font size differences between NT and Linux, and updated
many help files. Minor bug fixes here and there.
<P> the table object now takes a second argument to set size in points.
@@ -440,7 +499,7 @@ MIDI I/O. Otherwise, MIDI I/O jitter is limited by the audio buffer size.
<P> -noloadbang: cancels loadbangs.
-<P> -nogui: supress starting the GUI. You can then still talk to Pd using,
+<P> -nogui: suppress starting the GUI. You can then still talk to Pd using,
perhaps among other possibilities, the new network connection programs now
included in the release.
@@ -469,7 +528,7 @@ the soundfile name on the command line.
<P> <strong> in general: </strong>
<P> In Linux the treatment of MIDI input is now much more efficient. Also,
-bugs were fixed in notin and (for SGI) bendin.
+bugs were fixed in notein and (for SGI) bendin.
<P> You can "select all" from the Edit menu.
@@ -763,7 +822,7 @@ A "Font bomb" feature is provided for resizing fonts and stretching and
contracting patches to fit.
<P>
-Pds now bind themselves to the symbol pd-<window-name).
+Pds now bind themselves to the symbol pd-&lt;window-name).
<P>
IN Linux, if Pd is called as root it tries to promote its run-time
@@ -974,7 +1033,7 @@ notable new objects:
<P>
- an experimental facility for array of floats is included. You can make a new
array (from the "put" menu) which will be given a name such as "array1". You
-can then send it "read <file>", "write <file>", "resize <N>", and "print"
+can then send it "read &lt;file&gt;", "write &lt;file&gt;", "resize &lt;N&gt;", and "print"
messages. File reading and writing is in ascii. "resize" changes the size of
the array, and "print" prints its vital signs. You can then use "tabread4~"
to do a 4-point interpolating table lookup, and tabwrite~ to write audio
@@ -1191,7 +1250,7 @@ The following max-like objects are included:
send, receive.
<P> -----------------------------------------
-<H4> <A name=s2> 5.2. known bugs </A> </H4>
+<H3> <A name="s2"> 5.2. known bugs </A> </H3>
<P> In the list below, starred items are still things needing attention...
@@ -1239,7 +1298,7 @@ uses of block~ or switch~ objects that change block size frmo the default of
read/write delay lines or use send~/receive~, or throw~/catch~, between
windows with different block sizes.
-<H4> <A name=s3> 5.3. differences from Max/MSP </A> </H4>
+<H3> <A name="s3"> 5.3. differences from Max/MSP </A> </H3>
<P> It wasn't anyone's intention to make Pd a Max/MSP clone, but on the
other hand, if there's no reason for a feature to appear differently in
@@ -1259,7 +1318,7 @@ kind of personalized compatibility library.
<P> There are, however, differences in semantics you'll want to know about;
a partial list follows.
-<P> <bold> abstraction arguments. </bold>
+<P> <b> abstraction arguments. </b>
In Pd you can edit instantiations of abstractions and save the result back
to the file of the abstraction. This isn't possible in Max, because the
instantiations are different from the abstraction itself in that "#1", etc.,
diff --git a/pd/doc/2.control.examples/22.sequencing.pd b/pd/doc/2.control.examples/22.sequencing.pd
index efddcb21..1aa19942 100644
--- a/pd/doc/2.control.examples/22.sequencing.pd
+++ b/pd/doc/2.control.examples/22.sequencing.pd
@@ -1,20 +1,28 @@
-#N canvas 47 52 679 466 12;
+#N canvas 47 52 758 482 12;
#X text 465 442 updated for Pd version 0.26;
-#X text 35 28 You can use "qlist" or "textfile" objects for sequencing. Qlist is simpler to use than the (more versatile) textfile.;
-#X obj 355 146 r receive1;
+#X text 35 28 You can use "qlist" or "textfile" objects for sequencing.
+Qlist is simpler to use than the (more versatile) textfile.;
+#X obj 345 144 r receive1;
#X obj 441 146 r receive2;
-#X msg 205 88 clear \, add receive1 1 \, add 1000 receive1 0 \, add receive2 2 \, add 1000 receive2 0 \, add receive1 3 \, bang;
+#X msg 205 88 clear \, add receive1 1 \, add 1000 receive1 0 \, add
+receive2 2 \, add 1000 receive2 0 \, add receive1 3 \, bang;
#X obj 205 129 qlist;
-#X floatatom 355 172;
-#X floatatom 441 171;
-#X text 23 210 The "add" messages add lines to the qlist \, so that it contains:;
+#X floatatom 345 170 0 0 0 0 - - -;
+#X floatatom 441 171 0 0 0 0 - - -;
+#X text 48 202 The "add" messages add lines to the qlist \, so that
+it contains:;
#X text 155 238 receive1 1;
-#X text 121 259 1000 receive1 0;
+#X text 154 259 1000 receive1 0;
#X text 155 279 receive2 2;
-#X text 120 299 1000 receive2 0;
+#X text 153 299 1000 receive2 0;
#X text 155 317 receive1 3;
-#X text 17 342 and the "bang" instructs qlist to play the sequence by sending messages to "receive" objects. MEssages starting with numbers request that amount of delay.;
-#X text 16 391 If you have more than 5 lines or so wou will probably want to store them as a separate file and have qlist read it. You can also write files \, set tempo \, and single step... see the help patch for details.;
+#X text 16 391 If you have more than 5 lines or so wou will probably
+want to store them as a separate file and have qlist read it. You can
+also write files \, set tempo \, and single step... see the help patch
+for details.;
+#X text 22 341 and the "bang" instructs qlist to play the sequence
+by sending messages to "receive" objects. Messages starting with numbers
+request that amount of delay.;
#X connect 2 0 6 0;
#X connect 3 0 7 0;
#X connect 4 0 5 0;
diff --git a/pd/doc/3.audio.examples/00.INTRO.txt b/pd/doc/3.audio.examples/00.INTRO.txt
deleted file mode 100644
index 8792dc1e..00000000
--- a/pd/doc/3.audio.examples/00.INTRO.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-This is the second of three tutorial series on Pd. The first one shows how to
-use Pd to do "control" computations. This one shows the time-domain audio
-processing features.
-
-Here is an approximate table of contents...
-
-1. sinusoids
- oscillators
- amplitudes
- frequency and pitch
- FM
-
-2. wavetable synthesis and sampling
-
-3. synthetic waveforms, classic and modern
- pulses
- rectangles and sawtooth waves
- additive synthesis
-
-4. more sampling
-
-5. envelopes
- two flavors of ADSR envelope
- log/linear conversion
-
-6. control structures
- analog-style sequencing
- monophonic keyboard synthesizer
- sample and hold
- envelope following
-
-7. processing
- filters
- modulation
- delays
-
-8. formant synthesis
-
-9. strategies
- quartic curves in envelopes
- triggering notes from qlists
- order of execution and block size
-
diff --git a/pd/doc/3.audio.examples/01.PART1.sinewave.pd b/pd/doc/3.audio.examples/01.PART1.sinewave.pd
deleted file mode 100644
index 42b8aed0..00000000
--- a/pd/doc/3.audio.examples/01.PART1.sinewave.pd
+++ /dev/null
@@ -1,32 +0,0 @@
-#N canvas 6 2 588 513 12;
-#X obj 108 109 osc~ 440;
-#X obj 108 168 dac~;
-#X text 187 111 <-- 440 Hz. sine wave at full blast;
-#X obj 108 138 *~ 0.05;
-#X text 202 3 MAKING A SINE WAVE;
-#X text 32 195 Audio computation can be turned on and off by sending
-messages to the global "pd" object as follows:;
-#X msg 98 239 \; pd dsp 1;
-#X msg 202 239 \; pd dsp 0;
-#X text 113 276 ON;
-#X text 222 276 OFF;
-#X text 29 297 You should see the Pd window change to reflect whether
-audio is on or off. You can also turn audio on and off using the "audio"
-menu \, but the buttons are provided as a shortcut.;
-#X text 30 368 When DSP is on \, you should hear a tone whose pitch
-is A 440 and whose amplitude is 0.05. If instead you are greeted with
-silence \, you might want to read the HTML documentation on setting
-up audio.;
-#X text 28 434 In general when you start a work session with Pd \,
-you will want to choose "test audio and MIDI" from the help window
-\, which opens a more comprehensive test patch than this one.;
-#X text 296 247 <-- click these;
-#X text 187 139 <-- reduce amplitude to 0.05;
-#X text 160 168 <----- send to the audio output device;
-#X text 32 23 Audio computation in Pd is done using "tilde objects"
-such as the three below. They use continuous audio streams to intercommunicate
-\, as well as communicating with other ("control") Pd objects using
-messages.;
-#X text 342 490 updated for Pd version 0.36;
-#X connect 0 0 3 0;
-#X connect 3 0 1 0;
diff --git a/pd/doc/3.audio.examples/02.amplitude.pd b/pd/doc/3.audio.examples/02.amplitude.pd
deleted file mode 100644
index d24be18d..00000000
--- a/pd/doc/3.audio.examples/02.amplitude.pd
+++ /dev/null
@@ -1,37 +0,0 @@
-#N canvas 73 190 702 512 12;
-#X obj 64 65 osc~ 440;
-#X obj 64 283 dac~;
-#X text 145 66 <-- 440 Hz. sine wave at full blast;
-#X msg 431 7 \; pd dsp 1;
-#X msg 514 7 \; pd dsp 0;
-#X text 456 45 ON;
-#X text 534 43 OFF;
-#X text 164 18 CONTROLLING AMPLITUDE;
-#X text 35 327 Amplitudes of audio signals can have any reasonable
-range \, but when you output a signal via the dac~ object \, the samples
-should range between -1 and +1. Values out of that range will be "clipped."
-;
-#X obj 64 202 *~ 0;
-#X floatatom 107 165 0 0 0 0 - - -;
-#X obj 95 132 dbtorms;
-#X floatatom 95 100 0 0 80 0 - - -;
-#X text 141 100 <-- set amplitude here in dB;
-#X text 211 133 <-- this converts dB to linear units;
-#X text 210 164 <-- this shows the linear gain;
-#X text 116 204 <-- multiply the sine wave by the gain \, reducing
-its amplitude. You can also use the "*~" object to multiply two signals.
-The "0" argument here instructs it that we'll just send it messages
-to set the multiplier.;
-#X text 35 396 Here we calculate a gain for the multiplier (*~) using
-a "dbtorms" object (acronym for "dB to RMS"). 100 dB is normalized
-to one \, and zero dB artificially outputs a true 0;
-#X text 34 452 Pd assumes you have a two channel audio system unless
-you tell it otherwise.;
-#X text 440 486 updated for Pd version 0.33;
-#X text 114 282 <-- and out. We're sending to both channels now.;
-#X connect 0 0 9 0;
-#X connect 9 0 1 0;
-#X connect 9 0 1 1;
-#X connect 11 0 9 1;
-#X connect 11 0 10 0;
-#X connect 12 0 11 0;
diff --git a/pd/doc/3.audio.examples/03.line.pd b/pd/doc/3.audio.examples/03.line.pd
deleted file mode 100644
index 392df533..00000000
--- a/pd/doc/3.audio.examples/03.line.pd
+++ /dev/null
@@ -1,55 +0,0 @@
-#N canvas 369 106 647 598 12;
-#X obj 56 79 osc~ 440;
-#X obj 56 309 dac~;
-#X msg 446 79 \; pd dsp 1;
-#X msg 538 79 \; pd dsp 0;
-#X text 467 112 ON;
-#X text 555 112 OFF;
-#X obj 56 269 *~;
-#X obj 72 243 line~;
-#X text 129 243 <--- ramp generator;
-#X text 132 78 <-- sine wave;
-#X msg 72 103 0.1 2000;
-#X msg 72 177 0 2000;
-#X msg 72 125 0.1 50;
-#X msg 72 199 0 50;
-#X msg 72 147 0.1;
-#X msg 72 221 0;
-#X text 274 124 ON;
-#X text 154 105 <-- slow;
-#X text 144 126 <-- fast;
-#X text 111 146 <-- instantly;
-#X text 271 197 OFF;
-#X text 136 178 <-- slow;
-#X text 129 199 <-- fast;
-#X text 109 219 <-- instantly;
-#X text 112 161 ----------------------;
-#X text 97 308 <-- out;
-#X text 103 7 CONTROLLING AMPLITUDE USING LINE~;
-#X text 38 342 Line~'s left inlet is a target value \; it reaches that
-target in the time specified (in milliseconds) to its right inlet.
-;
-#X text 34 495 The line~ object (and its control brother \, line) treat
-their right inlet specially. The inlets don't retain values the way
-other inlets do but revert to zero whenever a target is received.;
-#X text 14 27 In this patch \, the multiplier is configured to multiply
-two signals. The amplitude is now a signal computed by the line~ object.
-;
-#X text 37 395 (In this example \, message boxes with two numbers each
-are connected to line~'s left inlet. Except in some special cases \,
-Pd objects with more than one inlet will automatically distribute lists
-of numbers across their inlets. In this case \, "0 50" becomes \, "50
-at right and 0 at left.");
-#X text 386 557 updated for Pd version 0.36;
-#X text 93 268 <-- multiply the sine wave by the ramp. There's no longer
-a "0" argument-- this tells Pd to expect a signal here.;
-#X connect 0 0 6 0;
-#X connect 6 0 1 0;
-#X connect 6 0 1 1;
-#X connect 7 0 6 1;
-#X connect 10 0 7 0;
-#X connect 11 0 7 0;
-#X connect 12 0 7 0;
-#X connect 13 0 7 0;
-#X connect 14 0 7 0;
-#X connect 15 0 7 0;
diff --git a/pd/doc/3.audio.examples/04.line2.pd b/pd/doc/3.audio.examples/04.line2.pd
deleted file mode 100644
index c6dd1679..00000000
--- a/pd/doc/3.audio.examples/04.line2.pd
+++ /dev/null
@@ -1,59 +0,0 @@
-#N canvas 30 68 949 754 12;
-#X obj 67 77 osc~ 440;
-#X obj 67 329 dac~;
-#X obj 67 242 *~;
-#X obj 86 180 line~;
-#X text 116 330 <-- out;
-#X text 124 9 LINES GRAPHED;
-#X text 24 33 Here again is a line~ controlling the amplitude of an
-osc~ \, but with the outputs graphed:;
-#X obj 149 89 r graphit;
-#X obj 151 179 r graphit;
-#X obj 151 246 r graphit;
-#X obj 86 149 r to-line;
-#X graph graph1 0 -1.02 44100 1.02 631 480 831 350;
-#X array product 44100 float 0;
-#X pop;
-#X graph graph1 0 -1.02 44100 1.02 631 150 831 20;
-#X array osc-output 44100 float 0;
-#X pop;
-#X graph graph1 0 -1.02 44100 1.02 631 315 831 185;
-#X array line-output 44100 float 0;
-#X pop;
-#X obj 149 119 tabwrite~ osc-output;
-#X obj 67 299 *~ 0.1;
-#X msg 38 401 \; pd dsp 1 \; to-line 0 \, 1 500 \; graphit bang;
-#X msg 210 401 \; pd dsp 1 \; to-line 1 \, 0 500 \; graphit bang;
-#X obj 151 209 tabwrite~ line-output;
-#X obj 151 276 tabwrite~ product;
-#X text 70 379 ramp up;
-#X text 235 378 ramp down;
-#X text 406 376 to 1/2;
-#X msg 375 400 \; pd dsp 1 \; to-line 0.5 1000 \; graphit bang;
-#X text 634 491 ------ 1 second ------;
-#X text 38 485 Click the message boxes above to try it. Note that in
-the first two boxes \, the line~ objects get two messages. The first
-one \, with no time value \, causes the line~ to jump immediately to
-the value. The third box takes line~'s previous value as a point of
-departure. What you see will depend on which box you last clicked and
-how long you waited between the two.;
-#X text 662 727 updated for Pd version 0.33;
-#X text 41 600 On most machines \, you will hear an interruption in
-the sound one second after you click on the first or third box. This
-is because the graphical updates are likely to eat more CPU time than
-your audio buffer has pre-buffered for. You can avoid this if you keep
-your graphs in sub-windows and open them only when you need them. In
-some future version of Pd this behavior will be improved. Until then
-\, you'll have to avoid having arrays getting re-drawn during music
-performances.;
-#X connect 0 0 2 0;
-#X connect 0 0 14 0;
-#X connect 2 0 15 0;
-#X connect 2 0 19 0;
-#X connect 3 0 2 1;
-#X connect 3 0 18 0;
-#X connect 7 0 14 0;
-#X connect 8 0 18 0;
-#X connect 9 0 19 0;
-#X connect 10 0 3 0;
-#X connect 15 0 1 0;
diff --git a/pd/doc/3.audio.examples/05.output.subpatch.pd b/pd/doc/3.audio.examples/05.output.subpatch.pd
deleted file mode 100644
index d24fdba2..00000000
--- a/pd/doc/3.audio.examples/05.output.subpatch.pd
+++ /dev/null
@@ -1,30 +0,0 @@
-#N canvas 300 159 635 486 12;
-#X text 261 20 CONTROLLING OUTPUT AMPLITUDE;
-#X obj 32 27 osc~ 440;
-#X obj 54 55 osc~ 550;
-#X obj 54 116 osc~ 660;
-#X obj 32 88 +~;
-#X obj 32 142 +~;
-#X text 108 177 <-- this is a subwindow--right click on it;
-#X text 149 197 and select "open" to see inside.;
-#X text 30 401 The output control automatically starts DSP whenever
-you touch the level control. Hitting "mute" toggles between the current
-level and zero.;
-#X obj 32 173 output~;
-#X text 383 463 updated for Pd version 0.36;
-#X text 143 115 <-- Here we make an A major triad as a test signal.
-;
-#X text 31 250 In this and subsequent patches \, we'll use a subwindow
-\, "output" \, to control overall amplitude. The amplitudes are in
-decibels \, with 100 being full blast. In this example \, you can't
-actually push the output amplitude past 90 or so without clipping.
-You'll know you're clipping if \, instead of an A major chord \, you
-hear a single \, distorted tone two octaves down. The clipping happens
-at Pd's last stage of audio output. Audio signals internal to Pd have
-essentially no level limit.;
-#X connect 1 0 4 0;
-#X connect 2 0 4 1;
-#X connect 3 0 5 1;
-#X connect 4 0 5 0;
-#X connect 5 0 9 0;
-#X connect 5 0 9 1;
diff --git a/pd/doc/3.audio.examples/06.frequency.pd b/pd/doc/3.audio.examples/06.frequency.pd
deleted file mode 100644
index 50cff7c0..00000000
--- a/pd/doc/3.audio.examples/06.frequency.pd
+++ /dev/null
@@ -1,60 +0,0 @@
-#N canvas 8 17 693 642 12;
-#N canvas 0 0 450 300 graph1 0;
-#X array osc-output 4410 float 0;
-#X coords 0 1.02 4410 -1.02 200 130 1;
-#X restore 473 167 graph;
-#X obj 98 261 tabwrite~ osc-output;
-#X msg 98 232 bang;
-#X floatatom 280 66 0 0 0 0 - - -;
-#X text 147 231 <-- click to graph;
-#X obj 15 206 r frequency;
-#X msg 280 37 set \$1;
-#X floatatom 6 66 0 0 0 0 - - -;
-#X obj 6 8 r frequency;
-#X msg 6 37 set \$1;
-#X obj 19 90 s frequency;
-#X obj 280 8 r pitch;
-#X obj 289 90 s pitch;
-#X obj 280 116 mtof;
-#X obj 280 145 s frequency;
-#X obj 6 145 s pitch;
-#X obj 6 116 ftom;
-#X text 105 66 <-- set frequency;
-#X text 372 65 <-- set MIDI pitch;
-#X text 15 429 Frequency and pitch are converted using the "ftom" and
-"mtof" objects. Frequency refers to the number of cycles per second.
-Pitch is "60" for Middle C \, 61 for C sharp \, 72 for the next C up
-\, and so on.;
-#X text 476 308 ---- 0.1 seconds ----;
-#X text 447 6 FREQUENCY AND PITCH;
-#X text 16 363 The osc~ object \, if you give it an argument \, expects
-floating-point messages to set its frequency. Without arguments \,
-its frequency is controlled by connecting an audio signal to its input.
-;
-#X text 14 496 Mtof and ftom work fine for microtones (non-integral
-"MIDI pitch" ) and don't have MIDI's range restriction-- for example
-\, MIDI -36 is about 1 Hz.;
-#X text 15 553 Note also the "set" messages going to the number boxes
-so that they can each update the other without bringing on an infinite
-loop. (get help on number boxes for details.);
-#X text 87 291 <-- output level;
-#X text 51 116 <-- convert frequency;
-#X text 106 134 to "MIDI" pitch;
-#X text 327 117 <-- convert "MIDI" pitch to frequency;
-#X obj 15 273 output~;
-#X text 437 619 updated for Pd version 0.36;
-#X obj 15 232 osc~;
-#X connect 2 0 1 0;
-#X connect 3 0 12 0;
-#X connect 3 0 13 0;
-#X connect 5 0 31 0;
-#X connect 6 0 3 0;
-#X connect 7 0 10 0;
-#X connect 7 0 16 0;
-#X connect 8 0 9 0;
-#X connect 9 0 7 0;
-#X connect 11 0 6 0;
-#X connect 13 0 14 0;
-#X connect 16 0 15 0;
-#X connect 31 0 1 0;
-#X connect 31 0 29 0;
diff --git a/pd/doc/3.audio.examples/07.frequency.mod.pd b/pd/doc/3.audio.examples/07.frequency.mod.pd
deleted file mode 100644
index a7bab032..00000000
--- a/pd/doc/3.audio.examples/07.frequency.mod.pd
+++ /dev/null
@@ -1,105 +0,0 @@
-#N canvas 52 144 760 640 12;
-#X obj 256 180 *~;
-#X floatatom 256 95 0 0 0;
-#X floatatom 166 130 0 0 0;
-#X obj 166 200 +~;
-#X graph graph1 0 -1.02 440 1.02 527 170 727 40;
-#X array fm-output 441 float 0;
-#X pop;
-#X floatatom 204 300 0 0 100;
-#N canvas 159 26 516 274 output 1;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 396 182 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 391 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 391 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 104 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 159 audio;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X restore 166 328 pd output;
-#X msg 242 301 MUTE;
-#X text 283 301 <-- output amplitude;
-#X msg 242 248 bang;
-#X text 284 248 <-- click to graph;
-#X obj 242 272 tabwrite~ fm-output;
-#X floatatom 278 150 0 0 0;
-#X text 163 87 carrier;
-#X text 162 105 frequency;
-#X text 241 71 frequency;
-#X text 242 54 modulation;
-#X text 33 8 FREQUENCY MODULATION ("FM") USING TWO OSCILLATORS;
-#X obj 166 252 osc~;
-#X text 50 234 "carrier";
-#X text 32 252 oscillator -->;
-#X text 40 161 add modulator;
-#X text 39 179 to carrier;
-#X text 37 198 frequency -->;
-#X text 317 162 index;
-#X text 319 143 modulation;
-#X text 477 601 updated for Pd version 0.34;
-#X obj 256 120 osc~;
-#X text 52 363 This shows the classical FM synthesis technique developed
-by John Chowning. It's nothing but an oscillator with vibrato controlled
-by another "modulation" oscillator. First \, to understand the patch
-\, set carrier frequency to 400 or so \, modulation frequency between
-5 and 10 \, and try modulation index values between 0 and 400 \, say.
-You'll hear a sine wave with vibrato.;
-#X text 531 172 --- 0.01 seconds ----;
-#X text 51 478 To get the FM sound \, set all three of carrier frequency
-\, modulation frequency \, and modulation index in the hundreds. Note
-that you get a timbral change as you sweep modulation index \, because
-this changes the amplitudes of the components of the output sound but
-not their frequencies.;
-#X text 48 564 The component frequencies are equal to the carrier frequency
-\, plus or minus multiples of the modulator frequency.;
-#X connect 0 0 3 1;
-#X connect 1 0 27 0;
-#X connect 2 0 3 0;
-#X connect 3 0 18 0;
-#X connect 5 0 6 1;
-#X connect 6 0 5 0;
-#X connect 7 0 6 2;
-#X connect 9 0 11 0;
-#X connect 12 0 0 1;
-#X connect 18 0 11 0;
-#X connect 18 0 6 0;
-#X connect 27 0 0 0;
diff --git a/pd/doc/3.audio.examples/09.review.pd b/pd/doc/3.audio.examples/09.review.pd
deleted file mode 100644
index 4e683e3c..00000000
--- a/pd/doc/3.audio.examples/09.review.pd
+++ /dev/null
@@ -1,43 +0,0 @@
-#N canvas 36 68 701 588 12;
-#X text 444 567 updated for Pd version 0.34;
-#X text 39 14 PART 1 REVIEW;
-#X obj 66 131 tabwrite~;
-#X obj 66 105 line~;
-#X obj 54 298 +;
-#X obj 66 79 +~;
-#X obj 66 209 cos~;
-#X obj 66 157 osc~;
-#X obj 66 183 phasor~;
-#X obj 54 324 pack;
-#X obj 52 536 r;
-#X obj 53 512 s;
-#X obj 54 433 inlet;
-#X obj 53 487 f;
-#X obj 53 461 t;
-#X obj 54 350 moses;
-#X obj 54 403 dbtorms;
-#X obj 97 376 mtof;
-#X obj 54 375 ftom;
-#X obj 105 433 outlet;
-#X obj 66 235 dac~;
-#X text 26 52 So far we've seen these audio ("tilde") objects:;
-#X text 123 104 -- ramp generator;
-#X text 157 131 -- sampler (which we've only used for graphing so far)
-;
-#X text 111 157 -- a cosine wave oscillator;
-#X text 139 183 -- phase generator for making your own oscillator;
-#X text 112 209 -- cosine waveshape lookup;
-#X text 112 236 -- audio output ("digital/analog converter" -- a misnomer)
-;
-#X text 31 266 ... and these "control" objects:;
-#X text 145 374 -- frequency to pitch conversion;
-#X text 126 403 -- decibel to amplitude conversion;
-#X text 167 434 -- input and output to a subpatch;
-#X text 90 462 ("trigger") -- message ordering and conversion;
-#X text 93 487 ("float") -- store a (floating point) number;
-#X text 90 513 ("send") -- wireless message sending;
-#X text 91 538 ("receive") ... and receiving;
-#X text 106 78 (etc.) -- arithmetic on audio signals;
-#X text 92 296 (etc.) -- arithmetic;
-#X text 99 323 -- combine two or more values in a single message;
-#X text 107 350 -- arithmetic "if";
diff --git a/pd/doc/3.audio.examples/10.PART2.wavetables.pd b/pd/doc/3.audio.examples/10.PART2.wavetables.pd
deleted file mode 100644
index 925988ad..00000000
--- a/pd/doc/3.audio.examples/10.PART2.wavetables.pd
+++ /dev/null
@@ -1,104 +0,0 @@
-#N canvas 19 22 722 608 12;
-#X floatatom 164 43 0 0 0;
-#X graph graph1 0 -1.02 258 1.02 445 177 703 47;
-#X array table10 259 float 1;
-#A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0.612 0.612 0.612 0.612 0.612 0.627692 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 -0.470769 -0.470769 -0.470769 -0.470769 -0.470769
--0.470769 -0.470769 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0.627692 0.627692 0.627692 0.643385 0.643385 0.643385
-0.659077 0 -0.502154 -0.502154 -0.502154 -0.486462 -0.486462 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0.580615 0.596308 0.596308 0.596308 0.596308
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
-#X pop;
-#X floatatom 202 171 0 0 100;
-#N canvas 159 26 532 285 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 426 180 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 105 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 159 audio;
-#X text 96 114 show level;
-#X obj 426 155 t b;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X restore 164 199 pd output;
-#X msg 240 172 MUTE;
-#X text 30 123 oscillator -->;
-#X text 456 587 updated for Pd version 0.34;
-#X text 33 8 WAVETABLE OSCILLATORS;
-#X text 36 106 wavetable;
-#X obj 164 70 mtof;
-#X floatatom 164 97 0 0 0;
-#X obj 164 123 tabosc4~ table10;
-#X text 94 42 pitch->;
-#X text 35 309 Note that I selected "save contents" in the properties
-dialog for table10 (right click on the table to see.) If this isn't
-set \, the waveform won't be remembered as part of the patch but will
-be reinitialized to zero when the patch is reopened.;
-#X msg 35 549 \; table10 cosinesum 256 0.2 -0.2 0.2 -0.2 0.2 -0.2 0.2
-;
-#X msg 578 240 \; table10 const 0;
-#X text 597 217 CLEAR TABLE;
-#X text 35 395 For efficiency's sake tabosc4~ requires that the table
-have a power of two plus three points (64+3=67 \, 128+3=131 \, 256+3=259
-\, etc.) If you want wraparound to work smoothly \, you should make
-the last three points copies of the first three. This is done because
-tabread4~ does 4-point interpolation.;
-#X text 38 494 If you want a specific sinusoidal composition \, you
-can send table10 a message \, as below (see 11.arrays in the control
-examples):;
-#X text 36 240 Here \, in place of the "osc~" cosine wave oscillator
-\, we introduce the tabosc4~ oscillator which produces an arbitrary
-waveform. You can draw in the waveform with the mouse.;
-#X connect 0 0 9 0;
-#X connect 2 0 3 1;
-#X connect 3 0 2 0;
-#X connect 4 0 3 2;
-#X connect 9 0 10 0;
-#X connect 10 0 11 0;
-#X connect 11 0 3 0;
diff --git a/pd/doc/3.audio.examples/11.wavetable.FM.pd b/pd/doc/3.audio.examples/11.wavetable.FM.pd
deleted file mode 100644
index c4cc6d60..00000000
--- a/pd/doc/3.audio.examples/11.wavetable.FM.pd
+++ /dev/null
@@ -1,147 +0,0 @@
-#N canvas 74 98 749 466 12;
-#X graph graph1 0 -1.02 258 1.02 475 298 733 168;
-#X array waveform11 259 float 1;
-#A 0 -0.0896033 0 0.0896033 0.178356 0.265425 0.350007 0.431348 0.508756
-0.58161 0.649372 0.711597 0.767935 0.818137 0.862053 0.89963 0.930912
-0.956028 0.975187 0.988669 0.996811 1 0.998655 0.993223 0.984158 0.971919
-0.956953 0.939691 0.920538 0.899867 0.878018 0.85529 0.831945 0.808204
-0.784252 0.760239 0.736284 0.712477 0.688888 0.665568 0.642553 0.619872
-0.59755 0.575607 0.554066 0.532953 0.512296 0.49213 0.472491 0.453419
-0.434957 0.417147 0.400027 0.383632 0.367992 0.353126 0.339046 0.32575
-0.313227 0.301453 0.290394 0.280002 0.270224 0.260995 0.252248 0.24391
-0.235908 0.22817 0.220628 0.213219 0.205888 0.198586 0.191278 0.183936
-0.176545 0.169098 0.1616 0.154063 0.146505 0.138954 0.131437 0.123987
-0.116636 0.109415 0.102354 0.0954784 0.0888083 0.08236 0.0761442 0.0701659
-0.0644253 0.0589178 0.0536354 0.0485669 0.0436994 0.0390194 0.0345135
-0.0301695 0.0259776 0.0219306 0.0180245 0.0142591 0.0106377 0.00716724
-0.00385775 0.000722025 -0.00222511 -0.0049675 -0.00748845 -0.00977153
--0.0118014 -0.0135644 -0.0150493 -0.0162479 -0.0171551 -0.0177693 -0.0180928
--0.0181312 -0.0178936 -0.017392 -0.0166417 -0.0156601 -0.0144666 -0.0130822
--0.0115294 -0.00983114 -0.0080113 -0.00609396 -0.0041034 -0.00206402
--2.23572e-07 0.00206358 0.00410297 0.00609353 0.00801089 0.00983075
-0.011529 0.0130819 0.0144663 0.0156599 0.0166416 0.0173919 0.0178935
-0.0181312 0.0180929 0.0177695 0.0171552 0.0162481 0.0150496 0.0135647
-0.0118018 0.009772 0.00748897 0.00496807 0.00222573 -0.000721367 -0.00385706
--0.00716651 -0.010637 -0.0142583 -0.0180237 -0.0219297 -0.0259767 -0.0301686
--0.0345125 -0.0390184 -0.0436984 -0.0485658 -0.0536343 -0.0589167 -0.0644241
--0.0701647 -0.0761429 -0.0823587 -0.0888069 -0.0954769 -0.102353 -0.109414
--0.116634 -0.123985 -0.131435 -0.138952 -0.146504 -0.154061 -0.161598
--0.169097 -0.176543 -0.183935 -0.191276 -0.198584 -0.205886 -0.213218
--0.220627 -0.228169 -0.235906 -0.243908 -0.252246 -0.260993 -0.270222
--0.28 -0.290392 -0.301451 -0.313224 -0.325747 -0.339043 -0.353123 -0.367989
--0.383629 -0.400023 -0.417143 -0.434954 -0.453415 -0.472486 -0.492125
--0.512292 -0.532948 -0.554062 -0.575602 -0.597545 -0.619868 -0.642548
--0.665563 -0.688883 -0.712472 -0.736279 -0.760234 -0.784247 -0.808199
--0.83194 -0.855285 -0.878013 -0.899863 -0.920533 -0.939687 -0.956949
--0.971916 -0.984156 -0.993221 -0.998655 -1 -0.996813 -0.988671 -0.975191
--0.956033 -0.930918 -0.899638 -0.862061 -0.818147 -0.767947 -0.71161
--0.649386 -0.581625 -0.508772 -0.431366 -0.350025 -0.265443 -0.178375
--0.0896226 -1.94061e-05 0.089584;
-#X pop;
-#X floatatom 202 171 0 0 100;
-#N canvas 159 26 532 285 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 426 180 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 155 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 105 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 132 audio;
-#X text 96 114 show level;
-#X obj 426 155 t b;
-#X obj 20 181 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 27 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X connect 27 0 21 0;
-#X restore 164 199 pd output;
-#X msg 240 172 MUTE;
-#X text 30 123 oscillator -->;
-#X text 485 445 updated for Pd version 0.34;
-#X text 33 8 WAVETABLE OSCILLATORS;
-#X text 36 106 wavetable;
-#X text 88 54 pitch->;
-#X graph graph2 0 0 258 1000 475 155 734 15;
-#X array pitch11 259 float 1;
-#A 0 757.143 757.143 735.714 700 671.429 650 621.429 600 571.429 550
-521.429 507.143 485.714 464.286 442.857 428.571 414.286 400 378.571
-364.286 342.857 328.571 928.571 921.429 921.429 914.286 907.143 892.857
-885.714 878.571 864.286 850 828.571 807.143 792.857 785.714 775 764.286
-753.571 742.857 735.714 728.571 721.429 714.286 703.571 692.857 682.143
-671.429 650 628.571 617.857 607.143 596.429 585.714 575 564.286 553.571
-542.857 532.143 521.429 510.714 500 485.714 478.571 464.286 450 435.714
-428.571 400 392.857 385.714 378.571 357.143 350 342.857 335.714 328.571
-314.286 292.857 285.714 271.429 264.286 571.429 571.429 571.429 571.429
-571.429 564.286 564.286 278.571 271.429 271.429 278.571 278.571 278.571
-278.571 571.429 571.429 571.429 575 578.571 578.571 278.571 278.571
-285.714 285.714 278.571 278.571 278.571 878.571 878.571 878.571 878.571
-878.571 321.429 325 328.571 328.571 328.571 328.571 885.714 885.714
-885.714 885.714 207.143 207.143 207.143 200 207.143 207.143 207.143
-214.286 214.286 221.429 228.571 228.571 242.857 250 257.143 264.286
-278.571 292.857 307.143 321.429 335.714 350 371.429 392.857 421.429
-435.714 471.429 500 542.857 571.429 628.571 664.286 700 728.571 757.143
-792.857 828.571 885.714 928.571 978.571 1000 1007.14 1007.14 1000 1000
-992.857 985.714 885.714 914.286 671.429 671.429 671.429 671.429 671.429
-671.429 671.429 671.429 671.429 671.429 678.571 635.714 635.714 678.571
-714.286 714.286 678.571 635.714 635.714 635.714 742.857 742.857 685.714
-685.714 635.714 621.429 685.714 792.857 792.857 678.571 521.429 521.429
-521.429 864.286 857.143 857.143 471.429 471.429 471.429 471.429 921.429
-921.429 385.714 385.714 385.714 964.286 964.286 964.286 328.571 328.571
-328.571 328.571 885.714 885.714 885.714 685.714 214.286 214.286 207.143
-207.143 921.429 921.429 921.429 921.429 207.143 207.143 200 200 957.143
-957.143 950 214.286 214.286 207.143 207.143 957.143 957.143 950 200
-207.143 207.143 942.857 942.857 942.857 950 950;
-#X pop;
-#X obj 164 87 tabosc4~ pitch11;
-#X obj 164 123 tabosc4~ waveform11;
-#X obj 164 55 sig~ 0.5;
-#X text 13 319 Here's a tabosc4~ controlling the frequency of another
-one. If you get properties on the two arrays \, you'll see that the
-top graph has a vertical scale from 0 to 1000 \; we're looping through
-that at a frequency of 0.5 Hz. and the output is used as the frequency
-input of the second tabosc4~. I've detected Klingons \, Captain Kirk...
-;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 10 0 11 0;
-#X connect 11 0 2 0;
-#X connect 12 0 10 0;
diff --git a/pd/doc/3.audio.examples/12.tabread4.pd b/pd/doc/3.audio.examples/12.tabread4.pd
deleted file mode 100644
index b045485c..00000000
--- a/pd/doc/3.audio.examples/12.tabread4.pd
+++ /dev/null
@@ -1,128 +0,0 @@
-#N canvas 55 137 820 651 12;
-#X graph graph1 0 -1.02 130 1.02 462 160 720 30;
-#X array waveform12 131 float 1;
-#A 0 -0.172615 -0.172615 -0.172615 -0.172615 -0.172615 -0.141231 -0.109846
--0.0941538 -0.0627692 -0.0470769 0.0156923 0.0784615 0.125538 0.188308
-0.235385 0.298154 0.360923 0.392308 0.470769 0.533538 0.596308 0.643385
-0.674769 0.721846 0.753231 0.784615 0.816 0.831692 0.847385 0.878769
-0.894462 0.910154 0.910154 0.910154 0.910154 0.910154 0.894462 0.894462
-0.894462 0.894462 0.878769 0.863077 0.816 0.800308 0.768923 0.737538
-0.706154 0.674769 0.643385 0.596308 0.564923 0.533538 0.470769 0.423692
-0.376615 0.313846 0.266769 0.204 0.172615 0.109846 0.0627692 0.0156923
-0 -0.0313846 -0.0627692 -0.0784615 -0.0941538 -0.109846 -0.141231 -0.156923
--0.172615 -0.204 -0.219692 -0.219692 -0.235385 -0.235385 -0.235385
--0.219692 -0.219692 -0.219692 -0.204 -0.156923 -0.125538 -0.0784615
-0 0.172615 0.313846 0.470769 0.564923 0.627692 0.690462 0.721846 0.737538
-0.753231 0.768923 0.768923 0.753231 0.737538 0.706154 0.674769 0.612
-0.580615 0.549231 0.517846 0.486462 0.423692 0.392308 0.360923 0.282462
-0.219692 0.109846 -0.0156923 -0.0941538 -0.109846 -0.141231 -0.156923
--0.172615 -0.188308 -0.204 -0.204 -0.219692 -0.204 -0.204 -0.219692
--0.219692 -0.204 -0.204 -0.204 -0.204 -0.204 -0.188308;
-#X pop;
-#X floatatom 194 299 0 0 100;
-#N canvas 159 26 532 285 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 426 180 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 155 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 105 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 132 audio;
-#X text 96 114 show level;
-#X obj 426 155 t b;
-#X obj 20 181 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 27 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X connect 27 0 21 0;
-#X restore 156 327 pd output;
-#X msg 232 300 MUTE;
-#X text 554 624 updated for Pd version 0.34;
-#X text 33 8 WAVETABLE OSCILLATORS;
-#X obj 156 95 phasor~;
-#X obj 156 184 tabread4~ waveform12;
-#X obj 156 157 +~ 1;
-#X floatatom 156 66 4 0 0;
-#X floatatom 250 59 4 0 1000;
-#X obj 250 111 pack 0 50;
-#X obj 250 137 line~;
-#X obj 156 131 *~;
-#X text 21 81 phase;
-#X text 20 96 generation -->;
-#X text 25 117 range;
-#X text 24 132 adjustment -->;
-#X text 250 38 squeeze;
-#X text 133 40 frequency;
-#X graph graph3 0 -1 440 1 481 330 781 190;
-#X array wave-out12 441 float 0;
-#X pop;
-#X obj 177 247 tabwrite~ wave-out12;
-#X msg 177 216 bang;
-#X text 223 217 <--click to graph;
-#X obj 250 84 + 128;
-#X text 25 360 The tabread4~ module is available for situations requiring
-more control than tabosc4~ offers. The relationship between the two
-is the same as between cos~ and osc~ \, although the units are different
-between cos~ and tabread4~. Cos~ assumes input is normalized from 0
-to 1 (and will wrap around as needed.) Tabread4~ takes values from
-1 to n-2 where n is the number of points in the table-- for a 259-point
-table such as we have here \, it's 1 to 129 (so the "good" segment
-is 128 samples long.);
-#X text 30 508 You would use tabread4~ (as opposed to tabosc4~) if
-you need direct control of the phase \, for instance if you to advance
-nonlinearly through the table. In the case shown here \, the "squeeze"
-factor makes the phase grow to a value at least \, and possibly much
-graeater than \, 129 (to which tabread4~ then limits it). So the resulting
-waveform is compressed in time.;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 6 0 13 0;
-#X connect 7 0 2 0;
-#X connect 7 0 21 0;
-#X connect 8 0 7 0;
-#X connect 9 0 6 0;
-#X connect 10 0 24 0;
-#X connect 11 0 12 0;
-#X connect 12 0 13 1;
-#X connect 13 0 8 0;
-#X connect 22 0 21 0;
-#X connect 24 0 11 0;
diff --git a/pd/doc/3.audio.examples/13.tabread4.interpolation.pd b/pd/doc/3.audio.examples/13.tabread4.interpolation.pd
deleted file mode 100644
index 18aef089..00000000
--- a/pd/doc/3.audio.examples/13.tabread4.interpolation.pd
+++ /dev/null
@@ -1,44 +0,0 @@
-#N canvas 137 102 781 520 12;
-#X graph graph1 0 -1.02 10 1.02 468 159 648 29;
-#X array waveform13 11 float 1;
-#A 0 1 1 1 1 1 1 1 -1 -1 -1 -1;
-#X pop;
-#X text 533 502 updated for Pd version 0.34;
-#X obj 156 157 +~ 1;
-#X text 21 81 phase;
-#X text 20 96 generation -->;
-#X text 25 117 range;
-#X text 24 132 adjustment -->;
-#X graph graph3 0 -1.02 440 1.02 469 362 769 222;
-#X array wave-out13 441 float 0;
-#X pop;
-#X msg 177 216 bang;
-#X text 223 217 <--click to graph;
-#N canvas 11 418 523 216 other-stuff 0;
-#X obj 41 49 loadbang;
-#X msg 39 81 \; waveform13 0 1 1 1 1 1 1 1 -1 -1 -1 -1 \; waveform13
-xlabel -1.2 0 1 2 3 4 5 6 7 8 9 10 \; pd dsp 1;
-#X connect 0 0 1 0;
-#X restore 626 426 pd other-stuff;
-#X obj 156 247 tabwrite~ wave-out13;
-#X obj 156 184 tabread4~ waveform13;
-#X obj 156 131 *~ 8;
-#X obj 156 95 phasor~ 220;
-#X text 36 22 4-POINT INTERPOLATION IN DETAIL;
-#X obj 216 316 sig~ 220;
-#X obj 216 346 tabosc4~ waveform13;
-#X text 35 293 (this would be;
-#X text 36 313 equivalent to the;
-#X text 110 333 above) -->;
-#X text 18 409 This patch demonstrates 4-point interpolation in tabread4~.
-The 11-point table \, waveform13 \, contains a transition from from
-1 to -1 \, which is "smoothed" as seen in wave-out13. There's no such
-transition at the wraparoind point--the interpolation always happens
-between 4 consccutive samples of the table \, disregarding wraparound.
-;
-#X connect 2 0 12 0;
-#X connect 8 0 11 0;
-#X connect 12 0 11 0;
-#X connect 13 0 2 0;
-#X connect 14 0 13 0;
-#X connect 16 0 17 0;
diff --git a/pd/doc/3.audio.examples/14.more.tabread.pd b/pd/doc/3.audio.examples/14.more.tabread.pd
deleted file mode 100644
index 22ff2846..00000000
--- a/pd/doc/3.audio.examples/14.more.tabread.pd
+++ /dev/null
@@ -1,106 +0,0 @@
-#N canvas 55 137 777 467 12;
-#X graph graph1 0 -1.02 130 1.02 462 160 720 30;
-#X array pitchmod14 131 float 1;
-#A 0 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385
-0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.863077
-0.863077 0.863077 0.863077 0.863077 0.863077 0.863077 0.863077 0.863077
-0.863077 0.863077 0.863077 0.863077 0.863077 0.863077 0.863077 0.863077
-0.863077 0.863077 0.863077 0.863077 0.863077 0.831692 0.847385 0.847385
-0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385
-0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385
-0.847385 0.863077 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385
--0.800308 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.768923 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.768923 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.800308 -0.800308
--0.800308 -0.800308 -0.800308 -0.800308 -0.800308;
-#X pop;
-#X floatatom 194 299 0 0 100;
-#N canvas 159 26 532 285 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 426 180 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 155 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 105 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 132 audio;
-#X text 96 114 show level;
-#X obj 426 155 t b;
-#X obj 20 181 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 27 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X connect 27 0 21 0;
-#X restore 156 327 pd output;
-#X msg 232 300 MUTE;
-#X text 521 439 updated for Pd version 0.34;
-#X floatatom 153 95 4 0 0;
-#X text 153 69 frequency;
-#X text 33 8 MORE ON FREQUENCY MODULATION;
-#X floatatom 195 206 4 0 0;
-#X text 155 50 modulation;
-#X obj 152 157 *~;
-#X text 255 150 modulation;
-#X text 253 169 depth;
-#X floatatom 201 157 4 0 0;
-#X obj 152 205 +~;
-#X text 250 212 frequency;
-#X obj 152 237 osc~;
-#X obj 153 122 tabosc4~ pitchmod14;
-#X text 254 194 carrier;
-#X text 44 379 This patch is like the original FM patch except in having
-a settable wavetable for the modulation oscillator. Try changing the
-waveform as well as the three familiar parameters.;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 5 0 17 0;
-#X connect 8 0 14 1;
-#X connect 10 0 14 0;
-#X connect 13 0 10 1;
-#X connect 14 0 16 0;
-#X connect 16 0 2 0;
-#X connect 17 0 10 0;
diff --git a/pd/doc/3.audio.examples/15.table.switching.pd b/pd/doc/3.audio.examples/15.table.switching.pd
deleted file mode 100644
index 558f91c4..00000000
--- a/pd/doc/3.audio.examples/15.table.switching.pd
+++ /dev/null
@@ -1,127 +0,0 @@
-#N canvas 55 137 835 504 12;
-#X graph graph1 0 -1.02 130 1.02 565 153 823 23;
-#X array waveshape15a 131 float 1;
-#A 0 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385
-0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.863077
-0.863077 0.863077 0.863077 0.863077 0.863077 0.863077 0.863077 0.863077
-0.863077 0.863077 0.863077 0.863077 0.863077 0.863077 0.863077 0.863077
-0.863077 0.863077 0.863077 0.863077 0.863077 0.831692 0.847385 0.847385
-0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385
-0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385
-0.847385 0.863077 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385
--0.800308 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.768923 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.768923 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.800308 -0.800308
--0.800308 -0.800308 -0.800308 -0.800308 -0.800308;
-#X pop;
-#X floatatom 194 299 0 0 100;
-#N canvas 159 26 532 285 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 426 180 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 155 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 105 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 132 audio;
-#X text 96 114 show level;
-#X obj 426 155 t b;
-#X obj 20 181 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 27 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X connect 27 0 21 0;
-#X restore 156 327 pd output;
-#X msg 232 300 MUTE;
-#X text 581 481 updated for Pd version 0.34;
-#X text 33 8 SWITCHING BETWEEN TABLES;
-#X graph graph1 0 -1.02 130 1.02 565 308 823 178;
-#X array waveshape15b 131 float 1;
-#A 0 -0.659077 -0.643385 -0.643385 -0.627692 -0.612 -0.612 -0.596308
--0.596308 -0.580615 -0.580615 -0.580615 -0.580615 -0.580615 -0.580615
--0.580615 -0.596308 -0.596308 -0.596308 -0.596308 -0.596308 -0.596308
--0.596308 -0.596308 -0.580615 -0.580615 -0.580615 -0.580615 -0.580615
--0.580615 -0.580615 -0.580615 -0.564923 -0.549231 -0.549231 -0.533538
--0.517846 -0.517846 -0.517846 -0.517846 -0.517846 -0.517846 -0.517846
--0.517846 -0.533538 -0.549231 -0.580615 -0.580615 0.847385 0.847385
-0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 0.863077
-0.847385 0.847385 0.847385 0.847385 0.847385 0.847385 -0.800308 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.768923 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.768923 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615 -0.784615
--0.784615 -0.784615 -0.784615 -0.800308 -0.800308 -0.800308 -0.800308
--0.800308 -0.800308 -0.800308;
-#X pop;
-#X obj 156 274 tabosc4~ waveshape15a;
-#X obj 156 186 sig~ 110;
-#X msg 181 215 set waveshape15a;
-#X msg 182 244 set waveshape15b;
-#X text 20 51 During a performance you're unlikely to want to draw
-or recalculate wavetables on the fly \, because you don't want to give
-Pd computationally intensive atomic tasks that could make Pd miss a
-DAC deadline. Instead \, use "set" mesages to switch tabosc~ or tabread4~
-between pre-prepared tables. Indeed \, you will eventually want to
-save screen space by throwing all your wavetables in a subpatch somewhere.
-;
-#X obj 161 401 table waveshape15c 131;
-#X text 41 362 There's also a "text object" hook so that you can have
-arrays with parametrizable names and sizes:;
-#X text 31 431 You would use this if you want to include one or more
-arrays in an abstraction. In this invocation you can't save the state
-of the array--instead \, juts read it in from a file or calculate it
-at startup.;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 7 0 2 0;
-#X connect 8 0 7 0;
-#X connect 9 0 7 0;
-#X connect 10 0 7 0;
diff --git a/pd/doc/3.audio.examples/16.table.spectrum.pd b/pd/doc/3.audio.examples/16.table.spectrum.pd
deleted file mode 100644
index 65ccccde..00000000
--- a/pd/doc/3.audio.examples/16.table.spectrum.pd
+++ /dev/null
@@ -1,143 +0,0 @@
-#N canvas 227 120 801 403 12;
-#X graph graph3 0 0 126 50 496 276 796 136;
-#X array spectrum-tab 127 float 1;
-#A 0 42.8571 42.5 43.2143 43.2143 43.2143 43.2143 43.2143 42.8571 42.8571
-42.8571 42.8571 42.8571 42.8571 42.5 42.5 42.5 42.5 42.5 42.5 42.5
-42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5
-42.5 42.5 42.1429 42.1429 41.7857 41.0714 40.3571 39.6429 39.2857 38.2143
-37.5 37.1429 36.0714 35.3571 33.9286 33.2143 32.8571 31.4286 31.0714
-30.3571 28.9286 28.2143 27.5 26.4286 25.7143 23.9286 23.2143 21.7857
-21.0714 20.7143 20 19.6429 19.6429 23.2143 28.2143 31.4286 33.5714
-36.4286 37.8571 38.9286 43.9286 45.7143 47.8571 47.8571 47.8571 47.8571
-47.5 47.1429 43.2143 40.3571 36.4286 33.9286 32.1429 29.2857 18.2143
-16.7857 16.7857 17.5 19.6429 22.1429 28.2143 33.9286 33.9286 33.9286
-33.5714 22.5 18.5714 16.7857 4.64286 4.64286 18.2143 17.1429 8.92857
-4.28571 11.4286 10 7.5 6.42857 5.71429 5.35714 5 4.64286 4.28571 3.92857
-3.92857 3.57143 3.57143 2.85714 2.5 2.14286 1.78571 0.714286 0.357143
-;
-#X pop;
-#X floatatom 57 351 0 0 0;
-#N canvas 159 26 526 286 output 0;
-#X obj 345 163 t b;
-#X obj 345 112 f;
-#X obj 345 61 inlet;
-#X text 351 30 mute;
-#X obj 345 189 f;
-#X msg 434 182 0;
-#X msg 345 87 bang;
-#X obj 345 138 moses 1;
-#X obj 405 119 moses 1;
-#X obj 85 151 dbtorms;
-#X obj 405 94 r master-lvl;
-#X obj 85 43 r master-lvl;
-#X obj 345 214 s master-lvl;
-#X obj 22 185 inlet~;
-#X obj 203 42 inlet;
-#X text 203 18 level;
-#X obj 203 102 s master-lvl;
-#X msg 98 67 set \$1;
-#X obj 98 91 outlet;
-#X msg 218 65 \; pd dsp 1;
-#X obj 85 198 line~;
-#X obj 22 216 *~;
-#X obj 22 246 dac~;
-#X obj 85 175 pack 0 50;
-#X text 20 162 audio;
-#X obj 434 155 t b;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 25 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 25 0 5 0;
-#X restore 19 376 pd output;
-#X msg 95 350 MUTE;
-#N canvas 98 16 694 474 oscbank 0;
-#X obj 36 53 spectrum-partial 1;
-#X obj 36 79 spectrum-partial 2;
-#X obj 36 105 spectrum-partial 3;
-#X obj 36 131 spectrum-partial 4;
-#X obj 36 157 spectrum-partial 5;
-#X obj 36 183 spectrum-partial 6;
-#X obj 36 209 spectrum-partial 7;
-#X obj 36 235 spectrum-partial 8;
-#X obj 36 261 spectrum-partial 9;
-#X obj 36 287 spectrum-partial 10;
-#X obj 216 53 spectrum-partial 11;
-#X obj 122 382 loadbang;
-#X obj 122 407 metro 30;
-#X obj 122 433 s poll-table;
-#X text 107 21 This is the bank of oscillators--open one to see:;
-#X text 72 345 And here we send bangs to "poll-table" needed by the
-abstraction.;
-#X obj 216 79 spectrum-partial 12;
-#X obj 216 105 spectrum-partial 13;
-#X obj 216 131 spectrum-partial 14;
-#X obj 216 157 spectrum-partial 15;
-#X obj 216 183 spectrum-partial 16;
-#X obj 216 209 spectrum-partial 17;
-#X obj 216 235 spectrum-partial 18;
-#X obj 215 261 spectrum-partial 19;
-#X obj 215 287 spectrum-partial 20;
-#X obj 395 53 spectrum-partial 21;
-#X obj 395 78 spectrum-partial 22;
-#X obj 395 104 spectrum-partial 23;
-#X obj 395 130 spectrum-partial 24;
-#X obj 395 156 spectrum-partial 25;
-#X obj 395 182 spectrum-partial 26;
-#X obj 395 207 spectrum-partial 27;
-#X obj 396 234 spectrum-partial 28;
-#X obj 395 260 spectrum-partial 29;
-#X obj 395 287 spectrum-partial 30;
-#X connect 11 0 12 0;
-#X connect 12 0 13 0;
-#X restore 17 251 pd oscbank;
-#X obj 19 321 catch~ sum-bus;
-#X obj 16 153 s pitch;
-#X floatatom 16 125 4 0 0;
-#X text 43 18 DRAWABLE SPECTRA;
-#X floatatom 14 183 4 0 0;
-#X obj 14 211 s whammybar;
-#N canvas 0 0 650 341 table-setup 0;
-#X obj 39 227 loadbang;
-#X msg 39 261 \; spectrum-tab xlabel -5 0 12 24 36 48 60 72 84 96 108
-120;
-#X text 82 60 comment;
-#X connect 0 0 1 0;
-#X restore 17 283 pd table-setup;
-#X msg 596 65 \; spectrum-tab const 0;
-#X text 555 381 Updated for Pd version 0.34;
-#X text 26 42 In this array \, you can draw a spectral envelope that
-will be synthesized by an oscillator bank. Each oscillator in the bank
-computes its own frequency and uses it to look up amplitude from the
-array.;
-#X text 113 254 <-- the oscillator bank;
-#X text 71 128 <-- pitch;
-#X text 61 185 <-- left or right shift (normally 0);
-#X text 157 318 <-- here we just collect the sum of all the partials
-which are computed in "oscbank".;
-#X text 662 44 CLEAR;
-#X text 148 283 <-- make the number labels;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 5 0 2 0;
-#X connect 7 0 6 0;
-#X connect 9 0 10 0;
diff --git a/pd/doc/3.audio.examples/17.foldover.pd b/pd/doc/3.audio.examples/17.foldover.pd
deleted file mode 100644
index 81757423..00000000
--- a/pd/doc/3.audio.examples/17.foldover.pd
+++ /dev/null
@@ -1,112 +0,0 @@
-#N canvas 17 89 590 637 12;
-#X graph graph1 0 -1.02 130 1.02 295 415 553 285;
-#X array table17 131 float 1;
-#A 0 -0.399997 0 0.399997 0.107489 0.0789648 0.218247 0.115563 0.169861
-0.178655 0.138352 0.235708 0.164533 0.125264 0.214359 0.169042 0.134156
-0.0997789 0.118172 0.270954 0.293566 0.289833 0.12888 -0.215992 -0.0145419
-0.203984 -0.159792 -0.11901 0.135321 -0.0665301 -0.0776689 0.0247374
--0.0222149 0.0755675 4.97363e-06 -0.049046 0.232851 0.2132 -0.0357245
--0.101696 -0.125624 -0.0530428 0.0608632 0.111596 0.0910138 -0.0326553
-0.100844 0.22303 -0.0649953 0.00678476 0.247437 -0.0319972 -0.064833
-0.141408 0.00354245 -0.0891558 -0.227284 -0.293046 0.100474 0.173878
--0.071401 0.0482414 0.0773852 -0.0590095 0.00509727 0.0421473 2.40106e-06
--0.0421444 -0.00510817 0.0590137 -0.0773699 -0.0482621 0.0714097 -0.173852
--0.100516 0.293024 0.227308 0.0891607 -0.0035225 -0.141411 0.0648073
-0.0320313 -0.247433 -0.00682219 0.0650219 -0.223015 -0.100872 0.0326609
--0.0910026 -0.1116 -0.0608712 0.0530287 0.125624 0.101698 0.035742
--0.213174 -0.232876 0.0490274 1.49209e-05 -0.0755759 0.0222125 -0.024735
-0.0776516 0.066554 -0.135321 0.118972 0.159827 -0.203967 0.0144949
-0.216008 -0.128842 -0.289832 -0.293563 -0.270967 -0.118185 -0.0997734
--0.134155 -0.169034 -0.214362 -0.125272 -0.164519 -0.235713 -0.138359
--0.178646 -0.169872 -0.115556 -0.218244 -0.0789868 -0.107456 -0.399993
--7.20319e-05 0.4;
-#X pop;
-#X floatatom 73 385 0 0 100;
-#N canvas 159 26 532 285 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 426 180 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 105 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 159 audio;
-#X text 96 114 show level;
-#X obj 426 155 t b;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X restore 35 413 pd output;
-#X msg 111 386 MUTE;
-#X text 343 617 updated for Pd version 0.34;
-#X msg 310 531 \; table17 const 0;
-#X text 362 513 CLEAR;
-#X obj 35 356 tabosc4~ table17;
-#X obj 35 329 line~;
-#X text 229 3 FOLDOVER;
-#X msg 28 532 \; table17 const 0 \, 0 1 1 1 1 1;
-#X msg 28 443 \; table17 sinesum 128 1 1 1 1 0 0 0 0 1 0 0 0 0 0 0
-1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 \, normalize
-0.4;
-#X msg 35 278 500 \, 1423 4000;
-#X text 26 26 WARNING: THIS IS REALLY OBNOXIOUS--TURN YOUR AMP DOWN!
-;
-#X floatatom 43 303 5 0 0;
-#X text 25 125 Foldover occurs when you synthesize frequencies greater
-than the Nyquist frequency (half the sample rate). In this example
-\, the fundamental only reaches 1423 \, but the tables contain high
-partials. As the partials sweep upward you hear them reflect off the
-Nyquist frequency. Also \, partials can come into contact with each
-other causing beating. The value of 1423 was chosen to make the beating
-effect especially strong \, but it's clearly audible even for a 440-Hz.
-sawtooth wave \, for example.;
-#X text 25 58 Use this patch sparingly... it's probably bad for your
-ears. Don't amuse yourself by playing this as part of your club act
-unless you want your country's health department to inquire.;
-#X text 16 572 Synthesis techniques vary in their tendency to make
-foldover. For higher pitched sounds you'll want to try out relatively
-folvover-resistant ones.;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 7 0 2 0;
-#X connect 8 0 7 0;
-#X connect 12 0 8 0;
-#X connect 14 0 8 0;
diff --git a/pd/doc/3.audio.examples/18.PART3.pulse.pd b/pd/doc/3.audio.examples/18.PART3.pulse.pd
deleted file mode 100644
index 8efe6390..00000000
--- a/pd/doc/3.audio.examples/18.PART3.pulse.pd
+++ /dev/null
@@ -1,126 +0,0 @@
-#N canvas 15 126 821 582 12;
-#X obj 285 163 line~;
-#X floatatom 66 64 0 0 0;
-#X obj 43 315 cos~;
-#X graph graph1 0 -1.02 882 1.02 599 472 799 342;
-#X array pulse-output 882 float 0;
-#X pop;
-#X floatatom 72 407 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 43 435 pd output;
-#X msg 111 405 MUTE;
-#X text 158 406 <-- output amplitude;
-#X obj 66 91 phasor~ 0;
-#X obj 285 139 pack 0 50;
-#X floatatom 285 54 0 0 0;
-#X text 63 43 frequency;
-#X obj 66 115 -~ 0.5;
-#X obj 66 207 *~;
-#X obj 285 78 / 10;
-#X obj 43 265 clip~ -0.5 0.5;
-#X obj 43 371 hip~ 5;
-#X graph graph1 0 -1.02 882 1.02 599 168 799 108;
-#X array phase-output 882 float 0;
-#X pop;
-#X graph graph1 0 -1.02 882 1.02 599 335 799 205;
-#X array clip-output 882 float 0;
-#X pop;
-#X text 280 34 bandwidth;
-#X text 130 114 phase -1/2 to 1/2;
-#X text 152 91 phase 0 to 1;
-#X text 132 5 PULSE GENERATOR;
-#X obj 32 234 tabwrite~ phase-output;
-#X obj 32 346 tabwrite~ pulse-output;
-#X text 116 372 high pass filter to cut DC;
-#X msg 32 147 bang;
-#X text 332 79 fix range;
-#X text 337 100 force;
-#X text 337 117 nonnegative;
-#X text 339 164 smooth it;
-#X text 327 187 add 1;
-#X text 78 148 <-- click to graph;
-#X text 96 209 increase amplitude;
-#X text 177 264 clip back to range -1/2 to 1/2;
-#X text 103 316 cosine wave lookup (-1/2 and 1/2 give -1);
-#X text 24 470 This patch computes a pulse train \, with a "bandwidth"
-control that essentually squeezes the pulses. If "bandwidth" is zero
-you get a pure cosine wave \, and for larger values of the bandwidth
-\, the cosine wave is squeezed to fill smaller portions of the waveform.
-;
-#X obj 285 188 +~ 1;
-#X obj 32 292 tabwrite~ clip-output;
-#X text 601 478 ---- 0.02 seconds ----;
-#X obj 285 102 max 0;
-#X text 544 551 updated for Pd version 0.34;
-#X connect 0 0 37 0;
-#X connect 1 0 8 0;
-#X connect 2 0 16 0;
-#X connect 2 0 24 0;
-#X connect 4 0 5 1;
-#X connect 5 0 4 0;
-#X connect 6 0 5 2;
-#X connect 8 0 12 0;
-#X connect 9 0 0 0;
-#X connect 10 0 14 0;
-#X connect 12 0 13 0;
-#X connect 13 0 15 0;
-#X connect 13 0 23 0;
-#X connect 14 0 40 0;
-#X connect 15 0 2 0;
-#X connect 15 0 38 0;
-#X connect 16 0 5 0;
-#X connect 26 0 23 0;
-#X connect 26 0 24 0;
-#X connect 26 0 38 0;
-#X connect 37 0 13 1;
-#X connect 40 0 9 0;
diff --git a/pd/doc/3.audio.examples/20.pulse.spectrum.pd b/pd/doc/3.audio.examples/20.pulse.spectrum.pd
deleted file mode 100644
index 49d21cbd..00000000
--- a/pd/doc/3.audio.examples/20.pulse.spectrum.pd
+++ /dev/null
@@ -1,136 +0,0 @@
-#N canvas 15 126 887 588 12;
-#X obj 189 166 line~;
-#X obj 42 187 cos~;
-#X graph graph1 0 -1.02 882 1.02 633 508 833 378;
-#X array pulse-output 882 float 0;
-#X pop;
-#X floatatom 71 317 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 42 345 pd output;
-#X msg 118 319 MUTE;
-#X obj 189 142 pack 0 50;
-#X floatatom 189 41 0 0 0;
-#X text 598 545 updated for Pd version 0.26;
-#X obj 43 114 -~ 0.5;
-#X obj 43 140 *~;
-#X obj 189 67 / 10;
-#X obj 189 91 moses 0;
-#X msg 189 115 0;
-#X obj 42 163 clip~ -0.5 0.5;
-#X obj 42 289 hip~ 5;
-#X graph graph1 0 0 128 500 503 285 759 155;
-#X array spectrum 128 float 0;
-#X pop;
-#X text 184 23 bandwidth;
-#X obj 115 267 tabwrite~ pulse-output;
-#X msg 105 229 bang;
-#X text 143 226 <-- click to graph;
-#X obj 189 191 +~ 1;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 53 267 pd fft;
-#X obj 43 90 phasor~ 172.266;
-#X obj 42 211 +~ 1;
-#X text 63 1 PULSE SPECTRUM MEASUREMENT;
-#X text 16 377 Here is a measured amplitude spectrum for the pulse
-train. Nutice that \, other than a smallish spillover \, the energy
-sits in one "lobe" whose changing width justifies our calling the squeeze
-factor the "bandwidth.";
-#X text 16 442 The spectrum is in units of amplitude. THe sidelobes
-\, although they look small \, are actually only about 34 dB down.
-You can design more complicated pulse trains \, little Blackman window
-functions \, which control the sidelobes much better.;
-#X text 17 518 The spectrum measurement is done in the "pd fft" subwindow
-\, but see the "FFT examples" for information about that.;
-#X text 501 291 0;
-#X text 749 288 5512;
-#X text 633 511 ---- 0.02 seconds ----;
-#X text 160 319 <-- output;
-#X connect 0 0 21 0;
-#X connect 1 0 24 0;
-#X connect 3 0 4 1;
-#X connect 4 0 3 0;
-#X connect 5 0 4 2;
-#X connect 6 0 0 0;
-#X connect 7 0 11 0;
-#X connect 9 0 10 0;
-#X connect 10 0 14 0;
-#X connect 11 0 12 0;
-#X connect 12 0 13 0;
-#X connect 12 1 6 0;
-#X connect 13 0 6 0;
-#X connect 14 0 1 0;
-#X connect 15 0 4 0;
-#X connect 19 0 18 0;
-#X connect 19 0 22 1;
-#X connect 21 0 10 1;
-#X connect 23 0 9 0;
-#X connect 24 0 22 0;
-#X connect 24 0 15 0;
-#X connect 24 0 18 0;
diff --git a/pd/doc/3.audio.examples/21.more.pulses.pd b/pd/doc/3.audio.examples/21.more.pulses.pd
deleted file mode 100644
index 1aa97555..00000000
--- a/pd/doc/3.audio.examples/21.more.pulses.pd
+++ /dev/null
@@ -1,138 +0,0 @@
-#N canvas 15 126 902 581 12;
-#X obj 220 171 line~;
-#X msg 350 15 \; pd dsp 1;
-#X msg 434 16 \; pd dsp 0;
-#X text 371 46 ON;
-#X text 451 47 OFF;
-#X floatatom 68 303 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 39 331 pd output;
-#X msg 106 303 MUTE;
-#X text 150 302 <-- output amplitude;
-#X obj 220 147 pack 0 50;
-#X floatatom 220 46 0 0 0;
-#X text 640 544 updated for Pd version 0.26;
-#X obj 70 108 *~;
-#X obj 220 72 / 10;
-#X obj 220 96 moses 0;
-#X msg 220 120 0;
-#X obj 39 275 hip~ 5;
-#X graph graph1 0 0 128 300 620 491 876 361;
-#X array spectrum 128 float 0;
-#X pop;
-#X text 215 28 bandwidth;
-#X msg 135 235 bang;
-#X text 177 234 <-- click to graph;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 68 237 pd fft;
-#X text 618 497 0;
-#X text 851 492 5512;
-#X obj 78 141 *~;
-#X obj 18 141 sig~ 1;
-#X obj 39 194 /~;
-#X obj 54 168 +~;
-#X obj 70 79 osc~ 86.1328;
-#X text 103 107 call this X;
-#X text 111 141 X^2;
-#X text 84 171 1+X^2;
-#X text 71 196 1/(1+X^2);
-#X text 10 357 This is the form of pulse train used in the Phase Aligned
-Formant (PAF) algorithm. It has the neat property that its amplitude
-spectrum drops off as a perfectly exponential function of frequency.
-This algorithm is protected by French and US patents. contact Vincent
-Puig to learn what restrictions may apply.;
-#X text 11 457 On the other hand \, there are rumors that exp(-X*X)
-actually sounds better than 1/(1+X*X). To compute exp(-X*X) efficiently
-you will want to employ tabread4~ with a stored bell curve. I don't
-want to know you're doing this. However \, the first Pd user who e-mails
-me the correct formula for the output spectrum wins a free CO2 fire
-extinguisher.;
-#X text 28 4 ANOTHER PULSE WIDTH MOD ALGORITHM;
-#X connect 0 0 12 1;
-#X connect 5 0 6 1;
-#X connect 6 0 5 0;
-#X connect 7 0 6 2;
-#X connect 9 0 0 0;
-#X connect 10 0 13 0;
-#X connect 12 0 24 0;
-#X connect 12 0 24 1;
-#X connect 13 0 14 0;
-#X connect 14 0 15 0;
-#X connect 14 1 9 0;
-#X connect 15 0 9 0;
-#X connect 16 0 6 0;
-#X connect 19 0 21 1;
-#X connect 24 0 27 1;
-#X connect 25 0 26 0;
-#X connect 25 0 27 0;
-#X connect 26 0 16 0;
-#X connect 26 0 21 0;
-#X connect 27 0 26 1;
-#X connect 28 0 12 0;
diff --git a/pd/doc/3.audio.examples/26.additive.pd b/pd/doc/3.audio.examples/26.additive.pd
deleted file mode 100644
index 9070b08b..00000000
--- a/pd/doc/3.audio.examples/26.additive.pd
+++ /dev/null
@@ -1,92 +0,0 @@
-#N canvas 59 99 696 468 12;
-#X floatatom 81 408 0 0 0;
-#N canvas 159 26 534 281 output 1;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X obj 425 153 t b;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X restore 43 435 pd output;
-#X msg 119 408 MUTE;
-#X text 153 407 <-- output amplitude;
-#X obj 43 377 catch~ sum;
-#X obj 381 288 s frequency;
-#X floatatom 381 264 0 0 0;
-#X floatatom 495 265 0 0 0;
-#X obj 495 289 s duration;
-#X msg 260 276 \; trigger bang;
-#X obj 45 221 partial 0.67 0.56 0 1;
-#X obj 45 245 partial 1 0.56 1 0.9;
-#X obj 45 269 partial 1 0.92 0 0.65;
-#X obj 45 294 partial 1.8 0.94 0 0.55;
-#X floatatom 495 217 0 0 0;
-#X obj 495 241 * 100;
-#X obj 381 240 mtof;
-#X floatatom 381 216 0 0 0;
-#X text 87 15 ADDITIVE SYNTHESIS;
-#X text 32 73 This patch demonstrates using an abstraction \, "partial"
-\, to make a simple additive synthesis instrument.;
-#X text 28 114 Partial takes as arguments an amplitude \, a relative
-frequency \, a detuning frequency \, and a relative duration. You set
-absolute duration and pitch using the controls below. Hit hte trigger
-to make sound.;
-#X text 460 435 updated for Pd version 0.26;
-#X text 535 207 duration in tenths;
-#X text 535 222 of a second;
-#X text 419 215 pitch;
-#X text 251 253 click to start;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 1 0;
-#X connect 6 0 5 0;
-#X connect 7 0 8 0;
-#X connect 14 0 15 0;
-#X connect 15 0 7 0;
-#X connect 16 0 6 0;
-#X connect 17 0 16 0;
diff --git a/pd/doc/3.audio.examples/27.PART4.samplers.pd b/pd/doc/3.audio.examples/27.PART4.samplers.pd
deleted file mode 100644
index e7aee0cd..00000000
--- a/pd/doc/3.audio.examples/27.PART4.samplers.pd
+++ /dev/null
@@ -1,111 +0,0 @@
-#N canvas 11 3 930 640 12;
-#X msg 306 14 \; pd dsp 1;
-#X msg 391 14 \; pd dsp 0;
-#X text 327 45 ON;
-#X text 408 45 OFF;
-#X floatatom 75 275 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 46 303 pd output;
-#X msg 114 273 MUTE;
-#X text 148 272 <-- output amplitude;
-#X obj 46 239 hip~ 5;
-#X text 102 240 high pass filter to cut DC;
-#X graph graph1 0 -1.02 44103 1.02 594 172 794 42;
-#X array sample-table 44104 float 0;
-#X pop;
-#X obj 46 207 tabread4~ sample-table;
-#X obj 46 172 line~;
-#X obj 46 123 * 441;
-#X floatatom 46 69 0 0 0;
-#X obj 46 147 pack 0 100;
-#X text 102 13 SCRATCH MACHINE;
-#X text 81 70 <-- read point in 100ths of a second;
-#X text 103 123 convert to SAMPLES (441 samples in 0.01 sec);
-#X obj 414 257 loadbang;
-#X text 248 195 read from the table;
-#X text 239 213 (the input is the index in samples);
-#X text 23 516 For more on reading and writing soundfiles to tables
-\, setting their lengths \, etc \, see "arrays" in the "control examples"
-series.;
-#X text 20 385 This patch introduces the "tabread4~" object \, which
-reads audio samples out of a floating-point array \, often called a
-"sample table." The input is the index of the sample to read \, counting
-from zero. The output is calculated using 4-point cubic interpolation
-\, which is adequate for most purposes. Because of the interpolation
-scheme \, tabread4~'s input cannot be less than one or greater than
-the table length minus two.;
-#X text 22 565 Fanatics take note: if you want really high-fidelity
-sampling \, use a high-quality resampling program to up-sample your
-soundfile to 88200 to drastically reduce interpolation error.;
-#X text 600 195 (one second plus three extra;
-#X text 602 214 for 4-point interpolation);
-#X text 407 330 message to read a soundfile into the table (automatically
-sent when you load this patch by the "loadbang" object.);
-#X text 93 172 convert smoothly to audio signal;
-#X text 93 84 (range is 0-100.) YOU ONLY HEAR OUTPUT;
-#X text 94 100 WHEN THIS IS 0-100 AND ACTIVELY CHANGING.;
-#X text 605 611 updated for Pd version 0.33;
-#X text 593 173 --- 44103 samples ---;
-#X msg 414 281 read ../sound/voice.wav sample-table;
-#X obj 414 306 soundfiler;
-#X connect 4 0 5 1;
-#X connect 5 0 4 0;
-#X connect 6 0 5 2;
-#X connect 8 0 5 0;
-#X connect 11 0 8 0;
-#X connect 12 0 11 0;
-#X connect 13 0 15 0;
-#X connect 14 0 13 0;
-#X connect 15 0 12 0;
-#X connect 19 0 33 0;
-#X connect 33 0 34 0;
diff --git a/pd/doc/3.audio.examples/28.sampler.loop.pd b/pd/doc/3.audio.examples/28.sampler.loop.pd
deleted file mode 100644
index 5d2687a6..00000000
--- a/pd/doc/3.audio.examples/28.sampler.loop.pd
+++ /dev/null
@@ -1,124 +0,0 @@
-#N canvas 143 17 993 674 12;
-#X graph graph1 0 -1.02 44100 1.02 630 370 830 240;
-#X array tabread4-out 44100 float 0;
-#X pop;
-#X msg 354 13 \; pd dsp 1;
-#X msg 437 13 \; pd dsp 0;
-#X text 379 51 ON;
-#X text 457 51 OFF;
-#X graph graph1 0 -1.02 44103 1.02 631 144 831 14;
-#X array sample-table 44103 float 0;
-#X pop;
-#X obj 564 556 loadbang;
-#X obj 92 318 tabwrite~ tabread4-out;
-#X floatatom 90 396 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 406 192 t b;
-#X obj 406 132 f;
-#X obj 406 72 inlet;
-#X text 413 35 mute;
-#X obj 406 222 f;
-#X msg 510 214 0;
-#X msg 406 102 bang;
-#X obj 406 162 moses 1;
-#X obj 510 184 t b f;
-#X obj 476 140 moses 1;
-#X obj 100 178 dbtorms;
-#X obj 476 110 r master-lvl;
-#X obj 100 50 r master-lvl;
-#X obj 406 252 s master-lvl;
-#X obj 26 217 inlet~;
-#X obj 239 49 inlet;
-#X text 239 22 level;
-#X obj 239 120 s master-lvl;
-#X msg 115 78 set \$1;
-#X obj 115 107 outlet;
-#X msg 257 77 \; pd dsp 1;
-#X obj 100 233 line~;
-#X obj 26 254 *~;
-#X obj 26 289 dac~;
-#X obj 100 205 pack 0 50;
-#X text 24 190 audio;
-#X text 112 132 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 55 430 pd output;
-#X msg 125 396 MUTE;
-#X text 166 395 <-- output amplitude;
-#X obj 55 361 hip~ 5;
-#X obj 55 248 tabread4~ sample-table;
-#X floatatom 55 60 0 0 0;
-#X text 254 251 read from the table;
-#X text 110 16 LOOPING SAMPLER;
-#X text 104 60 <-- frequency (Hz.);
-#X floatatom 83 121 0 0 0;
-#X obj 83 154 * 441;
-#X obj 55 181 *~ 0;
-#X obj 55 211 +~ 1;
-#X text 136 286 <-- click to display output;
-#X obj 55 92 phasor~ 0;
-#X msg 91 283 bang;
-#X text 130 120 <-- chunk size (100ths of a second);
-#X text 25 460 This is a looping sampler in which you specify the number
-of loops per second (the frequency) and the size of the chunk to loop.
-If the frequency is less than about 20 \, you will hear repetition
-and the chunk size will sound like transposition. For frequencies above
-50 or so \, you hear a tone whose timbre is controlled by the chunk
-size (best kept below 5 or so.) Remember to use the "shift" key on
-number boxes to make fine adjustments.;
-#X obj 558 426 adc~ 1;
-#X obj 558 455 hip~ 5;
-#X obj 558 515 tabwrite~ sample-table;
-#X msg 576 482 bang;
-#X text 614 483 <-- click here to record your own sample;
-#X text 674 561 v-- re-read the original sample;
-#X text 23 597 In this patch you will frequently hear discontinuities
-at the looping point. If you're working in a studio \, you can sometimes
-find "good" loop points for samples. Another approach \, better for
-live situations \, is shown in the next patch.;
-#X text 101 180 <-- readjust phase for range 0 - (chunk size);
-#X text 100 211 <-- add one to avoid beginning of table;
-#X msg 564 584 read ../sound/voice.wav sample-table;
-#X obj 564 609 soundfiler;
-#X text 748 653 updated for Pd version 0.33;
-#X text 629 153 ---- 44103 samples ----;
-#X text 641 376 ---- 1 second ------;
-#X connect 6 0 36 0;
-#X connect 8 0 9 1;
-#X connect 9 0 8 0;
-#X connect 10 0 9 2;
-#X connect 12 0 9 0;
-#X connect 13 0 12 0;
-#X connect 13 0 7 0;
-#X connect 14 0 23 0;
-#X connect 18 0 19 0;
-#X connect 19 0 20 1;
-#X connect 20 0 21 0;
-#X connect 21 0 13 0;
-#X connect 23 0 20 0;
-#X connect 24 0 7 0;
-#X connect 27 0 28 0;
-#X connect 28 0 29 0;
-#X connect 30 0 29 0;
-#X connect 36 0 37 0;
diff --git a/pd/doc/3.audio.examples/30.sampler.scratch.pd b/pd/doc/3.audio.examples/30.sampler.scratch.pd
deleted file mode 100644
index d4602050..00000000
--- a/pd/doc/3.audio.examples/30.sampler.scratch.pd
+++ /dev/null
@@ -1,175 +0,0 @@
-#N canvas 33 19 1046 749 12;
-#X msg 354 13 \; pd dsp 1;
-#X msg 437 13 \; pd dsp 0;
-#X text 379 51 ON;
-#X text 457 51 OFF;
-#X graph graph1 0 -1.02 44100 1.02 757 142 957 12;
-#X array sample-table 44103 float 0;
-#X pop;
-#X floatatom 71 466 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 406 192 t b;
-#X obj 406 132 f;
-#X obj 406 72 inlet;
-#X text 413 35 mute;
-#X obj 406 222 f;
-#X msg 510 214 0;
-#X msg 406 102 bang;
-#X obj 406 162 moses 1;
-#X obj 510 184 t b f;
-#X obj 476 140 moses 1;
-#X obj 100 178 dbtorms;
-#X obj 476 110 r master-lvl;
-#X obj 100 50 r master-lvl;
-#X obj 406 252 s master-lvl;
-#X obj 26 217 inlet~;
-#X obj 239 49 inlet;
-#X text 239 22 level;
-#X obj 239 120 s master-lvl;
-#X msg 115 78 set \$1;
-#X obj 115 107 outlet;
-#X msg 257 77 \; pd dsp 1;
-#X obj 100 233 line~;
-#X obj 26 254 *~;
-#X obj 26 289 dac~;
-#X obj 100 205 pack 0 50;
-#X text 24 190 audio;
-#X text 112 132 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 36 499 pd output;
-#X msg 106 466 MUTE;
-#X text 145 465 <-- output amplitude;
-#X obj 36 427 hip~ 5;
-#X obj 55 368 tabread4~ sample-table;
-#X floatatom 55 60 0 0 0;
-#X text 102 59 <-- frequency (Hz.);
-#X floatatom 109 152 0 0 0;
-#X obj 109 181 * 441;
-#X obj 55 152 *~ 0;
-#X obj 55 181 +~ 1;
-#X obj 55 89 phasor~ 0;
-#X msg 172 246 bang;
-#X text 156 151 <-- chunk size (100ths of a second);
-#X obj 598 451 adc~ 1;
-#X obj 598 480 hip~ 5;
-#X obj 598 540 tabwrite~ sample-table;
-#X msg 616 508 bang;
-#X text 654 507 <-- click here to record your own sample;
-#X text 64 17 ENVELOPING YOUR LOOPING SAMPLER;
-#X graph graph2 0 0 44100 44100 760 345 960 215;
-#X array table-index 44100 float 0;
-#X pop;
-#X obj 172 308 tabwrite~ table-index;
-#X obj 36 398 *~;
-#N canvas 160 476 591 415 envelope 0;
-#X obj 97 82 -~ 0.5;
-#X obj 100 331 clip~ -0.5 0.5;
-#X obj 100 305 *~ 1;
-#X obj 152 272 moses 1;
-#X msg 115 272 1;
-#X obj 100 361 cos~;
-#X obj 97 112 wrap~;
-#X obj 97 146 -~ 0.5;
-#X obj 100 419 *~ -0.5;
-#X obj 100 389 -~ 1;
-#X floatatom 152 234 0 0 0;
-#X text 162 78 subtracting 0.5 and wrapping produces a sawtooth wave
-180 degrees out of phase from the original.;
-#X text 156 139 as before we subtract 1/2 again to center the sawtooth
-from -1/2 to 1/2.;
-#X text 212 234 <-- sharpness (at least 1);
-#X obj 97 50 inlet~;
-#X obj 100 455 outlet~;
-#X obj 152 208 inlet;
-#X connect 0 0 6 0;
-#X connect 1 0 5 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 1 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 9 0;
-#X connect 6 0 7 0;
-#X connect 7 0 2 0;
-#X connect 8 0 15 0;
-#X connect 9 0 8 0;
-#X connect 10 0 3 0;
-#X connect 14 0 0 0;
-#X connect 16 0 10 0;
-#X restore 36 122 pd envelope;
-#X floatatom 146 124 0 0 0;
-#X text 187 123 <-- envelope sharpness;
-#X obj 74 304 line~;
-#X obj 74 246 * 441;
-#X floatatom 174 215 0 0 0;
-#X obj 74 275 pack 0 100;
-#X text 216 214 <-- read point in 100ths of a second;
-#X obj 55 338 +~;
-#X text 31 529 In this patch we can loop in any "window" of the input
-sample. The "read point" (0-100) gives the starting point of the window
-and "chunk" is its size (both in 100ths of a second.) Try \, for example
-\, frequency 4 \, sharpness 10 \, chunk size 25 \, and vary the read
-point from -25 to 100 \, listening to the result.;
-#X text 220 246 <-- graph table index;
-#X text 34 627 You should hear some doppler shift as you change the
-read point. To see why \, click on "graph table index" and quickly
-start changing the read point--- you should see entertaining pictures
-in "table-index". THe next patch shows how to prevent this if you wish
-to.;
-#X text 763 356 ----- 1 second ------;
-#X obj 602 583 loadbang;
-#X text 711 597 v-- re-read the original sample;
-#X msg 602 670 \; graph2 ylabel 48000 0 44100;
-#X msg 662 619 read ../sound/voice.wav sample-table;
-#X obj 662 643 soundfiler;
-#X text 766 719 updated for Pd version 0.33;
-#X text 755 151 ---- 44103 samples ---;
-#X connect 5 0 6 1;
-#X connect 6 0 5 0;
-#X connect 7 0 6 2;
-#X connect 9 0 6 0;
-#X connect 10 0 28 1;
-#X connect 11 0 17 0;
-#X connect 13 0 14 0;
-#X connect 14 0 15 1;
-#X connect 15 0 16 0;
-#X connect 16 0 37 0;
-#X connect 17 0 15 0;
-#X connect 17 0 29 0;
-#X connect 18 0 27 0;
-#X connect 20 0 21 0;
-#X connect 21 0 22 0;
-#X connect 23 0 22 0;
-#X connect 28 0 9 0;
-#X connect 29 0 28 0;
-#X connect 30 0 29 1;
-#X connect 32 0 37 1;
-#X connect 33 0 35 0;
-#X connect 34 0 33 0;
-#X connect 35 0 32 0;
-#X connect 37 0 27 0;
-#X connect 37 0 10 0;
-#X connect 42 0 44 0;
-#X connect 42 0 45 0;
-#X connect 45 0 46 0;
diff --git a/pd/doc/3.audio.examples/31.sampler.nodoppler.pd b/pd/doc/3.audio.examples/31.sampler.nodoppler.pd
deleted file mode 100644
index fca63bb9..00000000
--- a/pd/doc/3.audio.examples/31.sampler.nodoppler.pd
+++ /dev/null
@@ -1,180 +0,0 @@
-#N canvas 113 57 1004 644 12;
-#X msg 409 9 \; pd dsp 1;
-#X msg 495 10 \; pd dsp 0;
-#X text 430 40 ON;
-#X text 511 41 OFF;
-#X graph graph1 0 -1.02 44100 1.02 631 140 831 10;
-#X array sample-table 44103 float 0;
-#X pop;
-#X obj 586 483 loadbang;
-#X floatatom 60 462 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 31 490 pd output;
-#X msg 89 462 MUTE;
-#X text 124 455 <-- output amplitude;
-#X obj 31 430 hip~ 5;
-#X obj 47 381 tabread4~ sample-table;
-#X floatatom 46 50 0 0 0;
-#X text 85 49 <-- frequency (Hz.);
-#X floatatom 165 122 0 0 0;
-#X obj 164 145 * 441;
-#X obj 46 220 +~ 1;
-#X obj 46 74 phasor~ 0;
-#X msg 151 262 bang;
-#X text 204 121 <-- chunk size (100ths of a second);
-#X obj 580 379 adc~ 1;
-#X obj 580 403 hip~ 5;
-#X obj 580 453 tabwrite~ sample-table;
-#X msg 595 426 bang;
-#X text 627 425 <-- click here to record your own sample;
-#X text 695 497 v-- re-read the original sample;
-#X graph graph2 0 0 44100 44100 633 309 833 179;
-#X array table-index 44100 float 0;
-#X pop;
-#X obj 151 354 tabwrite~ table-index;
-#X obj 31 406 *~;
-#N canvas 160 476 591 415 envelope 0;
-#X obj 81 68 -~ 0.5;
-#X obj 83 276 clip~ -0.5 0.5;
-#X obj 83 254 *~ 1;
-#X obj 127 227 moses 1;
-#X msg 96 227 1;
-#X obj 83 301 cos~;
-#X obj 81 93 wrap~;
-#X obj 81 122 -~ 0.5;
-#X obj 83 349 *~ -0.5;
-#X obj 83 324 -~ 1;
-#X floatatom 127 195 0 0 0;
-#X text 135 65 subtracting 0.5 and wrapping produces a sawtooth wave
-180 degrees out of phase from the original.;
-#X text 130 116 as before we subtract 1/2 again to center the sawtooth
-from -1/2 to 1/2.;
-#X text 177 195 <-- sharpness (at least 1);
-#X obj 81 42 inlet~;
-#X obj 83 379 outlet~;
-#X obj 127 173 inlet;
-#X connect 0 0 6 0;
-#X connect 1 0 5 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 1 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 9 0;
-#X connect 6 0 7 0;
-#X connect 7 0 2 0;
-#X connect 8 0 15 0;
-#X connect 9 0 8 0;
-#X connect 10 0 3 0;
-#X connect 14 0 0 0;
-#X connect 16 0 10 0;
-#X restore 30 102 pd envelope;
-#X floatatom 149 84 0 0 0;
-#X text 183 83 <-- envelope sharpness;
-#X obj 65 308 line~;
-#X obj 65 260 * 441;
-#X floatatom 150 238 0 0 0;
-#X obj 65 284 pack 0 100;
-#X text 185 237 <-- read point in 100ths of a second;
-#X obj 47 356 +~;
-#X text 191 262 <-- graph table index;
-#X obj 65 332 samphold~;
-#X text 26 522 This example differs from the previous one in having
-samphold~ objects which allow the chunk size and especially the read
-point to change only at points where the phase wraps around. This removes
-signal discontinuities (when the chunk size changes) and doppler shift
-for changing read point.;
-#X obj 99 195 samphold~;
-#X obj 164 170 sig~;
-#X obj 47 196 *~;
-#X text 229 192 explicitly to use samphold~...;
-#X text 200 173 <-- you often have to convert to audio;
-#X text 643 315 ----- 1 second ------;
-#X text 631 144 ---- 44103 samples ---;
-#X msg 586 570 \; graph2 ylabel 48000 0 44100;
-#X text 739 621 updated for Pd version 0.33;
-#X msg 646 519 read ../sound/voice.wav sample-table;
-#X obj 646 543 soundfiler;
-#X text 21 8 SLIDING STABLE LOOPS WITHOUT DOPPLER SHIFT;
-#X connect 5 0 48 0;
-#X connect 5 0 50 0;
-#X connect 6 0 7 1;
-#X connect 7 0 6 0;
-#X connect 8 0 7 2;
-#X connect 10 0 7 0;
-#X connect 11 0 28 1;
-#X connect 12 0 17 0;
-#X connect 14 0 15 0;
-#X connect 15 0 42 0;
-#X connect 16 0 37 0;
-#X connect 17 0 29 0;
-#X connect 17 0 39 1;
-#X connect 17 0 41 1;
-#X connect 17 0 43 0;
-#X connect 18 0 27 0;
-#X connect 20 0 21 0;
-#X connect 21 0 22 0;
-#X connect 23 0 22 0;
-#X connect 28 0 10 0;
-#X connect 29 0 28 0;
-#X connect 30 0 29 1;
-#X connect 32 0 39 0;
-#X connect 33 0 35 0;
-#X connect 34 0 33 0;
-#X connect 35 0 32 0;
-#X connect 37 0 27 0;
-#X connect 37 0 11 0;
-#X connect 39 0 37 1;
-#X connect 41 0 43 1;
-#X connect 42 0 41 0;
-#X connect 43 0 16 0;
-#X connect 50 0 51 0;
diff --git a/pd/doc/3.audio.examples/32.sampler.transpose.pd b/pd/doc/3.audio.examples/32.sampler.transpose.pd
deleted file mode 100644
index 02d937f4..00000000
--- a/pd/doc/3.audio.examples/32.sampler.transpose.pd
+++ /dev/null
@@ -1,207 +0,0 @@
-#N canvas 50 103 992 682 12;
-#X graph graph1 0 -1.02 44100 1.02 599 426 799 296;
-#X array sample-table 44103 float 0;
-#X pop;
-#X obj 502 568 loadbang;
-#X floatatom 88 616 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 50 641 pd output;
-#X msg 126 614 MUTE;
-#X text 168 613 <-- output amplitude;
-#X obj 50 586 hip~ 5;
-#X obj 50 510 tabread4~ sample-table;
-#X floatatom 16 306 0 0 0;
-#X obj 16 331 * 441;
-#X obj 16 453 +~ 1;
-#X obj 35 249 phasor~ 0;
-#X text 57 303 <-- chunk size (100ths of a second);
-#X obj 497 460 adc~ 1;
-#X obj 497 485 hip~ 5;
-#X obj 497 534 tabwrite~ sample-table;
-#X msg 512 507 bang;
-#X text 544 506 <-- click here to record your own sample;
-#X text 595 575 v-- re-read the original sample;
-#X obj 50 561 *~;
-#X text 599 432 -------- 44103 samples ------;
-#N canvas 160 476 591 415 envelope 0;
-#X obj 81 68 -~ 0.5;
-#X obj 83 276 clip~ -0.5 0.5;
-#X obj 83 254 *~ 1;
-#X obj 127 227 moses 1;
-#X msg 96 227 1;
-#X obj 83 301 cos~;
-#X obj 81 93 wrap~;
-#X obj 81 122 -~ 0.5;
-#X obj 83 349 *~ -0.5;
-#X obj 83 324 -~ 1;
-#X floatatom 127 195 0 0 0;
-#X text 135 65 subtracting 0.5 and wrapping produces a sawtooth wave
-180 degrees out of phase from the original.;
-#X text 130 116 as before we subtract 1/2 again to center the sawtooth
-from -1/2 to 1/2.;
-#X text 177 195 <-- sharpness (at least 1);
-#X obj 81 42 inlet~;
-#X obj 83 379 outlet~;
-#X obj 127 173 inlet;
-#X connect 0 0 6 0;
-#X connect 1 0 5 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 1 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 9 0;
-#X connect 6 0 7 0;
-#X connect 7 0 2 0;
-#X connect 8 0 15 0;
-#X connect 9 0 8 0;
-#X connect 10 0 3 0;
-#X connect 14 0 0 0;
-#X connect 16 0 10 0;
-#X restore 88 560 pd envelope;
-#X floatatom 179 535 0 0 0;
-#X text 212 534 <-- envelope sharpness;
-#X obj 112 456 line~;
-#X obj 112 406 * 441;
-#X floatatom 112 381 0 0 0;
-#X obj 112 431 pack 0 100;
-#X text 158 383 <-- read point in 100ths of a second;
-#X obj 50 485 +~;
-#X obj 112 481 samphold~;
-#X obj 16 381 samphold~;
-#X obj 16 356 sig~;
-#X obj 16 428 *~;
-#X text 18 5 CALCULATING LOOP FREQUENCY AS FUNCTION OF TRANSPOSITION
-;
-#X obj 88 535 r~ phase;
-#X obj 35 274 s~ phase;
-#X obj 74 356 r~ phase;
-#X obj 32 403 r~ phase;
-#X obj 170 457 r~ phase;
-#X obj 157 351 s chunk-size;
-#X floatatom 22 50 0 0 0;
-#X text 66 49 <-- transposition (10ths of a halftone);
-#X obj 22 75 / 120;
-#X obj 36 149 pow;
-#X obj 22 100 t b f;
-#X msg 22 125 2;
-#X text 86 103 2 to the power (octaves);
-#X text 85 125 gives speed change for the;
-#X text 85 148 desired transposition;
-#X obj 157 326 * 0.01;
-#X text 270 339 chunk size;
-#X text 270 361 in seconds;
-#X obj 46 175 r chunk-size;
-#X obj 46 200 t b f;
-#X obj 35 224 /;
-#X text 105 201 divide speed change by chunk;
-#X text 103 222 size to get loop frequency;
-#X text 402 74 The transposition is frequency in Hz. divided by chunk
-size in seconds. This patch calculates the loop frequency as a function
-of desired transposition;
-#X text 77 75 transposition in octaves;
-#X text 404 124 Notice now that we get Doppler effects when the chunk
-size changes. You can suppress that if you don't want it \, by converting
-the chunk size to an audio signal \, sampling and holding it. But then
-there would be more work to deal with very low frequencies never triggering
-the sample and hold...;
-#X text 403 208 You might also want to have a way to retrigger the
-loop to sync it with some other process. By the time we had all this
-built the patch would be fairly involved. For now \, we'll move on
-to note-oriented samplers instead.;
-#X text 665 650 updated for Pd version 0.33;
-#X msg 502 595 read ../sound/voice.wav sample-table;
-#X obj 502 622 soundfiler;
-#X obj 21 28 loadbang;
-#X connect 1 0 63 0;
-#X connect 2 0 3 1;
-#X connect 3 0 2 0;
-#X connect 4 0 3 2;
-#X connect 6 0 3 0;
-#X connect 7 0 19 0;
-#X connect 8 0 9 0;
-#X connect 8 0 50 0;
-#X connect 9 0 32 0;
-#X connect 10 0 29 0;
-#X connect 11 0 36 0;
-#X connect 13 0 14 0;
-#X connect 14 0 15 0;
-#X connect 16 0 15 0;
-#X connect 19 0 6 0;
-#X connect 21 0 19 1;
-#X connect 22 0 21 1;
-#X connect 24 0 30 0;
-#X connect 25 0 27 0;
-#X connect 26 0 25 0;
-#X connect 27 0 24 0;
-#X connect 29 0 7 0;
-#X connect 30 0 29 1;
-#X connect 31 0 33 0;
-#X connect 32 0 31 0;
-#X connect 33 0 10 0;
-#X connect 35 0 21 0;
-#X connect 37 0 31 1;
-#X connect 38 0 33 1;
-#X connect 39 0 30 1;
-#X connect 41 0 43 0;
-#X connect 43 0 45 0;
-#X connect 44 0 55 0;
-#X connect 45 0 46 0;
-#X connect 45 1 44 1;
-#X connect 46 0 44 0;
-#X connect 50 0 40 0;
-#X connect 53 0 54 0;
-#X connect 54 0 55 0;
-#X connect 54 1 55 1;
-#X connect 55 0 11 0;
-#X connect 63 0 64 0;
-#X connect 65 0 41 0;
diff --git a/pd/doc/3.audio.examples/33.sampler.oneshot.pd b/pd/doc/3.audio.examples/33.sampler.oneshot.pd
deleted file mode 100644
index 75ce9153..00000000
--- a/pd/doc/3.audio.examples/33.sampler.oneshot.pd
+++ /dev/null
@@ -1,143 +0,0 @@
-#N canvas 34 0 994 773 12;
-#X msg 538 26 \; pd dsp 1;
-#X msg 622 26 \; pd dsp 0;
-#X text 563 64 ON;
-#X text 641 64 OFF;
-#X graph graph1 0 -1.02 176403 1.02 746 290 946 160;
-#X array sample-table 176403 float 0;
-#X pop;
-#X obj 583 520 loadbang;
-#X floatatom 72 407 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 406 192 t b;
-#X obj 406 132 f;
-#X obj 406 72 inlet;
-#X text 413 35 mute;
-#X obj 406 222 f;
-#X msg 510 214 0;
-#X msg 406 102 bang;
-#X obj 406 162 moses 1;
-#X obj 510 184 t b f;
-#X obj 476 140 moses 1;
-#X obj 100 178 dbtorms;
-#X obj 476 110 r master-lvl;
-#X obj 100 50 r master-lvl;
-#X obj 406 252 s master-lvl;
-#X obj 26 217 inlet~;
-#X obj 239 49 inlet;
-#X text 239 22 level;
-#X obj 239 120 s master-lvl;
-#X msg 115 78 set \$1;
-#X obj 115 107 outlet;
-#X msg 257 77 \; pd dsp 1;
-#X obj 100 233 line~;
-#X obj 26 254 *~;
-#X obj 26 289 dac~;
-#X obj 100 205 pack 0 50;
-#X text 24 190 audio;
-#X text 112 132 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 37 440 pd output;
-#X msg 107 407 MUTE;
-#X text 157 406 <-- output amplitude;
-#X obj 37 374 hip~ 5;
-#X obj 37 288 tabread4~ sample-table;
-#X obj 593 379 adc~ 1;
-#X obj 593 409 hip~ 5;
-#X obj 564 473 tabwrite~ sample-table;
-#X msg 564 340 bang;
-#X text 697 525 v-- re-read the original sample;
-#X text 18 15 ONE-SHOT SAMPLER USING LINE~ AS PHASE;
-#X obj 37 258 line~;
-#X obj 77 340 line~;
-#X obj 37 340 *~;
-#X obj 77 313 r cutoff;
-#X obj 37 228 r phase;
-#X msg 130 161 \; phase 1 \, 4.41e+08 1e+07 \; cutoff 1 5;
-#X msg 30 71 bang;
-#X obj 130 126 delay 5;
-#X text 83 71 <-- play the sample;
-#X msg 30 162 \; cutoff 0 5;
-#X text 40 119 cut the;
-#X text 40 138 sound off;
-#X text 210 111 Wait for the;
-#X text 208 131 cutoff to finish;
-#X text 355 155 set the upper line~ to start;
-#X text 355 174 at the first sample and go;
-#X text 354 195 forever (until the next trigger);
-#X text 24 479 In this example we're using a line~ object in place
-of the phaser~-based network that controls read location.;
-#X text 24 520 To start a note \, first we have to mute the output
-in case ther's already something playing---otherwise we'll get a click.
-The "cutoff" line~ then takes 5 msec to get to zero. After that amount
-of delay \, we reset the phase to sample number 1 and set it in motion.
-We want the line~ output to increase by 1 each sample of output \,
-so we ask for it to do 4.41e+08 samples in 1e+07 milliseconds.;
-#X text 24 636 The cutoff mechanism is still safe if we happen to ask
-for two notes in under 5 msec. The second request would reset the delay
-\, so that there's no way the delay can possibly fire without the cutoff
-line~ at zero.;
-#X text 602 339 <-- record;
-#X obj 628 439 line~;
-#X obj 593 444 *~;
-#X text 710 328 ------ 4 seconds ------;
-#X msg 551 418 1;
-#X obj 661 376 del 3990;
-#X msg 661 404 0 10;
-#X text 712 405 <--stop recording;
-#X text 25 706 We avoid clicking at the end of the table by getting
-the table's own contents to go smoothly to zero. To do this we added
-a level control to the recording patch that cuts off just before the
-recording reaches the end of the table.;
-#X text 595 641 this is.;
-#X text 596 615 My apologies to Jonathan Harvey whose bell;
-#X msg 583 550 read ../sound/bell.aiff sample-table;
-#X obj 583 579 soundfiler;
-#X text 725 751 updated for Pd version 0.33;
-#X connect 5 0 49 0;
-#X connect 6 0 7 1;
-#X connect 7 0 6 0;
-#X connect 8 0 7 2;
-#X connect 10 0 7 0;
-#X connect 11 0 20 0;
-#X connect 12 0 13 0;
-#X connect 13 0 40 0;
-#X connect 15 0 14 0;
-#X connect 15 0 43 0;
-#X connect 15 0 42 0;
-#X connect 18 0 11 0;
-#X connect 19 0 20 1;
-#X connect 20 0 10 0;
-#X connect 21 0 19 0;
-#X connect 22 0 18 0;
-#X connect 24 0 27 0;
-#X connect 24 0 25 0;
-#X connect 25 0 23 0;
-#X connect 39 0 40 1;
-#X connect 40 0 14 0;
-#X connect 42 0 39 0;
-#X connect 43 0 44 0;
-#X connect 44 0 39 0;
-#X connect 49 0 50 0;
diff --git a/pd/doc/3.audio.examples/34.sampler.notes.pd b/pd/doc/3.audio.examples/34.sampler.notes.pd
deleted file mode 100644
index 9b08a10a..00000000
--- a/pd/doc/3.audio.examples/34.sampler.notes.pd
+++ /dev/null
@@ -1,321 +0,0 @@
-#N canvas 12 0 1074 786 12;
-#X msg 862 17 \; pd dsp 1;
-#X msg 946 17 \; pd dsp 0;
-#X text 887 53 ON;
-#X text 965 53 OFF;
-#X floatatom 64 512 0 0 0;
-#N canvas 159 26 495 262 output 0;
-#X obj 406 192 t b;
-#X obj 406 132 f;
-#X obj 406 72 inlet;
-#X text 413 35 mute;
-#X obj 406 222 f;
-#X msg 510 214 0;
-#X msg 406 102 bang;
-#X obj 406 162 moses 1;
-#X obj 510 184 t b f;
-#X obj 476 140 moses 1;
-#X obj 100 178 dbtorms;
-#X obj 476 110 r master-lvl;
-#X obj 100 50 r master-lvl;
-#X obj 406 252 s master-lvl;
-#X obj 26 217 inlet~;
-#X obj 239 49 inlet;
-#X text 239 22 level;
-#X obj 239 120 s master-lvl;
-#X msg 115 78 set \$1;
-#X obj 115 107 outlet;
-#X msg 257 77 \; pd dsp 1;
-#X obj 100 233 line~;
-#X obj 26 254 *~;
-#X obj 26 289 dac~;
-#X obj 100 205 pack 0 50;
-#X text 24 190 audio;
-#X text 112 132 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 29 546 pd output;
-#X msg 98 512 MUTE;
-#X text 143 511 <-- output amplitude;
-#X msg 253 7 bang;
-#X obj 253 35 delay 5;
-#X text 493 269 end of note;
-#X obj 359 35 r note;
-#N canvas 459 46 678 451 samples 0;
-#X graph graph1 0 -1.02 176403 1.02 262 171 462 41;
-#X array sample1 176403 float 0;
-#X pop;
-#X text 264 376 ------ 4 seconds ------;
-#X graph graph1 0 -1.02 176403 1.02 262 356 462 226;
-#X array sample2 176403 float 0;
-#X pop;
-#X restore 29 277 pd samples;
-#N canvas 21 287 947 410 recorder 0;
-#X obj 318 43 inlet;
-#X obj 272 196 adc~ 1;
-#X obj 272 224 hip~ 5;
-#X obj 341 254 line~;
-#X obj 272 253 *~;
-#X msg 341 226 1;
-#X obj 400 191 del 3990;
-#X msg 377 226 0 10;
-#X obj 272 304 tabwrite~ sample1;
-#X obj 124 110 makefilename sample%1;
-#X msg 124 139 set \$1 \, bang;
-#X msg 446 162 stop;
-#X msg 400 162 bang;
-#X obj 557 182 loadbang;
-#X obj 660 137 openpanel;
-#X msg 660 109 bang;
-#X text 702 108 <-- browse for samples;
-#X text 628 233 v-- re-read original samples;
-#X obj 318 72 route record stop reload browse;
-#X obj 557 319 soundfiler;
-#X msg 557 261 read ../sound/bell.aiff sample1 \, read ../sound/voice2.wav
-sample2;
-#X msg 660 164 read \$1 sample1;
-#X obj 660 191 soundfiler;
-#X connect 0 0 18 0;
-#X connect 1 0 2 0;
-#X connect 2 0 4 0;
-#X connect 3 0 4 1;
-#X connect 4 0 8 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 7 0 3 0;
-#X connect 9 0 10 0;
-#X connect 10 0 8 0;
-#X connect 11 0 6 0;
-#X connect 12 0 6 0;
-#X connect 13 0 20 0;
-#X connect 14 0 21 0;
-#X connect 15 0 14 0;
-#X connect 18 0 9 0;
-#X connect 18 0 12 0;
-#X connect 18 0 5 0;
-#X connect 18 1 7 0;
-#X connect 18 1 11 0;
-#X connect 18 2 20 0;
-#X connect 18 3 15 0;
-#X connect 20 0 19 0;
-#X connect 21 0 22 0;
-#X restore 29 443 pd recorder;
-#X msg 29 305 record 1;
-#X msg 29 360 stop;
-#N canvas 700 402 671 621 playback 0;
-#X obj 37 79 line~;
-#X obj 56 271 line~;
-#X obj 37 302 *~;
-#X obj 56 242 r cutoff;
-#X obj 37 50 r phase;
-#X obj 37 626 outlet~;
-#X obj 37 598 hip~ 5;
-#X obj 49 113 r sample-number;
-#X obj 49 142 makefilename sample%d;
-#X msg 49 170 set \$1;
-#X obj 37 211 tabread4~ sample1;
-#X obj 55 338 r envelope;
-#X obj 55 396 dbtorms;
-#X obj 55 367 unpack;
-#X obj 55 425 sqrt;
-#X obj 55 454 sqrt;
-#X obj 55 482 line~;
-#X obj 37 569 *~;
-#X obj 55 511 *~;
-#X obj 55 540 *~;
-#X text 107 51 messages to the phase generating line~;
-#X text 188 114 setting the sample number.;
-#X text 238 143 compute the name;
-#X text 110 171 and send a "set" message to the tabread4~.;
-#X text 116 270 line~ for de-clicking;
-#X text 156 341 The envelope generator. Rather than sending our message
-straight to the line~ we unpack it in order to fool with the amplitude
-field.;
-#X text 126 397 convert amplitude to linear units.;
-#X text 121 426 take the fourth root. This because we want to raies
-the line~'s output to the 4th power afterward. This is an inexpensive
-way to give the rise and decay a more natural sounding evolution than
-just a straight line.;
-#X text 94 514 square the output twice to get the fourth power.;
-#X connect 0 0 10 0;
-#X connect 1 0 2 1;
-#X connect 2 0 17 0;
-#X connect 3 0 1 0;
-#X connect 4 0 0 0;
-#X connect 6 0 5 0;
-#X connect 7 0 8 0;
-#X connect 8 0 9 0;
-#X connect 9 0 10 0;
-#X connect 10 0 2 0;
-#X connect 11 0 13 0;
-#X connect 12 0 14 0;
-#X connect 13 0 12 0;
-#X connect 13 1 16 1;
-#X connect 14 0 15 0;
-#X connect 15 0 16 0;
-#X connect 16 0 18 0;
-#X connect 16 0 18 1;
-#X connect 17 0 6 0;
-#X connect 18 0 19 0;
-#X connect 18 0 19 1;
-#X connect 19 0 17 1;
-#X restore 29 480 pd playback;
-#X msg 29 332 record 2;
-#X text 641 25 ARGUMENTS FOR NOTES:;
-#X text 662 53 pitch in halftones;
-#X text 662 77 amplitude (dB);
-#X text 662 125 sample number;
-#X text 662 101 duration (msec);
-#X text 662 149 start location (msec);
-#X text 662 173 rise time (msec);
-#X text 662 197 decay time (msec);
-#X obj 359 62 unpack 0 0 0 0 0 0 0;
-#X text 46 6 CHOCOLATE SAMPLER;
-#X obj 517 168 f;
-#X obj 452 142 f;
-#X obj 383 142 f;
-#X obj 346 142 f;
-#X obj 314 142 f;
-#X obj 220 142 f;
-#X obj 220 169 mtof;
-#X obj 220 197 / 261.62;
-#X obj 220 224 * 4.41e+08;
-#X obj 220 252 +;
-#X obj 485 142 delay;
-#X obj 314 312 pack 0 0 0 0 0;
-#X obj 253 62 t b b b;
-#X text 494 346 This starts the note \, sending to "receives" in the
-playback subptach. The new receive "envelope" is an amplitude control
-in parallel with the cutoff control. The "sample-number" switches the
-tabread4~ between tables.;
-#X msg 152 44 \; pd dsp 1 \; cutoff 0 5;
-#X obj 383 197 + 1;
-#X msg 552 467 60 100 10000 1 0 0 0;
-#X obj 552 737 s note;
-#X msg 517 196 \; envelope 0 \$1;
-#X msg 671 691 62;
-#X msg 706 691 64;
-#X msg 637 691 60;
-#X msg 608 691 55;
-#X msg 739 691 72;
-#X msg 576 691 48;
-#X msg 638 734 60.5;
-#X msg 552 494 60 90 10000 1 0 0 0;
-#X msg 552 522 60 100 10000 2 0 0 0;
-#X msg 552 550 60 100 10000 1 3000 0 0;
-#X obj 383 169 * 44.1;
-#X msg 552 605 60 100 100 1 0 0 0;
-#X msg 552 632 60 100 100 1 0 0 1000;
-#X msg 552 577 60 100 10000 1 0 1000 0;
-#X msg 314 340 \; envelope 0 \, \$1 \$2 \; phase \$3 \, \$4 1e+07 \;
-sample-number \$5 \; cutoff 1 5 \;;
-#X text 108 315 <-- record;
-#X msg 29 388 reload;
-#X msg 29 415 browse;
-#X text 6 109 transposition works;
-#X text 6 133 by altering the phase;
-#X text 6 181 The mtof and / 261;
-#X text 6 205 calculate speed change;
-#X text 6 229 considering 60 as unity.;
-#X text 20 43 as before we;
-#X text 11 64 mute and wait;
-#X text 6 157 target ($4 below right.);
-#X text 446 303 combine amplitude \, rise time \, start phase \, end
-phase \, and sample number in one message;
-#X text 16 594 This patch take the same principle as the previous one
-\, but allows you to parametrize sample playback. Since we must wait
-5 msec before starting the playback \, we store all the parameters
-in "f" objects \, and recall them to construct the new note. Transposition
-is done by altering the amount to play back in the (artificial) ten
-thousand seconds (1e+07). The playback segment can be altered to start
-in the middle of the sample instead of the beginning \, and you can
-change the duration and rise and decay times.;
-#X text 744 468 straight playback;
-#X text 749 495 change amplitude;
-#X text 752 523 change sample number;
-#X text 755 550 change start location;
-#X text 754 576 change rise time;
-#X text 754 609 change duration;
-#X text 755 633 ... and decay time;
-#X text 688 736 microtones OK too.;
-#X text 576 667 If you omit values they stay unchanged;
-#X text 799 759 updated for Pd version 0.33;
-#X text 548 426 Here are buttons to demonstrate the effect of varying
-the parameters one by one.;
-#X connect 4 0 5 1;
-#X connect 5 0 4 0;
-#X connect 6 0 5 2;
-#X connect 8 0 9 0;
-#X connect 8 0 42 0;
-#X connect 9 0 40 0;
-#X connect 11 0 26 0;
-#X connect 14 0 13 0;
-#X connect 15 0 13 0;
-#X connect 16 0 5 0;
-#X connect 17 0 13 0;
-#X connect 26 0 33 1;
-#X connect 26 0 8 0;
-#X connect 26 1 32 1;
-#X connect 26 2 38 1;
-#X connect 26 3 31 1;
-#X connect 26 4 30 1;
-#X connect 26 5 29 1;
-#X connect 26 6 28 1;
-#X connect 28 0 46 0;
-#X connect 29 0 39 1;
-#X connect 30 0 57 0;
-#X connect 31 0 39 4;
-#X connect 32 0 39 0;
-#X connect 33 0 34 0;
-#X connect 34 0 35 0;
-#X connect 35 0 36 0;
-#X connect 36 0 37 0;
-#X connect 37 0 39 3;
-#X connect 38 0 28 0;
-#X connect 39 0 61 0;
-#X connect 40 0 32 0;
-#X connect 40 1 33 0;
-#X connect 40 2 29 0;
-#X connect 40 2 30 0;
-#X connect 40 2 31 0;
-#X connect 40 2 38 0;
-#X connect 43 0 39 2;
-#X connect 43 0 37 1;
-#X connect 44 0 45 0;
-#X connect 47 0 45 0;
-#X connect 48 0 45 0;
-#X connect 49 0 45 0;
-#X connect 50 0 45 0;
-#X connect 51 0 45 0;
-#X connect 52 0 45 0;
-#X connect 53 0 45 0;
-#X connect 54 0 45 0;
-#X connect 55 0 45 0;
-#X connect 56 0 45 0;
-#X connect 57 0 43 0;
-#X connect 58 0 45 0;
-#X connect 59 0 45 0;
-#X connect 60 0 45 0;
-#X connect 63 0 13 0;
-#X connect 64 0 13 0;
diff --git a/pd/doc/3.audio.examples/35.qlist.txt b/pd/doc/3.audio.examples/35.qlist.txt
deleted file mode 100644
index 0c412767..00000000
--- a/pd/doc/3.audio.examples/35.qlist.txt
+++ /dev/null
@@ -1,147 +0,0 @@
-note 60 90 50 2 50 30 30;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-15 note 60;
-100 note 59 90 100;
-comment measure 1;
-100 note 60 90 150 2 0;
- note 36 90 200 2 50;
-200 note 48 90 250 2 0;
- note 40 90 200 2 50;
- note 43 90 200 2 50;
-200 note 48 90 250 2 0;
- note 31 90 200 2 50;
-200 note 55 90 100;
- note 41 90 200;
- note 43 90 200;
-100 note 53 90 100;
-100 note 52 90 100;
- note 36 90 200;
-100 note 55 90 100;
-100 note 60 90 100;
- note 40 90 200;
- note 43 90 200;
-100 note 59 90 100;
-100 note 60 90 100;
- note 25 90 200;
-100 note 64 90 100;
-100 note 62 90 100;
- note 39 90 200;
- note 43 90 200;
-100 note 61 90 100;
-
-comment measure 2;
-100 note 62 90 150 2 0;
- note 26 90 200;
-200 note 50 90 250 2 50;
- note 41 90 200;
- note 42 90 200;
-200 note 50 90 250;
- note 29 90 200;
-200 note 50 90 100;
- note 30 90 200;
- note 44 90 200;
- note 48 90 200;
-100 note 48 90 100;
-100 note 47 90 100;
- note 31 90 200;
- note 43 90 200;
- note 47 90 200;
-100 note 50 90 100;
-100 note 55 90 100;
- note 34 90 200;
- note 42 90 200;
- note 46 90 200;
-100 note 54 90 100;
-100 note 55 90 200;
- note 35 90 200;
- note 42 90 200;
- note 45 90 200;
-200 note 57 90 100;
- note 41 90 200;
- note 47 90 200;
-100 note 59 90 100;
-comment measure 3;
-100 note 60 90 100;
- note 24 90 200;
- note 40 90 200;
- note 48 90 200 2 0;
-
-100 note 59 90 100 2 50;
-100 note 57 90 100;
-100 note 55 90 100;
-
-100 note 57 90 100;
- note 28 90 200;
- note 38 90 200;
- note 46 90 200;
-100 note 55 90 100;
-100 note 53 90 100;
-100 note 52 90 100;
-
-100 note 53 90 100;
- note 29 90 100;
- note 36 90 100;
- note 45 90 100;
-100 note 52 90 100;
-100 note 50 90 100;
- note 29 90 300;
- note 36 90 300;
- note 45 90 300;
-100 note 48 90 100;
-
-100 note 50 90 100;
-100 note 48 90 100;
-100 note 47 90 100;
- note 29 90 300;
- note 38 90 300;
- note 44 90 300 2 0;
-100 note 45 90 100 2 50;
-
-comment measure 4;
-100 note 43 90 100;
- note 31 90 200;
- note 38 90 200;
-100 note 48 90 100;
-100 note 47 90 100;
- note 31 90 300;
- note 40 90 300;
- note 43 90 300 2 0;
-100 note 50 90 100 2 50;
-
-100 note 48 90 100;
-100 note 52 90 100;
-100 note 50 90 100;
- note 31 90 300 2 0;
- note 41 90 300;
- note 43 90 300;
-100 note 53 90 100 2 50;
-
-100 note 52 90 200;
- note 31 90 300 2 50;
-200 note 48 90 200;
- note 19 90 200 2 50;
- note 29 90 200 2 50;
- note 36 90 200 2 50;
-
-200 note 48 90 100 2 50 0 4000;
- note 12 90 300;
- note 28 90 300;
- note 36 90 300;
-
-
-
diff --git a/pd/doc/3.audio.examples/35.sampler.poly.pd b/pd/doc/3.audio.examples/35.sampler.poly.pd
deleted file mode 100644
index e42b586d..00000000
--- a/pd/doc/3.audio.examples/35.sampler.poly.pd
+++ /dev/null
@@ -1,228 +0,0 @@
-#N canvas 66 253 1119 674 12;
-#X floatatom 582 562 0 0 0;
-#N canvas 159 26 495 262 output 0;
-#X obj 406 192 t b;
-#X obj 406 132 f;
-#X obj 406 72 inlet;
-#X text 413 35 mute;
-#X obj 406 222 f;
-#X msg 510 214 0;
-#X msg 406 102 bang;
-#X obj 406 162 moses 1;
-#X obj 510 184 t b f;
-#X obj 476 140 moses 1;
-#X obj 100 178 dbtorms;
-#X obj 476 110 r master-lvl;
-#X obj 100 50 r master-lvl;
-#X obj 406 252 s master-lvl;
-#X obj 26 217 inlet~;
-#X obj 239 49 inlet;
-#X text 239 22 level;
-#X obj 239 120 s master-lvl;
-#X msg 115 78 set \$1;
-#X obj 115 107 outlet;
-#X msg 257 77 \; pd dsp 1;
-#X obj 100 233 line~;
-#X obj 26 254 *~;
-#X obj 26 289 dac~;
-#X obj 100 205 pack 0 50;
-#X text 24 190 audio;
-#X text 112 132 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 547 595 pd output;
-#X msg 617 562 MUTE;
-#X text 660 561 <-- output amplitude;
-#N canvas 0 0 600 392 samples 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array sample1 176403 float 0;
-#X coords 0 1.02 176403 -1.02 200 130 1;
-#X restore 262 41 graph;
-#X text 282 385 ------ 4 seconds ------;
-#N canvas 0 0 450 300 graph1 0;
-#X array sample2 176403 float 0;
-#X coords 0 1.02 176403 -1.02 200 130 1;
-#X restore 262 226 graph;
-#X restore 931 97 pd samples;
-#N canvas 52 219 967 340 recorder 0;
-#X obj 220 21 inlet;
-#X obj 174 174 adc~ 1;
-#X obj 174 202 hip~ 5;
-#X obj 243 232 line~;
-#X obj 174 231 *~;
-#X msg 243 204 1;
-#X obj 302 169 del 3990;
-#X msg 279 204 0 10;
-#X obj 174 282 tabwrite~ sample1;
-#X obj 26 88 makefilename sample%1;
-#X msg 26 117 set \$1 \, bang;
-#X msg 348 140 stop;
-#X msg 302 140 bang;
-#X obj 220 50 route record stop reload browse;
-#X obj 411 158 loadbang;
-#X obj 514 113 openpanel;
-#X msg 514 85 bang;
-#X text 556 84 <-- browse for samples;
-#X text 482 209 v-- re-read original samples;
-#X obj 411 295 soundfiler;
-#X msg 411 237 read ../sound/bell.aiff sample1 \, read ../sound/voice2.wav
-sample2;
-#X msg 514 140 read \$1 sample1;
-#X obj 514 167 soundfiler;
-#X connect 0 0 13 0;
-#X connect 1 0 2 0;
-#X connect 2 0 4 0;
-#X connect 3 0 4 1;
-#X connect 4 0 8 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 7 0 3 0;
-#X connect 9 0 10 0;
-#X connect 10 0 8 0;
-#X connect 11 0 6 0;
-#X connect 12 0 6 0;
-#X connect 13 0 9 0;
-#X connect 13 0 12 0;
-#X connect 13 0 5 0;
-#X connect 13 1 7 0;
-#X connect 13 1 11 0;
-#X connect 13 2 20 0;
-#X connect 13 3 16 0;
-#X connect 14 0 20 0;
-#X connect 15 0 21 0;
-#X connect 16 0 15 0;
-#X connect 20 0 19 0;
-#X connect 21 0 22 0;
-#X restore 931 284 pd recorder;
-#X msg 931 146 record 1;
-#X msg 931 202 stop;
-#X msg 931 174 record 2;
-#X text 19 49 ARGUMENTS FOR NOTES:;
-#X text 19 71 pitch in halftones;
-#X text 19 95 amplitude (dB);
-#X text 19 143 sample number;
-#X text 19 119 duration (msec);
-#X text 19 167 start location (msec);
-#X text 19 191 rise time (msec);
-#X text 19 215 decay time (msec);
-#X msg 931 229 reload;
-#X msg 931 257 browse;
-#X text 47 10 POLYPHONIC SAMPLER;
-#X obj 547 522 sampvoice;
-#X obj 547 494 sampvoice;
-#X obj 547 467 sampvoice;
-#X obj 547 439 sampvoice;
-#X obj 547 412 sampvoice;
-#X obj 547 384 sampvoice;
-#X obj 547 356 sampvoice;
-#X obj 547 329 sampvoice;
-#X obj 631 17 r note;
-#X obj 631 44 unpack 0 0 0 0 0 0 0;
-#X obj 604 76 t b f;
-#X obj 544 109 f;
-#X obj 580 109 + 1;
-#X obj 552 146 mod 1e+06;
-#X obj 544 175 makenote 64;
-#X obj 544 203 poly 8 1;
-#X obj 544 230 stripnote;
-#X obj 617 272 pack 0 0 0 0 0 0 0 0;
-#X obj 617 300 route 1 2 3 4 5 6 7 8;
-#X text 929 124 record \, etc.;
-#X text 206 142 increment mod 1e+06 to make fake pitch;
-#X text 326 177 supply note-off message;
-#X text 336 207 allocate sampler voice;
-#X text 359 232 drop note off again;
-#X obj 736 516 qlist;
-#X obj 870 520 r comment;
-#X text 732 445 sailors to untie him...;
-#X text 735 395 Lashed to the mast of his boat \, Ulysses;
-#X text 735 420 hears beautiful singing. He begs his;
-#X text 19 271 Here we take the previous patch and make it polyphonic
-\, with 8 voices. The single voice which we had before has been made
-into an abstraction \, "sampvoice.pd" \, which we instantiate in 8
-copies. Earlier we used sends and receives to pass messages to "cutoff"
-\, etc \, but here if we did that the copies of sampvoice would be
-sending messages to each other \, so we combine the control and the
-audio computation in the sampvoice abstraction without using send and
-receive. Click on one to see how.;
-#X text 20 421 The "poly" object essentially repeats pitch and velocity
-pairs to its output \, but also sending a voice number from its left
-outlet. To use it \, we unpack the 7 parameters \, calculate the voice
-number \, repack the message as 8 parameters with voice number first
-\, and use "route" to send it to one of the 8 voices.;
-#X text 20 523 There's some bother because poly expects to track note
-on and note off messages separately as they would come from a MIDI
-keyboard. So we assign each note a unique fake "pitch" \, use makenote
-to generate the note-off messages \, and run poly on the resulting
-stream. We then discard both pitch and velocity (using the velocity
-only to strip note-offs) and rebuild the original message adding the
-voice number we just scored.;
-#X text 854 639 updated for Pd version 0.33;
-#X msg 736 486 read 35.qlist.txt \, rewind \, tempo 1 \, bang;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 6 0 5 0;
-#X connect 7 0 5 0;
-#X connect 8 0 5 0;
-#X connect 17 0 5 0;
-#X connect 18 0 5 0;
-#X connect 20 0 1 0;
-#X connect 21 0 20 0;
-#X connect 22 0 21 0;
-#X connect 23 0 22 0;
-#X connect 24 0 23 0;
-#X connect 25 0 24 0;
-#X connect 26 0 25 0;
-#X connect 27 0 26 0;
-#X connect 28 0 29 0;
-#X connect 29 0 30 0;
-#X connect 29 1 37 2;
-#X connect 29 2 34 2;
-#X connect 29 2 37 3;
-#X connect 29 3 37 4;
-#X connect 29 4 37 5;
-#X connect 29 5 37 6;
-#X connect 29 6 37 7;
-#X connect 30 0 31 0;
-#X connect 30 1 37 1;
-#X connect 31 0 32 0;
-#X connect 31 0 34 0;
-#X connect 32 0 33 0;
-#X connect 33 0 31 1;
-#X connect 34 0 35 0;
-#X connect 34 1 35 1;
-#X connect 35 0 36 0;
-#X connect 35 2 36 1;
-#X connect 36 0 37 0;
-#X connect 37 0 38 0;
-#X connect 38 0 27 1;
-#X connect 38 1 26 1;
-#X connect 38 2 25 1;
-#X connect 38 3 24 1;
-#X connect 38 4 23 1;
-#X connect 38 5 22 1;
-#X connect 38 6 21 1;
-#X connect 38 7 20 1;
-#X connect 53 0 44 0;
diff --git a/pd/doc/3.audio.examples/36.PART5.envelopes.pd b/pd/doc/3.audio.examples/36.PART5.envelopes.pd
deleted file mode 100644
index 61e7a6d7..00000000
--- a/pd/doc/3.audio.examples/36.PART5.envelopes.pd
+++ /dev/null
@@ -1,90 +0,0 @@
-#N canvas 173 105 609 433 12;
-#X floatatom 96 358 0 0 100;
-#N canvas 448 68 641 420 output 0;
-#X obj 430 203 t b;
-#X obj 430 143 f;
-#X obj 430 83 inlet;
-#X obj 430 233 f;
-#X msg 541 225 0;
-#X msg 430 113 bang;
-#X obj 430 173 moses 1;
-#X obj 496 151 moses 1;
-#X obj 107 174 dbtorms;
-#X obj 496 121 r master-lvl;
-#X obj 107 56 r master-lvl;
-#X obj 430 263 s master-lvl;
-#X obj 36 202 inlet~;
-#X obj 251 229 inlet;
-#X obj 269 257 s master-lvl;
-#X msg 119 85 set \$1;
-#X obj 119 115 outlet;
-#X msg 251 283 \; pd dsp 1;
-#X obj 107 236 line~;
-#X obj 36 258 *~;
-#X obj 36 290 dac~;
-#X obj 107 204 pack 0 50;
-#X text 23 179 audio in;
-#X text 2 313 out both channels;
-#X obj 36 231 hip~ 1;
-#X obj 541 194 t b;
-#X connect 0 0 3 0;
-#X connect 1 0 6 0;
-#X connect 2 0 5 0;
-#X connect 3 0 11 0;
-#X connect 4 0 11 0;
-#X connect 5 0 1 0;
-#X connect 6 0 0 0;
-#X connect 6 1 25 0;
-#X connect 7 1 3 1;
-#X connect 8 0 21 0;
-#X connect 9 0 1 1;
-#X connect 9 0 7 0;
-#X connect 10 0 8 0;
-#X connect 10 0 15 0;
-#X connect 12 0 24 0;
-#X connect 13 0 14 0;
-#X connect 13 0 17 0;
-#X connect 15 0 16 0;
-#X connect 18 0 19 1;
-#X connect 19 0 20 0;
-#X connect 19 0 20 1;
-#X connect 21 0 18 0;
-#X connect 24 0 19 0;
-#X connect 25 0 4 0;
-#X restore 58 391 pd output;
-#X msg 134 359 MUTE;
-#X msg 247 180 bang;
-#X msg 328 180 bang;
-#X text 244 152 attack;
-#X text 325 150 release;
-#X obj 247 281 line~;
-#X msg 328 254 0 500;
-#X text 134 10 ENVELOPE GENERATORS;
-#X obj 58 246 phasor~ 50;
-#X obj 58 301 *~;
-#X obj 58 328 wrap~;
-#X msg 247 248 1 2500;
-#X obj 58 275 -~ 0.5;
-#X msg 179 247 10 200;
-#X obj 247 221 del 200;
-#X text 349 405 updated for Pd version 0.34;
-#X text 39 35 This patch uses an envelope generator to control a sound.
-When you hit "attack" two things happen. First \, the line~ object
-rises to 10 in 200 milliseconds. Then after a "delay" of the same 200
-msec \, the second message sends the line~ back down to 1 over another
-2500 msec. The "release" just ramps us down to zero at the end.;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 15 0;
-#X connect 3 0 16 0;
-#X connect 4 0 8 0;
-#X connect 7 0 11 1;
-#X connect 8 0 7 0;
-#X connect 10 0 14 0;
-#X connect 11 0 12 0;
-#X connect 12 0 1 0;
-#X connect 13 0 7 0;
-#X connect 14 0 11 0;
-#X connect 15 0 7 0;
-#X connect 16 0 13 0;
diff --git a/pd/doc/3.audio.examples/37.adsr.pd b/pd/doc/3.audio.examples/37.adsr.pd
deleted file mode 100644
index 06fa21b7..00000000
--- a/pd/doc/3.audio.examples/37.adsr.pd
+++ /dev/null
@@ -1,34 +0,0 @@
-#N canvas 141 83 672 516 12;
-#X text 412 489 updated for Pd version 0.26;
-#X graph graph1 0 -1.02 44100 1.02 395 235 595 105;
-#X array adsr-output 44100 float 0;
-#X pop;
-#X text 394 244 ------ 1 second ------;
-#X obj 32 74 r trigger;
-#X obj 32 148 tabwrite~ adsr-output;
-#X obj 54 123 r graphit;
-#X msg 31 176 bang;
-#X text 75 177 <-- attack and delayed release;
-#X obj 42 200 del 500;
-#X text 146 283 <-- attack only;
-#X msg 31 264 \; pd dsp 1 \; trigger 1 \; graphit bang;
-#X text 147 360 <-- release only;
-#X msg 30 334 \; pd dsp 1 \; trigger 0 \; graphit bang;
-#X msg 42 225 \; trigger 0;
-#X text 598 221 -1;
-#X text 600 96 1;
-#X text 35 24 This patch introduces a simple "adsr" abstraction we'll
-use frequently. You can click on the "adsr" object to see what's inside.
-;
-#X text 30 402 The active ingredient of the ADSR envelope generator
-is a single line~ which gets passed messages to make the attack and
-release behavior. You can retrigger the ADSR envelope generator all
-you wish without having to wait for attacks or releases to finish;
-#X text 104 5 ENVELOPE GENERATOR ABSTRACTION;
-#X obj 32 100 adsr 1 100 200 50 300;
-#X connect 3 0 19 0;
-#X connect 5 0 4 0;
-#X connect 6 0 10 0;
-#X connect 6 0 8 0;
-#X connect 8 0 13 0;
-#X connect 19 0 4 0;
diff --git a/pd/doc/3.audio.examples/38.envelope.dB.pd b/pd/doc/3.audio.examples/38.envelope.dB.pd
deleted file mode 100644
index 8ec1d1ae..00000000
--- a/pd/doc/3.audio.examples/38.envelope.dB.pd
+++ /dev/null
@@ -1,158 +0,0 @@
-#N canvas 112 44 674 673 12;
-#X obj 32 80 r trigger;
-#X text 85 8 USING ADSR'S OUTPUT AS dB;
-#X text 34 28 For natural sounding amplitude control \, you will want
-to use the ADSR's output as log amplitude. In practice this is best
-done using a lookup table:;
-#X obj 32 131 tabread4~ dbtorms;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 387 83 graph;
-#N canvas 461 495 663 358 make-table 0;
-#X obj 97 195 moses 2;
-#X msg 81 44 bang;
-#X obj 81 73 t b b;
-#X obj 152 134 f;
-#X obj 190 134 + 1;
-#X msg 174 106 0;
-#X obj 81 102 until;
-#X obj 73 162 sel 122;
-#X msg 97 226 0;
-#X obj 141 227 dbtorms;
-#X obj 152 162 t f f;
-#X obj 97 259 tabwrite dbtorms;
-#X floatatom 435 103 0 0 0;
-#X floatatom 435 186 0 0 0;
-#X obj 435 157 tabread4 dbtorms;
-#X floatatom 331 183 0 0 0;
-#X obj 331 154 dbtorms;
-#X text 35 12 bang to recalculate the table;
-#X text 268 62 check accuracy of reading table against;
-#X text 268 81 the "real" dbtorms object.;
-#X connect 0 0 8 0;
-#X connect 0 1 9 0;
-#X connect 1 0 2 0;
-#X connect 2 0 6 0;
-#X connect 2 1 5 0;
-#X connect 3 0 4 0;
-#X connect 3 0 7 0;
-#X connect 3 0 10 0;
-#X connect 4 0 3 1;
-#X connect 5 0 3 1;
-#X connect 6 0 3 0;
-#X connect 7 0 6 1;
-#X connect 8 0 11 0;
-#X connect 9 0 11 0;
-#X connect 10 0 0 0;
-#X connect 10 1 11 1;
-#X connect 12 0 14 0;
-#X connect 12 0 16 0;
-#X connect 14 0 13 0;
-#X connect 16 0 15 0;
-#X restore 288 328 pd make-table;
-#X text 258 299 here's the patch I used to make the table:;
-#X obj 48 156 osc~ 440;
-#X text 589 176 0;
-#X text 590 77 10;
-#X text 406 186 ------ 123 samples ------;
-#X floatatom 61 204 0 0 0;
-#N canvas 159 26 532 285 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X obj 425 153 t b;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X restore 32 232 pd output;
-#X msg 108 205 MUTE;
-#X text 149 204 <-- output amplitude;
-#X text 112 276 <-- attack;
-#X text 113 333 <-- release;
-#X msg 32 319 \; pd dsp 1 \; trigger 0;
-#X obj 32 182 *~;
-#X msg 31 264 \; pd dsp 1 \; trigger 1;
-#X text 29 431 Notice how the attack sounds different when you retrigger
-than when you start from zero. This is because if you go from the steady
-state you only rise 30 dB instead of 100 \, so it sounds slower.;
-#X obj 32 106 adsr 100 100 200 70 300;
-#X text 29 381 The table is indexed from 1 to 120 so that 1 gives a
-true zero out and 120 gives 10 (a 20 dB boost.) The extra 20 dB are
-for headroom.;
-#X text 28 498 If this is a problem you have at least 2 ways of dealing
-with it. The best might be to adjust the attack time inside the abstraction
-using snapshot~ to find out where you're slewing from \, as demonstrated
-in the next patch.;
-#X text 406 631 updated for Pd version 0.35;
-#X text 28 568 There's also a "real" dbtorms~ object... but it's almost
-certainly much more compute-intensive than tabread4~ \, since it has
-to call a library "exp" function.;
-#X connect 0 0 21 0;
-#X connect 3 0 18 0;
-#X connect 7 0 18 1;
-#X connect 11 0 12 1;
-#X connect 12 0 11 0;
-#X connect 13 0 12 2;
-#X connect 18 0 12 0;
-#X connect 21 0 3 0;
diff --git a/pd/doc/3.audio.examples/39.envelope.slew.pd b/pd/doc/3.audio.examples/39.envelope.slew.pd
deleted file mode 100644
index 74599c6c..00000000
--- a/pd/doc/3.audio.examples/39.envelope.slew.pd
+++ /dev/null
@@ -1,102 +0,0 @@
-#N canvas 95 40 682 438 12;
-#X obj 32 80 r trigger;
-#X obj 32 131 tabread4~ dbtorms;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 392 93 graph;
-#X obj 55 157 osc~ 440;
-#X text 594 186 0;
-#X text 596 86 10;
-#X text 411 196 ------ 123 samples ------;
-#X floatatom 70 206 0 0 0;
-#N canvas 159 26 530 278 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 395 183 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 389 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 389 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X restore 32 232 pd output;
-#X msg 106 205 MUTE;
-#X text 147 204 <-- output amplitude;
-#X text 112 276 <-- attack;
-#X text 113 333 <-- release;
-#X msg 32 319 \; pd dsp 1 \; trigger 0;
-#X obj 32 182 *~;
-#X msg 31 264 \; pd dsp 1 \; trigger 1;
-#X text 82 7 ADSR with constant slew rate instead of constant attack
-time;
-#X text 34 28 Here we swap in "adsr2" so you cam compare. I think sometimes
-you'll want the constant rise time \, and sometimes the constant rise
-rate as in adsr2.;
-#X text 40 390 Click on the adsr2 object to see how this is done.;
-#X obj 32 106 adsr2 100 100 200 70 300;
-#X text 420 414 updated for Pd version 0.35;
-#X connect 0 0 19 0;
-#X connect 1 0 14 0;
-#X connect 3 0 14 1;
-#X connect 7 0 8 1;
-#X connect 8 0 7 0;
-#X connect 9 0 8 2;
-#X connect 14 0 8 0;
-#X connect 19 0 1 0;
diff --git a/pd/doc/3.audio.examples/40.envelope.pitch.pd b/pd/doc/3.audio.examples/40.envelope.pitch.pd
deleted file mode 100644
index 42fc9ba8..00000000
--- a/pd/doc/3.audio.examples/40.envelope.pitch.pd
+++ /dev/null
@@ -1,209 +0,0 @@
-#N canvas 222 84 686 544 12;
-#X obj 48 106 r trigger;
-#X obj 48 154 tabread4~ dbtorms;
-#X floatatom 86 232 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 48 258 pd output;
-#X msg 124 232 MUTE;
-#X text 166 231 <-- output amplitude;
-#X text 141 298 <-- attack;
-#X text 568 305 <-- release;
-#X obj 48 208 *~;
-#N canvas 151 343 812 522 make-table 0;
-#X msg 82 49 bang;
-#X obj 82 78 t b b;
-#X obj 141 142 f;
-#X obj 179 142 + 1;
-#X msg 150 112 0;
-#X obj 82 107 until;
-#X obj 141 176 t f f;
-#X floatatom 369 67 0 0 0;
-#X floatatom 369 127 0 0 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 538 298 graph;
-#X text 740 391 0;
-#X text 742 291 10;
-#X text 544 403 ------ 123 samples ------;
-#N canvas 0 0 450 300 graph2 0;
-#X array mtof 130 float 1;
-#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
-12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
-21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
-36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
-61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
-103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
-174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
-293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
-493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
-830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
-1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
-2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
-4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
-7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
-11839.8 12543.9 13289.8 14080;
-#X coords 0 12000 130 0 200 100 1;
-#X restore 537 130 graph;
-#X obj 283 102 mtof;
-#X floatatom 282 127 0 0 0;
-#X text 541 237 ------ 130 samples ------;
-#X text 746 223 0;
-#X text 748 123 12000;
-#X obj 81 203 mtof;
-#X obj 72 167 sel 129;
-#X obj 80 229 tabwrite mtof;
-#X obj 369 99 tabread4 mtof;
-#X obj 71 418 moses 2;
-#X msg 55 267 bang;
-#X obj 55 296 t b b;
-#X obj 126 357 f;
-#X obj 164 357 + 1;
-#X msg 148 329 0;
-#X obj 55 325 until;
-#X obj 47 385 sel 122;
-#X msg 71 449 0;
-#X obj 115 450 dbtorms;
-#X obj 126 385 t f f;
-#X obj 71 482 tabwrite dbtorms;
-#X text 312 40 ... and test accuracy;
-#X text 23 15 patch to recalculate the mtof table;
-#X text 107 267 bang to recalculate dbtorms table;
-#X connect 0 0 1 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 2 0 20 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 0;
-#X connect 6 0 19 0;
-#X connect 6 1 21 1;
-#X connect 7 0 14 0;
-#X connect 7 0 22 0;
-#X connect 14 0 15 0;
-#X connect 19 0 21 0;
-#X connect 20 0 5 1;
-#X connect 22 0 8 0;
-#X connect 23 0 31 0;
-#X connect 23 1 32 0;
-#X connect 24 0 25 0;
-#X connect 25 0 29 0;
-#X connect 25 1 28 0;
-#X connect 26 0 27 0;
-#X connect 26 0 30 0;
-#X connect 26 0 33 0;
-#X connect 27 0 26 1;
-#X connect 28 0 26 1;
-#X connect 29 0 26 0;
-#X connect 30 0 29 1;
-#X connect 31 0 34 0;
-#X connect 32 0 34 0;
-#X connect 33 0 23 0;
-#X connect 33 1 34 1;
-#X restore 451 222 pd make-table;
-#X text 35 6 PITCH ENVELOPES;
-#X text 125 24 For pitch envelopes \, unlike amplitude envelopes \,
-discontinuities are allowed and sometimes you would rather the envelope
-generator actually jump to zero when it's triggered. The "adsr2" object
-does this for you if you send a negative trigger instead of a positive
-one:;
-#X obj 280 106 r trigger2;
-#X obj 280 178 tabread4~ mtof;
-#X obj 280 202 osc~;
-#X msg 46 288 \; pd dsp 1 \; trigger 1 \; trigger2 1;
-#X text 358 297 <-- attack;
-#X msg 249 293 \; pd dsp 1 \; trigger 1 \; trigger2 -1;
-#X msg 472 293 \; pd dsp 1 \; trigger 0 \; trigger2 0;
-#X obj 280 154 +~ 69;
-#X text 358 314 restarting;
-#X text 363 331 pitch env;
-#X text 37 377 We have added a new table \, mtof \, for converting
-audio signals from pitch to frequency. Its range is 1-127 \, so you
-want to add a base pitch in before you start reading from it.;
-#X text 37 443 This is an extreme use of pitch enveloping. In a real
-situation you might want an envelope controlling vibrato depth or the
-like instead of straight pitch.;
-#X obj 48 130 adsr2 100 50 200 90 1000;
-#X obj 280 130 adsr2 20 200 100 100 1000;
-#X text 413 497 updated for Pd version 0.35;
-#X connect 0 0 24 0;
-#X connect 1 0 8 0;
-#X connect 2 0 3 1;
-#X connect 3 0 2 0;
-#X connect 4 0 3 2;
-#X connect 8 0 3 0;
-#X connect 12 0 25 0;
-#X connect 13 0 14 0;
-#X connect 14 0 8 1;
-#X connect 19 0 13 0;
-#X connect 24 0 1 0;
-#X connect 25 0 19 0;
diff --git a/pd/doc/3.audio.examples/42.PART6.analog.sequencer.pd b/pd/doc/3.audio.examples/42.PART6.analog.sequencer.pd
deleted file mode 100644
index b217112f..00000000
--- a/pd/doc/3.audio.examples/42.PART6.analog.sequencer.pd
+++ /dev/null
@@ -1,133 +0,0 @@
-#N canvas 222 24 761 466 12;
-#X floatatom 61 408 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 23 433 pd output;
-#X msg 99 405 MUTE;
-#X text 139 406 <-- output amplitude;
-#X obj 336 272 loadbang;
-#X text 35 6 ANALOG SYNTH SEQUENCER;
-#X obj 215 152 metro 100;
-#X obj 214 178 f;
-#X obj 248 181 + 1;
-#X obj 248 205 mod 11;
-#X graph graph1 0 36 11 96 511 197 711 97;
-#X array array1 11 float 0;
-#X pop;
-#X floatatom 215 127 0 0 0;
-#X floatatom 304 152 0 0 0;
-#X obj 214 230 tabread array1;
-#X obj 214 256 mtof;
-#X obj 214 283 osc~ 0;
-#X msg 26 171 1;
-#X obj 24 303 *~;
-#X obj 24 350 cos~;
-#X obj 24 375 hip~ 5;
-#X obj 24 327 +~ 0.1;
-#X msg 336 298 \; array1 0 50 51 52 50 52 56 50 56 58 52 58;
-#X floatatom 43 219 0 0 0;
-#X floatatom 163 221 0 0 0;
-#X floatatom 93 219 0 0 0;
-#X floatatom 128 220 0 0 0;
-#X msg 93 311 0;
-#X msg 93 329 0.1;
-#X msg 93 348 0.25;
-#X msg 215 101 1;
-#X text 244 101 <--START;
-#X text 126 331 <--symmetry;
-#X text 72 185 ADSR controls;
-#X text 43 199 lvl;
-#X text 95 200 A;
-#X text 137 201 D;
-#X text 170 202 S;
-#X floatatom 298 181 0 0 0;
-#X text 332 183 <--increment;
-#X text 339 155 <--msec;
-#X text 20 35 Analog synths had sequencers which could be used in a
-wide variety of ways. You can use an array to hold a sequence of control
-values as shown here.;
-#X obj 23 274 adsr 1 65 13 10 1000;
-#X obj 42 243 / 100;
-#X text 336 340 You can also do microtones \; 50.5 is a quarter tone
-sharper than 50;
-#X text 505 431 updated for Pd version 0.34;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 21 0;
-#X connect 6 0 7 0;
-#X connect 6 0 16 0;
-#X connect 7 0 8 0;
-#X connect 7 0 13 0;
-#X connect 8 0 9 0;
-#X connect 9 0 7 1;
-#X connect 11 0 6 0;
-#X connect 12 0 6 1;
-#X connect 13 0 14 0;
-#X connect 14 0 15 0;
-#X connect 15 0 17 1;
-#X connect 16 0 41 0;
-#X connect 17 0 20 0;
-#X connect 18 0 19 0;
-#X connect 19 0 1 0;
-#X connect 20 0 18 0;
-#X connect 22 0 42 0;
-#X connect 23 0 41 4;
-#X connect 24 0 41 2;
-#X connect 25 0 41 3;
-#X connect 26 0 20 1;
-#X connect 27 0 20 1;
-#X connect 28 0 20 1;
-#X connect 29 0 11 0;
-#X connect 37 0 8 1;
-#X connect 41 0 17 0;
-#X connect 42 0 41 1;
diff --git a/pd/doc/3.audio.examples/43.monophonic.synth.pd b/pd/doc/3.audio.examples/43.monophonic.synth.pd
deleted file mode 100644
index 26603430..00000000
--- a/pd/doc/3.audio.examples/43.monophonic.synth.pd
+++ /dev/null
@@ -1,135 +0,0 @@
-#N canvas 63 28 664 702 12;
-#X floatatom 71 494 4 0 0;
-#X floatatom 104 625 0 0 100;
-#N canvas 269 205 698 344 output 0;
-#X obj 388 156 t b;
-#X obj 388 105 f;
-#X obj 388 54 inlet;
-#X obj 388 181 f;
-#X msg 482 174 0;
-#X msg 388 79 bang;
-#X obj 388 130 moses 1;
-#X obj 482 149 t b f;
-#X obj 444 111 moses 1;
-#X obj 91 148 dbtorms;
-#X obj 444 86 r master-lvl;
-#X obj 91 48 r master-lvl;
-#X obj 388 207 s master-lvl;
-#X obj 28 169 inlet~;
-#X obj 213 195 inlet;
-#X obj 229 218 s master-lvl;
-#X msg 101 72 set \$1;
-#X obj 101 98 outlet;
-#X msg 213 241 \; pd dsp 1;
-#X obj 91 201 line~;
-#X obj 31 219 *~;
-#X obj 31 247 dac~;
-#X obj 91 173 pack 0 50;
-#X text 17 149 audio in;
-#X obj 28 194 hip~ 1;
-#X connect 0 0 3 0;
-#X connect 1 0 6 0;
-#X connect 2 0 5 0;
-#X connect 3 0 12 0;
-#X connect 4 0 12 0;
-#X connect 5 0 1 0;
-#X connect 6 0 0 0;
-#X connect 6 1 7 0;
-#X connect 7 0 4 0;
-#X connect 8 1 3 1;
-#X connect 9 0 22 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 16 0;
-#X connect 13 0 24 0;
-#X connect 14 0 15 0;
-#X connect 14 0 18 0;
-#X connect 16 0 17 0;
-#X connect 19 0 20 1;
-#X connect 20 0 21 0;
-#X connect 20 0 21 1;
-#X connect 22 0 19 0;
-#X connect 24 0 20 0;
-#X restore 72 648 pd output;
-#X msg 137 625 MUTE;
-#X obj 71 521 mtof;
-#X obj 77 345 stripnote;
-#X obj 201 500 select;
-#X obj 246 369 float;
-#X obj 255 318 t b f;
-#X obj 255 462 float;
-#X text 318 310 f - store pitch below;
-#X text 301 368 velocity stored here;
-#X text 349 395 test velocity for note on or off;
-#X text 301 425 note on;
-#X text 201 408 note;
-#X text 205 423 off;
-#X text 308 464 recall pitch;
-#X text 272 508 test against latest note-on pitch;
-#X text 96 367 pitch \, only;
-#X text 96 386 for note-on;
-#X text 86 456 pitch;
-#X text 197 6 MONOPHONIC MIDI SYNTH;
-#X obj 79 308 unpack;
-#X obj 80 228 notein;
-#X obj 79 260 pack;
-#X obj 71 547 osc~;
-#X obj 71 573 *~;
-#X obj 71 600 cos~;
-#X obj 166 557 line~;
-#X msg 121 526 \$1 100;
-#X msg 201 526 0 1000;
-#X obj 121 500 / 100;
-#X text 81 74 First \, at top \, incoming MIDI notes are parsed and
-used to set pitch and trigger an ADSR envelope. Second \, the envelope
-generator itself has been extended to offer controls over the time
-and target values via number boxes.;
-#X text 82 25 This patch shows how to make a monophonic synthesizer
-that could be controlled from a MIDI or voltage-control keyboard--in
-this example we assume MIDI.;
-#X text 350 658 updated for Pd version 0.34;
-#X msg 237 256 55 64;
-#X msg 237 282 55 0;
-#X msg 181 230 48 200;
-#X msg 180 257 48 64;
-#X msg 180 283 48 0;
-#X text 79 140 The note-off testing is complicated by the fact that
-we have to test both that the velocity is zero \, and further that
-the note-off pitch matches the pitch that is now playing (the most
-recent note-on pitch.);
-#X text 317 327 b - bang to recall velocity;
-#X obj 246 417 sel 0;
-#X connect 0 0 4 0;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 4 0 25 0;
-#X connect 5 0 0 0;
-#X connect 5 0 6 1;
-#X connect 6 0 30 0;
-#X connect 7 0 42 0;
-#X connect 8 0 7 0;
-#X connect 8 1 9 1;
-#X connect 9 0 6 0;
-#X connect 22 0 5 0;
-#X connect 22 0 8 0;
-#X connect 22 1 5 1;
-#X connect 22 1 7 1;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 22 0;
-#X connect 25 0 26 0;
-#X connect 26 0 27 0;
-#X connect 27 0 2 0;
-#X connect 28 0 26 1;
-#X connect 29 0 28 0;
-#X connect 30 0 28 0;
-#X connect 31 0 29 0;
-#X connect 35 0 22 0;
-#X connect 36 0 22 0;
-#X connect 37 0 22 0;
-#X connect 38 0 22 0;
-#X connect 39 0 22 0;
-#X connect 42 0 9 0;
-#X connect 42 1 31 0;
diff --git a/pd/doc/3.audio.examples/44.sample.hold.pd b/pd/doc/3.audio.examples/44.sample.hold.pd
deleted file mode 100644
index ef504816..00000000
--- a/pd/doc/3.audio.examples/44.sample.hold.pd
+++ /dev/null
@@ -1,160 +0,0 @@
-#N canvas 186 95 944 489 12;
-#X text 597 420 updated for Pd version 0.26;
-#X floatatom 94 393 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 65 421 pd output;
-#X msg 141 393 MUTE;
-#X text 184 392 <-- output amplitude;
-#N canvas 0 0 450 300 graph1 0;
-#X array samphold 44100 float 0;
-#X coords 0 1 44100 0 300 200 1;
-#X restore 606 36 graph;
-#N canvas 0 0 439 429 tables 1;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 78 55 graph;
-#X text 280 148 0;
-#X text 282 48 10;
-#X text 97 158 ------ 123 samples ------;
-#N canvas 0 0 450 300 graph2 0;
-#X array mtof 130 float 1;
-#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
-12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
-21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
-36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
-61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
-103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
-174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
-293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
-493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
-830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
-1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
-2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
-4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
-7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
-11839.8 12543.9 13289.8 14080;
-#X coords 0 12000 130 0 200 100 1;
-#X restore 85 232 graph;
-#X text 95 340 ------ 130 samples ------;
-#X text 294 325 0;
-#X text 296 225 12000;
-#X restore 648 280 pd tables;
-#X text 67 8 SAMPLE AND HOLD;
-#X obj 141 292 phasor~ 5;
-#X obj 44 267 phasor~ 7;
-#X obj 44 292 samphold~;
-#X floatatom 44 242 0 0 0;
-#X floatatom 141 237 0 0 0;
-#X obj 216 345 tabwrite~ samphold;
-#X msg 216 320 bang;
-#X obj 44 367 tabread4~ mtof;
-#X obj 44 317 *~ 48;
-#X obj 44 342 +~ 36;
-#X obj 44 392 osc~;
-#X msg 216 262 0;
-#X text 259 319 <--graph output;
-#X obj 44 217 unpack;
-#X text 254 259 <-- reset phase;
-#X msg 311 131 32 96.33;
-#X msg 124 131 5 7;
-#X msg 44 131 1 5;
-#X msg 78 131 2 11;
-#X msg 161 131 3.7 8.8;
-#X msg 235 131 3.4 8.9;
-#X text 16 31 Another analog favorite \, the sample and hold unit freezes
-an audio signal on command. In the Pd version \, the second input of
-samphold~ triggers it \, and the first input becomes the output's new
-value whenever the trigger decreases from one sample to the next. This
-is ideal for updating values when a phasor wraps around.;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 8 0 10 1;
-#X connect 9 0 10 0;
-#X connect 10 0 16 0;
-#X connect 10 0 13 0;
-#X connect 11 0 9 0;
-#X connect 12 0 8 0;
-#X connect 14 0 13 0;
-#X connect 15 0 18 0;
-#X connect 16 0 17 0;
-#X connect 17 0 15 0;
-#X connect 18 0 2 0;
-#X connect 19 0 8 1;
-#X connect 19 0 9 1;
-#X connect 21 0 11 0;
-#X connect 21 1 12 0;
-#X connect 23 0 21 0;
-#X connect 24 0 21 0;
-#X connect 25 0 21 0;
-#X connect 26 0 21 0;
-#X connect 27 0 21 0;
-#X connect 28 0 21 0;
diff --git a/pd/doc/3.audio.examples/45.envelope.follower.pd b/pd/doc/3.audio.examples/45.envelope.follower.pd
deleted file mode 100644
index 0c3de2b4..00000000
--- a/pd/doc/3.audio.examples/45.envelope.follower.pd
+++ /dev/null
@@ -1,101 +0,0 @@
-#N canvas 64 77 982 581 12;
-#X text 759 566 updated for Pd version 0.26;
-#X text 67 8 ENVELOPE FOLLOWERS;
-#X text 17 28 The env~ object reports ths RMS signal level over the last 256 samples (by default) or any other power of 2 that's at least twice the block size. The analysis is done in an overlapped fashion so that results appear every N/2 points if N is the analysis window size. So the larger the window \, the stabler the result and the less frequently it appears. Computation time doesn't depend heavily on N.;
-#X text 471 28 Envelope followers are frequently used to detect attacks and periods of silence. (There are fancier attack detectors out there \, though.) Here is a simple threshold-based attack and rest detector.;
-#X obj 152 160 dbtorms;
-#X floatatom 75 142;
-#X obj 75 165 osc~ 440;
-#X obj 75 188 *~ 0;
-#X obj 75 211 env~;
-#X floatatom 136 216;
-#X floatatom 152 137;
-#X msg 219 155 \; pd dsp 1;
-#X obj 87 307 t b f;
-#X floatatom 87 330;
-#X obj 94 385 pack;
-#X text 198 215 note 3.01 dB difference between peak and RMS amplitudes.;
-#X obj 94 408 route 0 1;
-#X obj 94 431 > 55;
-#X obj 139 433 < 45;
-#X obj 94 454 sel 1;
-#X obj 139 456 sel 1;
-#X msg 16 494 1;
-#X msg 45 494 0;
-#X obj 94 494 print attack;
-#X obj 87 365 != 0;
-#X obj 517 267 t b f;
-#X floatatom 517 290;
-#X obj 524 348 pack;
-#X obj 524 371 route 0 1;
-#X obj 524 404 sel 1;
-#X msg 458 525 1;
-#X msg 488 525 0;
-#X obj 517 326 != 0;
-#X obj 547 290 < 45;
-#X obj 542 441 timer;
-#X obj 600 371 sel 0;
-#X obj 616 496 sel 0;
-#X obj 542 487 sel 1;
-#X obj 542 528 print rest;
-#X obj 542 464 > 1000;
-#X text 125 330 state -- 1 if waiting for low threshold \,;
-#X text 151 345 0 if we've attained it and now want the;
-#X text 180 359 high one.;
-#X text 165 408 route the RMS value according to state;
-#X text 191 435 if off \, 55 dB means attack. If on \, 45;
-#X text 192 456 dB or less means state changes to off.;
-#X text 106 279 ATTACK DETECTION;
-#X text 515 244 REST DETECTION;
-#X text 590 288 Here we always will test RMS against a low value;
-#X text 615 305 but as before we route the result according to;
-#X text 637 322 our state \, 1 if "resting" \, 0 if not.;
-#X text 645 368 regardless of state \, when RMS isn't low;
-#X text 667 383 reset the timer;
-#X text 691 511 RMS isn't low enough.;
-#X text 602 403 If we're not in rest \, and the RMS is low \,;
-#X text 626 419 check elapsed time sinse RMS last wasn't low.;
-#X text 613 461 If more than 1 second \, report a rest.;
-#X text 664 495 If we're at rest \, pop out of it when;
-#X text 471 94 Both detectors are state machines with two states \, on and off. If on \, a test is run to determine whether to turn off \, and vice versa. The tests are run at each output of the rms~ object.;
-#X connect 4 0 7 1;
-#X connect 5 0 6 0;
-#X connect 6 0 7 0;
-#X connect 7 0 8 0;
-#X connect 8 0 9 0;
-#X connect 8 0 12 0;
-#X connect 8 0 25 0;
-#X connect 10 0 4 0;
-#X connect 10 0 11 0;
-#X connect 12 0 13 0;
-#X connect 12 1 14 1;
-#X connect 13 0 24 0;
-#X connect 14 0 16 0;
-#X connect 16 0 17 0;
-#X connect 16 1 18 0;
-#X connect 17 0 19 0;
-#X connect 18 0 20 0;
-#X connect 19 0 21 0;
-#X connect 19 0 23 0;
-#X connect 20 0 22 0;
-#X connect 21 0 13 0;
-#X connect 22 0 13 0;
-#X connect 24 0 14 0;
-#X connect 25 0 26 0;
-#X connect 25 1 33 0;
-#X connect 26 0 32 0;
-#X connect 27 0 28 0;
-#X connect 28 0 29 0;
-#X connect 28 1 36 0;
-#X connect 29 0 34 1;
-#X connect 30 0 26 0;
-#X connect 31 0 26 0;
-#X connect 32 0 27 0;
-#X connect 33 0 27 1;
-#X connect 33 0 35 0;
-#X connect 34 0 39 0;
-#X connect 35 0 34 0;
-#X connect 36 0 31 0;
-#X connect 37 0 30 0;
-#X connect 37 0 38 0;
-#X connect 39 0 37 0;
diff --git a/pd/doc/3.audio.examples/51.ring.modulation.pd b/pd/doc/3.audio.examples/51.ring.modulation.pd
deleted file mode 100644
index 0380a07d..00000000
--- a/pd/doc/3.audio.examples/51.ring.modulation.pd
+++ /dev/null
@@ -1,153 +0,0 @@
-#N canvas 1 23 809 567 12;
-#X graph graph1 0 -1.02 882 1.02 542 471 742 341;
-#X array pulse-output 882 float 0;
-#X pop;
-#X floatatom 101 331 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 63 359 pd output;
-#X msg 139 332 MUTE;
-#X text 179 331 <-- output amplitude;
-#X floatatom 63 48 0 0 0;
-#X obj 63 303 hip~ 5;
-#X graph graph1 0 0 128 1000 490 259 746 129;
-#X array spectrum 128 float 0;
-#X pop;
-#X obj 129 278 tabwrite~ pulse-output;
-#X msg 129 243 bang;
-#X text 170 244 <-- click to graph;
-#N canvas 204 17 358 234 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 2048 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 74 281 pd fft;
-#X text 488 265 0;
-#X obj 79 194 osc~ 0;
-#N canvas 0 0 600 384 pulse-train 0;
-#X obj 185 162 line~;
-#X obj 39 251 cos~;
-#X obj 185 138 pack 0 50;
-#X obj 40 178 -~ 0.5;
-#X obj 40 204 *~;
-#X obj 185 63 / 10;
-#X obj 185 87 moses 0;
-#X msg 185 111 0;
-#X obj 39 227 clip~ -0.5 0.5;
-#X obj 185 187 +~ 1;
-#X obj 38 274 +~ 1;
-#X obj 184 38 inlet;
-#X obj 38 299 outlet~;
-#X obj 40 154 phasor~ 344.532;
-#X text 51 13 This is the pulse train generator from example 17;
-#X connect 0 0 9 0;
-#X connect 1 0 10 0;
-#X connect 2 0 0 0;
-#X connect 3 0 4 0;
-#X connect 4 0 8 0;
-#X connect 5 0 6 0;
-#X connect 6 0 7 0;
-#X connect 6 1 2 0;
-#X connect 7 0 2 0;
-#X connect 8 0 1 0;
-#X connect 9 0 4 1;
-#X connect 10 0 12 0;
-#X connect 11 0 5 0;
-#X connect 13 0 3 0;
-#X restore 63 75 pd pulse-train;
-#X floatatom 79 168 0 0 0;
-#X text 124 167 <-- modulation frequency;
-#X text 102 48 <-- bandwidth;
-#X obj 63 218 *~;
-#X text 736 262 2656 Hz.;
-#X text 196 77 fundamental is 344.5 Hz;
-#X text 157 210 an oscillator...;
-#X text 66 22 RING MODULATION;
-#X text 542 473 ---- 0.02 seconds ----;
-#X text 528 533 updated for Pd version 0.34;
-#X text 156 195 Just multiply by;
-#X text 12 422 Ring modulation is just multiplication by an oscillator.
-This patch shows the effect of ring modulation on a pulse train. When
-bandwidth is high and modulation frequency is moderately low \, you
-see the spectrum reflect off the "y axis".;
-#X obj 79 140 * 344.5;
-#X floatatom 79 114 0 0 0;
-#X text 120 114 <-- modulation frequency as;
-#X text 159 128 multiple of fundamental;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 5 0 14 0;
-#X connect 6 0 2 0;
-#X connect 9 0 8 0;
-#X connect 9 0 11 1;
-#X connect 13 0 18 1;
-#X connect 14 0 18 0;
-#X connect 15 0 13 0;
-#X connect 18 0 11 0;
-#X connect 18 0 6 0;
-#X connect 18 0 8 0;
-#X connect 27 0 15 0;
-#X connect 28 0 27 0;
diff --git a/pd/doc/3.audio.examples/53.delays.pd b/pd/doc/3.audio.examples/53.delays.pd
deleted file mode 100644
index 5c4f20de..00000000
--- a/pd/doc/3.audio.examples/53.delays.pd
+++ /dev/null
@@ -1,225 +0,0 @@
-#N canvas 22 1 729 584 12;
-#X floatatom 62 506 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 33 534 pd output;
-#X msg 91 506 MUTE;
-#X text 130 505 <-- output amplitude;
-#X obj 33 482 hip~ 5;
-#X text 92 12 DELAYS;
-#X obj 33 341 -~;
-#X obj 30 241 tabread4~ mtof;
-#X obj 33 317 *~ 3;
-#X obj 69 318 *~ 2;
-#X obj 49 266 phasor~;
-#X floatatom 81 215 0 0 0;
-#X obj 33 293 clip~ 0 0.667;
-#X obj 30 190 line~;
-#X obj 30 165 pack 0 1000;
-#X obj 28 64 metro 1000;
-#X obj 28 88 random 200;
-#X obj 29 114 - 100;
-#X obj 30 141 * 0.001;
-#X obj 33 453 +~;
-#X obj 44 374 delwrite~ delay1 2000;
-#X floatatom 49 401 0 0 0;
-#X obj 49 426 delread~ delay1 1000;
-#X obj 27 41 loadbang;
-#X text 210 37 You can delay a signal using the delwrite~ and delread~
-objects. In this example \, the pitch of the oscillator is varying
-slightly so that the delayed signal is different from the straight
-signal.;
-#X text 212 99 delread always delays the signal an integer number of
-samples and does no interpolation.;
-#X text 211 137 The delwrite~ object creates the delay line \; you
-give it a name and a size in milliseconds. Each delwrite~ should have
-a different name.;
-#X text 209 184 Delread~'s arguments are the name of a delwrite (of
-which there should be exactly one) and a delay time in milliseconds
-between 0 and the length of the delay line. Each delwrite~ may have
-as many delread~s as you wish \, which function as multiple delay taps.
-;
-#X obj 30 215 +~ 60;
-#X text 112 215 <-- pitch;
-#X text 83 401 <-- delay time;
-#X text 60 341 asymmetric triangle wave;
-#X text 236 372 write to delay line;
-#X text 232 425 read from delay line;
-#X text 59 454 add the original and the delayed signal;
-#N canvas 0 0 600 392 conversion-tables 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 70 45 graph;
-#X text 272 138 0;
-#X text 274 38 10;
-#X text 89 148 ------ 123 samples ------;
-#N canvas 0 0 450 300 graph2 0;
-#X array mtof 130 float 1;
-#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
-12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
-21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
-36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
-61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
-103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
-174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
-293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
-493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
-830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
-1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
-2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
-4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
-7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
-11839.8 12543.9 13289.8 14080;
-#X coords 0 12000 130 0 200 100 1;
-#X restore 77 222 graph;
-#X text 87 330 ------ 130 samples ------;
-#X text 286 315 0;
-#X text 288 215 12000;
-#N canvas 244 212 672 338 regenerate-tables 0;
-#X msg 415 84 bang;
-#X obj 415 113 t b b;
-#X obj 474 177 f;
-#X obj 512 177 + 1;
-#X msg 483 147 0;
-#X obj 415 142 until;
-#X obj 474 211 t f f;
-#X obj 414 238 mtof;
-#X obj 405 202 sel 129;
-#X obj 413 264 tabwrite mtof;
-#X obj 35 227 moses 2;
-#X msg 19 76 bang;
-#X obj 19 105 t b b;
-#X obj 90 166 f;
-#X obj 128 166 + 1;
-#X msg 112 138 0;
-#X obj 19 134 until;
-#X obj 11 194 sel 122;
-#X msg 35 258 0;
-#X obj 79 259 dbtorms;
-#X obj 90 194 t f f;
-#X obj 35 291 tabwrite dbtorms;
-#X text 18 49 bang to recalculate dbtorms table;
-#X text 356 50 bang to recalculate the mtof table;
-#X connect 0 0 1 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 2 0 8 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 6 1 9 1;
-#X connect 7 0 9 0;
-#X connect 8 0 5 1;
-#X connect 10 0 18 0;
-#X connect 10 1 19 0;
-#X connect 11 0 12 0;
-#X connect 12 0 16 0;
-#X connect 12 1 15 0;
-#X connect 13 0 14 0;
-#X connect 13 0 17 0;
-#X connect 13 0 20 0;
-#X connect 14 0 13 1;
-#X connect 15 0 13 1;
-#X connect 16 0 13 0;
-#X connect 17 0 16 1;
-#X connect 18 0 21 0;
-#X connect 19 0 21 0;
-#X connect 20 0 10 0;
-#X connect 20 1 21 1;
-#X restore 375 76 pd regenerate-tables;
-#X restore 449 418 pd conversion-tables;
-#X text 427 536 updated for Pd version 0.35;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 1 0;
-#X connect 6 0 19 0;
-#X connect 6 0 20 0;
-#X connect 7 0 10 0;
-#X connect 8 0 6 0;
-#X connect 9 0 6 1;
-#X connect 10 0 9 0;
-#X connect 10 0 12 0;
-#X connect 11 0 28 1;
-#X connect 12 0 8 0;
-#X connect 13 0 28 0;
-#X connect 14 0 13 0;
-#X connect 15 0 16 0;
-#X connect 16 0 17 0;
-#X connect 17 0 18 0;
-#X connect 18 0 14 0;
-#X connect 19 0 4 0;
-#X connect 21 0 22 0;
-#X connect 22 0 19 1;
-#X connect 23 0 15 0;
-#X connect 28 0 7 0;
diff --git a/pd/doc/3.audio.examples/54.delay.loop.pd b/pd/doc/3.audio.examples/54.delay.loop.pd
deleted file mode 100644
index 71b35253..00000000
--- a/pd/doc/3.audio.examples/54.delay.loop.pd
+++ /dev/null
@@ -1,213 +0,0 @@
-#N canvas 22 1 630 601 12;
-#X text 309 531 updated for Pd version 0.26;
-#X floatatom 58 505 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 29 533 pd output;
-#X msg 87 505 MUTE;
-#X text 126 504 <-- output amplitude;
-#X obj 29 476 hip~ 5;
-#X obj 29 297 -~;
-#X obj 29 273 *~ 3;
-#X obj 66 279 *~ 2;
-#X floatatom 29 177 0 0 0;
-#X obj 29 249 clip~ 0 0.667;
-#X obj 39 450 delwrite~ delay1 2000;
-#X floatatom 45 353 0 0 0;
-#X text 79 176 <-- pitch;
-#X text 75 352 <-- delay time;
-#X text 238 450 write to delay line;
-#X text 226 378 read from delay line;
-#X text 64 426 add the original and the delayed signal;
-#X obj 29 201 mtof;
-#X msg 135 238 1;
-#X obj 29 321 *~;
-#X obj 29 225 phasor~ 0;
-#X obj 135 286 tabread4~ dbtorms;
-#X obj 135 262 adsr 100 100 2000 0 2000;
-#X obj 29 427 +~;
-#X obj 45 377 delread~ delay1 160;
-#X obj 45 401 *~ 0.7;
-#X text 103 401 feedback gain;
-#X text 57 9 DELAYS WITH FEEDBACK;
-#X text 33 39 You can feed the result of a delread~ module back into
-its own delwrite~ \, as long as you're careful about stability. For
-delays below 30 msec \, you can frequently hear teh resonant pitch.
-For longer delay times you get the famous old delay loop effect.;
-#X text 32 118 We've added an amplitude control here so that teh test
-oscillator only speaks while you're dragging the pitch up and down.
-Be sure to try the shift key.;
-#N canvas 0 0 600 392 conversion-tables 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 70 45 graph;
-#X text 272 138 0;
-#X text 274 38 10;
-#X text 89 148 ------ 123 samples ------;
-#N canvas 0 0 450 300 graph2 0;
-#X array mtof 130 float 1;
-#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
-12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
-21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
-36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
-61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
-103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
-174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
-293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
-493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
-830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
-1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
-2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
-4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
-7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
-11839.8 12543.9 13289.8 14080;
-#X coords 0 12000 130 0 200 100 1;
-#X restore 77 222 graph;
-#X text 87 330 ------ 130 samples ------;
-#X text 286 315 0;
-#X text 288 215 12000;
-#N canvas 244 212 672 338 regenerate-tables 0;
-#X msg 415 84 bang;
-#X obj 415 113 t b b;
-#X obj 474 177 f;
-#X obj 512 177 + 1;
-#X msg 483 147 0;
-#X obj 415 142 until;
-#X obj 474 211 t f f;
-#X obj 414 238 mtof;
-#X obj 405 202 sel 129;
-#X obj 413 264 tabwrite mtof;
-#X obj 35 227 moses 2;
-#X msg 19 76 bang;
-#X obj 19 105 t b b;
-#X obj 90 166 f;
-#X obj 128 166 + 1;
-#X msg 112 138 0;
-#X obj 19 134 until;
-#X obj 11 194 sel 122;
-#X msg 35 258 0;
-#X obj 79 259 dbtorms;
-#X obj 90 194 t f f;
-#X obj 35 291 tabwrite dbtorms;
-#X text 18 49 bang to recalculate dbtorms table;
-#X text 356 50 bang to recalculate the mtof table;
-#X connect 0 0 1 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 2 0 8 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 6 1 9 1;
-#X connect 7 0 9 0;
-#X connect 8 0 5 1;
-#X connect 10 0 18 0;
-#X connect 10 1 19 0;
-#X connect 11 0 12 0;
-#X connect 12 0 16 0;
-#X connect 12 1 15 0;
-#X connect 13 0 14 0;
-#X connect 13 0 17 0;
-#X connect 13 0 20 0;
-#X connect 14 0 13 1;
-#X connect 15 0 13 1;
-#X connect 16 0 13 0;
-#X connect 17 0 16 1;
-#X connect 18 0 21 0;
-#X connect 19 0 21 0;
-#X connect 20 0 10 0;
-#X connect 20 1 21 1;
-#X restore 375 76 pd regenerate-tables;
-#X restore 334 483 pd conversion-tables;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 5 0 2 0;
-#X connect 6 0 20 0;
-#X connect 7 0 6 0;
-#X connect 8 0 6 1;
-#X connect 9 0 18 0;
-#X connect 9 0 19 0;
-#X connect 10 0 7 0;
-#X connect 12 0 25 0;
-#X connect 18 0 21 0;
-#X connect 19 0 23 0;
-#X connect 20 0 24 0;
-#X connect 21 0 8 0;
-#X connect 21 0 10 0;
-#X connect 22 0 20 1;
-#X connect 23 0 22 0;
-#X connect 24 0 11 0;
-#X connect 24 0 5 0;
-#X connect 25 0 26 0;
-#X connect 26 0 24 1;
diff --git a/pd/doc/3.audio.examples/55.delay.variable.pd b/pd/doc/3.audio.examples/55.delay.variable.pd
deleted file mode 100644
index bb16de95..00000000
--- a/pd/doc/3.audio.examples/55.delay.variable.pd
+++ /dev/null
@@ -1,129 +0,0 @@
-#N canvas 100 17 671 522 12;
-#X obj 63 306 hip~ 10;
-#X floatatom 331 222;
-#X obj 331 270 line~;
-#X obj 331 246 pack 0 100;
-#X floatatom 256 192;
-#X floatatom 442 297;
-#X obj 442 369 line~;
-#X obj 442 345 pack 0 100;
-#X obj 442 321 * 0.01;
-#X floatatom 143 167;
-#X obj 143 238 line~;
-#X obj 143 214 pack 0 100;
-#X obj 63 258 *~;
-#X obj 63 282 cos~;
-#X floatatom 63 135;
-#X obj 63 159 mtof;
-#X obj 63 183 * 0.5;
-#X obj 63 330 clip~ -0.2 0.2;
-#X obj 143 190 * 0.01;
-#X obj 426 444 delwrite~ delay1 1000;
-#X obj 63 354 +~;
-#X obj 426 396 *~;
-#X obj 256 336 vd~ delay1;
-#X obj 256 288 *~;
-#X obj 256 216 / 100;
-#X floatatom 93 419;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 64 447 pd output;
-#X msg 122 419 MUTE;
-#X text 161 418 <-- output amplitude;
-#X obj 63 378 hip~ 5;
-#X text 401 505 updated for Pd version 0.26;
-#X obj 256 264 +~ 1;
-#X obj 256 240 osc~ 0;
-#X obj 256 312 +~ 1.46;
-#X obj 426 420 clip~ -5 5;
-#X text 43 35 This is a fuzzed FM generator going into a delay loop \, this time using a variable delay object (vd~). You can get several interesting effects this way. We have taken the precaution if clipping inside the loop to avoid instabilities. You can push the loop gain past 1 if you want \, it will just uscillate.;
-#X text 184 165 <-- timbre;
-#X text 96 136 <-- pitch;
-#X text 300 192 <-- cycle frequency (hundredths);
-#X text 361 222 <-- cycle depth (msec);
-#X text 491 298 <-- feedback (hundredths);
-#X text 86 9 VARIABLE DELAYS;
-#X obj 63 207 osc~ 0;
-#X connect 0 0 17 0;
-#X connect 1 0 3 0;
-#X connect 2 0 23 1;
-#X connect 3 0 2 0;
-#X connect 4 0 24 0;
-#X connect 5 0 8 0;
-#X connect 6 0 21 1;
-#X connect 7 0 6 0;
-#X connect 8 0 7 0;
-#X connect 9 0 18 0;
-#X connect 10 0 12 1;
-#X connect 11 0 10 0;
-#X connect 12 0 13 0;
-#X connect 13 0 0 0;
-#X connect 14 0 15 0;
-#X connect 15 0 16 0;
-#X connect 16 0 42 0;
-#X connect 17 0 20 0;
-#X connect 18 0 11 0;
-#X connect 20 0 29 0;
-#X connect 21 0 34 0;
-#X connect 22 0 20 1;
-#X connect 23 0 33 0;
-#X connect 24 0 32 0;
-#X connect 25 0 26 1;
-#X connect 26 0 25 0;
-#X connect 27 0 26 2;
-#X connect 29 0 26 0;
-#X connect 29 0 21 0;
-#X connect 31 0 23 0;
-#X connect 32 0 31 0;
-#X connect 33 0 22 0;
-#X connect 34 0 19 0;
-#X connect 42 0 12 0;
diff --git a/pd/doc/3.audio.examples/56.delay.pitchshift.pd b/pd/doc/3.audio.examples/56.delay.pitchshift.pd
deleted file mode 100644
index feb56e2f..00000000
--- a/pd/doc/3.audio.examples/56.delay.pitchshift.pd
+++ /dev/null
@@ -1,226 +0,0 @@
-#N canvas 93 36 1005 580 12;
-#X obj 19 493 hip~ 5;
-#X floatatom 19 87 0 0 0;
-#X obj 84 359 *~;
-#X obj 192 290 line~;
-#X floatatom 265 114 0 0 0;
-#X text 68 9 PITCH SHIFTER;
-#X obj 192 264 pack 0 200;
-#X obj 266 141 moses 1;
-#X msg 227 141 1;
-#X obj 266 88 r window;
-#X obj 19 61 r transpose;
-#X obj 19 143 exp;
-#X floatatom 19 169 0 0 0;
-#X obj 19 259 /;
-#X obj 146 189 * 0.001;
-#X obj 314 366 line~;
-#X obj 315 338 pack 0 200;
-#X floatatom 315 258 0 0 0;
-#X text 314 202 delay (msec);
-#X obj 315 232 r delay;
-#X obj 84 385 +~;
-#X msg 315 311 1;
-#X obj 315 285 moses 1.5;
-#X obj 84 411 vd~ delay1;
-#X obj 19 410 cos~;
-#X obj 19 437 *~;
-#X obj 19 466 +~;
-#X obj 106 317 wrap~;
-#X obj 251 360 *~;
-#X obj 251 393 +~;
-#X obj 251 422 vd~ delay1;
-#X obj 188 420 cos~;
-#X obj 188 447 *~;
-#X msg 492 56 \; transpose 0 \; window 100 \; delay 0;
-#X obj 492 30 loadbang;
-#X obj 264 42 delwrite~ delay1 5000;
-#X obj 146 216 t b f;
-#X floatatom 19 285 0 0 0;
-#X obj 19 312 phasor~ 0;
-#X floatatom 51 526 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 372 176 t b;
-#X obj 372 121 f;
-#X obj 372 66 inlet;
-#X text 378 32 mute;
-#X obj 372 204 f;
-#X msg 468 196 0;
-#X msg 372 94 bang;
-#X obj 372 149 moses 1;
-#X obj 468 168 t b f;
-#X obj 437 129 moses 1;
-#X obj 91 163 dbtorms;
-#X obj 437 101 r master-lvl;
-#X obj 91 46 r master-lvl;
-#X obj 372 231 s master-lvl;
-#X obj 24 199 inlet~;
-#X obj 219 45 inlet;
-#X text 219 20 level;
-#X obj 219 110 s master-lvl;
-#X msg 106 72 set \$1;
-#X obj 106 98 outlet;
-#X msg 235 70 \; pd dsp 1;
-#X obj 91 213 line~;
-#X obj 24 233 *~;
-#X obj 24 265 dac~;
-#X obj 91 188 pack 0 50;
-#X text 22 174 audio;
-#X text 102 121 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 19 557 pd output;
-#X msg 83 526 MUTE;
-#X text 125 525 <-- output amplitude;
-#X obj 106 290 +~ 0.5;
-#X obj 19 358 -~ 0.5;
-#X obj 19 384 *~ 0.5;
-#X obj 188 359 -~ 0.5;
-#X obj 188 392 *~ 0.5;
-#X floatatom 227 167 0 0 0;
-#X obj 19 196 - 1;
-#X obj 19 117 * 0.05776;
-#X obj 19 222 * -1;
-#X text 53 86 <-- transposition;
-#X text 96 99 (halftones);
-#X text 86 177 speed;
-#X text 85 191 change;
-#X text 310 113 <--window (msec);
-#X text 54 252 tape head;
-#X text 55 265 rotation speed;
-#N canvas 0 0 612 637 test-input 0;
-#X graph graph1 0 -1 155947 1 150 291 350 141;
-#X array array1 155948 float 0;
-#X pop;
-#X obj 139 518 tabread4~ array1;
-#X obj 139 333 r totsamps;
-#X obj 139 413 /;
-#X obj 139 465 *~ 0;
-#X obj 139 439 phasor~ 0;
-#X obj 139 492 +~ 1;
-#X msg 139 386 44100;
-#X obj 139 360 t b f;
-#X obj 182 469 r totsamps;
-#X text 153 538 sample loop for;
-#X text 153 555 test signal;
-#X obj 162 30 loadbang;
-#X obj 139 590 outlet~;
-#X obj 393 169 r readfile;
-#X obj 393 199 symbol;
-#X msg 392 228 read -resize \$1 array1;
-#X obj 392 256 soundfiler;
-#X obj 392 284 s totsamps;
-#X msg 161 64 \; readfile ../sound/bell.aiff;
-#X connect 1 0 13 0;
-#X connect 2 0 8 0;
-#X connect 3 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 4 0;
-#X connect 6 0 1 0;
-#X connect 7 0 3 0;
-#X connect 8 0 7 0;
-#X connect 8 1 3 1;
-#X connect 9 0 4 1;
-#X connect 12 0 19 0;
-#X connect 14 0 15 0;
-#X connect 15 0 16 0;
-#X connect 16 0 17 0;
-#X connect 17 0 18 0;
-#X restore 264 11 pd test-input;
-#X text 439 161 This is a classic rotating-tape-head style pitch shifter
-using the vd~ variable delay object. Ther are two moving tape heads
-\, each of which is loudest at the middle of its trajectory \, and
-enveloped out at the moment it has to jump back (or forward) to start
-another scratch. Most of the brain work is in computing how fast the
-tape heads have to move to get the desired transposition.;
-#X text 439 280 The "window size" is the total trajectory of the read
-points in the delay line \, in milliseconds. The delay times are controlled
-by a phasor~ object. The second delay time \, 180 degrees out of phase
-from the first one \, is computed using the "wrap" object.;
-#X text 437 370 The "window size" is the total trajectory of the read
-points in the delay line \, in milliseconds. The delay times are controlled
-by a phasor~ object. The second delay time \, 180 degrees out of phase
-from the first one \, is computed using the "wrap" object.;
-#X text 436 462 The cos~ objects compute the fadein and fadeout of
-the two delay line outputs. They each traverse the positive half of
-the cosine waveform (phase -0.25 to +0.25) over the time the phase
-goes from one end to the other.;
-#X text 757 557 updated for Pd version 0.33;
-#X connect 0 0 40 0;
-#X connect 1 0 50 0;
-#X connect 2 0 20 0;
-#X connect 3 0 2 1;
-#X connect 3 0 28 1;
-#X connect 4 0 7 0;
-#X connect 6 0 3 0;
-#X connect 7 0 8 0;
-#X connect 7 1 48 0;
-#X connect 8 0 48 0;
-#X connect 9 0 4 0;
-#X connect 10 0 1 0;
-#X connect 11 0 12 0;
-#X connect 12 0 49 0;
-#X connect 13 0 37 0;
-#X connect 14 0 36 0;
-#X connect 15 0 20 1;
-#X connect 15 0 29 1;
-#X connect 16 0 15 0;
-#X connect 17 0 22 0;
-#X connect 19 0 17 0;
-#X connect 20 0 23 0;
-#X connect 21 0 16 0;
-#X connect 22 0 21 0;
-#X connect 22 1 16 0;
-#X connect 23 0 25 1;
-#X connect 24 0 25 0;
-#X connect 25 0 26 0;
-#X connect 26 0 0 0;
-#X connect 27 0 28 0;
-#X connect 27 0 46 0;
-#X connect 28 0 29 0;
-#X connect 29 0 30 0;
-#X connect 30 0 32 1;
-#X connect 31 0 32 0;
-#X connect 32 0 26 1;
-#X connect 34 0 33 0;
-#X connect 36 0 13 0;
-#X connect 36 1 13 1;
-#X connect 37 0 38 0;
-#X connect 38 0 2 0;
-#X connect 38 0 44 0;
-#X connect 38 0 43 0;
-#X connect 39 0 40 1;
-#X connect 40 0 39 0;
-#X connect 41 0 40 2;
-#X connect 43 0 27 0;
-#X connect 44 0 45 0;
-#X connect 45 0 24 0;
-#X connect 46 0 47 0;
-#X connect 47 0 31 0;
-#X connect 48 0 6 0;
-#X connect 48 0 14 0;
-#X connect 49 0 51 0;
-#X connect 50 0 11 0;
-#X connect 51 0 13 0;
-#X connect 59 0 35 0;
diff --git a/pd/doc/3.audio.examples/57.delay.reverb.pd b/pd/doc/3.audio.examples/57.delay.reverb.pd
deleted file mode 100644
index aad17023..00000000
--- a/pd/doc/3.audio.examples/57.delay.reverb.pd
+++ /dev/null
@@ -1,316 +0,0 @@
-#N canvas 127 171 643 406 12;
-#N canvas 0 0 499 321 test-input 0;
-#X obj 75 253 outlet~;
-#X obj 74 201 -~;
-#X obj 74 177 *~ 3;
-#X obj 111 183 *~ 2;
-#X floatatom 74 81 0 0 0;
-#X obj 74 153 clip~ 0 0.667;
-#X text 124 80 <-- pitch;
-#X obj 74 105 mtof;
-#X msg 195 142 1;
-#X obj 74 225 *~;
-#X obj 74 129 phasor~ 0;
-#X obj 195 190 tabread4~ dbtorms;
-#X obj 195 166 adsr 100 100 2000 0 2000;
-#X obj 73 54 inlet;
-#N canvas 0 0 600 392 conversion-tables 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 70 45 graph;
-#X text 272 138 0;
-#X text 274 38 10;
-#X text 89 148 ------ 123 samples ------;
-#N canvas 0 0 450 300 graph2 0;
-#X array mtof 130 float 1;
-#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
-12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
-21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
-36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
-61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
-103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
-174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
-293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
-493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
-830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
-1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
-2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
-4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
-7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
-11839.8 12543.9 13289.8 14080;
-#X coords 0 12000 130 0 200 100 1;
-#X restore 77 222 graph;
-#X text 87 330 ------ 130 samples ------;
-#X text 286 315 0;
-#X text 288 215 12000;
-#N canvas 244 212 672 338 regenerate-tables 0;
-#X msg 415 84 bang;
-#X obj 415 113 t b b;
-#X obj 474 177 f;
-#X obj 512 177 + 1;
-#X msg 483 147 0;
-#X obj 415 142 until;
-#X obj 474 211 t f f;
-#X obj 414 238 mtof;
-#X obj 405 202 sel 129;
-#X obj 413 264 tabwrite mtof;
-#X obj 35 227 moses 2;
-#X msg 19 76 bang;
-#X obj 19 105 t b b;
-#X obj 90 166 f;
-#X obj 128 166 + 1;
-#X msg 112 138 0;
-#X obj 19 134 until;
-#X obj 11 194 sel 122;
-#X msg 35 258 0;
-#X obj 79 259 dbtorms;
-#X obj 90 194 t f f;
-#X obj 35 291 tabwrite dbtorms;
-#X text 18 49 bang to recalculate dbtorms table;
-#X text 356 50 bang to recalculate the mtof table;
-#X connect 0 0 1 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 2 0 8 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 6 1 9 1;
-#X connect 7 0 9 0;
-#X connect 8 0 5 1;
-#X connect 10 0 18 0;
-#X connect 10 1 19 0;
-#X connect 11 0 12 0;
-#X connect 12 0 16 0;
-#X connect 12 1 15 0;
-#X connect 13 0 14 0;
-#X connect 13 0 17 0;
-#X connect 13 0 20 0;
-#X connect 14 0 13 1;
-#X connect 15 0 13 1;
-#X connect 16 0 13 0;
-#X connect 17 0 16 1;
-#X connect 18 0 21 0;
-#X connect 19 0 21 0;
-#X connect 20 0 10 0;
-#X connect 20 1 21 1;
-#X restore 375 76 pd regenerate-tables;
-#X restore 260 101 pd conversion-tables;
-#X connect 1 0 9 0;
-#X connect 2 0 1 0;
-#X connect 3 0 1 1;
-#X connect 4 0 7 0;
-#X connect 4 0 8 0;
-#X connect 5 0 2 0;
-#X connect 7 0 10 0;
-#X connect 8 0 12 0;
-#X connect 9 0 0 0;
-#X connect 10 0 3 0;
-#X connect 10 0 5 0;
-#X connect 11 0 9 1;
-#X connect 12 0 11 0;
-#X connect 13 0 4 0;
-#X restore 75 129 pd test-input;
-#X text 328 322 updated for Pd version 0.26;
-#X text 62 8 REVERBERATOR;
-#X floatatom 75 100 0 0 0;
-#X text 126 105 <-- pitch;
-#X floatatom 137 219 0 0 0;
-#N canvas 159 26 618 379 output 0;
-#X obj 393 156 t b;
-#X obj 393 106 f;
-#X obj 393 56 inlet;
-#X text 399 25 mute;
-#X obj 393 181 f;
-#X msg 480 174 0;
-#X msg 393 81 bang;
-#X obj 393 131 moses 1;
-#X obj 480 149 t b f;
-#X obj 452 113 moses 1;
-#X obj 138 144 dbtorms;
-#X obj 452 88 r master-lvl;
-#X obj 138 38 r master-lvl;
-#X obj 393 206 s master-lvl;
-#X obj 22 140 inlet~;
-#X obj 254 37 inlet;
-#X text 254 14 level;
-#X obj 254 96 s master-lvl;
-#X msg 151 61 set \$1;
-#X obj 151 85 outlet;
-#X msg 269 60 \; pd dsp 1;
-#X obj 138 190 line~;
-#X obj 22 231 *~;
-#X obj 138 167 pack 0 50;
-#X text 34 118 audio;
-#X text 148 106 show level;
-#X obj 73 140 inlet~;
-#X obj 73 232 *~;
-#X obj 22 260 dac~ 1;
-#X obj 73 260 dac~ 2;
-#X obj 22 182 hip~ 5;
-#X obj 73 181 hip~ 5;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 23 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 30 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 21 0 27 1;
-#X connect 22 0 28 0;
-#X connect 23 0 21 0;
-#X connect 26 0 31 0;
-#X connect 27 0 29 0;
-#X connect 30 0 22 0;
-#X connect 31 0 27 0;
-#X restore 75 247 pd output;
-#X msg 166 219 MUTE;
-#X text 184 217 <-- output amplitude;
-#N canvas 137 269 1056 577 reverb 0;
-#X obj 77 37 inlet~;
-#X obj 77 85 echo echo-del2 8.45346;
-#X obj 77 61 echo echo-del1 5.43216;
-#X obj 77 109 echo echo-del3 13.4367;
-#X obj 77 133 echo echo-del4 21.5463;
-#X obj 77 157 echo echo-del5 34.3876;
-#X obj 77 181 echo echo-del6 55.5437;
-#X obj 253 545 delwrite~ loop-del1 70;
-#X obj 295 157 delread~ loop-del1 70;
-#X obj 466 157 delread~ loop-del2 81.9345;
-#X obj 416 545 delwrite~ loop-del2 81.9345;
-#X obj 665 154 delread~ loop-del3 94.7545;
-#X obj 855 154 delread~ loop-del4 115.945;
-#X obj 622 545 delwrite~ loop-del3 94.7545;
-#X obj 820 545 delwrite~ loop-del4 115.945;
-#X obj 282 215 +~;
-#X obj 443 215 +~;
-#X obj 187 251 outlet~;
-#X obj 364 244 outlet~;
-#X obj 251 337 +~;
-#X obj 619 328 +~;
-#X obj 408 334 -~;
-#X obj 791 327 -~;
-#X obj 251 391 +~;
-#X obj 411 397 +~;
-#X obj 615 407 -~;
-#X obj 785 388 -~;
-#X obj 620 474 *~ 0;
-#X obj 620 511 lop~ 5000;
-#X obj 415 472 *~ 0;
-#X obj 415 510 lop~ 5000;
-#X obj 246 475 *~ 0;
-#X obj 246 513 lop~ 5000;
-#X obj 821 472 *~ 0;
-#X obj 821 506 lop~ 5000;
-#X obj 924 254 inlet;
-#X obj 924 278 moses 100;
-#X obj 926 325 moses -100;
-#X msg 979 303 100;
-#X msg 930 349 -100;
-#X obj 934 386 / 200;
-#X connect 0 0 2 0;
-#X connect 1 0 3 0;
-#X connect 1 1 3 1;
-#X connect 2 0 1 0;
-#X connect 2 1 1 1;
-#X connect 3 0 4 0;
-#X connect 3 1 4 1;
-#X connect 4 0 5 0;
-#X connect 4 1 5 1;
-#X connect 5 0 6 0;
-#X connect 5 1 6 1;
-#X connect 6 0 15 0;
-#X connect 6 1 16 0;
-#X connect 8 0 15 1;
-#X connect 9 0 16 1;
-#X connect 11 0 19 1;
-#X connect 11 0 21 1;
-#X connect 12 0 20 1;
-#X connect 12 0 22 1;
-#X connect 15 0 17 0;
-#X connect 15 0 19 0;
-#X connect 15 0 21 0;
-#X connect 16 0 18 0;
-#X connect 16 0 20 0;
-#X connect 16 0 22 0;
-#X connect 19 0 23 0;
-#X connect 19 0 25 0;
-#X connect 20 0 25 1;
-#X connect 20 0 23 1;
-#X connect 21 0 24 0;
-#X connect 21 0 26 0;
-#X connect 22 0 24 1;
-#X connect 22 0 26 1;
-#X connect 23 0 27 0;
-#X connect 24 0 29 0;
-#X connect 25 0 31 0;
-#X connect 26 0 33 0;
-#X connect 27 0 28 0;
-#X connect 28 0 13 0;
-#X connect 29 0 30 0;
-#X connect 30 0 10 0;
-#X connect 31 0 32 0;
-#X connect 32 0 7 0;
-#X connect 33 0 34 0;
-#X connect 34 0 14 0;
-#X connect 35 0 36 0;
-#X connect 36 0 37 0;
-#X connect 36 1 38 0;
-#X connect 37 0 39 0;
-#X connect 37 1 40 0;
-#X connect 38 0 37 0;
-#X connect 39 0 40 0;
-#X connect 40 0 33 1;
-#X connect 40 0 31 1;
-#X connect 40 0 29 1;
-#X connect 40 0 27 1;
-#X restore 50 193 pd reverb;
-#X floatatom 108 163 0 0 0;
-#X text 143 163 <-- feedback (100 maximum);
-#X text 32 41 Here is a simple recirculating reverberator. "Feedback"
-should be between -100 and 100;
-#X text 37 285 You can spend a lifetime tweaking reverberators... we'll
-just leave it at that for now.;
-#X connect 0 0 9 0;
-#X connect 0 0 6 0;
-#X connect 3 0 0 0;
-#X connect 5 0 6 2;
-#X connect 6 0 5 0;
-#X connect 7 0 6 3;
-#X connect 9 0 6 0;
-#X connect 9 1 6 1;
-#X connect 10 0 9 1;
diff --git a/pd/doc/3.audio.examples/58.PART8.moreFM.pd b/pd/doc/3.audio.examples/58.PART8.moreFM.pd
deleted file mode 100644
index 1b0e112b..00000000
--- a/pd/doc/3.audio.examples/58.PART8.moreFM.pd
+++ /dev/null
@@ -1,132 +0,0 @@
-#N canvas 25 100 785 694 12;
-#X floatatom 197 602 0 0 0;
-#N canvas 159 26 541 274 output 0;
-#X obj 351 166 t b;
-#X obj 351 114 f;
-#X obj 351 62 inlet;
-#X text 358 30 mute;
-#X obj 351 192 f;
-#X msg 442 186 0;
-#X msg 351 88 bang;
-#X obj 351 140 moses 1;
-#X obj 413 114 moses 1;
-#X obj 86 153 dbtorms;
-#X obj 413 88 r master-lvl;
-#X obj 86 44 r master-lvl;
-#X obj 351 218 s master-lvl;
-#X obj 12 166 inlet~;
-#X obj 207 43 inlet;
-#X text 207 19 level;
-#X obj 207 104 s master-lvl;
-#X msg 100 67 set \$1;
-#X obj 100 93 outlet;
-#X msg 222 67 \; pd dsp 1;
-#X obj 86 205 line~;
-#X obj 12 218 *~;
-#X obj 12 244 dac~;
-#X obj 86 179 pack 0 50;
-#X text 12 142 audio;
-#X text 100 118 show level;
-#X obj 12 192 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 158 630 pd output;
-#X msg 234 602 MUTE;
-#X text 528 618 updated for Pd version 0.34;
-#X text 277 601 <-- output;
-#X text 79 4 FM \, PWM \, PAF as formant generators;
-#X text 39 22 The next several patches illustrate "Synthesizing Sounds
-with Specified \, Time-Varying Spectra" presented at ICMC 2001 and
-reprinted on http://www.crca.ucsd.edu/~msp/publications.html.;
-#X obj 146 468 line~;
-#X obj 146 444 pack 0 50;
-#X floatatom 146 389 0 0 0;
-#X obj 124 493 *~;
-#X text 145 367 index;
-#X floatatom 248 398 0 0 0;
-#X text 250 370 carrier freq;
-#X obj 158 547 cos~;
-#X graph graph1 0 0 128 500 499 556 755 426;
-#X array spectrum 128 float 0;
-#X pop;
-#X msg 233 546 bang;
-#X text 271 543 <-- click to graph;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 187 574 pd fft;
-#X text 490 562 0;
-#X text 738 559 5512;
-#X obj 153 520 +~;
-#X obj 248 448 phasor~;
-#X obj 23 458 osc~ 172.266;
-#X obj 146 417 / 100;
-#X obj 248 422 * 172.266;
-#X text 34 93 First compare this phase modulation example with the
-ring modulation example from the section on processing (patch 51).
-Here we choose a convenient \, fixed modulation frequency and consider
-the effect of changing carrier frequency and modulation index. It's
-exactly as if the carrier frequency were a ring modulation frequency.
-;
-#X text 33 331 Next we'll look at two techniques for sliding a formant
-frequency without losing harmonicity.;
-#X text 33 191 Using either method we can synthesize the hat-shaped
-spectra called "formants." However \, if you try to move the formant
-up or down in frequency \, you'll lose harmonicity \; the partials
-are only integer multiples of the fundamental \, 172.266 \, when the
-carrier is an integer multiple. To hear this \, set index to 20 and
-carrier frequency to zero \, and scroll carrier through integers. Then
-shift-drag on the carrier frequency to change it in hundredths. Presto
-\, inharmonic sounds...;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 7 0 10 1;
-#X connect 8 0 7 0;
-#X connect 9 0 24 0;
-#X connect 10 0 21 0;
-#X connect 12 0 25 0;
-#X connect 14 0 1 0;
-#X connect 14 0 18 0;
-#X connect 16 0 18 1;
-#X connect 21 0 14 0;
-#X connect 22 0 21 1;
-#X connect 23 0 10 0;
-#X connect 24 0 8 0;
-#X connect 25 0 22 0;
diff --git a/pd/doc/3.audio.examples/59.packets.pd b/pd/doc/3.audio.examples/59.packets.pd
deleted file mode 100644
index 072ae27d..00000000
--- a/pd/doc/3.audio.examples/59.packets.pd
+++ /dev/null
@@ -1,161 +0,0 @@
-#N canvas 83 221 878 705 12;
-#X obj 315 424 line~;
-#X obj 47 517 cos~;
-#X graph graph1 0 -2 882 2 644 469 844 339;
-#X array pulse-output 882 float 0;
-#X pop;
-#X floatatom 84 633 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 48 660 pd output;
-#X msg 124 633 MUTE;
-#X obj 315 400 pack 0 50;
-#X floatatom 315 328 0 0 0;
-#X obj 47 429 -~ 0.5;
-#X obj 47 468 *~;
-#X obj 315 352 / 10;
-#X obj 47 493 clip~ -0.5 0.5;
-#X text 315 306 bandwidth;
-#X msg 165 602 bang;
-#X obj 315 448 +~ 1;
-#X obj 48 540 +~ 1;
-#X obj 197 513 cos~;
-#X obj 48 569 *~;
-#X floatatom 219 342 4 0 0;
-#X obj 219 366 / 10;
-#X text 644 472 --- 0.02 seconds ---;
-#X obj 197 487 *~;
-#N canvas 204 427 939 588 graph 0;
-#X obj 91 345 inlet~;
-#X obj 729 341 inlet;
-#X obj 74 395 tabwrite~ pulse-output;
-#X obj 319 350 inlet~;
-#X obj 493 343 inlet~;
-#X obj 302 400 tabwrite~ window;
-#X obj 484 401 tabwrite~ carrier;
-#X msg 390 53 \; array2 rename window;
-#X connect 0 0 2 0;
-#X connect 1 0 2 0;
-#X connect 1 0 5 0;
-#X connect 1 0 6 0;
-#X connect 3 0 5 0;
-#X connect 4 0 6 0;
-#X restore 76 602 pd graph;
-#X obj 315 376 max 0;
-#X obj 219 438 line~;
-#X obj 219 414 pack 0 50;
-#X obj 219 390 max 0;
-#X graph graph3 0 -2 881 2 644 328 844 188;
-#X array carrier 882 float 0;
-#X pop;
-#X graph graph4 0 -2 881 2 645 175 845 35;
-#X array window 882 float 0;
-#X pop;
-#X text 211 601 <-- graph;
-#X floatatom 47 381 4 0 0;
-#X obj 47 405 phasor~ 100;
-#X text 31 2 WINDOWED PACKETS;
-#X text 169 632 <-- output;
-#X text 43 356 freq.;
-#X text 43 337 fundamental;
-#X text 28 51 The simpler technique is to synthesize enveloped sinusoidal
-wave packets. The packets should repeat at the fundamental frequency
-\, but the frequency of the packet itself controls the center frequency
-of the formant. The length of the packet varies inversely with bandwidth.
-;
-#X text 27 132 In the patch below \, the "clip~" followed by "cos~"
-and "+~ 1" is the enveloping ("windowing" function \, which appears
-in the top graph. This is just the original PWM patch from part 2 The
-carrier \, on the other hand \, is a broken sinusoid made by amplifying
-the phasor~ (the "*~" controlled by "center freq.") and taking the
-cos~ of the result. The "breaks" in the sinusoid only occur when the
-enveloping signal is zero.;
-#X text 197 256 center;
-#X text 195 275 freq. (in;
-#X text 194 294 tenths of;
-#X text 193 314 fundamental);
-#X text 92 535 window;
-#X text 233 487 magnified phase;
-#X text 278 531 desired center frequency;
-#X text 250 514 <--this cosine goes at the;
-#X text 279 550 but its phase is reset each;
-#X text 277 569 fundamental period.;
-#X text 612 666 updated for Pd version 0.34;
-#X connect 0 0 14 0;
-#X connect 1 0 15 0;
-#X connect 3 0 4 1;
-#X connect 4 0 3 0;
-#X connect 5 0 4 2;
-#X connect 6 0 0 0;
-#X connect 7 0 10 0;
-#X connect 8 0 9 0;
-#X connect 8 0 21 0;
-#X connect 9 0 11 0;
-#X connect 10 0 23 0;
-#X connect 11 0 1 0;
-#X connect 13 0 22 3;
-#X connect 14 0 9 1;
-#X connect 15 0 17 0;
-#X connect 15 0 22 1;
-#X connect 16 0 17 1;
-#X connect 16 0 22 2;
-#X connect 17 0 22 0;
-#X connect 17 0 4 0;
-#X connect 18 0 19 0;
-#X connect 19 0 26 0;
-#X connect 21 0 16 0;
-#X connect 23 0 6 0;
-#X connect 24 0 21 1;
-#X connect 25 0 24 0;
-#X connect 26 0 25 0;
-#X connect 30 0 31 0;
-#X connect 31 0 8 0;
diff --git a/pd/doc/3.audio.examples/61.two.cosines.pd b/pd/doc/3.audio.examples/61.two.cosines.pd
deleted file mode 100644
index 0f813164..00000000
--- a/pd/doc/3.audio.examples/61.two.cosines.pd
+++ /dev/null
@@ -1,124 +0,0 @@
-#N canvas 10 49 705 610 12;
-#X floatatom 262 549 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 226 576 pd output;
-#X msg 302 549 MUTE;
-#X msg 59 550 bang;
-#X obj 185 427 cos~;
-#X floatatom 232 217 4 0 0;
-#X obj 232 241 / 10;
-#X text 464 288 --- 0.02 seconds ---;
-#X obj 185 397 *~;
-#X text 236 133 center;
-#X obj 232 313 line~;
-#X obj 232 265 max 0;
-#X graph graph3 0 -2 881 2 450 276 650 136;
-#X array carrier 882 float 0;
-#X pop;
-#X floatatom 33 284 4 0 0;
-#X text 29 240 fundamental;
-#X text 31 2 ADDING TWO COSINES;
-#X text 234 152 freq. (in;
-#X text 233 171 tenths of;
-#X text 232 191 fundamental);
-#X text 29 259 frequency;
-#X obj 227 427 cos~;
-#X obj 268 340 wrap~;
-#X obj 232 367 -~;
-#X obj 227 397 +~;
-#X obj 232 464 -~;
-#X obj 247 494 *~;
-#X obj 225 519 +~;
-#X obj 59 578 tabwrite~ carrier;
-#X obj 33 308 phasor~ 40;
-#X obj 232 289 pack 0 50;
-#X text 27 36 The other \, spiffier way is to make a sum of cosines
-to interpolate between adjacent harmonics. Suppose for example we want
-a center frequency of 5.3 (in units of the fundamental.) We just take
-partial 5 with amplitude 0.7 and partial 6 with amplitude 0.7:;
-#X text 451 581 updated for Pd version 0.34;
-#X text 281 366 subtract to get the integer part "n";
-#X text 277 399 multiply phase by n and n+1;
-#X text 282 427 synthesize the two partials;
-#X text 54 526 graph;
-#X text 347 548 <--output;
-#X text 323 339 the fractional part "b";
-#X text 280 463 p2 - p1;
-#X text 295 492 b * (p2 - p1);
-#X text 264 519 b * p2 + (1-b) * p1;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 27 0;
-#X connect 4 0 24 1;
-#X connect 4 0 26 0;
-#X connect 5 0 6 0;
-#X connect 6 0 11 0;
-#X connect 8 0 4 0;
-#X connect 8 0 23 0;
-#X connect 10 0 22 0;
-#X connect 10 0 21 0;
-#X connect 11 0 29 0;
-#X connect 13 0 28 0;
-#X connect 20 0 24 0;
-#X connect 21 0 22 1;
-#X connect 21 0 25 1;
-#X connect 22 0 8 1;
-#X connect 23 0 20 0;
-#X connect 24 0 25 0;
-#X connect 25 0 26 1;
-#X connect 26 0 1 0;
-#X connect 26 0 27 0;
-#X connect 28 0 8 0;
-#X connect 28 0 23 1;
-#X connect 29 0 10 0;
diff --git a/pd/doc/3.audio.examples/62.declickit.pd b/pd/doc/3.audio.examples/62.declickit.pd
deleted file mode 100644
index eb296e63..00000000
--- a/pd/doc/3.audio.examples/62.declickit.pd
+++ /dev/null
@@ -1,132 +0,0 @@
-#N canvas 10 49 715 680 12;
-#X floatatom 242 612 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 206 639 pd output;
-#X msg 282 612 MUTE;
-#X obj 165 490 cos~;
-#X obj 165 460 *~;
-#X obj 207 490 cos~;
-#X obj 249 406 wrap~;
-#X obj 212 415 -~;
-#X obj 207 460 +~;
-#X obj 207 525 -~;
-#X obj 227 557 *~;
-#X obj 205 582 +~;
-#X text 454 648 updated for Pd version 0.34;
-#X text 327 611 <--output;
-#X obj 191 184 loadbang;
-#X obj 191 210 metro 400;
-#X obj 203 234 del 200;
-#X obj 204 335 samphold~;
-#X obj 259 364 toggle 20 0 empty empty empty 20 8 0 10 -262144 -1 -1
-0 1;
-#X obj 166 290 sig~;
-#X msg 203 263 3.5;
-#X msg 166 263 2;
-#X obj 23 280 phasor~ 169;
-#N canvas 0 0 600 400 switch 0;
-#X obj 85 52 inlet~;
-#X obj 177 58 inlet~;
-#X obj 298 66 inlet;
-#X obj 112 107 -~;
-#X obj 112 131 *~ 0;
-#X obj 90 157 +~;
-#X obj 160 249 outlet~;
-#X connect 0 0 3 1;
-#X connect 0 0 5 0;
-#X connect 1 0 3 0;
-#X connect 2 0 4 1;
-#X connect 3 0 4 0;
-#X connect 4 0 5 1;
-#X connect 5 0 6 0;
-#X restore 166 364 pd switch;
-#X text 31 2 CHANGING THE CENTER FREQUENCY QUICKLY;
-#X text 313 381 off to hear the straight sig~;
-#X text 286 363 <--on to hear the "samphold~" \,;
-#X text 25 27 Since in the previous patch the amplitudes of the two
-cosines depend on "center frequency" we can't change that discontinuously
-without clicking \, as you hear in this patch. The fix is to use a
-samphold~ object to keep the center frequency frozen except at phase
-crossings. At the phase crossings the two weighted cosines add to one
-\, so we can discontinuously change the frequencies and weights there.
-;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 9 1;
-#X connect 3 0 11 0;
-#X connect 4 0 3 0;
-#X connect 4 0 8 0;
-#X connect 5 0 9 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 4 1;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 1 0;
-#X connect 14 0 15 0;
-#X connect 15 0 21 0;
-#X connect 15 0 16 0;
-#X connect 16 0 20 0;
-#X connect 17 0 23 1;
-#X connect 18 0 23 2;
-#X connect 19 0 17 0;
-#X connect 19 0 23 0;
-#X connect 20 0 19 0;
-#X connect 21 0 19 0;
-#X connect 22 0 4 0;
-#X connect 22 0 8 1;
-#X connect 22 0 17 1;
-#X connect 23 0 7 0;
-#X connect 23 0 6 0;
diff --git a/pd/doc/3.audio.examples/63.sweepable.FM.pd b/pd/doc/3.audio.examples/63.sweepable.FM.pd
deleted file mode 100644
index ff3827ee..00000000
--- a/pd/doc/3.audio.examples/63.sweepable.FM.pd
+++ /dev/null
@@ -1,161 +0,0 @@
-#N canvas 89 117 803 661 12;
-#X floatatom 242 605 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 204 634 pd output;
-#X msg 280 606 MUTE;
-#X obj 165 506 cos~;
-#X obj 165 460 *~;
-#X obj 208 508 cos~;
-#X obj 249 409 wrap~;
-#X obj 212 408 -~;
-#X obj 208 485 +~;
-#X obj 206 543 -~;
-#X obj 226 575 *~;
-#X obj 204 600 +~;
-#X text 520 628 updated for Pd version 0.34;
-#X text 325 605 <--output;
-#X obj 212 378 samphold~;
-#X text 31 2 APPLYING TWO-COSINE CARRIER TO FM;
-#X floatatom 229 238 4 0 0;
-#X obj 229 261 / 10;
-#X text 229 157 center;
-#X obj 229 330 line~;
-#X obj 229 284 max 0;
-#X text 229 177 freq. (in;
-#X text 229 197 tenths of;
-#X text 229 217 fundamental);
-#X obj 229 307 pack 0 50;
-#X obj 118 313 phasor~;
-#X floatatom 118 290 4 0 0;
-#X text 103 237 fundamental;
-#X text 103 257 (= mod freq);
-#X text 432 284 index;
-#X text 432 304 (percent);
-#X floatatom 432 325 4 0 0;
-#X obj 382 391 cos~;
-#X obj 432 394 line~;
-#X obj 382 414 *~;
-#X obj 432 348 / 100;
-#X obj 432 371 pack 0 50;
-#X obj 165 483 +~;
-#X graph graph1 0 0 128 500 515 256 771 126;
-#X array spectrum 128 float 0;
-#X pop;
-#X text 511 261 0;
-#X text 759 258 5512;
-#X msg 117 599 bang;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 68 630 pd fft;
-#X text 25 33 And now we just treat the cosines like carrier signals
-in an FM instrument. This doesn't work as well as you'd wish \, because
-the phases of the partials of the two FM instruments don't line up
-\, so that \, for indices of modulation above about 20% \, you get
-beating effects as the center frequency goes up and down.;
-#X text 385 440 modulating;
-#X text 385 460 oscillator;
-#X text 37 482 both phases-->;
-#X text 6 465 add modulator to;
-#X text 117 577 graph;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 9 1;
-#X connect 3 0 11 0;
-#X connect 4 0 37 0;
-#X connect 5 0 9 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 4 1;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 1 0;
-#X connect 11 0 42 0;
-#X connect 14 0 7 0;
-#X connect 14 0 6 0;
-#X connect 16 0 17 0;
-#X connect 17 0 20 0;
-#X connect 19 0 14 0;
-#X connect 20 0 24 0;
-#X connect 24 0 19 0;
-#X connect 25 0 14 1;
-#X connect 25 0 32 0;
-#X connect 25 0 4 0;
-#X connect 25 0 8 1;
-#X connect 26 0 25 0;
-#X connect 31 0 35 0;
-#X connect 32 0 34 0;
-#X connect 33 0 34 1;
-#X connect 34 0 37 1;
-#X connect 35 0 36 0;
-#X connect 36 0 33 0;
-#X connect 37 0 8 0;
-#X connect 37 0 3 0;
-#X connect 41 0 42 1;
diff --git a/pd/doc/3.audio.examples/64.paf.pd b/pd/doc/3.audio.examples/64.paf.pd
deleted file mode 100644
index 56c024c0..00000000
--- a/pd/doc/3.audio.examples/64.paf.pd
+++ /dev/null
@@ -1,234 +0,0 @@
-#N canvas 53 0 782 687 12;
-#X floatatom 253 735 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 215 764 pd output;
-#X msg 291 735 MUTE;
-#X obj 158 616 cos~;
-#X obj 158 593 *~;
-#X obj 201 616 cos~;
-#X obj 257 542 wrap~;
-#X obj 221 542 -~;
-#X obj 201 593 +~;
-#X obj 194 646 -~;
-#X obj 214 678 *~;
-#X obj 176 678 +~;
-#X text 515 768 updated for Pd version 0.34;
-#X text 336 734 <--output;
-#X obj 221 510 samphold~;
-#X floatatom 221 369 4 0 0;
-#X obj 221 392 / 10;
-#X text 221 288 center;
-#X obj 221 461 line~;
-#X obj 221 415 max 0;
-#X text 221 308 freq. (in;
-#X text 221 328 tenths of;
-#X text 221 348 fundamental);
-#X obj 221 438 pack 0 50;
-#X obj 104 445 phasor~;
-#X floatatom 104 399 4 0 0;
-#X text 84 372 fundamental;
-#X text 435 441 index;
-#X text 435 461 (percent);
-#X floatatom 435 482 4 0 0;
-#X obj 435 528 line~;
-#X obj 343 550 *~;
-#X obj 435 505 pack 0 50;
-#X graph graph1 0 0 128 500 510 395 766 265;
-#X array spectrum 128 float 0;
-#X pop;
-#X text 501 397 0;
-#X text 745 398 5512;
-#X msg 80 713 bang;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 31 745 pd fft;
-#X text 82 687 graph;
-#X text 31 2 THE PAF: TWO-COSINE RING MODULATOR FOR WAVESHAPER;
-#X graph graph4 0 0 199 1 563 718 763 578;
-#X array bell-curve 200 float 1;
-#A 0 1.12535e-07 1.54727e-07 2.12059e-07 2.89706e-07 3.94519e-07 5.35535e-07
-7.24633e-07 9.77371e-07 1.31404e-06 1.76105e-06 2.35258e-06 3.13275e-06
-4.15832e-06 5.50199e-06 7.25659e-06 9.54016e-06 1.25023e-05 1.63317e-05
-2.1266e-05 2.76026e-05 3.57128e-05 4.60584e-05 5.92113e-05 7.58768e-05
-9.69224e-05 0.00012341 0.000156634 0.000198167 0.000249912 0.000314163
-0.000393669 0.000491721 0.000612231 0.000759842 0.000940028 0.00115923
-0.00142498 0.00174605 0.00213263 0.00259648 0.00315111 0.00381201 0.00459678
-0.0055254 0.0066204 0.00790705 0.0094136 0.0111714 0.013215 0.0155826
-0.0183156 0.0214592 0.0250621 0.0291763 0.0338573 0.0391639 0.0451575
-0.0519019 0.0594631 0.0679081 0.0773047 0.0877205 0.0992216 0.111872
-0.125732 0.140858 0.1573 0.1751 0.194291 0.214896 0.236928 0.260383
-0.285247 0.311486 0.339053 0.367879 0.397882 0.428956 0.46098 0.493812
-0.527292 0.561244 0.595473 0.62977 0.663916 0.697676 0.730811 0.763074
-0.794216 0.823987 0.852144 0.878447 0.902668 0.924595 0.944027 0.960789
-0.974725 0.985703 0.99362 0.998401 1 0.998401 0.99362 0.985703 0.974725
-0.960789 0.944027 0.924595 0.902668 0.878447 0.852144 0.823987 0.794216
-0.763074 0.730811 0.697676 0.663916 0.62977 0.595473 0.561244 0.527292
-0.493812 0.46098 0.428956 0.397882 0.367879 0.339053 0.311486 0.285247
-0.260383 0.236928 0.214896 0.194291 0.1751 0.1573 0.140858 0.125732
-0.111872 0.0992216 0.0877205 0.0773047 0.0679081 0.0594631 0.0519019
-0.0451575 0.0391639 0.0338573 0.0291763 0.0250621 0.0214592 0.0183156
-0.0155826 0.013215 0.0111714 0.0094136 0.00790705 0.0066204 0.0055254
-0.00459678 0.00381201 0.00315111 0.00259648 0.00213263 0.00174605 0.00142498
-0.00115923 0.000940028 0.000759842 0.000612231 0.000491721 0.000393669
-0.000314163 0.000249912 0.000198167 0.000156634 0.00012341 9.69224e-05
-7.58768e-05 5.92113e-05 4.60584e-05 3.57128e-05 2.76026e-05 2.1266e-05
-1.63317e-05 1.25023e-05 9.54016e-06 7.25659e-06 5.50199e-06 4.15832e-06
-3.13275e-06 2.35258e-06 1.76105e-06 1.31404e-06 9.77371e-07 7.24633e-07
-5.35535e-07 3.94519e-07 2.89706e-07 2.12059e-07 1.54727e-07;
-#X pop;
-#N canvas 94 264 600 388 make-table 0;
-#X msg 81 44 bang;
-#X obj 81 73 t b b;
-#X obj 159 142 f;
-#X obj 197 142 + 1;
-#X msg 175 112 0;
-#X obj 81 102 until;
-#X obj 161 177 t f f;
-#X obj 76 306 tabwrite bell-curve;
-#X obj 52 270 expr exp(-$f1*$f1);
-#X obj 63 168 sel 199;
-#X obj 51 241 expr ($f1-100)/25;
-#X connect 0 0 1 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 2 0 9 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 0;
-#X connect 6 0 10 0;
-#X connect 6 1 7 1;
-#X connect 8 0 7 0;
-#X connect 9 0 5 1;
-#X connect 10 0 8 0;
-#X restore 627 538 pd make-table;
-#X obj 104 422 * 0.5;
-#X obj 343 527 cos~;
-#X obj 343 504 -~ 0.25;
-#X obj 343 573 +~ 100;
-#X obj 343 596 tabread4~ bell-curve;
-#X obj 104 474 *~ 2;
-#X obj 215 707 *~;
-#X text 25 33 Instead of using the two cosines as FM carrier oscillators
-\, we can use them as ring modulators for a synthetic tone. Here (as
-described in the paper) we use a sinusoid looking up a Gaussian bell
-curve. This has the nice properties that the partials are always positive
-cosines in phase \, and the spectrum spreads out smoothly as the index
-changes.;
-#X text 26 137 We needed the sine wave to have half the fundamental
-frequency \, so we run the phasor~ at half speed but double its output
-to the cosine pair and the samphold~ \, thus giving us the original
-frequency. As to the half-speed signal \, we take its sine (-~ 0.25
-and cos~) \, then center it for lookup in a 200-point table containing
-a bell curve.;
-#X text 251 705 <--ring mod step;
-#X text 375 621 waveshaper;
-#X text 27 239 Then with ~* we do the ring modulation and we're done.
-;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 9 1;
-#X connect 3 0 11 0;
-#X connect 4 0 8 0;
-#X connect 4 0 3 0;
-#X connect 5 0 9 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 4 1;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 48 0;
-#X connect 14 0 7 0;
-#X connect 14 0 6 0;
-#X connect 15 0 16 0;
-#X connect 16 0 19 0;
-#X connect 18 0 14 0;
-#X connect 19 0 23 0;
-#X connect 23 0 18 0;
-#X connect 24 0 44 0;
-#X connect 24 0 47 0;
-#X connect 25 0 42 0;
-#X connect 29 0 32 0;
-#X connect 30 0 31 1;
-#X connect 31 0 45 0;
-#X connect 32 0 30 0;
-#X connect 36 0 37 1;
-#X connect 42 0 24 0;
-#X connect 43 0 31 0;
-#X connect 44 0 43 0;
-#X connect 45 0 46 0;
-#X connect 46 0 48 1;
-#X connect 47 0 14 1;
-#X connect 47 0 4 0;
-#X connect 47 0 8 0;
-#X connect 48 0 1 0;
-#X connect 48 0 37 0;
diff --git a/pd/doc/3.audio.examples/65.paf.control.pd b/pd/doc/3.audio.examples/65.paf.control.pd
deleted file mode 100644
index 7d329357..00000000
--- a/pd/doc/3.audio.examples/65.paf.control.pd
+++ /dev/null
@@ -1,219 +0,0 @@
-#N canvas 89 36 743 752 12;
-#X floatatom 217 684 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 179 713 pd output;
-#X msg 255 684 MUTE;
-#X obj 122 565 cos~;
-#X obj 122 542 *~;
-#X obj 165 565 cos~;
-#X obj 220 510 wrap~;
-#X obj 184 510 -~;
-#X obj 165 542 +~;
-#X obj 158 595 -~;
-#X obj 178 627 *~;
-#X obj 140 627 +~;
-#X text 478 719 updated for Pd version 0.34;
-#X text 299 702 <--output;
-#X obj 184 478 samphold~;
-#X floatatom 183 266 4 0 0;
-#X text 181 218 center;
-#X obj 184 345 line~;
-#X obj 184 322 pack 0 50;
-#X obj 67 413 phasor~;
-#X floatatom 69 305 4 0 0;
-#X text 52 256 fundamental;
-#X floatatom 408 361 4 0 0;
-#X obj 408 438 line~;
-#X obj 306 518 *~;
-#X obj 408 415 pack 0 50;
-#N canvas 94 264 600 388 make-table 0;
-#X msg 81 44 bang;
-#X obj 81 73 t b b;
-#X obj 159 142 f;
-#X obj 197 142 + 1;
-#X msg 175 112 0;
-#X obj 81 102 until;
-#X obj 161 177 t f f;
-#X obj 76 306 tabwrite bell-curve;
-#X obj 52 270 expr exp(-$f1*$f1);
-#X obj 63 168 sel 199;
-#X obj 51 241 expr ($f1-100)/25;
-#X graph graph4 0 0 199 1 342 225 542 85;
-#X array bell-curve 200 float 1;
-#A 0 1.12535e-07 1.54727e-07 2.12059e-07 2.89706e-07 3.94519e-07 5.35535e-07
-7.24633e-07 9.77371e-07 1.31404e-06 1.76105e-06 2.35258e-06 3.13275e-06
-4.15832e-06 5.50199e-06 7.25659e-06 9.54016e-06 1.25023e-05 1.63317e-05
-2.1266e-05 2.76026e-05 3.57128e-05 4.60584e-05 5.92113e-05 7.58768e-05
-9.69224e-05 0.00012341 0.000156634 0.000198167 0.000249912 0.000314163
-0.000393669 0.000491721 0.000612231 0.000759842 0.000940028 0.00115923
-0.00142498 0.00174605 0.00213263 0.00259648 0.00315111 0.00381201 0.00459678
-0.0055254 0.0066204 0.00790705 0.0094136 0.0111714 0.013215 0.0155826
-0.0183156 0.0214592 0.0250621 0.0291763 0.0338573 0.0391639 0.0451575
-0.0519019 0.0594631 0.0679081 0.0773047 0.0877205 0.0992216 0.111872
-0.125732 0.140858 0.1573 0.1751 0.194291 0.214896 0.236928 0.260383
-0.285247 0.311486 0.339053 0.367879 0.397882 0.428956 0.46098 0.493812
-0.527292 0.561244 0.595473 0.62977 0.663916 0.697676 0.730811 0.763074
-0.794216 0.823987 0.852144 0.878447 0.902668 0.924595 0.944027 0.960789
-0.974725 0.985703 0.99362 0.998401 1 0.998401 0.99362 0.985703 0.974725
-0.960789 0.944027 0.924595 0.902668 0.878447 0.852144 0.823987 0.794216
-0.763074 0.730811 0.697676 0.663916 0.62977 0.595473 0.561244 0.527292
-0.493812 0.46098 0.428956 0.397882 0.367879 0.339053 0.311486 0.285247
-0.260383 0.236928 0.214896 0.194291 0.1751 0.1573 0.140858 0.125732
-0.111872 0.0992216 0.0877205 0.0773047 0.0679081 0.0594631 0.0519019
-0.0451575 0.0391639 0.0338573 0.0291763 0.0250621 0.0214592 0.0183156
-0.0155826 0.013215 0.0111714 0.0094136 0.00790705 0.0066204 0.0055254
-0.00459678 0.00381201 0.00315111 0.00259648 0.00213263 0.00174605 0.00142498
-0.00115923 0.000940028 0.000759842 0.000612231 0.000491721 0.000393669
-0.000314163 0.000249912 0.000198167 0.000156634 0.00012341 9.69224e-05
-7.58768e-05 5.92113e-05 4.60584e-05 3.57128e-05 2.76026e-05 2.1266e-05
-1.63317e-05 1.25023e-05 9.54016e-06 7.25659e-06 5.50199e-06 4.15832e-06
-3.13275e-06 2.35258e-06 1.76105e-06 1.31404e-06 9.77371e-07 7.24633e-07
-5.35535e-07 3.94519e-07 2.89706e-07 2.12059e-07 1.54727e-07;
-#X pop;
-#X connect 0 0 1 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 2 0 9 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 0;
-#X connect 6 0 10 0;
-#X connect 6 1 7 1;
-#X connect 8 0 7 0;
-#X connect 9 0 5 1;
-#X connect 10 0 8 0;
-#X restore 573 591 pd make-table;
-#X obj 67 390 * 0.5;
-#X obj 306 495 cos~;
-#X obj 306 472 -~ 0.25;
-#X obj 306 549 +~ 100;
-#X obj 306 572 tabread4~ bell-curve;
-#X obj 67 442 *~ 2;
-#X obj 179 656 *~;
-#X text 338 597 waveshaper;
-#X text 31 2 CHANGING PAF CONTROLS TO NATURAL UNITS;
-#X obj 67 362 mtof;
-#X obj 68 335 max 0;
-#X obj 206 370 expr 1/$f1;
-#X obj 183 296 mtof;
-#X text 181 238 freq.;
-#X obj 184 394 *~;
-#X text 406 340 bandwidth;
-#X obj 408 389 mtof;
-#X obj 408 474 *~;
-#X obj 408 498 *~ 25;
-#X text 25 33 The more "natural" units for describing a formant might
-be center frequency and bandwidth \, so that you can change the fundamental
-without having the formant shift up and down in parallel. Here all
-three frequencies are expressed in MIDI units. The bandwidth and center
-frequency have to be divided by the fundamental (the expr 1/$f1 takes
-its reciprocal and two *~ objects finish the division.);
-#X text 448 473 divide by fundamental;
-#X text 466 497 range for table;
-#X text 372 548 offset to middle of table;
-#X text 191 416 C.F. relative;
-#X text 192 432 to fundamental;
-#X text 48 275 (MIDI units);
-#X text 215 654 ring mod;
-#X text 25 150 And now you essentially have the PAF. Note \, however
-\, that there's a nice paf~ "external" object in the "extras" library
-that does this all more efficiently and takes care of a couple of subtle
-details we don't see here...;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 9 1;
-#X connect 3 0 11 0;
-#X connect 4 0 8 0;
-#X connect 4 0 3 0;
-#X connect 5 0 9 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 4 1;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 33 0;
-#X connect 14 0 7 0;
-#X connect 14 0 6 0;
-#X connect 15 0 39 0;
-#X connect 17 0 41 0;
-#X connect 18 0 17 0;
-#X connect 19 0 29 0;
-#X connect 19 0 32 0;
-#X connect 20 0 37 0;
-#X connect 22 0 43 0;
-#X connect 23 0 44 0;
-#X connect 24 0 30 0;
-#X connect 25 0 23 0;
-#X connect 27 0 19 0;
-#X connect 28 0 24 0;
-#X connect 29 0 28 0;
-#X connect 30 0 31 0;
-#X connect 31 0 33 1;
-#X connect 32 0 14 1;
-#X connect 32 0 4 0;
-#X connect 32 0 8 0;
-#X connect 33 0 1 0;
-#X connect 36 0 27 0;
-#X connect 36 0 38 0;
-#X connect 37 0 36 0;
-#X connect 38 0 41 1;
-#X connect 38 0 44 1;
-#X connect 39 0 18 0;
-#X connect 41 0 14 0;
-#X connect 43 0 25 0;
-#X connect 44 0 45 0;
-#X connect 45 0 24 1;
diff --git a/pd/doc/3.audio.examples/66.PART9.quartic.pd b/pd/doc/3.audio.examples/66.PART9.quartic.pd
deleted file mode 100644
index d71da05a..00000000
--- a/pd/doc/3.audio.examples/66.PART9.quartic.pd
+++ /dev/null
@@ -1,140 +0,0 @@
-#N canvas 57 35 614 650 12;
-#X graph graph1 0 0 40 1 151 551 551 301;
-#X array array-ampdb 41 float 1;
-#A 0 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1;
-#X array array-dbdb 41 float 1;
-#A 0 0 0.025 0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225 0.25 0.275 0.3
-0.325 0.35 0.375 0.4 0.425 0.45 0.475 0.5 0.525 0.55 0.575 0.6 0.625
-0.65 0.675 0.7 0.725 0.75 0.775 0.8 0.825 0.85 0.875 0.9 0.925 0.95
-0.975 1;
-#X array array-4thpow 41 float 1;
-#A 0 0 3.90624e-07 6.25001e-06 3.16406e-05 1e-04 0.000244141 0.00050625
-0.000937891 0.0016 0.00256289 0.00390625 0.00571914 0.0081 0.0111566
-0.0150063 0.0197754 0.0256 0.0326254 0.0410062 0.0509067 0.0625 0.0759691
-0.0915063 0.109313 0.1296 0.152588 0.178506 0.207594 0.2401 0.276282
-0.316406 0.36075 0.4096 0.46325 0.522006 0.586182 0.6561 0.732094 0.814506
-0.903688 1;
-#X pop;
-#N canvas 293 37 890 657 otherstuff 0;
-#X obj 42 438 loadbang;
-#X msg 259 94 bang;
-#X obj 259 123 t b b;
-#X obj 337 192 f;
-#X obj 375 192 + 1;
-#X msg 353 162 0;
-#X obj 259 152 until;
-#X obj 263 329 dbtorms;
-#X obj 339 227 t f f;
-#X msg 51 101 bang;
-#X obj 51 130 t b b;
-#X obj 129 199 f;
-#X obj 167 199 + 1;
-#X msg 145 169 0;
-#X obj 51 159 until;
-#X obj 131 234 t f f;
-#X obj 59 339 tabwrite array-dbdb;
-#X obj 263 355 tabwrite array-ampdb;
-#X msg 505 98 bang;
-#X obj 505 127 t b b;
-#X obj 583 196 f;
-#X obj 621 196 + 1;
-#X msg 599 166 0;
-#X obj 505 156 until;
-#X obj 585 231 t f f;
-#X obj 559 432 expr $f1 * $f1 * $f1 * $f1;
-#X obj 559 341 expr 1 + $f2 * ($f1 - 1);
-#X obj 705 253 loadbang;
-#X floatatom 703 309 0 0 0;
-#X msg 705 281 1;
-#X obj 559 385 max 0;
-#X obj 561 464 tabwrite array-4thpow;
-#X obj 263 274 + 100;
-#X obj 51 232 sel 40;
-#X obj 258 221 sel 40;
-#X obj 503 226 sel 40;
-#X obj 559 300 / 40;
-#X obj 263 302 - 40;
-#X obj 93 303 / 40;
-#X msg 43 465 \; graph1 xlabel -0.03 0 10 20 30 40 \; graph1 ylabel
--2 0.25 0.5 0.75 1;
-#X text 53 27 (here's how I computed the three transfer functions...)
-;
-#X connect 0 0 39 0;
-#X connect 1 0 2 0;
-#X connect 2 0 6 0;
-#X connect 2 1 5 0;
-#X connect 3 0 4 0;
-#X connect 3 0 8 0;
-#X connect 3 0 34 0;
-#X connect 4 0 3 1;
-#X connect 5 0 3 1;
-#X connect 6 0 3 0;
-#X connect 7 0 17 0;
-#X connect 8 0 32 0;
-#X connect 8 1 17 1;
-#X connect 9 0 10 0;
-#X connect 10 0 14 0;
-#X connect 10 1 13 0;
-#X connect 11 0 12 0;
-#X connect 11 0 15 0;
-#X connect 11 0 33 0;
-#X connect 12 0 11 1;
-#X connect 13 0 11 1;
-#X connect 14 0 11 0;
-#X connect 15 0 38 0;
-#X connect 15 1 16 1;
-#X connect 18 0 19 0;
-#X connect 19 0 23 0;
-#X connect 19 1 22 0;
-#X connect 20 0 21 0;
-#X connect 20 0 24 0;
-#X connect 20 0 35 0;
-#X connect 21 0 20 1;
-#X connect 22 0 20 1;
-#X connect 23 0 20 0;
-#X connect 24 0 36 0;
-#X connect 24 1 31 1;
-#X connect 25 0 31 0;
-#X connect 26 0 30 0;
-#X connect 27 0 29 0;
-#X connect 28 0 26 1;
-#X connect 29 0 28 0;
-#X connect 30 0 25 0;
-#X connect 32 0 37 0;
-#X connect 33 0 14 1;
-#X connect 34 0 6 1;
-#X connect 35 0 23 1;
-#X connect 36 0 26 0;
-#X connect 37 0 7 0;
-#X connect 38 0 16 0;
-#X restore 53 608 pd otherstuff;
-#X text 292 403 linear;
-#X text 279 509 decibels;
-#X text 387 518 quartic;
-#X text 45 5 QUARTIC CURVES AS THE IDEAL AMPLITUDE AND FREQUENCY SCALERS
-;
-#X text 346 611 updated for Pd version 0.34;
-#X text 246 578 units-->;
-#X text 45 447 amplitude;
-#X text 79 429 |;
-#X text 79 420 |;
-#X text 79 410 |;
-#X text 79 402 |;
-#X text 78 398 ^;
-#X text 38 149 The graph below shows that a simple quartic curve \,
-x-to-the-fourth-power \, twists like decibels but--unlike decibels--actually
-hits zero at left. You get the best of both worlds. Moreover \, raising
-something to the fourth power is very cheap: just two multiplications--whereas
-\, if you're computing envelopes in dB \, eventually you'll have to
-exponentiate \, sample by sample \, to get to linear units.;
-#X text 36 34 It's an old saw that we perceive amplitude and frequency
-logarithmically. But using decibels as a unit for controlling amplitude
-and frequency gets ugly for two reasons. First \, it's expensive to
-do the conversion. Second and more profoundly \, decibels grow by shifting
-\, and things should grow by scaling \, so that \, for example \, zero
-really means "nothing.";
diff --git a/pd/doc/3.audio.examples/67.more.quartic.pd b/pd/doc/3.audio.examples/67.more.quartic.pd
deleted file mode 100644
index fdb01dab..00000000
--- a/pd/doc/3.audio.examples/67.more.quartic.pd
+++ /dev/null
@@ -1,147 +0,0 @@
-#N canvas 130 66 880 587 12;
-#X floatatom 89 506 0 0 100;
-#N canvas 159 26 516 274 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 396 182 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 391 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 391 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 104 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 159 audio;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X restore 51 534 pd output;
-#X msg 127 507 MUTE;
-#X obj 32 441 *~;
-#X obj 12 469 -~;
-#X obj 73 446 *~;
-#X floatatom 170 421 1 0 100;
-#X obj 365 337 osc~;
-#X obj 365 362 *~;
-#X obj 425 342 line~;
-#X obj 365 312 line~;
-#X obj 550 468 osc~;
-#X obj 599 496 *~;
-#X obj 621 379 line~;
-#X obj 550 379 line~;
-#X obj 550 326 sqrt;
-#X obj 550 352 sqrt;
-#X obj 621 326 sqrt;
-#X obj 621 352 sqrt;
-#X obj 550 411 *~;
-#X obj 550 441 *~;
-#X obj 621 411 *~;
-#X obj 621 440 *~;
-#X obj 550 301 unpack;
-#X obj 621 301 unpack;
-#X obj 365 287 r freq;
-#X obj 425 318 r amp;
-#X obj 550 276 r freq;
-#X obj 621 276 r amp;
-#X obj 365 388 s~ linear;
-#X obj 599 523 s~ quartic;
-#X obj 12 377 r~ linear;
-#X obj 56 406 r~ quartic;
-#X msg 27 185 \; amp 0 5000 \;;
-#X msg 29 139 \; amp 1 5000 \;;
-#X msg 139 185 \; amp 0 1000 \;;
-#X msg 141 139 \; amp 1 1000 \;;
-#X msg 26 238 \; freq 1760 5000 \;;
-#X msg 29 286 \; freq 55 5000 \;;
-#X msg 180 238 \; freq 1760 1000 \;;
-#X msg 183 286 \; freq 55 1000 \;;
-#X text 90 15 QUARTIC AND LINEAR ENVELOPES COMPARED;
-#X obj 202 488 loadbang;
-#X msg 202 516 \; amp 1 \; freq 1760;
-#X text 194 414 1 for quartic \; 0 for linear;
-#X text 19 39 This patch has two sine wave oscillators \, one with
-linear envelopes \, the other with quartic ones which sound more uniform.
-The "toggle switch" at bottom selects between the two \, and the message
-boxes sweep the amplitude and frequency up and down.;
-#X text 366 257 LINEAR;
-#X text 555 249 QUARTIC;
-#X text 335 120 The two oscillators are below. In the quartic one \,
-for both the amplitude and the frequency \, we have to take the fourth
-root of the target value (which we get by taking square root twice.)
-Then we raise the line~ output to the fourth power by squaring twice
-(the *~ objects \, whose left and right inlets are the same.) The cost
-is mostly that of the four additional *~ objects.;
-#X text 579 560 updated for Pd version 0.34;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 4 1;
-#X connect 4 0 1 0;
-#X connect 5 0 1 0;
-#X connect 6 0 5 1;
-#X connect 6 0 3 1;
-#X connect 7 0 8 0;
-#X connect 8 0 29 0;
-#X connect 9 0 8 1;
-#X connect 10 0 7 0;
-#X connect 11 0 12 0;
-#X connect 12 0 30 0;
-#X connect 13 0 21 0;
-#X connect 13 0 21 1;
-#X connect 14 0 19 0;
-#X connect 14 0 19 1;
-#X connect 15 0 16 0;
-#X connect 16 0 14 0;
-#X connect 17 0 18 0;
-#X connect 18 0 13 0;
-#X connect 19 0 20 0;
-#X connect 19 0 20 1;
-#X connect 20 0 11 0;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 22 0 12 1;
-#X connect 23 0 15 0;
-#X connect 23 1 14 1;
-#X connect 24 0 17 0;
-#X connect 24 1 13 1;
-#X connect 25 0 10 0;
-#X connect 26 0 9 0;
-#X connect 27 0 23 0;
-#X connect 28 0 24 0;
-#X connect 31 0 3 0;
-#X connect 31 0 4 0;
-#X connect 32 0 5 0;
-#X connect 42 0 43 0;
diff --git a/pd/doc/3.audio.examples/68.qlist.pd b/pd/doc/3.audio.examples/68.qlist.pd
deleted file mode 100644
index 58495ca1..00000000
--- a/pd/doc/3.audio.examples/68.qlist.pd
+++ /dev/null
@@ -1,102 +0,0 @@
-#N canvas 233 179 684 516 12;
-#X floatatom 57 459 0 0 0;
-#N canvas 159 26 497 272 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 159 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 19 488 pd output;
-#X msg 95 459 MUTE;
-#X obj 19 211 osc-voice amp1 pit1;
-#X obj 19 240 osc-voice amp2 pit2;
-#X obj 19 269 osc-voice amp3 pit3;
-#X obj 19 298 osc-voice amp4 pit4;
-#X obj 19 327 osc-voice amp5 pit5;
-#X obj 19 356 osc-voice amp6 pit6;
-#X obj 19 385 osc-voice amp7 pit7;
-#X obj 19 414 osc-voice amp8 pit8;
-#X obj 467 382 qlist;
-#X msg 389 226 stop;
-#X msg 527 339 read qlist.txt;
-#X obj 527 294 loadbang;
-#X text 261 203 start;
-#X text 391 202 stop;
-#X text 537 318 reread file;
-#X msg 470 238 rewind;
-#X msg 538 238 next;
-#X msg 258 254 tempo 100 \, bang;
-#X msg 253 227 tempo 1 \, bang;
-#X text 82 11 USING QLIST TO SEQUENCE AN OSCILLATOR BANK;
-#X text 474 215 single step;
-#X obj 556 454 r #;
-#X text 35 61 Here is an eight voice additive synthesis patch controlled
-by a qlist. Open a text editor on the file \, "qlist.txt" \, to see
-how the oscillators' amplitudes and frequencies are specified. The
-abstraction \, "osc-voice" \, shows an effective way to make patches
-react to qlists but also to mousing.;
-#X text 258 453 this is where qlist comments go:;
-#X text 418 485 updatged for Pd version 0.34;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 4 0;
-#X connect 4 0 5 0;
-#X connect 5 0 6 0;
-#X connect 6 0 7 0;
-#X connect 7 0 8 0;
-#X connect 8 0 9 0;
-#X connect 9 0 10 0;
-#X connect 10 0 1 0;
-#X connect 12 0 11 0;
-#X connect 13 0 11 0;
-#X connect 14 0 13 0;
-#X connect 18 0 11 0;
-#X connect 19 0 11 0;
-#X connect 20 0 11 0;
-#X connect 21 0 11 0;
diff --git a/pd/doc/3.audio.examples/69.more.adsr.pd b/pd/doc/3.audio.examples/69.more.adsr.pd
deleted file mode 100644
index 5b38917a..00000000
--- a/pd/doc/3.audio.examples/69.more.adsr.pd
+++ /dev/null
@@ -1,117 +0,0 @@
-#N canvas 105 38 705 609 12;
-#X obj 39 140 r trigger;
-#X floatatom 70 376 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 351 166 t b;
-#X obj 351 114 f;
-#X obj 351 62 inlet;
-#X text 358 30 mute;
-#X obj 351 192 f;
-#X msg 442 185 0;
-#X msg 351 88 bang;
-#X obj 351 140 moses 1;
-#X obj 442 159 t b f;
-#X obj 413 122 moses 1;
-#X obj 86 154 dbtorms;
-#X obj 413 96 r master-lvl;
-#X obj 86 44 r master-lvl;
-#X obj 351 218 s master-lvl;
-#X obj 23 188 inlet~;
-#X obj 207 42 inlet;
-#X text 207 19 level;
-#X obj 207 104 s master-lvl;
-#X msg 100 67 set \$1;
-#X obj 100 93 outlet;
-#X msg 222 66 \; pd dsp 1;
-#X obj 86 202 line~;
-#X obj 23 221 *~;
-#X obj 23 250 dac~;
-#X obj 86 178 pack 0 50;
-#X text 21 165 audio;
-#X text 97 114 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 39 406 pd output;
-#X msg 107 376 MUTE;
-#X text 150 375 <-- output amplitude;
-#X text 518 189 <-- attack;
-#X text 485 281 <-- release;
-#X obj 39 338 *~;
-#X obj 39 282 *~;
-#X obj 39 310 *~;
-#X obj 80 340 osc~ 440;
-#X text 88 9 ADSR envelope;
-#X text 35 29 You can use the quartic trick to simplify patches using
-ADSR envelopes. For amplitude control it's especially simple. It's
-usually good enough in practice to control amplitudes by ranging an
-ADSR from 0 to 1 (divide by 100 so your input range can be a comfortable
-0-100) \, then take fourth power:;
-#X obj 77 227 / 100;
-#X floatatom 77 197 3 0 100;
-#X msg 383 269 \; trigger 0;
-#X obj 39 166 unpack;
-#X floatatom 39 197 1 0 100;
-#X msg 383 175 \; trigger 1 100;
-#X text 503 229 <-- softer attack;
-#X msg 382 222 \; trigger 1 60;
-#X text 441 583 updated for Pd version 0.34;
-#X text 14 437 Note that the units aren't dB \; for most of the range
-0-100 it's about 0.4 dB per unit. If you want something closer to dB
-\, you can set the scale as 0-40 instead of 0-100 (just change "/ 100"
-to "/ 40") and then you'll get the response shown in the first patch
-in this section.;
-#X obj 596 519 *~;
-#X obj 596 547 *~;
-#X floatatom 605 390 3 0 100;
-#X obj 605 416 mtof;
-#X obj 605 441 sqrt;
-#X obj 605 466 sqrt;
-#X text 174 526 To use ADSR to control pitch \, you should;
-#X text 173 545 usually just use real pitch units like this-->;
-#X obj 596 490 adsr 0;
-#X obj 39 253 adsr 0 100 200 70 300;
-#X connect 0 0 16 0;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 7 0 2 0;
-#X connect 8 0 9 0;
-#X connect 8 0 9 1;
-#X connect 9 0 7 0;
-#X connect 10 0 7 1;
-#X connect 13 0 32 1;
-#X connect 14 0 13 0;
-#X connect 16 0 17 0;
-#X connect 16 1 14 0;
-#X connect 17 0 32 0;
-#X connect 23 0 24 0;
-#X connect 23 0 24 1;
-#X connect 25 0 26 0;
-#X connect 26 0 27 0;
-#X connect 27 0 28 0;
-#X connect 28 0 31 1;
-#X connect 31 0 23 0;
-#X connect 31 0 23 1;
-#X connect 32 0 8 0;
-#X connect 32 0 8 1;
diff --git a/pd/doc/3.audio.examples/70.vibrato.pd b/pd/doc/3.audio.examples/70.vibrato.pd
deleted file mode 100644
index 78c38efd..00000000
--- a/pd/doc/3.audio.examples/70.vibrato.pd
+++ /dev/null
@@ -1,158 +0,0 @@
-#N canvas 80 10 736 726 12;
-#X obj 27 220 r trigger;
-#X floatatom 65 581 0 0 0;
-#N canvas 159 26 531 288 output 0;
-#X obj 351 166 t b;
-#X obj 351 114 f;
-#X obj 351 62 inlet;
-#X text 358 30 mute;
-#X obj 351 192 f;
-#X msg 442 185 0;
-#X msg 351 88 bang;
-#X obj 351 140 moses 1;
-#X obj 413 122 moses 1;
-#X obj 86 154 dbtorms;
-#X obj 413 96 r master-lvl;
-#X obj 86 44 r master-lvl;
-#X obj 351 218 s master-lvl;
-#X obj 24 163 inlet~;
-#X obj 207 42 inlet;
-#X text 207 19 level;
-#X obj 207 104 s master-lvl;
-#X msg 100 67 set \$1;
-#X obj 100 93 outlet;
-#X msg 222 66 \; pd dsp 1;
-#X obj 86 202 line~;
-#X obj 23 221 *~;
-#X obj 23 250 dac~;
-#X obj 86 178 pack 0 50;
-#X text 22 140 audio;
-#X obj 442 159 t b;
-#X obj 21 191 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 25 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 25 0 5 0;
-#X connect 26 0 21 0;
-#X restore 26 610 pd output;
-#X msg 102 581 MUTE;
-#X obj 27 446 *~;
-#X obj 27 474 *~;
-#X floatatom 62 277 3 0 100;
-#X msg 484 482 \; trigger 0;
-#X obj 27 246 unpack;
-#X floatatom 27 277 1 0 100;
-#X text 463 668 updated for Pd version 0.34;
-#X obj 26 525 +~ 0.3;
-#X obj 26 551 cos~;
-#X obj 26 499 osc~;
-#X text 88 9 PORTAMENTO AND VIBRATO;
-#X obj 62 300 mtof;
-#X obj 62 325 sqrt;
-#X obj 62 350 sqrt;
-#X text 619 402 <-- midC;
-#X text 607 444 <-- octave up;
-#X msg 484 388 \; trigger 1 60;
-#X msg 483 435 \; trigger 1 72;
-#X text 584 488 <-- release;
-#X text 590 506 is optional;
-#X obj 27 416 *~;
-#X obj 236 396 +~ 1;
-#X graph graph1 0 -1 130 1 433 643 633 543;
-#X array array62 131 float 1;
-#A 0 0.970031 1 0.970031 0.881921 0.740952 0.555571 0.336891 0.0980184
--0.146729 -0.382682 -0.595698 -0.773009 -0.88 -0.9 -0.92 -0.92 -0.85773
--0.707109 -0.514106 -0.290288 -0.0490716 0.195086 0.427551 0.63439
-0.803205 0.86 0.88 0.88 0.88 0.84 0.82 0.471402 0.242986 6.63397e-06
--0.242974 -0.471391 -0.671554 -0.831465 -0.941541 -0.995184 -0.989178
--0.923883 -0.803213 -0.68 -0.42 -0.24 0.1 0.4 0.6 0.7071 0.857723 0.956937
-0.998795 0.980787 0.903994 0.773018 0.595708 0.382694 0.146742 -0.0980052
--0.336878 -0.55556 -0.7 -0.8 -0.88 -0.88 -0.88 -0.84 -0.82 -0.555582
--0.336903 -0.0980316 0.146716 0.38267 0.595687 0.773001 0.903983 0.980782
-0.998796 0.956945 0.857737 0.707119 0.514117 0.290301 0.0490849 -0.195073
--0.427539 -0.63438 -0.803197 -0.923873 -0.989174 -0.995187 -0.94155
--0.83148 -0.671573 -0.471414 -0.242999 -1.99019e-05 0.242961 0.471379
-0.671544 0.831458 0.88 0.9 0.9 0.88 0.803221 0.63441 0.08 -0.14 -0.28
--0.48 -0.64 -0.72 -0.857717 -0.956933 -0.998794 -0.98079 -0.904 -0.773026
--0.595719 -0.382706 -0.146755 0.097992 0.336866 0.555549 0.740934 0.881909
-0.970025 1 0.970038;
-#X pop;
-#X obj 236 342 tabosc4~ array62;
-#X floatatom 236 286 3 0 0;
-#X obj 236 313 / 6;
-#X obj 236 370 *~;
-#X floatatom 390 323 3 0 0;
-#X text 235 421 since we'll multiply \,;
-#X text 234 436 vibrato output should;
-#X text 234 453 be centered at 1 \, not 0;
-#X text 275 372 multiply by vib depth;
-#X obj 390 350 / 6923;
-#X text 28 35 Portamento can be treated as a special case of an ADSR
-envelope \, with 100 percent sustain. Vibrato is properly computed
-in units of pitch \, but it's also easy to add vibrato to the envelope--before
-raising it to the fourth power \, so that it acts pseudo-logarithmically.
-Rather than add to the ADSR output \, we multiply a signal which controls
-relative frequency. The relative frequency change is one plus an oscillator.
-;
-#X text 61 417 apply vibrato;
-#X text 65 445 fourth;
-#X text 68 461 power;
-#X text 96 529 waveform;
-#X text 95 509 simple;
-#X text 465 344 4/(exp(log(2)/1200)-1);
-#X text 469 325 conversion factor is;
-#X text 383 279 vibrato depth;
-#X text 382 296 in cents;
-#X text 233 245 vibrato speed;
-#X text 232 262 in Hertz;
-#X text 152 168 I made a table with 6 cycles of vibrato and made small
-changes with the mouse to get a not-exactly-repeating vibrato \, and
-thus have to divide vibrato frequency by 6 You can just use a sine
-or triangle wave if you prefer.;
-#X obj 27 375 adsr 0 100 200 100 300;
-#X connect 0 0 8 0;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 4 0 5 0;
-#X connect 4 0 5 1;
-#X connect 5 0 13 0;
-#X connect 6 0 15 0;
-#X connect 8 0 9 0;
-#X connect 8 1 6 0;
-#X connect 9 0 50 0;
-#X connect 11 0 12 0;
-#X connect 12 0 2 0;
-#X connect 13 0 11 0;
-#X connect 15 0 16 0;
-#X connect 16 0 17 0;
-#X connect 17 0 50 1;
-#X connect 24 0 4 0;
-#X connect 24 0 4 1;
-#X connect 25 0 24 1;
-#X connect 27 0 30 0;
-#X connect 28 0 29 0;
-#X connect 29 0 27 0;
-#X connect 30 0 25 0;
-#X connect 31 0 36 0;
-#X connect 36 0 30 1;
-#X connect 50 0 24 0;
diff --git a/pd/doc/3.audio.examples/71.adsr.sequenced.pd b/pd/doc/3.audio.examples/71.adsr.sequenced.pd
deleted file mode 100644
index 26300054..00000000
--- a/pd/doc/3.audio.examples/71.adsr.sequenced.pd
+++ /dev/null
@@ -1,217 +0,0 @@
-#N canvas 32 15 950 613 12;
-#X obj 33 220 r trigger;
-#X floatatom 70 520 0 0 0;
-#N canvas 159 26 584 307 output 0;
-#X obj 390 189 t b;
-#X obj 390 129 f;
-#X obj 390 69 inlet;
-#X text 397 32 mute;
-#X obj 390 219 f;
-#X msg 451 217 0;
-#X msg 390 99 bang;
-#X obj 390 159 moses 1;
-#X obj 460 137 moses 1;
-#X obj 100 178 dbtorms;
-#X obj 460 107 r master-lvl;
-#X obj 100 50 r master-lvl;
-#X obj 390 249 s master-lvl;
-#X obj 26 217 inlet~;
-#X obj 239 49 inlet;
-#X text 239 22 level;
-#X obj 239 120 s master-lvl;
-#X msg 115 78 set \$1;
-#X obj 115 107 outlet;
-#X msg 257 77 \; pd dsp 1;
-#X obj 100 233 line~;
-#X obj 26 254 *~;
-#X obj 26 289 dac~;
-#X obj 100 205 pack 0 50;
-#X text 24 190 audio;
-#X text 112 132 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X restore 32 546 pd output;
-#X msg 108 521 MUTE;
-#X obj 33 438 *~;
-#X obj 33 331 *~ 0.01;
-#X obj 33 366 *~;
-#X obj 33 396 *~;
-#X obj 80 360 r pitch;
-#X obj 80 410 mtof;
-#X floatatom 80 385 4 0 0;
-#X floatatom 57 272 4 0 0;
-#X obj 57 247 r level;
-#X floatatom 131 272 4 0 0;
-#X obj 131 247 r attack;
-#X floatatom 216 272 4 0 0;
-#X obj 216 247 r decay;
-#X floatatom 291 272 4 0 0;
-#X floatatom 385 272 4 0 0;
-#X obj 291 247 r sustain;
-#X obj 385 247 r release;
-#X obj 509 106 r note;
-#X msg 510 195 \; trigger 1;
-#X obj 634 185 del;
-#X msg 634 210 \; trigger 0;
-#X obj 9 167 qlist;
-#X obj 8 6 r qlist;
-#X msg 30 35 bang;
-#X msg 30 60 rewind;
-#X obj 37 89 r tempo;
-#X floatatom 37 114 4 0 0;
-#X msg 37 139 tempo \$1;
-#X obj 509 156 t b f;
-#X obj 564 157 s pitch;
-#X obj 656 120 r duration;
-#X floatatom 656 145 4 0 0;
-#X floatatom 509 131 4 0 0;
-#X obj 289 320 r trigger;
-#X floatatom 315 376 4 0 0;
-#X floatatom 387 406 4 0 0;
-#X floatatom 477 406 4 0 0;
-#X floatatom 563 406 4 0 0;
-#X floatatom 659 406 4 0 0;
-#X obj 315 351 r level2;
-#X obj 387 381 r attack2;
-#X obj 477 381 r decay2;
-#X obj 563 381 r sustain2;
-#X obj 659 381 r release2;
-#X obj 80 435 tabosc4~ array1;
-#X floatatom 239 366 4 0 0;
-#X obj 33 482 vcf~;
-#X floatatom 140 488 4 0 0;
-#X obj 140 463 r q;
-#X obj 33 306 adsr 0 0 0 0 0;
-#X obj 289 444 adsr 0 0 0 0 0;
-#X obj 315 401 / 69.23;
-#X obj 239 391 mtof;
-#X obj 239 416 sqrt;
-#X obj 239 441 sqrt;
-#X obj 197 336 r filter;
-#X obj 240 494 *~;
-#X obj 240 519 *~;
-#X obj 289 469 +~ 1;
-#X obj 239 466 *~;
-#X text 139 215 ADSR for amplitude:;
-#X text 402 300 ADSR for filter. Here \, I thought it better to make
-the envelope modify a constant "filter pitch"--so the "filter" receive
-gets the "mtof" treatment and the ADSR is an offset in halftones (thus
-the "/ 69.23" as compared to the previous patch.);
-#X text 141 5 USING QLIST TO MAKE SEQUENCES OF "NOTES";
-#N canvas -10 258 703 380 otherstuff 0;
-#X obj 289 86 loadbang;
-#X obj 418 85 loadbang;
-#X graph graph2 0 -1 66 1 62 221 262 81;
-#X array array1 67 float 1;
-#A 0 0 0 0 0 0.714286 0.742857 0.757143 0.771429 0.778571 0.785714
-0.785714 0.785714 0.785714 0.790476 0.795238 0.614286 0.585714 0.442857
-0.271429 -0.128571 -0.142857 -0.157143 -0.171429 -0.642857 -0.528571
--0.614286 -0.685714 -0.828571 -0.828571 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-0.557143 0.571429 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
-#X pop;
-#X msg 418 115 \; qlist read qlist2.txt;
-#X msg 289 111 \; level 100 \; attack 20 \; decay 300 \; sustain 70
-\; release 300 \; duration 300 \; pitch 72 \; filter 38 \; level2 49
-\; attack2 19 \; decay2 300 \; sustain2 17 \; release2 700 \; q 3 \;
-tempo 1;
-#X connect 0 0 4 0;
-#X connect 1 0 3 0;
-#X restore 32 571 pd otherstuff;
-#X text 82 34 <--start loop;
-#X text 99 62 <--stop loop;
-#X text 85 114 <--set tempo;
-#X text 248 34 The qlist reads the file \, "qlist2.txt" \, which contains
-four "note" messages and a message at the end that restarts the qlist
-at the beginning. The "note" messages are translated into a pitch change
-and triggers for the ADSRs:;
-#X text 694 573 updated for Pd version 0.34;
-#X text 155 573 <--loadbangs and table;
-#X msg 468 518 \; qlist read qlist2.txt;
-#X text 462 494 click to reload qlist2.txt;
-#X text 149 521 <--output;
-#X connect 0 0 53 0;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 4 0 50 0;
-#X connect 5 0 6 0;
-#X connect 5 0 6 1;
-#X connect 6 0 7 0;
-#X connect 6 0 7 1;
-#X connect 7 0 4 0;
-#X connect 8 0 10 0;
-#X connect 9 0 48 0;
-#X connect 10 0 9 0;
-#X connect 11 0 53 1;
-#X connect 12 0 11 0;
-#X connect 13 0 53 2;
-#X connect 14 0 13 0;
-#X connect 15 0 53 3;
-#X connect 16 0 15 0;
-#X connect 17 0 53 4;
-#X connect 18 0 53 5;
-#X connect 19 0 17 0;
-#X connect 20 0 18 0;
-#X connect 21 0 36 0;
-#X connect 23 0 24 0;
-#X connect 26 0 25 0;
-#X connect 27 0 25 0;
-#X connect 28 0 25 0;
-#X connect 29 0 30 0;
-#X connect 30 0 31 0;
-#X connect 31 0 25 0;
-#X connect 32 0 23 0;
-#X connect 32 0 22 0;
-#X connect 32 1 33 0;
-#X connect 34 0 35 0;
-#X connect 35 0 23 1;
-#X connect 36 0 32 0;
-#X connect 37 0 54 0;
-#X connect 38 0 55 0;
-#X connect 39 0 54 2;
-#X connect 40 0 54 3;
-#X connect 41 0 54 4;
-#X connect 42 0 54 5;
-#X connect 43 0 38 0;
-#X connect 44 0 39 0;
-#X connect 45 0 40 0;
-#X connect 46 0 41 0;
-#X connect 47 0 42 0;
-#X connect 48 0 4 1;
-#X connect 49 0 56 0;
-#X connect 50 0 2 0;
-#X connect 51 0 50 2;
-#X connect 52 0 51 0;
-#X connect 53 0 5 0;
-#X connect 54 0 62 0;
-#X connect 55 0 54 1;
-#X connect 56 0 57 0;
-#X connect 57 0 58 0;
-#X connect 58 0 63 0;
-#X connect 59 0 49 0;
-#X connect 60 0 61 0;
-#X connect 60 0 61 1;
-#X connect 61 0 50 1;
-#X connect 62 0 63 1;
-#X connect 63 0 60 0;
-#X connect 63 0 60 1;
diff --git a/pd/doc/3.audio.examples/72.execution.order.pd b/pd/doc/3.audio.examples/72.execution.order.pd
deleted file mode 100644
index 2bea8e92..00000000
--- a/pd/doc/3.audio.examples/72.execution.order.pd
+++ /dev/null
@@ -1,127 +0,0 @@
-#N canvas 100 17 724 631 12;
-#X floatatom 448 290 0 0 0;
-#X obj 70 432 +~;
-#X obj 91 401 vd~ delay1;
-#X floatatom 108 559 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 18 152 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 197 104 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 16 129 audio;
-#X text 93 110 show level;
-#X obj 18 179 hip~ 5;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 70 585 pd output;
-#X msg 145 559 MUTE;
-#X text 184 558 <-- output amplitude;
-#X text 86 9 ORDER OF EXECUTION OF DELWRITE~ AND DELREAD~/VD~;
-#X text 43 35 If you're writing to and reading from a delay line \,
-you have to get the write sorted before the read or else you'll never
-get less than a block's delay. This patch compares a "wrong" flanger
-with a "right" one:;
-#X obj 69 299 noise~;
-#X obj 91 375 line~;
-#X obj 448 344 pack 0 100;
-#X text 518 292 <-- delay in samples;
-#X obj 92 505 *~;
-#X obj 92 481 -~;
-#X floatatom 175 505 1 0 0;
-#X obj 293 297 noise~;
-#X obj 423 398 line~;
-#N canvas 0 0 600 400 delay-writer 0;
-#X obj 96 107 inlet~;
-#X obj 96 180 outlet~;
-#X obj 116 144 delwrite~ delay2 1000;
-#X connect 0 0 1 0;
-#X connect 0 0 2 0;
-#X restore 293 325 pd delay-writer;
-#N canvas 0 0 280 330 delay-reader 0;
-#X obj 96 107 inlet~;
-#X obj 89 267 outlet~;
-#X obj 112 163 inlet~;
-#X obj 112 198 vd~ delay2;
-#X obj 89 237 +~;
-#X connect 0 0 4 0;
-#X connect 2 0 3 0;
-#X connect 3 0 4 1;
-#X connect 4 0 1 0;
-#X restore 293 427 pd delay-reader;
-#X obj 70 533 +~;
-#X text 194 505 <-- 0 to hear left-hand side \, 1 to hear right hand
-side.;
-#X text 46 105 All it took was to put the delread~ and vd~ objects
-in subpatches. The audio connections between the subpatches force the
-"reader" to be sorted after the "writer". DSP sorting in Pd follows
-the hierarchy of windows.;
-#X obj 447 318 / 44.1;
-#X obj 82 329 delwrite~ delay1 1000;
-#X text 450 596 updated for Pd version 0.34;
-#X text 43 173 To hear the difference scroll the delay time between
-0 and 100 samples. The patch at left doesn't let you get below 64 samples.
-;
-#X text 43 228 You can use the same strategy to avoid picking up 64-sample
-delays in send~/receive~ and throw~/catch~ pairs.;
-#X connect 0 0 23 0;
-#X connect 1 0 14 1;
-#X connect 1 0 20 0;
-#X connect 2 0 1 1;
-#X connect 3 0 4 1;
-#X connect 4 0 3 0;
-#X connect 5 0 4 2;
-#X connect 9 0 1 0;
-#X connect 9 0 24 0;
-#X connect 10 0 2 0;
-#X connect 11 0 10 0;
-#X connect 11 0 17 0;
-#X connect 13 0 20 1;
-#X connect 14 0 13 0;
-#X connect 15 0 13 1;
-#X connect 16 0 18 0;
-#X connect 17 0 19 1;
-#X connect 18 0 19 0;
-#X connect 19 0 14 0;
-#X connect 20 0 4 0;
-#X connect 23 0 11 0;
diff --git a/pd/doc/3.audio.examples/73.control.blocksize.pd b/pd/doc/3.audio.examples/73.control.blocksize.pd
deleted file mode 100644
index 05bad0d2..00000000
--- a/pd/doc/3.audio.examples/73.control.blocksize.pd
+++ /dev/null
@@ -1,111 +0,0 @@
-#N canvas 100 17 662 466 12;
-#X floatatom 130 389 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 18 152 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 197 104 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 16 129 audio;
-#X text 93 110 show level;
-#X obj 18 179 hip~ 5;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 92 415 pd output;
-#X msg 167 389 MUTE;
-#X text 206 388 <-- output amplitude;
-#X obj 51 203 noise~;
-#N canvas 0 0 760 350 delay-writer 0;
-#X obj 75 100 inlet~;
-#X obj 79 250 outlet~;
-#X obj 90 194 delwrite~ delay3 1000;
-#X obj 379 97 block~ 1;
-#X obj 145 131 delread~ delay3;
-#X obj 144 159 *~ 0.99;
-#X obj 79 164 +~;
-#X obj 146 100 inlet;
-#X text 84 22 Because of the feedback \, the delwrite~ has to go after
-the delread~. So we set the blocksize to 1 to minimize the resulting
-delay.;
-#X connect 0 0 6 0;
-#X connect 4 0 5 0;
-#X connect 5 0 6 1;
-#X connect 6 0 2 0;
-#X connect 6 0 1 0;
-#X connect 7 0 4 0;
-#X restore 91 328 pd delay-writer;
-#X text 401 435 updated for Pd version 0.34;
-#X obj 77 285 *~;
-#X obj 273 275 expr 1000/$f1;
-#X obj 273 249 mtof;
-#X msg 176 220 1;
-#X msg 176 282 0;
-#X obj 177 164 metro 500;
-#X obj 273 195 random 60;
-#X obj 177 135 loadbang;
-#X obj 216 217 del 2;
-#X obj 273 221 + 30;
-#X obj 51 228 lop~ 1000;
-#X text 86 9 CONTROLLING DELAY WITH BLOCK~;
-#X text 75 52 In situations where a delay read feeds pack to a delay
-write \, you can shorten the minimum delay by changing the block size.
-Do this in a subpatch...;
-#X text 238 328 <-- here is the delay loop;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 17 0;
-#X connect 5 0 1 0;
-#X connect 7 0 5 0;
-#X connect 8 0 5 1;
-#X connect 9 0 8 0;
-#X connect 10 0 7 1;
-#X connect 11 0 7 1;
-#X connect 12 0 10 0;
-#X connect 12 0 13 0;
-#X connect 12 0 15 0;
-#X connect 13 0 16 0;
-#X connect 14 0 12 0;
-#X connect 15 0 11 0;
-#X connect 16 0 9 0;
-#X connect 17 0 7 0;
diff --git a/pd/doc/3.audio.examples/74.up.downsampling.pd b/pd/doc/3.audio.examples/74.up.downsampling.pd
deleted file mode 100644
index cf50f9b9..00000000
--- a/pd/doc/3.audio.examples/74.up.downsampling.pd
+++ /dev/null
@@ -1,191 +0,0 @@
-#N canvas 32 25 1089 690 10;
-#X obj 57 567 osc~ 412;
-#X floatatom 58 543 5 0 0;
-#X obj 122 595 tabwrite~ scope;
-#X msg 122 571 bang;
-#X msg 205 43 bang;
-#X obj 42 191 tabwrite~ scope;
-#X msg 54 165 bang;
-#N canvas 316 181 600 400 simple 0;
-#X obj 185 46 inlet;
-#X obj 185 102 tabwrite~ scope;
-#X obj 78 38 inlet~;
-#X obj 78 258 outlet~;
-#X obj 317 103 block~ 64 1 0.25;
-#X connect 0 0 1 0;
-#X connect 2 0 1 0;
-#X connect 2 0 3 0;
-#X restore 42 64 pd simple downsampling 4;
-#X msg 451 42 bang;
-#X obj 275 190 tabwrite~ scope;
-#X msg 287 164 bang;
-#X graph graph2 0 -1 511 1 297 629 897 489;
-#X array scope 512 float 0;
-#X pop;
-#X msg 683 45 bang;
-#X obj 520 193 tabwrite~ scope;
-#X msg 532 167 bang;
-#X msg 929 44 bang;
-#X obj 753 192 tabwrite~ scope;
-#X msg 765 166 bang;
-#N canvas 165 168 600 400 simple 0;
-#X obj 185 74 inlet;
-#X obj 185 102 tabwrite~ scope;
-#X obj 78 38 inlet~;
-#X obj 78 258 outlet~;
-#X text 130 38 zero-padding upsampling;
-#X obj 317 103 block~ 64 1 4;
-#X connect 0 0 1 0;
-#X connect 2 0 1 0;
-#X connect 2 0 3 0;
-#X restore 520 66 pd simple upsampling 4;
-#X obj 42 38 r~ sine;
-#X obj 275 39 r~ sine;
-#X obj 57 595 s~ sine;
-#X obj 520 41 r~ sine;
-#X obj 753 41 r~ sine;
-#X obj 41 415 tabwrite~ scope;
-#X msg 47 369 bang;
-#X msg 804 265 bang;
-#X obj 711 415 tabwrite~ scope;
-#X msg 723 389 bang;
-#X obj 41 262 r~ sine;
-#X obj 711 264 r~ sine;
-#X obj 152 416 tabwrite~ scope;
-#X msg 158 370 bang;
-#X text 43 431 zero-padded;
-#N canvas 290 149 600 400 downsampling 0;
-#X obj 78 38 inlet~;
-#X obj 78 258 outlet~;
-#X obj 152 258 outlet~ hold;
-#X obj 317 103 block~ 64 1 0.25;
-#X connect 0 0 1 0;
-#X connect 0 0 2 0;
-#X restore 41 288 pd downsampling 4 (mixed);
-#N canvas 261 147 600 400 bad 0;
-#X obj 185 81 inlet;
-#X obj 185 102 tabwrite~ scope;
-#X text 172 257 "lin" is for linear upsampling;
-#X text 160 39 "lin" has no meaning when downsampling;
-#X obj 317 103 block~ 64 2;
-#X obj 78 258 outlet~;
-#X obj 78 38 inlet~;
-#X connect 0 0 1 0;
-#X connect 6 0 1 0;
-#X connect 6 0 5 0;
-#X restore 711 288 pd bad overlap;
-#X msg 1018 263 bang;
-#X obj 841 415 tabwrite~ scope;
-#X msg 853 389 bang;
-#X obj 841 264 r~ sine;
-#N canvas 121 72 600 400 bad 0;
-#X obj 185 81 inlet;
-#X obj 185 102 tabwrite~ scope;
-#X obj 78 258 outlet~ lin;
-#X obj 78 38 inlet~ lin;
-#X text 167 38 "lin" is for linear upsampling;
-#X text 166 259 "lin" has no meaning when downsampling;
-#X obj 317 103 block~ 64 2 2;
-#X connect 0 0 1 0;
-#X connect 3 0 1 0;
-#X connect 3 0 2 0;
-#X restore 841 288 pd bad overlap (upsampled);
-#X msg 458 267 bang;
-#X obj 323 417 tabwrite~ scope;
-#X msg 335 391 bang;
-#X obj 323 266 r~ sine;
-#X text 155 433 sample&hold;
-#X msg 653 265 bang;
-#X obj 511 416 tabwrite~ scope;
-#X msg 523 390 bang;
-#X obj 511 265 r~ sine;
-#N canvas 249 128 600 400 downsampled 0;
-#X obj 185 81 inlet;
-#X obj 185 102 tabwrite~ scope;
-#X obj 78 258 outlet~ lin;
-#X obj 78 230 *~ 0.5;
-#X obj 78 38 inlet~;
-#X obj 317 103 block~ 128 2 0.25;
-#X connect 0 0 1 0;
-#X connect 3 0 2 0;
-#X connect 4 0 1 0;
-#X connect 4 0 3 0;
-#X restore 511 289 pd downsampled overlap;
-#N canvas 175 94 600 400 upsampled 0;
-#X obj 185 81 inlet;
-#X obj 185 102 tabwrite~ scope;
-#X obj 78 258 outlet~ lin;
-#X obj 78 38 inlet~ lin;
-#X obj 78 230 *~ 0.5;
-#X obj 317 103 block~ 256 2 2;
-#X connect 0 0 1 0;
-#X connect 3 0 1 0;
-#X connect 3 0 4 0;
-#X connect 4 0 2 0;
-#X restore 323 290 pd upsampled overlap;
-#N canvas 350 164 600 400 upsampling 0;
-#X obj 185 81 inlet;
-#X obj 185 102 tabwrite~ scope;
-#X obj 78 38 inlet~ hold;
-#X obj 78 258 outlet~;
-#X text 160 39 "hold" is for sample&hold upsampling;
-#X obj 317 103 block~ 64 1 16;
-#X connect 0 0 1 0;
-#X connect 2 0 1 0;
-#X connect 2 0 3 0;
-#X restore 753 65 pd upsampling 16 (sample&hold);
-#N canvas 236 170 600 400 downsampling 0;
-#X obj 185 81 inlet;
-#X obj 185 102 tabwrite~ scope;
-#X obj 78 258 outlet~ lin;
-#X obj 78 38 inlet~ lin;
-#X text 172 257 "lin" is for linear upsampling;
-#X obj 320 102 block~ 64 1 0.125;
-#X text 330 137 0.125 = 1/8 = 8*downsampling;
-#X text 160 39 "lin" has (still !) no meaning when downsampling;
-#X connect 0 0 1 0;
-#X connect 3 0 1 0;
-#X connect 3 0 2 0;
-#X restore 275 63 pd downsampling 8 (linear);
-#X text 718 314 a pd-bug !;
-#X connect 0 0 2 0;
-#X connect 0 0 21 0;
-#X connect 1 0 0 0;
-#X connect 3 0 2 0;
-#X connect 4 0 7 1;
-#X connect 6 0 5 0;
-#X connect 7 0 5 0;
-#X connect 8 0 53 1;
-#X connect 10 0 9 0;
-#X connect 12 0 18 1;
-#X connect 14 0 13 0;
-#X connect 15 0 52 1;
-#X connect 17 0 16 0;
-#X connect 18 0 13 0;
-#X connect 19 0 7 0;
-#X connect 20 0 53 0;
-#X connect 22 0 18 0;
-#X connect 23 0 52 0;
-#X connect 25 0 24 0;
-#X connect 26 0 35 1;
-#X connect 28 0 27 0;
-#X connect 29 0 34 0;
-#X connect 30 0 35 0;
-#X connect 32 0 31 0;
-#X connect 34 0 24 0;
-#X connect 34 1 31 0;
-#X connect 35 0 27 0;
-#X connect 36 0 40 1;
-#X connect 38 0 37 0;
-#X connect 39 0 40 0;
-#X connect 40 0 37 0;
-#X connect 41 0 51 1;
-#X connect 43 0 42 0;
-#X connect 44 0 51 0;
-#X connect 46 0 50 1;
-#X connect 48 0 47 0;
-#X connect 49 0 50 0;
-#X connect 50 0 47 0;
-#X connect 51 0 42 0;
-#X connect 52 0 16 0;
-#X connect 53 0 9 0;
diff --git a/pd/doc/3.audio.examples/A00.intro.pd b/pd/doc/3.audio.examples/A00.intro.pd
new file mode 100644
index 00000000..69087781
--- /dev/null
+++ b/pd/doc/3.audio.examples/A00.intro.pd
@@ -0,0 +1,10 @@
+#N canvas 440 252 579 286 12;
+#X text 87 6 INTRODUCTION TO THE PD AUDIO EXAMPLE PATCHES;
+#X text 328 257 updated for Pd version 0.37;
+#X text 34 45 This is the second of three tutorial series on Pd. This
+one shows the time-domain audio processing features. (The first one
+showed how to use Pd to do "control" computations \, and the third
+is about frequency-domain techniques.);
+#X text 33 125 These patches are accompanied by an ONLINE BOOK:;
+#X text 100 158 http://www.crca.ucsd.edu/~msp/techniques.htm;
+#X text 37 189 which develops the underlying theory.;
diff --git a/pd/doc/3.audio.examples/A00.intro.txt b/pd/doc/3.audio.examples/A00.intro.txt
new file mode 100644
index 00000000..d982eedd
--- /dev/null
+++ b/pd/doc/3.audio.examples/A00.intro.txt
@@ -0,0 +1,9 @@
+This is the second of three tutorial series on Pd. This one shows the
+time-domain audio processing features. (The first one showed how to use Pd to
+do "control" computations, and the third is about frequency-domain techniques.)
+
+These patches are accompanied by an ONLINE BOOK:
+
+ http://www.crca.ucsd.edu/~msp/techniques.htm
+
+which develops the underlying theory.
diff --git a/pd/doc/3.audio.examples/A07.frequency.mod.pd b/pd/doc/3.audio.examples/A07.frequency.mod.pd
index a7bab032..aedb1cc1 100644
--- a/pd/doc/3.audio.examples/A07.frequency.mod.pd
+++ b/pd/doc/3.audio.examples/A07.frequency.mod.pd
@@ -1,105 +1,54 @@
-#N canvas 52 144 760 640 12;
-#X obj 256 180 *~;
-#X floatatom 256 95 0 0 0;
-#X floatatom 166 130 0 0 0;
-#X obj 166 200 +~;
-#X graph graph1 0 -1.02 440 1.02 527 170 727 40;
+#N canvas 92 96 760 640 12;
+#X obj 259 168 *~;
+#X floatatom 259 83 0 0 0 0 - - -;
+#X floatatom 169 118 0 0 0 0 - - -;
+#X obj 169 188 +~;
+#N canvas 0 0 450 300 graph1 0;
#X array fm-output 441 float 0;
-#X pop;
-#X floatatom 204 300 0 0 100;
-#N canvas 159 26 516 274 output 1;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 396 182 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 391 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 391 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 104 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 159 audio;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X restore 166 328 pd output;
-#X msg 242 301 MUTE;
-#X text 283 301 <-- output amplitude;
-#X msg 242 248 bang;
-#X text 284 248 <-- click to graph;
-#X obj 242 272 tabwrite~ fm-output;
-#X floatatom 278 150 0 0 0;
-#X text 163 87 carrier;
-#X text 162 105 frequency;
-#X text 241 71 frequency;
-#X text 242 54 modulation;
+#X coords 0 1.02 440 -1.02 200 130 1;
+#X restore 527 40 graph;
+#X msg 244 228 bang;
+#X text 286 228 <-- click to graph;
+#X obj 244 252 tabwrite~ fm-output;
+#X floatatom 281 138 0 0 0 0 - - -;
+#X text 166 75 carrier;
+#X text 165 93 frequency;
+#X text 244 59 frequency;
+#X text 245 42 modulation;
#X text 33 8 FREQUENCY MODULATION ("FM") USING TWO OSCILLATORS;
-#X obj 166 252 osc~;
-#X text 50 234 "carrier";
-#X text 32 252 oscillator -->;
-#X text 40 161 add modulator;
-#X text 39 179 to carrier;
-#X text 37 198 frequency -->;
-#X text 317 162 index;
-#X text 319 143 modulation;
-#X text 477 601 updated for Pd version 0.34;
-#X obj 256 120 osc~;
-#X text 52 363 This shows the classical FM synthesis technique developed
-by John Chowning. It's nothing but an oscillator with vibrato controlled
-by another "modulation" oscillator. First \, to understand the patch
-\, set carrier frequency to 400 or so \, modulation frequency between
-5 and 10 \, and try modulation index values between 0 and 400 \, say.
-You'll hear a sine wave with vibrato.;
+#X obj 168 232 osc~;
+#X text 52 214 "carrier";
+#X text 34 232 oscillator -->;
+#X text 47 149 add modulator;
+#X text 46 167 to carrier;
+#X text 44 186 frequency -->;
+#X text 320 150 index;
+#X text 322 131 modulation;
+#X obj 259 108 osc~;
#X text 531 172 --- 0.01 seconds ----;
-#X text 51 478 To get the FM sound \, set all three of carrier frequency
+#X text 53 443 To get the FM sound \, set all three of carrier frequency
\, modulation frequency \, and modulation index in the hundreds. Note
that you get a timbral change as you sweep modulation index \, because
this changes the amplitudes of the components of the output sound but
not their frequencies.;
-#X text 48 564 The component frequencies are equal to the carrier frequency
-\, plus or minus multiples of the modulator frequency.;
+#X obj 167 270 output~;
+#X text 489 613 updated for Pd version 0.37;
+#X text 54 332 This patch shows the classical FM synthesis technique
+developed by John Chowning. It's nothing but an oscillator with vibrato
+controlled by another "modulation" oscillator. First \, to understand
+the patch \, set carrier frequency to 400 or so \, modulation frequency
+between 5 and 10 \, and try modulation index values between 0 and 400
+\, say. You'll hear a sine wave with vibrato.;
+#X text 55 526 The component frequencies are equal to the carrier frequency
+\, plus or minus multiples of the modulator frequency. A more complete
+discussion of FM occurs in part 5 of this series.;
#X connect 0 0 3 1;
-#X connect 1 0 27 0;
+#X connect 1 0 22 0;
#X connect 2 0 3 0;
-#X connect 3 0 18 0;
-#X connect 5 0 6 1;
-#X connect 6 0 5 0;
-#X connect 7 0 6 2;
-#X connect 9 0 11 0;
-#X connect 12 0 0 1;
-#X connect 18 0 11 0;
-#X connect 18 0 6 0;
-#X connect 27 0 0 0;
+#X connect 3 0 14 0;
+#X connect 5 0 7 0;
+#X connect 8 0 0 1;
+#X connect 14 0 7 0;
+#X connect 14 0 25 0;
+#X connect 14 0 25 1;
+#X connect 22 0 0 0;
diff --git a/pd/doc/3.audio.examples/A08.phase.mod.pd b/pd/doc/3.audio.examples/A08.phase.mod.pd
deleted file mode 100644
index 716ba6ab..00000000
--- a/pd/doc/3.audio.examples/A08.phase.mod.pd
+++ /dev/null
@@ -1,246 +0,0 @@
-#N canvas 36 68 722 738 12;
-#X obj 216 145 *~;
-#X floatatom 216 88 0 0 0;
-#X obj 297 125 line~;
-#X floatatom 128 108 0 0 0;
-#X obj 128 222 cos~;
-#X obj 128 178 +~;
-#X floatatom 166 299 0 0 100;
-#N canvas 159 26 495 270 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 159 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 128 326 pd output;
-#X msg 204 299 MUTE;
-#X obj 216 113 osc~ 0;
-#X obj 297 99 pack 0 50;
-#X floatatom 297 46 0 0 0;
-#X obj 297 73 / 100;
-#X text 271 8 modulation index;
-#X text 271 23 in hundredths;
-#X text 125 65 carrier;
-#X text 124 83 frequency;
-#X text 201 64 frequency;
-#X text 202 47 modulation;
-#X text 33 119 carrier;
-#X text 33 134 phase -->;
-#X text 6 162 phase;
-#X text 5 177 modulation-->;
-#X text 12 204 output;
-#X text 11 221 waveform -->;
-#X text 527 6 PHASE MODULATION;
-#X text 417 703 updated for Pd version 0.34;
-#X text 13 377 Most implementations of "FM" actually use phase \, not
-frequency \, modulation \, because it extends in a more natural way
-to "multi-operator FM" with three or more oscillators.;
-#X text 15 437 To do phase modulation \, we split the "carrier oscillator"
-into its phase calculation (phasor~) and its waveform lookup (cos~).
-These together would be equivalent to an osc~ object \, but the "+~"
-between them adds the modulating oscillator's output to the phase.
-;
-#X text 18 587 The units of the "modulation" index change--it is now
-dimensionless and relative to the modulation frequency \, and "good"
-values tend to be between 0 and 1 In this patch it's in hundredths.
-;
-#X text 19 658 We also have to use a line~ to smooth changes in the
-modulation index \, which wasn't necessary in the previous patch.;
-#X obj 128 135 phasor~;
-#X obj 117 557 cos~;
-#X obj 117 529 phasor~;
-#X text 60 539 this:;
-#X text 219 532 is the same;
-#X text 220 551 as this:;
-#X obj 335 544 osc~;
-#X graph graph2 0 -1 440 1 509 330 709 190;
-#X array phase-out 441 float 1;
-#A 0 0.43245 0.433463 0.434452 0.435418 0.43636 0.43728 0.438178 0.439056
-0.439912 0.440749 0.441567 0.442366 0.443148 0.443912 0.444659 0.445391
-0.446107 0.446809 0.447497 0.448172 0.448834 0.449484 0.450122 0.450751
-0.451369 0.451978 0.452579 0.453172 0.453758 0.454338 0.454911 0.45548
-0.456045 0.456606 0.457164 0.457719 0.458274 0.458827 0.45938 0.459934
-0.460489 0.461046 0.461605 0.462168 0.462735 0.463306 0.463883 0.464466
-0.465056 0.465654 0.466259 0.466873 0.467497 0.468131 0.468776 0.469433
-0.470102 0.470783 0.471479 0.472188 0.472913 0.473653 0.474409 0.475182
-0.475973 0.476782 0.477611 0.478459 0.479327 0.480216 0.481127 0.48206
-0.483015 0.483994 0.484997 0.486024 0.487077 0.488156 0.48926 0.490392
-0.491552 0.49274 0.493957 0.495203 0.496479 0.497785 0.499123 0.500493
-0.501896 0.503332 0.504801 0.506304 0.507842 0.509415 0.511023 0.512667
-0.514348 0.516066 0.517821 0.519615 0.521447 0.523318 0.525228 0.527179
-0.52917 0.531202 0.533275 0.53539 0.537547 0.539747 0.541992 0.54428
-0.546613 0.548989 0.551411 0.553877 0.556389 0.558947 0.561551 0.564202
-0.5669 0.569645 0.572437 0.575278 0.578166 0.581104 0.58409 0.587125
-0.59021 0.593345 0.596529 0.599764 0.603051 0.606389 0.609778 0.613219
-0.61671 0.620254 0.62385 0.627497 0.631197 0.634949 0.638754 0.642612
-0.646522 0.650486 0.654503 0.658573 0.662696 0.666873 0.671104 -0.324611
--0.320273 -0.315881 -0.311434 -0.306931 -0.302375 -0.297764 -0.2931
--0.288381 -0.283608 -0.278781 -0.2739 -0.268964 -0.263975 -0.258931
--0.253833 -0.248682 -0.243476 -0.238217 -0.232904 -0.227537 -0.222116
--0.216642 -0.211115 -0.205534 -0.1999 -0.194211 -0.18847 -0.182675
--0.176829 -0.170929 -0.164978 -0.158975 -0.152919 -0.146813 -0.140655
--0.134446 -0.128186 -0.121875 -0.115514 -0.109103 -0.102642 -0.0961313
--0.0895714 -0.0829625 -0.0763049 -0.0695988 -0.0628447 -0.056041 -0.0491896
--0.0422913 -0.0353461 -0.0283546 -0.0213171 -0.0142339 -0.00710538
-6.80089e-05 0.00728586 0.0145478 0.0218535 0.0292025 0.0365944 0.0440286
-0.0515049 0.0590228 0.0665818 0.0741815 0.0818213 0.0895009 0.0972198
-0.104978 0.112776 0.120611 0.128484 0.136393 0.144339 0.15232 0.160337
-0.168388 0.176473 0.184592 0.192744 0.200929 0.209146 0.217393 0.225672
-0.233981 0.24232 0.250688 0.259084 0.267509 0.27596 0.284439 0.292944
-0.301475 0.310031 0.318611 0.327215 0.335842 0.344491 0.353162 0.361854
-0.370566 0.379298 0.38805 0.39682 0.405608 0.414413 0.423234 0.432072
-0.440924 0.449792 0.458673 0.467567 0.476474 0.485394 0.494324 0.503265
-0.512216 0.521176 0.530145 0.539121 0.548104 0.557094 0.566089 0.575089
-0.584094 0.593102 0.602113 0.611126 0.620141 0.629157 0.638173 0.647189
-0.656203 0.665215 0.674225 0.683232 0.692234 0.701231 0.710224 0.71921
-0.728189 0.737161 0.746124 0.755079 0.764024 0.772959 0.781884 0.790796
-0.799697 0.808584 0.817458 0.826318 0.835162 0.843992 0.852804 0.861601
-0.870379 0.879139 0.887879 0.8966 0.905301 0.913981 0.92264 0.931276
-0.93989 0.94848 0.957046 0.965588 0.974105 0.982595 0.99106 0.999497
-1.00791 1.01629 1.02464 1.03296 1.04126 1.04952 1.05775 1.06595 1.07412
-1.08225 1.09035 1.09841 1.10645 1.11444 1.1224 1.13033 1.13822 1.14607
-1.15388 1.16166 1.1694 1.17709 1.18475 1.19237 1.19995 1.20749 1.21498
-1.22244 1.22985 1.23722 1.24454 1.25182 1.25906 1.26625 1.2734 0.280502
-0.287559 0.29457 0.301536 0.308454 0.315325 0.32215 0.328926 0.335655
-0.342335 0.348967 0.35555 0.362084 0.368568 0.375003 0.381388 0.387722
-0.394004 0.400235 0.406415 0.412544 0.418621 0.424647 0.430621 0.436542
-0.442412 0.448228 0.453993 0.459704 0.465363 0.470969 0.476521 0.48202
-0.487466 0.492858 0.498196 0.503481 0.508712 0.513889 0.519011 0.524077
-0.52909 0.534049 0.538953 0.543804 0.5486 0.553342 0.55803 0.562664
-0.567243 0.571769 0.57624 0.580658 0.585021 0.589331 0.593587 0.597789
-0.601938 0.606033 0.610075 0.614064 0.617999 0.621879 0.625706 0.629481
-0.633203 0.636873 0.640491 0.644057 0.647571 0.651033 0.654445 0.657805
-0.661114 0.664372 0.66758 0.670739 0.673847 0.676905 0.679914 0.682875
-;
-#X array cos-out 441 float 1;
-#A 0 -0.911256 -0.913872 -0.916365 -0.918789 -0.921097 -0.923342 -0.925486
--0.927564 -0.92956 -0.931483 -0.93335 -0.935129 -0.936867 -0.938528
--0.940137 -0.941707 -0.943197 -0.944657 -0.946072 -0.947426 -0.948755
--0.95004 -0.951276 -0.952491 -0.953672 -0.954806 -0.955924 -0.957024
--0.958071 -0.959106 -0.960132 -0.961119 -0.962086 -0.963047 -0.963993
--0.964903 -0.965811 -0.966718 -0.967595 -0.968461 -0.969329 -0.970192
--0.971025 -0.971863 -0.972707 -0.973527 -0.974343 -0.975168 -0.975986
--0.976786 -0.977597 -0.978414 -0.979202 -0.980003 -0.980816 -0.981596
--0.982391 -0.983194 -0.983968 -0.984757 -0.985543 -0.98631 -0.987093
--0.987851 -0.98861 -0.98937 -0.990102 -0.990852 -0.991557 -0.992275
--0.99296 -0.993642 -0.994295 -0.994935 -0.995544 -0.996137 -0.996687
--0.997227 -0.997705 -0.998173 -0.998575 -0.998944 -0.999273 -0.999527
--0.999743 -0.999894 -0.999966 -0.999981 -0.999927 -0.999765 -0.999526
--0.999202 -0.998785 -0.99824 -0.997586 -0.996816 -0.995923 -0.994897
--0.99373 -0.992413 -0.990934 -0.989283 -0.987458 -0.985449 -0.983247
--0.980843 -0.978222 -0.975372 -0.972288 -0.968961 -0.965377 -0.96153
--0.95741 -0.952995 -0.948265 -0.943231 -0.937881 -0.932182 -0.926128
--0.919728 -0.912938 -0.905762 -0.898197 -0.890198 -0.881799 -0.87293
--0.863637 -0.853855 -0.843612 -0.832873 -0.821629 -0.809886 -0.797593
--0.784764 -0.771394 -0.757466 -0.742953 -0.727864 -0.712189 -0.695918
--0.679041 -0.661549 -0.643437 -0.624697 -0.605324 -0.585314 -0.564664
--0.543374 -0.521441 -0.498869 -0.475658 -0.451811 -0.427334 -0.402219
--0.376482 -0.350131 -0.323174 -0.295626 -0.267508 -0.238824 -0.2096
--0.179853 -0.149603 -0.118875 -0.0876953 -0.0560885 -0.0240874 0.00827867
-0.040974 0.0739643 0.107208 0.140666 0.174297 0.208056 0.241893 0.275757
-0.309603 0.343385 0.377036 0.410498 0.443712 0.476616 0.509148 0.541242
-0.572835 0.603858 0.634244 0.66391 0.692797 0.720837 0.747961 0.774084
-0.799131 0.823051 0.845758 0.867169 0.887248 0.90588 0.923037 0.938628
-0.952605 0.964885 0.975433 0.984153 0.991037 0.995988 0.998986 0.999997
-0.998938 0.995807 0.990576 0.983211 0.973668 0.961961 0.948075 0.932007
-0.913757 0.893328 0.87073 0.845995 0.81915 0.790227 0.759268 0.726324
-0.691452 0.654714 0.616181 0.57593 0.534037 0.490599 0.445716 0.399491
-0.352033 0.303459 0.253886 0.203441 0.152259 0.100478 0.0482368 -0.00432081
--0.057045 -0.109786 -0.162386 -0.214696 -0.266564 -0.317814 -0.368301
--0.417864 -0.466337 -0.513584 -0.559424 -0.603732 -0.646344 -0.687125
--0.725934 -0.762631 -0.797101 -0.829205 -0.858847 -0.8859 -0.91028
--0.931885 -0.950636 -0.966466 -0.97929 -0.989092 -0.995773 -0.999358
--0.999773 -0.997042 -0.991152 -0.982099 -0.969941 -0.954655 -0.936332
--0.915008 -0.890737 -0.863625 -0.833713 -0.801132 -0.765979 -0.728348
--0.688394 -0.646219 -0.601975 -0.555817 -0.507869 -0.45832 -0.407319
--0.355036 -0.301652 -0.247328 -0.192258 -0.136617 -0.0805873 -0.0243537
-0.0319027 0.0879985 0.143752 0.198986 0.253526 0.307194 0.359834 0.411262
-0.461345 0.509907 0.556823 0.601935 0.645131 0.686266 0.725245 0.761935
-0.796272 0.828125 0.857461 0.884158 0.9082 0.929508 0.948044 0.9638
-0.976698 0.986778 0.99402 0.998404 0.999981 0.998763 0.994751 0.988022
-0.978621 0.966582 0.95197 0.93487 0.915357 0.893512 0.869405 0.843139
-0.814817 0.784538 0.752408 0.718535 0.68303 0.646007 0.607581 0.567872
-0.526996 0.485074 0.442227 0.398573 0.354231 0.30932 0.263957 0.218256
-0.172326 0.126282 0.0802317 0.0342922 -0.0114471 -0.0568861 -0.101931
--0.146492 -0.190474 -0.233802 -0.276394 -0.318171 -0.359072 -0.399015
--0.437958 -0.475821 -0.512573 -0.548149 -0.582512 -0.615632 -0.647446
--0.677951 -0.707119 -0.734897 -0.761296 -0.786293 -0.80988 -0.83204
--0.852773 -0.872085 -0.88998 -0.906462 -0.921542 -0.935229 -0.94754
--0.95849 -0.968102 -0.976397 -0.9834 -0.989136 -0.993613 -0.996882
--0.998976 -0.99993 -0.999748 -0.998484 -0.996188 -0.99286 -0.988563
--0.983336 -0.977186 -0.970195 -0.962347 -0.953732 -0.944344 -0.934249
--0.923482 -0.912051 -0.900028 -0.887441 -0.874296 -0.860659 -0.846562
--0.832035 -0.817101 -0.801792 -0.786149 -0.770201 -0.753977 -0.737507
--0.720826 -0.703952 -0.686912 -0.669731 -0.652436 -0.635043 -0.617572
--0.600055 -0.582513 -0.564966 -0.547418 -0.529898 -0.512429 -0.495016
--0.477676 -0.460438 -0.443287 -0.426265 -0.409364;
-#X pop;
-#X obj 251 241 tabwrite~ phase-out;
-#X obj 251 268 tabwrite~ cos-out;
-#X msg 251 216 bang;
-#X text 298 215 <-- graph them;
-#X text 386 99 <-- change smoothly to avoid clicks;
-#X connect 0 0 5 1;
-#X connect 1 0 9 0;
-#X connect 2 0 0 1;
-#X connect 3 0 31 0;
-#X connect 4 0 7 0;
-#X connect 4 0 40 0;
-#X connect 5 0 4 0;
-#X connect 5 0 39 0;
-#X connect 6 0 7 1;
-#X connect 7 0 6 0;
-#X connect 8 0 7 2;
-#X connect 9 0 0 0;
-#X connect 10 0 2 0;
-#X connect 11 0 12 0;
-#X connect 12 0 10 0;
-#X connect 31 0 5 0;
-#X connect 33 0 32 0;
-#X connect 41 0 39 0;
-#X connect 41 0 40 0;
diff --git a/pd/doc/3.audio.examples/A09.review.pd b/pd/doc/3.audio.examples/A08.review.pd
index 9b190a19..9b190a19 100644
--- a/pd/doc/3.audio.examples/A09.review.pd
+++ b/pd/doc/3.audio.examples/A08.review.pd
diff --git a/pd/doc/3.audio.examples/B05.tabread.FM.pd b/pd/doc/3.audio.examples/B05.tabread.FM.pd
index ac2d9507..0dff773e 100644
--- a/pd/doc/3.audio.examples/B05.tabread.FM.pd
+++ b/pd/doc/3.audio.examples/B05.tabread.FM.pd
@@ -77,10 +77,8 @@
#X connect 27 0 21 0;
#X restore 153 305 pd output;
#X msg 229 278 MUTE;
-#X text 521 439 updated for Pd version 0.34;
#X floatatom 153 95 4 0 0 0 - - -;
#X text 153 69 frequency;
-#X text 33 8 MORE ON FREQUENCY MODULATION;
#X floatatom 195 206 4 0 0 0 - - -;
#X text 155 50 modulation;
#X obj 152 157 *~;
@@ -92,16 +90,18 @@
#X obj 152 237 osc~;
#X obj 153 122 tabosc4~ pitchmod14;
#X text 254 194 carrier;
-#X text 47 356 This patch is like the original FM patch except in having
-a settable wavetable for the modulation oscillator. Try changing the
-waveform as well as the three familiar parameters.;
+#X text 33 8 FREQUENCY MODULATION BY WAVETABLE;
+#X text 47 356 This tabosc4~ controls the pitch of a sinusoidal oscillator
+(osc~). Try changing the waveform as well as the three familiar parameters.
+;
+#X text 520 438 updated for Pd version 0.37;
#X connect 1 0 2 1;
#X connect 2 0 1 0;
#X connect 3 0 2 2;
-#X connect 5 0 17 0;
-#X connect 8 0 14 1;
-#X connect 10 0 14 0;
-#X connect 13 0 10 1;
-#X connect 14 0 16 0;
-#X connect 16 0 2 0;
-#X connect 17 0 10 0;
+#X connect 4 0 15 0;
+#X connect 6 0 12 1;
+#X connect 8 0 12 0;
+#X connect 11 0 8 1;
+#X connect 12 0 14 0;
+#X connect 14 0 2 0;
+#X connect 15 0 8 0;
diff --git a/pd/doc/3.audio.examples/D01.envelope.gen.pd b/pd/doc/3.audio.examples/D01.envelope.gen.pd
index 61e7a6d7..cd58d50c 100644
--- a/pd/doc/3.audio.examples/D01.envelope.gen.pd
+++ b/pd/doc/3.audio.examples/D01.envelope.gen.pd
@@ -1,90 +1,50 @@
-#N canvas 173 105 609 433 12;
-#X floatatom 96 358 0 0 100;
-#N canvas 448 68 641 420 output 0;
-#X obj 430 203 t b;
-#X obj 430 143 f;
-#X obj 430 83 inlet;
-#X obj 430 233 f;
-#X msg 541 225 0;
-#X msg 430 113 bang;
-#X obj 430 173 moses 1;
-#X obj 496 151 moses 1;
-#X obj 107 174 dbtorms;
-#X obj 496 121 r master-lvl;
-#X obj 107 56 r master-lvl;
-#X obj 430 263 s master-lvl;
-#X obj 36 202 inlet~;
-#X obj 251 229 inlet;
-#X obj 269 257 s master-lvl;
-#X msg 119 85 set \$1;
-#X obj 119 115 outlet;
-#X msg 251 283 \; pd dsp 1;
-#X obj 107 236 line~;
-#X obj 36 258 *~;
-#X obj 36 290 dac~;
-#X obj 107 204 pack 0 50;
-#X text 23 179 audio in;
-#X text 2 313 out both channels;
-#X obj 36 231 hip~ 1;
-#X obj 541 194 t b;
-#X connect 0 0 3 0;
-#X connect 1 0 6 0;
-#X connect 2 0 5 0;
-#X connect 3 0 11 0;
-#X connect 4 0 11 0;
-#X connect 5 0 1 0;
-#X connect 6 0 0 0;
-#X connect 6 1 25 0;
-#X connect 7 1 3 1;
-#X connect 8 0 21 0;
-#X connect 9 0 1 1;
-#X connect 9 0 7 0;
-#X connect 10 0 8 0;
-#X connect 10 0 15 0;
-#X connect 12 0 24 0;
-#X connect 13 0 14 0;
-#X connect 13 0 17 0;
-#X connect 15 0 16 0;
-#X connect 18 0 19 1;
-#X connect 19 0 20 0;
-#X connect 19 0 20 1;
-#X connect 21 0 18 0;
-#X connect 24 0 19 0;
-#X connect 25 0 4 0;
-#X restore 58 391 pd output;
-#X msg 134 359 MUTE;
-#X msg 247 180 bang;
-#X msg 328 180 bang;
-#X text 244 152 attack;
-#X text 325 150 release;
-#X obj 247 281 line~;
-#X msg 328 254 0 500;
-#X text 134 10 ENVELOPE GENERATORS;
-#X obj 58 246 phasor~ 50;
-#X obj 58 301 *~;
-#X obj 58 328 wrap~;
-#X msg 247 248 1 2500;
-#X obj 58 275 -~ 0.5;
-#X msg 179 247 10 200;
-#X obj 247 221 del 200;
-#X text 349 405 updated for Pd version 0.34;
-#X text 39 35 This patch uses an envelope generator to control a sound.
+#N canvas 173 105 567 576 12;
+#X text 246 260 attack;
+#X text 317 261 release;
+#X obj 248 397 line~;
+#X msg 318 355 0 500;
+#X text 126 7 ENVELOPE GENERATORS;
+#X obj 65 369 phasor~ 50;
+#X obj 65 417 *~;
+#X obj 65 465 wrap~;
+#X msg 247 355 1 2500;
+#X obj 65 393 -~ 0.5;
+#X msg 182 331 10 200;
+#X obj 247 331 del 200;
+#X text 26 22 This patch uses an envelope generator to control a sound.
When you hit "attack" two things happen. First \, the line~ object
rises to 10 in 200 milliseconds. Then after a "delay" of the same 200
msec \, the second message sends the line~ back down to 1 over another
2500 msec. The "release" just ramps us down to zero at the end.;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 15 0;
-#X connect 3 0 16 0;
-#X connect 4 0 8 0;
-#X connect 7 0 11 1;
-#X connect 8 0 7 0;
-#X connect 10 0 14 0;
-#X connect 11 0 12 0;
-#X connect 12 0 1 0;
-#X connect 13 0 7 0;
-#X connect 14 0 11 0;
+#X obj 65 513 output~;
+#X text 311 550 updated for Pd version 0.37;
+#X obj 65 441 +~ 0.5;
+#X obj 65 489 hip~ 5;
+#X obj 247 280 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 318 281 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 257 308 stop;
+#X text 28 121 You can hit the "attack" and/or "release" while something
+is still going on from a previous attack or release \, and the envelope
+generator does the ``right thing". In particular \, the release button
+sends a "stop" to the "del" object \, in case it is still scheduled
+to go off from a previous attack.;
+#X text 27 218 The synthesis method is a form of waveshaping \, which
+is the subject of a later chapter.;
+#X connect 2 0 6 1;
+#X connect 3 0 2 0;
+#X connect 5 0 9 0;
+#X connect 6 0 15 0;
+#X connect 7 0 16 0;
+#X connect 8 0 2 0;
+#X connect 9 0 6 0;
+#X connect 10 0 2 0;
+#X connect 11 0 8 0;
#X connect 15 0 7 0;
#X connect 16 0 13 0;
+#X connect 17 0 11 0;
+#X connect 17 0 10 0;
+#X connect 18 0 3 0;
+#X connect 18 0 19 0;
+#X connect 19 0 11 0;
diff --git a/pd/doc/3.audio.examples/D02.adsr.pd b/pd/doc/3.audio.examples/D02.adsr.pd
index 06fa21b7..c2a6a940 100644
--- a/pd/doc/3.audio.examples/D02.adsr.pd
+++ b/pd/doc/3.audio.examples/D02.adsr.pd
@@ -1,34 +1,42 @@
-#N canvas 141 83 672 516 12;
-#X text 412 489 updated for Pd version 0.26;
-#X graph graph1 0 -1.02 44100 1.02 395 235 595 105;
+#N canvas 40 23 609 630 12;
+#N canvas 0 0 450 300 graph1 0;
#X array adsr-output 44100 float 0;
-#X pop;
-#X text 394 244 ------ 1 second ------;
-#X obj 32 74 r trigger;
-#X obj 32 148 tabwrite~ adsr-output;
-#X obj 54 123 r graphit;
-#X msg 31 176 bang;
-#X text 75 177 <-- attack and delayed release;
-#X obj 42 200 del 500;
-#X text 146 283 <-- attack only;
-#X msg 31 264 \; pd dsp 1 \; trigger 1 \; graphit bang;
-#X text 147 360 <-- release only;
-#X msg 30 334 \; pd dsp 1 \; trigger 0 \; graphit bang;
-#X msg 42 225 \; trigger 0;
-#X text 598 221 -1;
-#X text 600 96 1;
-#X text 35 24 This patch introduces a simple "adsr" abstraction we'll
+#X coords 0 1.02 44100 -1.02 200 130 1;
+#X restore 121 332 graph;
+#X text 121 464 ------ 1 second ------;
+#X obj 18 92 r trigger;
+#X obj 34 168 tabwrite~ adsr-output;
+#X obj 56 143 r graphit;
+#X msg 261 89 bang;
+#X text 305 90 <-- attack and delayed release;
+#X obj 272 113 del 500;
+#X text 376 196 <-- attack only;
+#X msg 261 177 \; pd dsp 1 \; trigger 1 \; graphit bang;
+#X text 377 273 <-- release only;
+#X msg 260 247 \; pd dsp 1 \; trigger 0 \; graphit bang;
+#X msg 272 138 \; trigger 0;
+#X text 324 452 -1;
+#X text 326 327 1;
+#X text 12 27 This patch introduces a simple "adsr" abstraction we'll
use frequently. You can click on the "adsr" object to see what's inside.
;
-#X text 30 402 The active ingredient of the ADSR envelope generator
+#X text 16 516 The active ingredient of the ADSR envelope generator
is a single line~ which gets passed messages to make the attack and
release behavior. You can retrigger the ADSR envelope generator all
you wish without having to wait for attacks or releases to finish;
#X text 104 5 ENVELOPE GENERATOR ABSTRACTION;
-#X obj 32 100 adsr 1 100 200 50 300;
-#X connect 3 0 19 0;
-#X connect 5 0 4 0;
-#X connect 6 0 10 0;
-#X connect 6 0 8 0;
-#X connect 8 0 13 0;
-#X connect 19 0 4 0;
+#X obj 18 118 adsr 1 100 200 50 300;
+#X text 356 601 updated for Pd version 0.37;
+#X obj 36 195 osc~ 440;
+#X obj 17 220 *~;
+#X obj 16 249 output~;
+#X connect 2 0 18 0;
+#X connect 4 0 3 0;
+#X connect 5 0 9 0;
+#X connect 5 0 7 0;
+#X connect 7 0 12 0;
+#X connect 18 0 3 0;
+#X connect 18 0 21 0;
+#X connect 20 0 21 1;
+#X connect 21 0 22 0;
+#X connect 21 0 22 1;
diff --git a/pd/doc/3.audio.examples/D03.envelope.dB.pd b/pd/doc/3.audio.examples/D03.envelope.dB.pd
index 8ec1d1ae..70711f8a 100644
--- a/pd/doc/3.audio.examples/D03.envelope.dB.pd
+++ b/pd/doc/3.audio.examples/D03.envelope.dB.pd
@@ -1,9 +1,6 @@
-#N canvas 112 44 674 673 12;
+#N canvas 158 69 674 673 12;
#X obj 32 80 r trigger;
#X text 85 8 USING ADSR'S OUTPUT AS dB;
-#X text 34 28 For natural sounding amplitude control \, you will want
-to use the ADSR's output as log amplitude. In practice this is best
-done using a lookup table:;
#X obj 32 131 tabread4~ dbtorms;
#N canvas 0 0 450 300 graph1 0;
#X array dbtorms 123 float 1;
@@ -39,10 +36,10 @@ done using a lookup table:;
#X obj 141 227 dbtorms;
#X obj 152 162 t f f;
#X obj 97 259 tabwrite dbtorms;
-#X floatatom 435 103 0 0 0;
-#X floatatom 435 186 0 0 0;
+#X floatatom 435 103 0 0 0 0 - - -;
+#X floatatom 435 186 0 0 0 0 - - -;
#X obj 435 157 tabread4 dbtorms;
-#X floatatom 331 183 0 0 0;
+#X floatatom 331 183 0 0 0 0 - - -;
#X obj 331 154 dbtorms;
#X text 35 12 bang to recalculate the table;
#X text 268 62 check accuracy of reading table against;
@@ -67,92 +64,37 @@ done using a lookup table:;
#X connect 12 0 16 0;
#X connect 14 0 13 0;
#X connect 16 0 15 0;
-#X restore 288 328 pd make-table;
-#X text 258 299 here's the patch I used to make the table:;
-#X obj 48 156 osc~ 440;
+#X restore 266 351 pd make-table;
+#X text 257 327 here's the patch I used to make the table:;
+#X obj 53 157 osc~ 440;
#X text 589 176 0;
#X text 590 77 10;
#X text 406 186 ------ 123 samples ------;
-#X floatatom 61 204 0 0 0;
-#N canvas 159 26 532 285 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X obj 425 153 t b;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X restore 32 232 pd output;
-#X msg 108 205 MUTE;
-#X text 149 204 <-- output amplitude;
-#X text 112 276 <-- attack;
-#X text 113 333 <-- release;
-#X msg 32 319 \; pd dsp 1 \; trigger 0;
+#X text 117 306 <-- attack;
+#X text 116 362 <-- release;
+#X msg 31 347 \; pd dsp 1 \; trigger 0;
#X obj 32 182 *~;
-#X msg 31 264 \; pd dsp 1 \; trigger 1;
-#X text 29 431 Notice how the attack sounds different when you retrigger
-than when you start from zero. This is because if you go from the steady
-state you only rise 30 dB instead of 100 \, so it sounds slower.;
+#X msg 30 292 \; pd dsp 1 \; trigger 1;
#X obj 32 106 adsr 100 100 200 70 300;
-#X text 29 381 The table is indexed from 1 to 120 so that 1 gives a
+#X text 28 409 The table is indexed from 1 to 120 so that 1 gives a
true zero out and 120 gives 10 (a 20 dB boost.) The extra 20 dB are
for headroom.;
-#X text 28 498 If this is a problem you have at least 2 ways of dealing
-with it. The best might be to adjust the attack time inside the abstraction
-using snapshot~ to find out where you're slewing from \, as demonstrated
-in the next patch.;
-#X text 406 631 updated for Pd version 0.35;
-#X text 28 568 There's also a "real" dbtorms~ object... but it's almost
+#X text 25 459 (There's also a "real" dbtorms~ object... but it's almost
certainly much more compute-intensive than tabread4~ \, since it has
-to call a library "exp" function.;
-#X connect 0 0 21 0;
-#X connect 3 0 18 0;
-#X connect 7 0 18 1;
-#X connect 11 0 12 1;
-#X connect 12 0 11 0;
-#X connect 13 0 12 2;
-#X connect 18 0 12 0;
-#X connect 21 0 3 0;
+to call a library "exp" function.);
+#X text 26 518 Notice how the attack sounds different when you retrigger
+than when you start from zero. This is because if you go from the steady
+state you only rise 30 dB instead of 100 \, so it sounds slower...
+a slur effect. If you don't want this \, you might try increasing the
+amplitude of retriggered notes in comparison to isolated ones.;
+#X text 34 28 For more natural sounding amplitude control \, you can
+use the ADSR's output as log amplitude. In practice this is best done
+using a lookup table:;
+#X obj 31 211 output~;
+#X text 406 631 updated for Pd version 0.37;
+#X connect 0 0 15 0;
+#X connect 2 0 13 0;
+#X connect 6 0 13 1;
+#X connect 13 0 20 0;
+#X connect 13 0 20 1;
+#X connect 15 0 2 0;
diff --git a/pd/doc/3.audio.examples/D04.envelope.quartic.pd b/pd/doc/3.audio.examples/D04.envelope.quartic.pd
new file mode 100644
index 00000000..5b440ebe
--- /dev/null
+++ b/pd/doc/3.audio.examples/D04.envelope.quartic.pd
@@ -0,0 +1,81 @@
+#N canvas 130 66 646 584 12;
+#X obj 21 345 osc~;
+#X obj 21 370 *~;
+#X obj 81 350 line~;
+#X obj 21 320 line~;
+#X obj 163 455 osc~;
+#X obj 212 483 *~;
+#X obj 234 366 line~;
+#X obj 163 366 line~;
+#X obj 163 313 sqrt;
+#X obj 163 339 sqrt;
+#X obj 234 313 sqrt;
+#X obj 234 339 sqrt;
+#X obj 163 398 *~;
+#X obj 163 428 *~;
+#X obj 234 398 *~;
+#X obj 234 427 *~;
+#X obj 163 288 unpack;
+#X obj 234 288 unpack;
+#X obj 21 295 r freq;
+#X obj 81 326 r amp;
+#X obj 163 263 r freq;
+#X obj 234 263 r amp;
+#X msg 340 277 \; amp 0 5000 \;;
+#X msg 340 232 \; amp 1 5000 \;;
+#X msg 492 278 \; amp 0 1000 \;;
+#X msg 494 232 \; amp 1 1000 \;;
+#X msg 337 357 \; freq 1760 5000 \;;
+#X msg 338 404 \; freq 55 5000 \;;
+#X msg 493 357 \; freq 1760 1000 \;;
+#X msg 496 405 \; freq 55 1000 \;;
+#X text 90 15 QUARTIC AND LINEAR ENVELOPES COMPARED;
+#X obj 341 464 loadbang;
+#X msg 341 492 \; amp 1 \; freq 1760;
+#X text 22 265 LINEAR;
+#X text 168 236 QUARTIC;
+#X obj 21 397 output~;
+#X obj 212 509 output~;
+#X text 14 123 In the quartic example \, for both the amplitude and
+the frequency \, we have to take the fourth root of the target value
+(which we get by taking square root twice.) Then we raise the line~
+output to the fourth power by squaring twice (the *~ objects \, whose
+left and right inlets are the same.) The cost is mostly that of the
+four additional *~ objects.;
+#X text 350 553 updated for Pd version 0.37;
+#X text 19 39 This patch has two sine wave oscillators \, one with
+linear envelopes \, the other with quartic ones which sound more uniform.
+The message boxes sweep the amplitude and frequency up and down. You
+can compare the two to see that quartic-shaped changes sound more uniform
+than linear ones.;
+#X connect 0 0 1 0;
+#X connect 1 0 35 0;
+#X connect 1 0 35 1;
+#X connect 2 0 1 1;
+#X connect 3 0 0 0;
+#X connect 4 0 5 0;
+#X connect 5 0 36 0;
+#X connect 5 0 36 1;
+#X connect 6 0 14 0;
+#X connect 6 0 14 1;
+#X connect 7 0 12 0;
+#X connect 7 0 12 1;
+#X connect 8 0 9 0;
+#X connect 9 0 7 0;
+#X connect 10 0 11 0;
+#X connect 11 0 6 0;
+#X connect 12 0 13 0;
+#X connect 12 0 13 1;
+#X connect 13 0 4 0;
+#X connect 14 0 15 0;
+#X connect 14 0 15 1;
+#X connect 15 0 5 1;
+#X connect 16 0 8 0;
+#X connect 16 1 7 1;
+#X connect 17 0 10 0;
+#X connect 17 1 6 1;
+#X connect 18 0 3 0;
+#X connect 19 0 2 0;
+#X connect 20 0 16 0;
+#X connect 21 0 17 0;
+#X connect 31 0 32 0;
diff --git a/pd/doc/3.audio.examples/D04.envelope.pitch.pd b/pd/doc/3.audio.examples/D05.envelope.pitch.pd
index 43fbe5bc..b91477aa 100644
--- a/pd/doc/3.audio.examples/D04.envelope.pitch.pd
+++ b/pd/doc/3.audio.examples/D05.envelope.pitch.pd
@@ -1,62 +1,7 @@
#N canvas 222 84 686 544 12;
#X obj 48 106 r trigger;
#X obj 48 154 tabread4~ dbtorms;
-#X floatatom 86 232 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 48 258 pd output;
-#X msg 124 232 MUTE;
-#X text 166 231 <-- output amplitude;
-#X text 141 298 <-- attack;
+#X text 144 313 <-- attack;
#X text 568 305 <-- release;
#X obj 48 208 *~;
#N canvas 151 343 812 522 make-table 0;
@@ -67,8 +12,8 @@
#X msg 150 112 0;
#X obj 82 107 until;
#X obj 141 176 t f f;
-#X floatatom 369 67 0 0 0;
-#X floatatom 369 127 0 0 0;
+#X floatatom 369 67 0 0 0 0 - - -;
+#X floatatom 369 127 0 0 0 0 - - -;
#N canvas 0 0 450 300 graph1 0;
#X array dbtorms 123 float 1;
#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
@@ -113,7 +58,7 @@
#X coords 0 12000 130 0 200 100 1;
#X restore 537 130 graph;
#X obj 283 102 mtof;
-#X floatatom 282 127 0 0 0;
+#X floatatom 282 127 0 0 0 0 - - -;
#X text 541 237 ------ 130 samples ------;
#X text 746 223 0;
#X text 748 123 12000;
@@ -179,7 +124,7 @@ one:;
#X obj 280 106 r trigger2;
#X obj 280 178 tabread4~ mtof;
#X obj 280 202 osc~;
-#X msg 46 288 \; pd dsp 1 \; trigger 1 \; trigger2 1;
+#X msg 46 299 \; pd dsp 1 \; trigger 1 \; trigger2 1;
#X text 358 297 <-- attack;
#X msg 249 293 \; pd dsp 1 \; trigger 1 \; trigger2 -1;
#X msg 472 293 \; pd dsp 1 \; trigger 0 \; trigger2 0;
@@ -195,15 +140,14 @@ like instead of straight pitch.;
#X obj 48 130 adsr 100 50 200 90 1000;
#X obj 280 130 adsr 20 200 100 100 1000;
#X text 413 497 updated for Pd version 0.37;
-#X connect 0 0 24 0;
-#X connect 1 0 8 0;
-#X connect 2 0 3 1;
-#X connect 3 0 2 0;
-#X connect 4 0 3 2;
-#X connect 8 0 3 0;
-#X connect 12 0 25 0;
-#X connect 13 0 14 0;
-#X connect 14 0 8 1;
-#X connect 19 0 13 0;
-#X connect 24 0 1 0;
-#X connect 25 0 19 0;
+#X obj 48 233 output~;
+#X connect 0 0 20 0;
+#X connect 1 0 4 0;
+#X connect 4 0 23 0;
+#X connect 4 0 23 1;
+#X connect 8 0 21 0;
+#X connect 9 0 10 0;
+#X connect 10 0 4 1;
+#X connect 15 0 9 0;
+#X connect 20 0 1 0;
+#X connect 21 0 15 0;
diff --git a/pd/doc/3.audio.examples/D05.envelope.portamento.pd b/pd/doc/3.audio.examples/D05.envelope.portamento.pd
deleted file mode 100644
index 6542e8b5..00000000
--- a/pd/doc/3.audio.examples/D05.envelope.portamento.pd
+++ /dev/null
@@ -1,148 +0,0 @@
-#N canvas 222 84 642 346 12;
-#X floatatom 75 227 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 46 255 pd output;
-#X msg 123 227 MUTE;
-#X text 166 225 <-- output amplitude;
-#X obj 46 173 tabread4~ mtof;
-#X obj 46 197 osc~;
-#N canvas 247 30 505 439 tables 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 129 49 graph;
-#X text 331 142 0;
-#X text 333 42 10;
-#X text 127 157 ------ 123 samples ------;
-#N canvas 0 0 450 300 graph2 0;
-#X array mtof 130 float 1;
-#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
-12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
-21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
-36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
-61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
-103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
-174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
-293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
-493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
-830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
-1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
-2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
-4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
-7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
-11839.8 12543.9 13289.8 14080;
-#X coords 0 12000 130 0 200 100 1;
-#X restore 136 226 graph;
-#X text 128 336 ------ 130 samples ------;
-#X text 340 318 0;
-#X text 342 218 12000;
-#X restore 490 225 pd tables;
-#X text 35 6 PORTAMENTO;
-#X obj 46 149 line~;
-#X obj 46 101 r pitch;
-#X msg 316 101 36;
-#X msg 345 101 48;
-#X msg 372 101 60;
-#X msg 429 101 72;
-#X msg 401 101 67;
-#X msg 483 101 76;
-#X msg 457 101 74;
-#X obj 451 165 s pitch;
-#X msg 514 101 84;
-#X msg 544 101 96;
-#X floatatom 143 125 0 0 0;
-#X text 173 126 <-- change speed;
-#X floatatom 451 139 0 0 0;
-#X obj 46 125 pack 0 100;
-#X obj 388 192 loadbang;
-#X msg 387 214 \; pitch 72;
-#X text 40 37 Portamento can be done using just line~ \, but you still
-might want to sweep in pitch \, not frequency:;
-#X text 363 293 updated for Pd version 0.35;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 5 0;
-#X connect 5 0 1 0;
-#X connect 8 0 4 0;
-#X connect 9 0 23 0;
-#X connect 10 0 22 0;
-#X connect 11 0 22 0;
-#X connect 12 0 22 0;
-#X connect 13 0 22 0;
-#X connect 14 0 22 0;
-#X connect 15 0 22 0;
-#X connect 16 0 22 0;
-#X connect 18 0 22 0;
-#X connect 19 0 22 0;
-#X connect 20 0 23 1;
-#X connect 22 0 17 0;
-#X connect 23 0 8 0;
-#X connect 24 0 25 0;
diff --git a/pd/doc/3.audio.examples/D06.additive.pd b/pd/doc/3.audio.examples/D06.additive.pd
deleted file mode 100644
index 5121e62f..00000000
--- a/pd/doc/3.audio.examples/D06.additive.pd
+++ /dev/null
@@ -1,92 +0,0 @@
-#N canvas 179 69 696 468 12;
-#X floatatom 81 408 0 0 0 0 - - -;
-#N canvas 159 26 534 281 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X obj 425 153 t b;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 26 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 5 0;
-#X restore 43 435 pd output;
-#X msg 119 408 MUTE;
-#X text 153 407 <-- output amplitude;
-#X obj 43 377 catch~ sum;
-#X obj 381 288 s frequency;
-#X floatatom 381 264 0 0 0 0 - - -;
-#X floatatom 495 265 0 0 0 0 - - -;
-#X obj 495 289 s duration;
-#X msg 260 276 \; trigger bang;
-#X obj 45 221 partial 0.67 0.56 0 1;
-#X obj 45 245 partial 1 0.56 1 0.9;
-#X obj 45 269 partial 1 0.92 0 0.65;
-#X obj 45 294 partial 1.8 0.94 0 0.55;
-#X floatatom 495 217 0 0 0 0 - - -;
-#X obj 495 241 * 100;
-#X obj 381 240 mtof;
-#X floatatom 381 216 0 0 0 0 - - -;
-#X text 87 15 ADDITIVE SYNTHESIS;
-#X text 32 73 This patch demonstrates using an abstraction \, "partial"
-\, to make a simple additive synthesis instrument.;
-#X text 28 114 Partial takes as arguments an amplitude \, a relative
-frequency \, a detuning frequency \, and a relative duration. You set
-absolute duration and pitch using the controls below. Hit hte trigger
-to make sound.;
-#X text 460 435 updated for Pd version 0.26;
-#X text 535 207 duration in tenths;
-#X text 535 222 of a second;
-#X text 419 215 pitch;
-#X text 251 253 click to start;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 1 0;
-#X connect 6 0 5 0;
-#X connect 7 0 8 0;
-#X connect 14 0 15 0;
-#X connect 15 0 7 0;
-#X connect 16 0 6 0;
-#X connect 17 0 16 0;
diff --git a/pd/doc/3.audio.examples/41.envelope.portamento.pd b/pd/doc/3.audio.examples/D06.envelope.portamento.pd
index 6542e8b5..6542e8b5 100644
--- a/pd/doc/3.audio.examples/41.envelope.portamento.pd
+++ b/pd/doc/3.audio.examples/D06.envelope.portamento.pd
diff --git a/pd/doc/3.audio.examples/D07.additive.pd b/pd/doc/3.audio.examples/D07.additive.pd
new file mode 100644
index 00000000..c35a47fe
--- /dev/null
+++ b/pd/doc/3.audio.examples/D07.additive.pd
@@ -0,0 +1,50 @@
+#N canvas 9 13 684 547 12;
+#X obj 37 449 catch~ sum;
+#X obj 349 274 s frequency;
+#X obj 463 274 s duration;
+#X floatatom 463 224 0 0 0 0 - - -;
+#X obj 463 249 * 100;
+#X obj 349 249 mtof;
+#X floatatom 349 224 0 0 0 0 - - -;
+#X text 82 7 ADDITIVE SYNTHESIS;
+#X text 501 214 duration in tenths;
+#X text 503 230 of a second;
+#X text 387 223 pitch;
+#X text 433 518 updated for Pd version 0.37;
+#X obj 37 488 output~;
+#X text 26 83 Partial takes as arguments an amplitude \, a relative
+frequency \, a detuning frequency \, and a relative duration. You set
+absolute duration and pitch using the controls below. Hit the trigger
+to make sound.;
+#X obj 36 164 partial 1 1 0.56 0;
+#X text 27 31 This patch demonstrates using an abstraction \, "partial"
+\, to make a simple additive synthesis instrument originally from Jean-Claude
+Risset.;
+#X obj 349 169 loadbang;
+#X msg 349 192 72;
+#X msg 463 194 40;
+#X obj 352 322 bng 25 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X text 385 324 <-- click to play a note;
+#X obj 352 358 s trigger;
+#X obj 36 189 partial 0.67 0.9 0.56 1;
+#X obj 36 214 partial 1 0.65 0.92 0;
+#X obj 36 239 partial 1.8 0.55 0.92 1.7;
+#X obj 36 264 partial 2.67 0.325 1.19 0;
+#X obj 36 289 partial 1.67 0.35 1.7 0;
+#X obj 36 314 partial 1.46 0.25 2 0;
+#X obj 36 339 partial 1.33 0.2 2.74 0;
+#X obj 36 364 partial 1.33 0.15 3 0;
+#X obj 36 389 partial 1 0.1 3.76 0;
+#X obj 36 414 partial 1.33 0.075 4.07 0;
+#X connect 0 0 12 0;
+#X connect 0 0 12 1;
+#X connect 3 0 4 0;
+#X connect 4 0 2 0;
+#X connect 5 0 1 0;
+#X connect 6 0 5 0;
+#X connect 16 0 17 0;
+#X connect 16 0 18 0;
+#X connect 17 0 6 0;
+#X connect 18 0 3 0;
+#X connect 19 0 21 0;
diff --git a/pd/doc/3.audio.examples/D07.sampler.notes.pd b/pd/doc/3.audio.examples/D07.sampler.notes.pd
deleted file mode 100644
index 9b08a10a..00000000
--- a/pd/doc/3.audio.examples/D07.sampler.notes.pd
+++ /dev/null
@@ -1,321 +0,0 @@
-#N canvas 12 0 1074 786 12;
-#X msg 862 17 \; pd dsp 1;
-#X msg 946 17 \; pd dsp 0;
-#X text 887 53 ON;
-#X text 965 53 OFF;
-#X floatatom 64 512 0 0 0;
-#N canvas 159 26 495 262 output 0;
-#X obj 406 192 t b;
-#X obj 406 132 f;
-#X obj 406 72 inlet;
-#X text 413 35 mute;
-#X obj 406 222 f;
-#X msg 510 214 0;
-#X msg 406 102 bang;
-#X obj 406 162 moses 1;
-#X obj 510 184 t b f;
-#X obj 476 140 moses 1;
-#X obj 100 178 dbtorms;
-#X obj 476 110 r master-lvl;
-#X obj 100 50 r master-lvl;
-#X obj 406 252 s master-lvl;
-#X obj 26 217 inlet~;
-#X obj 239 49 inlet;
-#X text 239 22 level;
-#X obj 239 120 s master-lvl;
-#X msg 115 78 set \$1;
-#X obj 115 107 outlet;
-#X msg 257 77 \; pd dsp 1;
-#X obj 100 233 line~;
-#X obj 26 254 *~;
-#X obj 26 289 dac~;
-#X obj 100 205 pack 0 50;
-#X text 24 190 audio;
-#X text 112 132 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 29 546 pd output;
-#X msg 98 512 MUTE;
-#X text 143 511 <-- output amplitude;
-#X msg 253 7 bang;
-#X obj 253 35 delay 5;
-#X text 493 269 end of note;
-#X obj 359 35 r note;
-#N canvas 459 46 678 451 samples 0;
-#X graph graph1 0 -1.02 176403 1.02 262 171 462 41;
-#X array sample1 176403 float 0;
-#X pop;
-#X text 264 376 ------ 4 seconds ------;
-#X graph graph1 0 -1.02 176403 1.02 262 356 462 226;
-#X array sample2 176403 float 0;
-#X pop;
-#X restore 29 277 pd samples;
-#N canvas 21 287 947 410 recorder 0;
-#X obj 318 43 inlet;
-#X obj 272 196 adc~ 1;
-#X obj 272 224 hip~ 5;
-#X obj 341 254 line~;
-#X obj 272 253 *~;
-#X msg 341 226 1;
-#X obj 400 191 del 3990;
-#X msg 377 226 0 10;
-#X obj 272 304 tabwrite~ sample1;
-#X obj 124 110 makefilename sample%1;
-#X msg 124 139 set \$1 \, bang;
-#X msg 446 162 stop;
-#X msg 400 162 bang;
-#X obj 557 182 loadbang;
-#X obj 660 137 openpanel;
-#X msg 660 109 bang;
-#X text 702 108 <-- browse for samples;
-#X text 628 233 v-- re-read original samples;
-#X obj 318 72 route record stop reload browse;
-#X obj 557 319 soundfiler;
-#X msg 557 261 read ../sound/bell.aiff sample1 \, read ../sound/voice2.wav
-sample2;
-#X msg 660 164 read \$1 sample1;
-#X obj 660 191 soundfiler;
-#X connect 0 0 18 0;
-#X connect 1 0 2 0;
-#X connect 2 0 4 0;
-#X connect 3 0 4 1;
-#X connect 4 0 8 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 7 0 3 0;
-#X connect 9 0 10 0;
-#X connect 10 0 8 0;
-#X connect 11 0 6 0;
-#X connect 12 0 6 0;
-#X connect 13 0 20 0;
-#X connect 14 0 21 0;
-#X connect 15 0 14 0;
-#X connect 18 0 9 0;
-#X connect 18 0 12 0;
-#X connect 18 0 5 0;
-#X connect 18 1 7 0;
-#X connect 18 1 11 0;
-#X connect 18 2 20 0;
-#X connect 18 3 15 0;
-#X connect 20 0 19 0;
-#X connect 21 0 22 0;
-#X restore 29 443 pd recorder;
-#X msg 29 305 record 1;
-#X msg 29 360 stop;
-#N canvas 700 402 671 621 playback 0;
-#X obj 37 79 line~;
-#X obj 56 271 line~;
-#X obj 37 302 *~;
-#X obj 56 242 r cutoff;
-#X obj 37 50 r phase;
-#X obj 37 626 outlet~;
-#X obj 37 598 hip~ 5;
-#X obj 49 113 r sample-number;
-#X obj 49 142 makefilename sample%d;
-#X msg 49 170 set \$1;
-#X obj 37 211 tabread4~ sample1;
-#X obj 55 338 r envelope;
-#X obj 55 396 dbtorms;
-#X obj 55 367 unpack;
-#X obj 55 425 sqrt;
-#X obj 55 454 sqrt;
-#X obj 55 482 line~;
-#X obj 37 569 *~;
-#X obj 55 511 *~;
-#X obj 55 540 *~;
-#X text 107 51 messages to the phase generating line~;
-#X text 188 114 setting the sample number.;
-#X text 238 143 compute the name;
-#X text 110 171 and send a "set" message to the tabread4~.;
-#X text 116 270 line~ for de-clicking;
-#X text 156 341 The envelope generator. Rather than sending our message
-straight to the line~ we unpack it in order to fool with the amplitude
-field.;
-#X text 126 397 convert amplitude to linear units.;
-#X text 121 426 take the fourth root. This because we want to raies
-the line~'s output to the 4th power afterward. This is an inexpensive
-way to give the rise and decay a more natural sounding evolution than
-just a straight line.;
-#X text 94 514 square the output twice to get the fourth power.;
-#X connect 0 0 10 0;
-#X connect 1 0 2 1;
-#X connect 2 0 17 0;
-#X connect 3 0 1 0;
-#X connect 4 0 0 0;
-#X connect 6 0 5 0;
-#X connect 7 0 8 0;
-#X connect 8 0 9 0;
-#X connect 9 0 10 0;
-#X connect 10 0 2 0;
-#X connect 11 0 13 0;
-#X connect 12 0 14 0;
-#X connect 13 0 12 0;
-#X connect 13 1 16 1;
-#X connect 14 0 15 0;
-#X connect 15 0 16 0;
-#X connect 16 0 18 0;
-#X connect 16 0 18 1;
-#X connect 17 0 6 0;
-#X connect 18 0 19 0;
-#X connect 18 0 19 1;
-#X connect 19 0 17 1;
-#X restore 29 480 pd playback;
-#X msg 29 332 record 2;
-#X text 641 25 ARGUMENTS FOR NOTES:;
-#X text 662 53 pitch in halftones;
-#X text 662 77 amplitude (dB);
-#X text 662 125 sample number;
-#X text 662 101 duration (msec);
-#X text 662 149 start location (msec);
-#X text 662 173 rise time (msec);
-#X text 662 197 decay time (msec);
-#X obj 359 62 unpack 0 0 0 0 0 0 0;
-#X text 46 6 CHOCOLATE SAMPLER;
-#X obj 517 168 f;
-#X obj 452 142 f;
-#X obj 383 142 f;
-#X obj 346 142 f;
-#X obj 314 142 f;
-#X obj 220 142 f;
-#X obj 220 169 mtof;
-#X obj 220 197 / 261.62;
-#X obj 220 224 * 4.41e+08;
-#X obj 220 252 +;
-#X obj 485 142 delay;
-#X obj 314 312 pack 0 0 0 0 0;
-#X obj 253 62 t b b b;
-#X text 494 346 This starts the note \, sending to "receives" in the
-playback subptach. The new receive "envelope" is an amplitude control
-in parallel with the cutoff control. The "sample-number" switches the
-tabread4~ between tables.;
-#X msg 152 44 \; pd dsp 1 \; cutoff 0 5;
-#X obj 383 197 + 1;
-#X msg 552 467 60 100 10000 1 0 0 0;
-#X obj 552 737 s note;
-#X msg 517 196 \; envelope 0 \$1;
-#X msg 671 691 62;
-#X msg 706 691 64;
-#X msg 637 691 60;
-#X msg 608 691 55;
-#X msg 739 691 72;
-#X msg 576 691 48;
-#X msg 638 734 60.5;
-#X msg 552 494 60 90 10000 1 0 0 0;
-#X msg 552 522 60 100 10000 2 0 0 0;
-#X msg 552 550 60 100 10000 1 3000 0 0;
-#X obj 383 169 * 44.1;
-#X msg 552 605 60 100 100 1 0 0 0;
-#X msg 552 632 60 100 100 1 0 0 1000;
-#X msg 552 577 60 100 10000 1 0 1000 0;
-#X msg 314 340 \; envelope 0 \, \$1 \$2 \; phase \$3 \, \$4 1e+07 \;
-sample-number \$5 \; cutoff 1 5 \;;
-#X text 108 315 <-- record;
-#X msg 29 388 reload;
-#X msg 29 415 browse;
-#X text 6 109 transposition works;
-#X text 6 133 by altering the phase;
-#X text 6 181 The mtof and / 261;
-#X text 6 205 calculate speed change;
-#X text 6 229 considering 60 as unity.;
-#X text 20 43 as before we;
-#X text 11 64 mute and wait;
-#X text 6 157 target ($4 below right.);
-#X text 446 303 combine amplitude \, rise time \, start phase \, end
-phase \, and sample number in one message;
-#X text 16 594 This patch take the same principle as the previous one
-\, but allows you to parametrize sample playback. Since we must wait
-5 msec before starting the playback \, we store all the parameters
-in "f" objects \, and recall them to construct the new note. Transposition
-is done by altering the amount to play back in the (artificial) ten
-thousand seconds (1e+07). The playback segment can be altered to start
-in the middle of the sample instead of the beginning \, and you can
-change the duration and rise and decay times.;
-#X text 744 468 straight playback;
-#X text 749 495 change amplitude;
-#X text 752 523 change sample number;
-#X text 755 550 change start location;
-#X text 754 576 change rise time;
-#X text 754 609 change duration;
-#X text 755 633 ... and decay time;
-#X text 688 736 microtones OK too.;
-#X text 576 667 If you omit values they stay unchanged;
-#X text 799 759 updated for Pd version 0.33;
-#X text 548 426 Here are buttons to demonstrate the effect of varying
-the parameters one by one.;
-#X connect 4 0 5 1;
-#X connect 5 0 4 0;
-#X connect 6 0 5 2;
-#X connect 8 0 9 0;
-#X connect 8 0 42 0;
-#X connect 9 0 40 0;
-#X connect 11 0 26 0;
-#X connect 14 0 13 0;
-#X connect 15 0 13 0;
-#X connect 16 0 5 0;
-#X connect 17 0 13 0;
-#X connect 26 0 33 1;
-#X connect 26 0 8 0;
-#X connect 26 1 32 1;
-#X connect 26 2 38 1;
-#X connect 26 3 31 1;
-#X connect 26 4 30 1;
-#X connect 26 5 29 1;
-#X connect 26 6 28 1;
-#X connect 28 0 46 0;
-#X connect 29 0 39 1;
-#X connect 30 0 57 0;
-#X connect 31 0 39 4;
-#X connect 32 0 39 0;
-#X connect 33 0 34 0;
-#X connect 34 0 35 0;
-#X connect 35 0 36 0;
-#X connect 36 0 37 0;
-#X connect 37 0 39 3;
-#X connect 38 0 28 0;
-#X connect 39 0 61 0;
-#X connect 40 0 32 0;
-#X connect 40 1 33 0;
-#X connect 40 2 29 0;
-#X connect 40 2 30 0;
-#X connect 40 2 31 0;
-#X connect 40 2 38 0;
-#X connect 43 0 39 2;
-#X connect 43 0 37 1;
-#X connect 44 0 45 0;
-#X connect 47 0 45 0;
-#X connect 48 0 45 0;
-#X connect 49 0 45 0;
-#X connect 50 0 45 0;
-#X connect 51 0 45 0;
-#X connect 52 0 45 0;
-#X connect 53 0 45 0;
-#X connect 54 0 45 0;
-#X connect 55 0 45 0;
-#X connect 56 0 45 0;
-#X connect 57 0 43 0;
-#X connect 58 0 45 0;
-#X connect 59 0 45 0;
-#X connect 60 0 45 0;
-#X connect 63 0 13 0;
-#X connect 64 0 13 0;
diff --git a/pd/doc/3.audio.examples/D08.table.spectrum.pd b/pd/doc/3.audio.examples/D08.table.spectrum.pd
new file mode 100644
index 00000000..d9257e6c
--- /dev/null
+++ b/pd/doc/3.audio.examples/D08.table.spectrum.pd
@@ -0,0 +1,91 @@
+#N canvas 251 127 807 425 12;
+#N canvas 0 0 450 300 graph3 0;
+#X array spectrum-tab 127 float 1;
+#A 0 48.5713 48.5713 48.5713 48.2142 48.2142 48.2142 48.2142 48.2142
+48.2142 48.2142 48.2142 48.2142 48.2142 48.5713 48.5713 48.9284 48.9284
+48.9284 48.9284 48.9284 48.9284 48.9284 48.5713 48.5713 48.5713 48.2142
+48.2142 47.4999 47.1427 46.4285 46.4285 46.0713 46.0713 46.0713 45.7142
+44.9999 44.6428 43.5713 43.2142 42.8571 42.4999 41.7856 38.2143 36.7857
+34.6429 31.7857 30.3572 29.6429 28.5715 27.8572 26.7858 25.3572 25.7144
+23.9287 23.9287 23.5715 23.5715 23.5715 23.5715 23.2144 23.2144 23.2144
+22.8573 22.8573 23.5715 23.9287 23.5715 26.0715 26.0715 48.5713 48.5713
+48.5713 48.2142 47.4999 46.7856 46.7856 17.143 16.4287 16.0716 16.4287
+14.643 13.5716 13.5716 40.7142 40.7142 40.7142 14.643 13.2145 12.8573
+12.5002 12.5002 24.2858 29.6429 30.7143 16.4287 10.7145 11.7859 10.7145
+24.2858 23.5715 17.143 13.9288 9.64309 6.78597 5.71455 5.71455 4.28599
+3.92885 3.92885 3.92885 1.42887 1.42887 1.42887 1.07174 1.07174 1.07174
+0.714596 0.714596 0.714596 0.714596 0.714596 1.07174 1.07174 1.07174
+1.07174 0.714286 0.357143;
+#X coords 0 50 126 0 300 140 1;
+#X restore 496 136 graph;
+#N canvas 98 16 694 474 oscbank 0;
+#X obj 36 53 spectrum-partial 1;
+#X obj 36 79 spectrum-partial 2;
+#X obj 36 105 spectrum-partial 3;
+#X obj 36 131 spectrum-partial 4;
+#X obj 36 157 spectrum-partial 5;
+#X obj 36 183 spectrum-partial 6;
+#X obj 36 209 spectrum-partial 7;
+#X obj 36 235 spectrum-partial 8;
+#X obj 36 261 spectrum-partial 9;
+#X obj 36 287 spectrum-partial 10;
+#X obj 216 53 spectrum-partial 11;
+#X obj 122 382 loadbang;
+#X obj 122 407 metro 30;
+#X obj 122 433 s poll-table;
+#X text 107 21 This is the bank of oscillators--open one to see:;
+#X text 72 345 And here we send bangs to "poll-table" needed by the
+abstraction.;
+#X obj 216 79 spectrum-partial 12;
+#X obj 216 105 spectrum-partial 13;
+#X obj 216 131 spectrum-partial 14;
+#X obj 216 157 spectrum-partial 15;
+#X obj 216 183 spectrum-partial 16;
+#X obj 216 209 spectrum-partial 17;
+#X obj 216 235 spectrum-partial 18;
+#X obj 215 261 spectrum-partial 19;
+#X obj 215 287 spectrum-partial 20;
+#X obj 395 53 spectrum-partial 21;
+#X obj 395 78 spectrum-partial 22;
+#X obj 395 104 spectrum-partial 23;
+#X obj 395 130 spectrum-partial 24;
+#X obj 395 156 spectrum-partial 25;
+#X obj 395 182 spectrum-partial 26;
+#X obj 395 207 spectrum-partial 27;
+#X obj 396 234 spectrum-partial 28;
+#X obj 395 260 spectrum-partial 29;
+#X obj 395 287 spectrum-partial 30;
+#X connect 11 0 12 0;
+#X connect 12 0 13 0;
+#X restore 17 251 pd oscbank;
+#X obj 19 321 catch~ sum-bus;
+#X obj 16 153 s pitch;
+#X floatatom 16 125 4 0 0 0 - - -;
+#X text 43 18 DRAWABLE SPECTRA;
+#X floatatom 14 183 4 0 0 0 - - -;
+#X obj 14 211 s whammybar;
+#N canvas 0 0 650 341 table-setup 0;
+#X obj 39 227 loadbang;
+#X msg 39 261 \; spectrum-tab xlabel -5 0 12 24 36 48 60 72 84 96 108
+120;
+#X text 82 60 comment;
+#X connect 0 0 1 0;
+#X restore 17 283 pd table-setup;
+#X msg 596 65 \; spectrum-tab const 0;
+#X text 26 42 In this array \, you can draw a spectral envelope that
+will be synthesized by an oscillator bank. Each oscillator in the bank
+computes its own frequency and uses it to look up amplitude from the
+array.;
+#X text 113 254 <-- the oscillator bank;
+#X text 71 128 <-- pitch;
+#X text 61 185 <-- left or right shift (normally 0);
+#X text 157 318 <-- here we just collect the sum of all the partials
+which are computed in "oscbank".;
+#X text 662 44 CLEAR;
+#X text 148 283 <-- make the number labels;
+#X obj 19 358 output~;
+#X text 556 389 Updated for Pd version 0.37;
+#X connect 2 0 17 0;
+#X connect 2 0 17 1;
+#X connect 4 0 3 0;
+#X connect 6 0 7 0;
diff --git a/pd/doc/3.audio.examples/D09.shepard.tone.pd b/pd/doc/3.audio.examples/D09.shepard.tone.pd
new file mode 100644
index 00000000..8cb66603
--- /dev/null
+++ b/pd/doc/3.audio.examples/D09.shepard.tone.pd
@@ -0,0 +1,108 @@
+#N canvas 124 20 599 828 12;
+#X floatatom 169 520 0 0 0 0 - - -;
+#X floatatom 169 446 0 0 0 0 - - -;
+#X text 462 208 START;
+#X floatatom 190 303 0 0 0 0 - - -;
+#X obj 190 280 r incr;
+#X obj 168 255 metro 50;
+#X floatatom 168 373 5 0 0 0 - - -;
+#X obj 168 394 s phase;
+#X obj 168 350 +;
+#X obj 169 469 s dropoff+;
+#X obj 169 622 s interval+;
+#X floatatom 169 599 0 0 0 0 - - -;
+#X obj 169 543 s pitch+;
+#X obj 169 423 r dropoff;
+#X obj 169 497 r pitch;
+#X obj 169 576 r interval;
+#X obj 168 212 r metro;
+#X obj 228 345 f;
+#X obj 12 212 shepvoice 0;
+#X floatatom 83 708 0 0 0 0 - - -;
+#X obj 83 685 r rev;
+#X obj 138 685 r revtime;
+#X floatatom 138 708 0 0 0 0 - - -;
+#X obj 228 368 mod 10000;
+#X obj 168 327 f;
+#X obj 73 742 rev2~;
+#X obj 12 769 output~;
+#X obj 168 235 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
+1;
+#X msg 446 225 \; dropoff 10 \; pitch 60 \; interval 120 \; metro 1
+\; rev 84 \; revtime 87 \; incr -2 \; pd dsp 1;
+#X text 27 7 SHEPARD TONE;
+#X text 339 804 updated for Pd version 0.37;
+#X obj 12 235 shepvoice 500;
+#X obj 12 258 shepvoice 1000;
+#X obj 12 281 shepvoice 1500;
+#X obj 12 304 shepvoice 2000;
+#X obj 12 327 shepvoice 2500;
+#X obj 12 350 shepvoice 3000;
+#X obj 12 373 shepvoice 3500;
+#X obj 12 396 shepvoice 4000;
+#X obj 12 419 shepvoice 4500;
+#X obj 12 442 shepvoice 5000;
+#X obj 12 465 shepvoice 5500;
+#X obj 12 488 shepvoice 6000;
+#X obj 12 511 shepvoice 6500;
+#X obj 12 534 shepvoice 7000;
+#X obj 12 557 shepvoice 7500;
+#X obj 12 580 shepvoice 8000;
+#X obj 12 603 shepvoice 8500;
+#X obj 12 626 shepvoice 9000;
+#X obj 12 649 shepvoice 9500;
+#X text 25 31 This patch is a bank of 20 sinusoids \, arranged so that
+their frequencies sweep upward or downward in parallel \, and their
+amplitudes fade in and out so that each one is quiet when it wraps
+around from one end to the other. The overall "phase" computed here
+is added to each voice's relative phase (its creation argument). The
+"incr" parameter controlls how fast the phase changes \, "dropoff"
+the slope at which the amplitudes fall off at the ends \, "pitch" the
+center pitch of the cluster \, "interval" the number of (tenths of
+halftones) between successive voices \, and "rev" and "revtime" the
+reverberator at bottom.;
+#X connect 0 0 12 0;
+#X connect 1 0 9 0;
+#X connect 3 0 24 1;
+#X connect 4 0 3 0;
+#X connect 5 0 24 0;
+#X connect 6 0 7 0;
+#X connect 8 0 17 0;
+#X connect 8 0 6 0;
+#X connect 11 0 10 0;
+#X connect 13 0 1 0;
+#X connect 14 0 0 0;
+#X connect 15 0 11 0;
+#X connect 16 0 27 0;
+#X connect 17 0 23 0;
+#X connect 18 0 31 0;
+#X connect 19 0 25 1;
+#X connect 20 0 19 0;
+#X connect 21 0 22 0;
+#X connect 22 0 25 2;
+#X connect 23 0 8 1;
+#X connect 24 0 8 0;
+#X connect 25 0 26 0;
+#X connect 25 1 26 1;
+#X connect 27 0 5 0;
+#X connect 31 0 32 0;
+#X connect 32 0 33 0;
+#X connect 33 0 34 0;
+#X connect 34 0 35 0;
+#X connect 35 0 36 0;
+#X connect 36 0 37 0;
+#X connect 37 0 38 0;
+#X connect 38 0 39 0;
+#X connect 39 0 40 0;
+#X connect 40 0 41 0;
+#X connect 41 0 42 0;
+#X connect 42 0 43 0;
+#X connect 43 0 44 0;
+#X connect 44 0 45 0;
+#X connect 45 0 46 0;
+#X connect 46 0 47 0;
+#X connect 47 0 48 0;
+#X connect 48 0 49 0;
+#X connect 49 0 25 0;
+#X connect 49 0 26 0;
+#X connect 49 0 26 1;
diff --git a/pd/doc/3.audio.examples/D09.table.spectrum.pd b/pd/doc/3.audio.examples/D09.table.spectrum.pd
deleted file mode 100644
index 65ccccde..00000000
--- a/pd/doc/3.audio.examples/D09.table.spectrum.pd
+++ /dev/null
@@ -1,143 +0,0 @@
-#N canvas 227 120 801 403 12;
-#X graph graph3 0 0 126 50 496 276 796 136;
-#X array spectrum-tab 127 float 1;
-#A 0 42.8571 42.5 43.2143 43.2143 43.2143 43.2143 43.2143 42.8571 42.8571
-42.8571 42.8571 42.8571 42.8571 42.5 42.5 42.5 42.5 42.5 42.5 42.5
-42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5 42.5
-42.5 42.5 42.1429 42.1429 41.7857 41.0714 40.3571 39.6429 39.2857 38.2143
-37.5 37.1429 36.0714 35.3571 33.9286 33.2143 32.8571 31.4286 31.0714
-30.3571 28.9286 28.2143 27.5 26.4286 25.7143 23.9286 23.2143 21.7857
-21.0714 20.7143 20 19.6429 19.6429 23.2143 28.2143 31.4286 33.5714
-36.4286 37.8571 38.9286 43.9286 45.7143 47.8571 47.8571 47.8571 47.8571
-47.5 47.1429 43.2143 40.3571 36.4286 33.9286 32.1429 29.2857 18.2143
-16.7857 16.7857 17.5 19.6429 22.1429 28.2143 33.9286 33.9286 33.9286
-33.5714 22.5 18.5714 16.7857 4.64286 4.64286 18.2143 17.1429 8.92857
-4.28571 11.4286 10 7.5 6.42857 5.71429 5.35714 5 4.64286 4.28571 3.92857
-3.92857 3.57143 3.57143 2.85714 2.5 2.14286 1.78571 0.714286 0.357143
-;
-#X pop;
-#X floatatom 57 351 0 0 0;
-#N canvas 159 26 526 286 output 0;
-#X obj 345 163 t b;
-#X obj 345 112 f;
-#X obj 345 61 inlet;
-#X text 351 30 mute;
-#X obj 345 189 f;
-#X msg 434 182 0;
-#X msg 345 87 bang;
-#X obj 345 138 moses 1;
-#X obj 405 119 moses 1;
-#X obj 85 151 dbtorms;
-#X obj 405 94 r master-lvl;
-#X obj 85 43 r master-lvl;
-#X obj 345 214 s master-lvl;
-#X obj 22 185 inlet~;
-#X obj 203 42 inlet;
-#X text 203 18 level;
-#X obj 203 102 s master-lvl;
-#X msg 98 67 set \$1;
-#X obj 98 91 outlet;
-#X msg 218 65 \; pd dsp 1;
-#X obj 85 198 line~;
-#X obj 22 216 *~;
-#X obj 22 246 dac~;
-#X obj 85 175 pack 0 50;
-#X text 20 162 audio;
-#X obj 434 155 t b;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 25 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 25 0 5 0;
-#X restore 19 376 pd output;
-#X msg 95 350 MUTE;
-#N canvas 98 16 694 474 oscbank 0;
-#X obj 36 53 spectrum-partial 1;
-#X obj 36 79 spectrum-partial 2;
-#X obj 36 105 spectrum-partial 3;
-#X obj 36 131 spectrum-partial 4;
-#X obj 36 157 spectrum-partial 5;
-#X obj 36 183 spectrum-partial 6;
-#X obj 36 209 spectrum-partial 7;
-#X obj 36 235 spectrum-partial 8;
-#X obj 36 261 spectrum-partial 9;
-#X obj 36 287 spectrum-partial 10;
-#X obj 216 53 spectrum-partial 11;
-#X obj 122 382 loadbang;
-#X obj 122 407 metro 30;
-#X obj 122 433 s poll-table;
-#X text 107 21 This is the bank of oscillators--open one to see:;
-#X text 72 345 And here we send bangs to "poll-table" needed by the
-abstraction.;
-#X obj 216 79 spectrum-partial 12;
-#X obj 216 105 spectrum-partial 13;
-#X obj 216 131 spectrum-partial 14;
-#X obj 216 157 spectrum-partial 15;
-#X obj 216 183 spectrum-partial 16;
-#X obj 216 209 spectrum-partial 17;
-#X obj 216 235 spectrum-partial 18;
-#X obj 215 261 spectrum-partial 19;
-#X obj 215 287 spectrum-partial 20;
-#X obj 395 53 spectrum-partial 21;
-#X obj 395 78 spectrum-partial 22;
-#X obj 395 104 spectrum-partial 23;
-#X obj 395 130 spectrum-partial 24;
-#X obj 395 156 spectrum-partial 25;
-#X obj 395 182 spectrum-partial 26;
-#X obj 395 207 spectrum-partial 27;
-#X obj 396 234 spectrum-partial 28;
-#X obj 395 260 spectrum-partial 29;
-#X obj 395 287 spectrum-partial 30;
-#X connect 11 0 12 0;
-#X connect 12 0 13 0;
-#X restore 17 251 pd oscbank;
-#X obj 19 321 catch~ sum-bus;
-#X obj 16 153 s pitch;
-#X floatatom 16 125 4 0 0;
-#X text 43 18 DRAWABLE SPECTRA;
-#X floatatom 14 183 4 0 0;
-#X obj 14 211 s whammybar;
-#N canvas 0 0 650 341 table-setup 0;
-#X obj 39 227 loadbang;
-#X msg 39 261 \; spectrum-tab xlabel -5 0 12 24 36 48 60 72 84 96 108
-120;
-#X text 82 60 comment;
-#X connect 0 0 1 0;
-#X restore 17 283 pd table-setup;
-#X msg 596 65 \; spectrum-tab const 0;
-#X text 555 381 Updated for Pd version 0.34;
-#X text 26 42 In this array \, you can draw a spectral envelope that
-will be synthesized by an oscillator bank. Each oscillator in the bank
-computes its own frequency and uses it to look up amplitude from the
-array.;
-#X text 113 254 <-- the oscillator bank;
-#X text 71 128 <-- pitch;
-#X text 61 185 <-- left or right shift (normally 0);
-#X text 157 318 <-- here we just collect the sum of all the partials
-which are computed in "oscbank".;
-#X text 662 44 CLEAR;
-#X text 148 283 <-- make the number labels;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 5 0 2 0;
-#X connect 7 0 6 0;
-#X connect 9 0 10 0;
diff --git a/pd/doc/3.audio.examples/D10.risset.bell.pd b/pd/doc/3.audio.examples/D10.risset.bell.pd
deleted file mode 100644
index 8e329eaa..00000000
--- a/pd/doc/3.audio.examples/D10.risset.bell.pd
+++ /dev/null
@@ -1,109 +0,0 @@
-#N canvas 375 37 484 454 12;
-#X floatatom 129 403 0 0 0 0 - - -;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 159 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 105 428 pd output;
-#X msg 154 403 MUTE;
-#X text 195 402 <-- output amplitude;
-#X obj 97 167 sinevoice 1 0.56 0 1;
-#X obj 243 42 unpack 0 0 0;
-#X floatatom 242 84 0 0 0 0 - - -;
-#X obj 217 62 t b f;
-#X floatatom 276 84 0 0 0 0 - - -;
-#X floatatom 310 84 0 0 0 0 - - -;
-#X obj 217 105 f;
-#X msg 170 84 bang;
-#X obj 217 127 pack 0 0 0;
-#X msg 243 20 80 72 5000;
-#X obj 97 189 sinevoice 0.67 0.56 1 0.9;
-#X obj 97 211 sinevoice 1 0.92 0 0.65;
-#X obj 97 233 sinevoice 1.8 0.92 1.7 0.55;
-#X obj 97 255 sinevoice 2.67 1.19 0 0.325;
-#X obj 97 277 sinevoice 1.67 1.7 0 0.35;
-#X obj 97 299 sinevoice 1.46 2 0 0.25;
-#X obj 97 321 sinevoice 1.33 2.74 0 0.2;
-#X obj 97 343 sinevoice 1 3 0 0.15;
-#X obj 97 365 sinevoice 1.33 4.07 0 0.075;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 14 0;
-#X connect 4 1 14 1;
-#X connect 5 0 7 0;
-#X connect 5 1 8 0;
-#X connect 5 2 9 0;
-#X connect 6 0 10 1;
-#X connect 7 0 10 0;
-#X connect 7 1 6 0;
-#X connect 8 0 12 1;
-#X connect 9 0 12 2;
-#X connect 10 0 12 0;
-#X connect 11 0 10 0;
-#X connect 12 0 4 1;
-#X connect 13 0 5 0;
-#X connect 14 0 15 0;
-#X connect 14 1 15 1;
-#X connect 15 0 16 0;
-#X connect 15 1 16 1;
-#X connect 16 0 17 0;
-#X connect 16 1 17 1;
-#X connect 17 0 18 0;
-#X connect 17 1 18 1;
-#X connect 18 0 19 0;
-#X connect 18 1 19 1;
-#X connect 19 0 20 0;
-#X connect 19 1 20 1;
-#X connect 20 0 21 0;
-#X connect 20 1 21 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 1 0;
diff --git a/pd/doc/3.audio.examples/D10.sampler.notes.pd b/pd/doc/3.audio.examples/D10.sampler.notes.pd
new file mode 100644
index 00000000..6bfd1402
--- /dev/null
+++ b/pd/doc/3.audio.examples/D10.sampler.notes.pd
@@ -0,0 +1,263 @@
+#N canvas 12 0 1074 786 12;
+#X msg 257 7 bang;
+#X obj 257 35 delay 5;
+#X text 497 269 end of note;
+#X obj 363 35 r note;
+#N canvas 459 46 678 451 samples 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array sample1 176403 float 0;
+#X coords 0 1.02 176403 -1.02 200 130 1;
+#X restore 262 41 graph;
+#X text 264 376 ------ 4 seconds ------;
+#N canvas 0 0 450 300 graph1 0;
+#X array sample2 176403 float 0;
+#X coords 0 1.02 176403 -1.02 200 130 1;
+#X restore 262 226 graph;
+#X restore 33 277 pd samples;
+#N canvas 21 287 947 410 recorder 0;
+#X obj 318 43 inlet;
+#X obj 272 196 adc~ 1;
+#X obj 272 224 hip~ 5;
+#X obj 341 254 line~;
+#X obj 272 253 *~;
+#X msg 341 226 1;
+#X obj 400 191 del 3990;
+#X msg 377 226 0 10;
+#X obj 272 304 tabwrite~ sample1;
+#X obj 124 110 makefilename sample%1;
+#X msg 124 139 set \$1 \, bang;
+#X msg 446 162 stop;
+#X msg 400 162 bang;
+#X obj 557 182 loadbang;
+#X obj 660 137 openpanel;
+#X msg 660 109 bang;
+#X text 702 108 <-- browse for samples;
+#X text 628 233 v-- re-read original samples;
+#X obj 318 72 route record stop reload browse;
+#X obj 557 319 soundfiler;
+#X msg 557 261 read ../sound/bell.aiff sample1 \, read ../sound/voice2.wav
+sample2;
+#X msg 660 164 read \$1 sample1;
+#X obj 660 191 soundfiler;
+#X connect 0 0 18 0;
+#X connect 1 0 2 0;
+#X connect 2 0 4 0;
+#X connect 3 0 4 1;
+#X connect 4 0 8 0;
+#X connect 5 0 3 0;
+#X connect 6 0 7 0;
+#X connect 7 0 3 0;
+#X connect 9 0 10 0;
+#X connect 10 0 8 0;
+#X connect 11 0 6 0;
+#X connect 12 0 6 0;
+#X connect 13 0 20 0;
+#X connect 14 0 21 0;
+#X connect 15 0 14 0;
+#X connect 18 0 9 0;
+#X connect 18 0 12 0;
+#X connect 18 0 5 0;
+#X connect 18 1 7 0;
+#X connect 18 1 11 0;
+#X connect 18 2 20 0;
+#X connect 18 3 15 0;
+#X connect 20 0 19 0;
+#X connect 21 0 22 0;
+#X restore 33 443 pd recorder;
+#X msg 33 305 record 1;
+#X msg 33 360 stop;
+#N canvas 359 226 666 626 playback 0;
+#X obj 20 45 line~;
+#X obj 39 237 line~;
+#X obj 20 268 *~;
+#X obj 39 208 r cutoff;
+#X obj 20 16 r phase;
+#X obj 20 592 outlet~;
+#X obj 20 564 hip~ 5;
+#X obj 32 79 r sample-number;
+#X obj 32 108 makefilename sample%d;
+#X msg 32 136 set \$1;
+#X obj 20 177 tabread4~ sample1;
+#X obj 38 304 r envelope;
+#X obj 38 362 dbtorms;
+#X obj 38 333 unpack;
+#X obj 38 391 sqrt;
+#X obj 38 420 sqrt;
+#X obj 38 448 line~;
+#X obj 20 535 *~;
+#X obj 38 477 *~;
+#X obj 38 506 *~;
+#X text 90 17 messages to the phase generating line~;
+#X text 171 80 setting the sample number.;
+#X text 221 109 compute the name;
+#X text 93 137 and send a "set" message to the tabread4~.;
+#X text 99 236 line~ for de-clicking;
+#X text 139 307 The envelope generator. Rather than sending our message
+straight to the line~ we unpack it in order to fool with the amplitude
+field.;
+#X text 109 363 convert amplitude to linear units.;
+#X text 104 392 take the fourth root. This because we want to raies
+the line~'s output to the 4th power afterward. This is an inexpensive
+way to give the rise and decay a more natural sounding evolution than
+just a straight line.;
+#X text 77 480 square the output twice to get the fourth power.;
+#X connect 0 0 10 0;
+#X connect 1 0 2 1;
+#X connect 2 0 17 0;
+#X connect 3 0 1 0;
+#X connect 4 0 0 0;
+#X connect 6 0 5 0;
+#X connect 7 0 8 0;
+#X connect 8 0 9 0;
+#X connect 9 0 10 0;
+#X connect 10 0 2 0;
+#X connect 11 0 13 0;
+#X connect 12 0 14 0;
+#X connect 13 0 12 0;
+#X connect 13 1 16 1;
+#X connect 14 0 15 0;
+#X connect 15 0 16 0;
+#X connect 16 0 18 0;
+#X connect 16 0 18 1;
+#X connect 17 0 6 0;
+#X connect 18 0 19 0;
+#X connect 18 0 19 1;
+#X connect 19 0 17 1;
+#X restore 33 480 pd playback;
+#X msg 33 332 record 2;
+#X text 645 25 ARGUMENTS FOR NOTES:;
+#X text 666 53 pitch in halftones;
+#X text 666 77 amplitude (dB);
+#X text 666 125 sample number;
+#X text 666 101 duration (msec);
+#X text 666 149 start location (msec);
+#X text 666 173 rise time (msec);
+#X text 666 197 decay time (msec);
+#X obj 363 62 unpack 0 0 0 0 0 0 0;
+#X text 50 6 CHOCOLATE SAMPLER;
+#X obj 521 168 f;
+#X obj 456 142 f;
+#X obj 387 142 f;
+#X obj 350 142 f;
+#X obj 318 142 f;
+#X obj 224 142 f;
+#X obj 224 169 mtof;
+#X obj 224 197 / 261.62;
+#X obj 224 224 * 4.41e+08;
+#X obj 224 252 +;
+#X obj 489 142 delay;
+#X obj 318 312 pack 0 0 0 0 0;
+#X obj 257 62 t b b b;
+#X text 498 346 This starts the note \, sending to "receives" in the
+playback subptach. The new receive "envelope" is an amplitude control
+in parallel with the cutoff control. The "sample-number" switches the
+tabread4~ between tables.;
+#X msg 156 44 \; pd dsp 1 \; cutoff 0 5;
+#X obj 387 197 + 1;
+#X msg 556 467 60 100 10000 1 0 0 0;
+#X obj 556 737 s note;
+#X msg 521 196 \; envelope 0 \$1;
+#X msg 675 691 62;
+#X msg 710 691 64;
+#X msg 641 691 60;
+#X msg 612 691 55;
+#X msg 743 691 72;
+#X msg 580 691 48;
+#X msg 642 734 60.5;
+#X msg 556 494 60 90 10000 1 0 0 0;
+#X msg 556 522 60 100 10000 2 0 0 0;
+#X msg 556 550 60 100 10000 1 3000 0 0;
+#X obj 387 169 * 44.1;
+#X msg 556 605 60 100 100 1 0 0 0;
+#X msg 556 632 60 100 100 1 0 0 1000;
+#X msg 556 577 60 100 10000 1 0 1000 0;
+#X msg 318 340 \; envelope 0 \, \$1 \$2 \; phase \$3 \, \$4 1e+07 \;
+sample-number \$5 \; cutoff 1 5 \;;
+#X text 117 305 <-- record;
+#X msg 33 388 reload;
+#X msg 33 415 browse;
+#X text 7 109 transposition works;
+#X text 7 133 by altering the phase;
+#X text 7 181 The mtof and / 261;
+#X text 7 205 calculate speed change;
+#X text 7 229 considering 60 as unity.;
+#X text 24 43 as before we;
+#X text 15 64 mute and wait;
+#X text 7 157 target ($4 below right.);
+#X text 450 303 combine amplitude \, rise time \, start phase \, end
+phase \, and sample number in one message;
+#X text 764 467 straight playback;
+#X text 764 493 change amplitude;
+#X text 767 521 change sample number;
+#X text 769 550 change start location;
+#X text 768 576 change rise time;
+#X text 768 609 change duration;
+#X text 769 633 ... and decay time;
+#X text 692 736 microtones OK too.;
+#X text 580 667 If you omit values they stay unchanged;
+#X text 552 426 Here are buttons to demonstrate the effect of varying
+the parameters one by one.;
+#X obj 34 511 output~;
+#X text 13 596 This patch take the same principle as the earlier "one-shot
+sampler" \, but allows you to parametrize sample playback. Since we
+must wait 5 msec before starting the playback \, we store all the parameters
+in "f" objects \, and recall them to construct the new note. Transposition
+is done by altering the amount to play back in the (artificial) ten
+thousand seconds (1e+07). The playback segment can be altered to start
+in the middle of the sample instead of the beginning \, and you can
+change the duration and rise and decay times.;
+#X text 823 763 updated for Pd version 0.37;
+#X connect 0 0 1 0;
+#X connect 0 0 34 0;
+#X connect 1 0 32 0;
+#X connect 3 0 18 0;
+#X connect 6 0 5 0;
+#X connect 7 0 5 0;
+#X connect 8 0 76 0;
+#X connect 8 0 76 1;
+#X connect 9 0 5 0;
+#X connect 18 0 25 1;
+#X connect 18 0 0 0;
+#X connect 18 1 24 1;
+#X connect 18 2 30 1;
+#X connect 18 3 23 1;
+#X connect 18 4 22 1;
+#X connect 18 5 21 1;
+#X connect 18 6 20 1;
+#X connect 20 0 38 0;
+#X connect 21 0 31 1;
+#X connect 22 0 49 0;
+#X connect 23 0 31 4;
+#X connect 24 0 31 0;
+#X connect 25 0 26 0;
+#X connect 26 0 27 0;
+#X connect 27 0 28 0;
+#X connect 28 0 29 0;
+#X connect 29 0 31 3;
+#X connect 30 0 20 0;
+#X connect 31 0 53 0;
+#X connect 32 0 24 0;
+#X connect 32 1 25 0;
+#X connect 32 2 21 0;
+#X connect 32 2 22 0;
+#X connect 32 2 23 0;
+#X connect 32 2 30 0;
+#X connect 35 0 31 2;
+#X connect 35 0 29 1;
+#X connect 36 0 37 0;
+#X connect 39 0 37 0;
+#X connect 40 0 37 0;
+#X connect 41 0 37 0;
+#X connect 42 0 37 0;
+#X connect 43 0 37 0;
+#X connect 44 0 37 0;
+#X connect 45 0 37 0;
+#X connect 46 0 37 0;
+#X connect 47 0 37 0;
+#X connect 48 0 37 0;
+#X connect 49 0 35 0;
+#X connect 50 0 37 0;
+#X connect 51 0 37 0;
+#X connect 52 0 37 0;
+#X connect 55 0 5 0;
+#X connect 56 0 5 0;
diff --git a/pd/doc/3.audio.examples/D08.sampler.poly.pd b/pd/doc/3.audio.examples/D11.sampler.poly.pd
index 3e6cdba9..60aa7377 100644
--- a/pd/doc/3.audio.examples/D08.sampler.poly.pd
+++ b/pd/doc/3.audio.examples/D11.sampler.poly.pd
@@ -1,59 +1,4 @@
#N canvas 66 253 1119 674 12;
-#X floatatom 582 562 0 0 0 0 - - -;
-#N canvas 159 26 495 262 output 0;
-#X obj 406 192 t b;
-#X obj 406 132 f;
-#X obj 406 72 inlet;
-#X text 413 35 mute;
-#X obj 406 222 f;
-#X msg 510 214 0;
-#X msg 406 102 bang;
-#X obj 406 162 moses 1;
-#X obj 510 184 t b f;
-#X obj 476 140 moses 1;
-#X obj 100 178 dbtorms;
-#X obj 476 110 r master-lvl;
-#X obj 100 50 r master-lvl;
-#X obj 406 252 s master-lvl;
-#X obj 26 217 inlet~;
-#X obj 239 49 inlet;
-#X text 239 22 level;
-#X obj 239 120 s master-lvl;
-#X msg 115 78 set \$1;
-#X obj 115 107 outlet;
-#X msg 257 77 \; pd dsp 1;
-#X obj 100 233 line~;
-#X obj 26 254 *~;
-#X obj 26 289 dac~;
-#X obj 100 205 pack 0 50;
-#X text 24 190 audio;
-#X text 112 132 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 547 595 pd output;
-#X msg 617 562 MUTE;
-#X text 660 561 <-- output amplitude;
#N canvas 0 0 600 392 samples 0;
#N canvas 0 0 450 300 graph1 0;
#X array sample1 176403 float 0;
@@ -149,16 +94,14 @@ sample2;
#X obj 617 272 pack 0 0 0 0 0 0 0 0;
#X obj 617 300 route 1 2 3 4 5 6 7 8;
#X text 929 124 record \, etc.;
-#X text 206 142 increment mod 1e+06 to make fake pitch;
-#X text 326 177 supply note-off message;
-#X text 336 207 allocate sampler voice;
-#X text 359 232 drop note off again;
+#X text 335 203 allocate sampler voice;
+#X text 361 228 drop note off again;
#X obj 704 516 qlist;
#X obj 870 520 r comment;
#X text 732 445 sailors to untie him...;
#X text 735 395 Lashed to the mast of his boat \, Ulysses;
#X text 735 420 hears beautiful singing. He begs his;
-#X text 19 271 Here we take the previous patch and make it polyphonic
+#X text 7 263 Here we take the previous patch and make it polyphonic
\, with 8 voices. The single voice which we had before has been made
into an abstraction \, "sampvoice.pd" \, which we instantiate in 8
copies. Earlier we used sends and receives to pass messages to "cutoff"
@@ -166,12 +109,12 @@ copies. Earlier we used sends and receives to pass messages to "cutoff"
sending messages to each other \, so we combine the control and the
audio computation in the sampvoice abstraction without using send and
receive. Click on one to see how.;
-#X text 20 421 The "poly" object essentially repeats pitch and velocity
+#X text 8 413 The "poly" object essentially repeats pitch and velocity
pairs to its output \, but also sending a voice number from its left
outlet. To use it \, we unpack the 7 parameters \, calculate the voice
number \, repack the message as 8 parameters with voice number first
\, and use "route" to send it to one of the 8 voices.;
-#X text 20 523 There's some bother because poly expects to track note
+#X text 8 515 There's some bother because poly expects to track note
on and note off messages separately as they would come from a MIDI
keyboard. So we assign each note a unique fake "pitch" \, use makenote
to generate the note-off messages \, and run poly on the resulting
@@ -181,49 +124,52 @@ voice number we just scored.;
#X text 854 639 updated for Pd version 0.33;
#X msg 704 486 read qlist-sampler.txt \, rewind \, tempo 1 \, bang
;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 6 0 5 0;
-#X connect 7 0 5 0;
-#X connect 8 0 5 0;
-#X connect 17 0 5 0;
-#X connect 18 0 5 0;
-#X connect 20 0 1 0;
+#X obj 548 551 output~;
+#X text 249 108 increment mod 1e+06 to make tag;
+#X text 276 127 (acts like a MIDI pitch to;
+#X text 277 146 identify the note to "poly");
+#X text 258 175 supply delayed note-off message;
+#X connect 2 0 1 0;
+#X connect 3 0 1 0;
+#X connect 4 0 1 0;
+#X connect 13 0 1 0;
+#X connect 14 0 1 0;
+#X connect 16 0 48 0;
+#X connect 16 0 48 1;
+#X connect 17 0 16 0;
+#X connect 18 0 17 0;
+#X connect 19 0 18 0;
+#X connect 20 0 19 0;
#X connect 21 0 20 0;
#X connect 22 0 21 0;
#X connect 23 0 22 0;
-#X connect 24 0 23 0;
-#X connect 25 0 24 0;
-#X connect 26 0 25 0;
-#X connect 27 0 26 0;
+#X connect 24 0 25 0;
+#X connect 25 0 26 0;
+#X connect 25 1 33 2;
+#X connect 25 2 30 2;
+#X connect 25 2 33 3;
+#X connect 25 3 33 4;
+#X connect 25 4 33 5;
+#X connect 25 5 33 6;
+#X connect 25 6 33 7;
+#X connect 26 0 27 0;
+#X connect 26 1 33 1;
+#X connect 27 0 28 0;
+#X connect 27 0 30 0;
#X connect 28 0 29 0;
-#X connect 29 0 30 0;
-#X connect 29 1 37 2;
-#X connect 29 2 34 2;
-#X connect 29 2 37 3;
-#X connect 29 3 37 4;
-#X connect 29 4 37 5;
-#X connect 29 5 37 6;
-#X connect 29 6 37 7;
+#X connect 29 0 27 1;
#X connect 30 0 31 0;
-#X connect 30 1 37 1;
+#X connect 30 1 31 1;
#X connect 31 0 32 0;
-#X connect 31 0 34 0;
+#X connect 31 2 32 1;
#X connect 32 0 33 0;
-#X connect 33 0 31 1;
-#X connect 34 0 35 0;
-#X connect 34 1 35 1;
-#X connect 35 0 36 0;
-#X connect 35 2 36 1;
-#X connect 36 0 37 0;
-#X connect 37 0 38 0;
-#X connect 38 0 27 1;
-#X connect 38 1 26 1;
-#X connect 38 2 25 1;
-#X connect 38 3 24 1;
-#X connect 38 4 23 1;
-#X connect 38 5 22 1;
-#X connect 38 6 21 1;
-#X connect 38 7 20 1;
-#X connect 53 0 44 0;
+#X connect 33 0 34 0;
+#X connect 34 0 23 1;
+#X connect 34 1 22 1;
+#X connect 34 2 21 1;
+#X connect 34 3 20 1;
+#X connect 34 4 19 1;
+#X connect 34 5 18 1;
+#X connect 34 6 17 1;
+#X connect 34 7 16 1;
+#X connect 47 0 38 0;
diff --git a/pd/doc/3.audio.examples/D11.shepard.tone.pd b/pd/doc/3.audio.examples/D11.shepard.tone.pd
deleted file mode 100644
index 8be283ab..00000000
--- a/pd/doc/3.audio.examples/D11.shepard.tone.pd
+++ /dev/null
@@ -1,110 +0,0 @@
-#N canvas 19 0 594 599 12;
-#X floatatom 107 202 0 0 0 0 - - -;
-#X floatatom 11 202 0 0 0 0 - - -;
-#X text 140 17 STOP;
-#X text 20 3 START;
-#X floatatom 78 358 0 0 0 0 - - -;
-#X obj 78 337 r incr;
-#X obj 65 310 metro 50;
-#X floatatom 64 426 0 0 0 0 - - -;
-#X obj 62 494 s phase;
-#X obj 62 474 + 10000;
-#X obj 64 406 +;
-#X obj 11 222 s dropoff+;
-#X obj 186 221 s interval+;
-#X floatatom 186 201 0 0 0 0 - - -;
-#X obj 107 222 s pitch+;
-#X obj 11 182 r dropoff;
-#X obj 107 182 r pitch;
-#X obj 186 181 r interval;
-#X floatatom 65 289 0 0 0 0 - - -;
-#X obj 65 269 r metro;
-#X obj 124 406 f;
-#X obj 295 467 *~;
-#X obj 295 15 shepvoice 0;
-#X obj 315 441 line~;
-#X obj 471 408 pack 0 100;
-#X floatatom 471 367 0 0 0 0 - - -;
-#X obj 471 347 r amp;
-#X obj 295 519 dac~;
-#X obj 471 387 dbtorms;
-#X floatatom 372 464 0 0 0 0 - - -;
-#X obj 372 444 r rev;
-#X obj 420 440 r revtime;
-#X floatatom 420 461 0 0 0 0 - - -;
-#X obj 313 497 rev4~;
-#X obj 124 426 mod 10000;
-#X obj 295 36 shepvoice 500;
-#X obj 295 56 shepvoice 1000;
-#X obj 295 77 shepvoice 1500;
-#X obj 295 97 shepvoice 2000;
-#X obj 295 117 shepvoice 2500;
-#X obj 295 138 shepvoice 3000;
-#X obj 295 158 shepvoice 3500;
-#X obj 295 179 shepvoice 4000;
-#X obj 295 199 shepvoice 4500;
-#X obj 295 219 shepvoice 5000;
-#X obj 295 240 shepvoice 5500;
-#X obj 295 260 shepvoice 6000;
-#X obj 295 281 shepvoice 6500;
-#X obj 295 301 shepvoice 7000;
-#X obj 295 321 shepvoice 7500;
-#X obj 295 342 shepvoice 8000;
-#X obj 295 362 shepvoice 8500;
-#X obj 295 385 shepvoice 9000;
-#X obj 295 405 shepvoice 9500;
-#X obj 65 380 f;
-#X msg 140 35 \; amp 0 \;;
-#X msg 6 18 \; dropoff 10 \; pitch 60 \; interval 120 \; metro 1 \;
-rev 74 \; revtime 87 \; incr -2 \; pd dsp 1;
-#X connect 0 0 14 0;
-#X connect 1 0 11 0;
-#X connect 4 0 54 1;
-#X connect 5 0 4 0;
-#X connect 6 0 54 0;
-#X connect 7 0 9 0;
-#X connect 9 0 8 0;
-#X connect 10 0 20 0;
-#X connect 10 0 7 0;
-#X connect 13 0 12 0;
-#X connect 15 0 1 0;
-#X connect 16 0 0 0;
-#X connect 17 0 13 0;
-#X connect 18 0 6 0;
-#X connect 19 0 18 0;
-#X connect 20 0 34 0;
-#X connect 21 0 27 0;
-#X connect 21 0 33 0;
-#X connect 22 0 35 0;
-#X connect 23 0 21 1;
-#X connect 24 0 23 0;
-#X connect 25 0 28 0;
-#X connect 26 0 25 0;
-#X connect 28 0 24 0;
-#X connect 29 0 33 1;
-#X connect 30 0 29 0;
-#X connect 31 0 32 0;
-#X connect 32 0 33 2;
-#X connect 33 0 27 0;
-#X connect 33 1 27 1;
-#X connect 34 0 10 1;
-#X connect 35 0 36 0;
-#X connect 36 0 37 0;
-#X connect 37 0 38 0;
-#X connect 38 0 39 0;
-#X connect 39 0 40 0;
-#X connect 40 0 41 0;
-#X connect 41 0 42 0;
-#X connect 42 0 43 0;
-#X connect 43 0 44 0;
-#X connect 44 0 45 0;
-#X connect 45 0 46 0;
-#X connect 46 0 47 0;
-#X connect 47 0 48 0;
-#X connect 48 0 49 0;
-#X connect 49 0 50 0;
-#X connect 50 0 51 0;
-#X connect 51 0 52 0;
-#X connect 52 0 53 0;
-#X connect 53 0 21 0;
-#X connect 54 0 10 0;
diff --git a/pd/doc/3.audio.examples/D12.sampler.bis.pd b/pd/doc/3.audio.examples/D12.sampler.bis.pd
new file mode 100644
index 00000000..cad81484
--- /dev/null
+++ b/pd/doc/3.audio.examples/D12.sampler.bis.pd
@@ -0,0 +1,203 @@
+#N canvas 104 78 1119 674 12;
+#N canvas 0 0 600 392 samples 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array sample1 176403 float 0;
+#X coords 0 1.02 176403 -1.02 200 130 1;
+#X restore 262 41 graph;
+#X text 282 385 ------ 4 seconds ------;
+#N canvas 0 0 450 300 graph1 0;
+#X array sample2 176403 float 0;
+#X coords 0 1.02 176403 -1.02 200 130 1;
+#X restore 262 226 graph;
+#X restore 785 563 pd samples;
+#N canvas 52 219 971 512 recorder 0;
+#X obj 174 304 adc~ 1;
+#X obj 174 332 hip~ 5;
+#X obj 243 362 line~;
+#X obj 174 361 *~;
+#X msg 243 334 1;
+#X obj 302 299 del 3990;
+#X msg 279 334 0 10;
+#X obj 174 412 tabwrite~ sample1;
+#X obj 26 218 makefilename sample%1;
+#X msg 26 247 set \$1 \, bang;
+#X msg 348 270 stop;
+#X msg 302 270 bang;
+#X obj 220 180 route record stop reload browse;
+#X obj 411 288 loadbang;
+#X obj 514 243 openpanel;
+#X msg 514 215 bang;
+#X text 556 214 <-- browse for samples;
+#X text 482 339 v-- re-read original samples;
+#X obj 411 425 soundfiler;
+#X msg 411 367 read ../sound/bell.aiff sample1 \, read ../sound/voice2.wav
+sample2;
+#X msg 514 270 read \$1 sample1;
+#X obj 514 297 soundfiler;
+#X msg 220 41 record 1;
+#X msg 220 97 stop;
+#X msg 220 69 record 2;
+#X msg 220 124 reload;
+#X msg 220 152 browse;
+#X text 218 19 record \, etc.;
+#X connect 0 0 1 0;
+#X connect 1 0 3 0;
+#X connect 2 0 3 1;
+#X connect 3 0 7 0;
+#X connect 4 0 2 0;
+#X connect 5 0 6 0;
+#X connect 6 0 2 0;
+#X connect 8 0 9 0;
+#X connect 9 0 7 0;
+#X connect 10 0 5 0;
+#X connect 11 0 5 0;
+#X connect 12 0 8 0;
+#X connect 12 0 11 0;
+#X connect 12 0 4 0;
+#X connect 12 1 6 0;
+#X connect 12 1 10 0;
+#X connect 12 2 19 0;
+#X connect 12 3 15 0;
+#X connect 13 0 19 0;
+#X connect 14 0 20 0;
+#X connect 15 0 14 0;
+#X connect 19 0 18 0;
+#X connect 20 0 21 0;
+#X connect 22 0 12 0;
+#X connect 23 0 12 0;
+#X connect 24 0 12 0;
+#X connect 25 0 12 0;
+#X connect 26 0 12 0;
+#X restore 785 586 pd recorder;
+#X text 782 458 sample number;
+#X obj 619 96 unpack 0 0 0 0 0 0 0;
+#X obj 563 124 poly 8 1;
+#X obj 654 270 route 1 2 3 4 5 6 7 8;
+#X obj 558 487 output~;
+#X obj 563 149 swap;
+#X obj 563 196 route 0;
+#X obj 563 173 pack;
+#X obj 605 221 unpack;
+#X obj 557 289 sampvoice2;
+#X obj 563 221 pack;
+#X text 933 411 amplitude;
+#X text 932 435 pitch;
+#X text 851 344 ARGUMENTS FOR:;
+#X text 784 386 pitch;
+#X text 784 410 amplitude;
+#X text 784 434 duration;
+#X text 13 4 POLY SAMPLER \, VERSION 2 FOR SEPARATE NOTE-ON/OFF MESSAGES
+;
+#X obj 619 71 r onoff;
+#X text 932 368 ON/OFF TRANSITIONS:;
+#X text 785 367 ENTIRE NOTES:;
+#X text 932 390 tag;
+#X text 782 485 sample onset;
+#X text 782 511 rise time;
+#X text 783 535 decay time;
+#X text 929 460 (same other 4);
+#X obj 836 159 f;
+#X obj 872 159 + 1;
+#X obj 836 185 mod 1e+06;
+#X obj 654 245 pack 0 0 0 0 0 0 0;
+#X obj 918 74 r note;
+#X obj 918 100 unpack 0 0 0 0 0 0 0;
+#X text 860 641 updated for Pd version 0.37;
+#X obj 895 127 t b f;
+#X obj 936 237 pack 0 0 0 0 0 0 0;
+#X obj 889 285 s onoff;
+#X obj 870 230 pipe;
+#X obj 870 253 pack;
+#X msg 103 528 \; onoff 1 90 60 1 0 0 100;
+#X msg 323 528 \; onoff 1 0;
+#X msg 104 570 \; onoff 2 90 48 1 0 0 100;
+#X msg 324 570 \; onoff 2 0;
+#X msg 104 627 \; note 51 90 1000 1 0 0 100;
+#X obj 557 312 sampvoice2;
+#X obj 557 336 sampvoice2;
+#X obj 557 360 sampvoice2;
+#X obj 557 383 sampvoice2;
+#X obj 557 407 sampvoice2;
+#X obj 557 430 sampvoice2;
+#X obj 557 454 sampvoice2;
+#X text 14 35 Here is a variation on the polyphonic sampler \, which
+can take separate messages to start and stop notes (so that you can
+attach it to a MIDI keyboard \, for example.) "Note" messages act as
+before \, but in an intermediate step they are split onto note-on and
+note-off messages \, sent to "onoff". You can alternatively send messages
+straight to onoff if you don't know the duration in advance.;
+#X text 12 150 Messages to "onoff" require a tag \, which is a number
+shared between the note-on and note-off message so that we can track
+down the voice to turn it off. If you're using MIDI input \, you can
+just re-use the pitch as a tag.;
+#X text 102 508 separate messages for not on and off:;
+#X text 101 608 single messages to do both as before:;
+#X text 10 221 Messages to "onoff" whose amplitude is zero are note-off
+messages (the other parameters of note-off messages are ignored). The
+"sampvoice2" abstraction is a modification of "sampvoice" which looks
+at the amplitude field to decide whether to begin or end a note.;
+#X text 10 301 To convert "note" messages to pairs of "onoff" messages
+\, first a counter generates a tag. The the "pipe" object delays a
+copy of the tag \, which the following "pack" object converts into
+a note-off message (a pair of numbers \, the tag and a zero.);
+#X text 9 382 Under "r onoff" \, the poly object allocates a voice
+number \, putting it out paired with velocity. After swapping the two
+and packing them into a single message \, the amplitude is checked
+against zero by the "route 0" object \; if zero \, the "pack" confects
+a 2-argument message (voice number and zero). Otherwise \, the "unpack"
+retrieves the nonzero amplitude for a note-on message \, to which we
+add all the other parameters and route to the appropriate voice.;
+#X connect 3 0 4 0;
+#X connect 3 1 31 1;
+#X connect 3 1 4 1;
+#X connect 3 2 31 2;
+#X connect 3 3 31 3;
+#X connect 3 4 31 4;
+#X connect 3 5 31 5;
+#X connect 3 6 31 6;
+#X connect 4 0 7 0;
+#X connect 4 2 7 1;
+#X connect 5 0 11 1;
+#X connect 5 1 45 1;
+#X connect 5 2 46 1;
+#X connect 5 3 47 1;
+#X connect 5 4 48 1;
+#X connect 5 5 49 1;
+#X connect 5 6 50 1;
+#X connect 5 7 51 1;
+#X connect 7 0 9 0;
+#X connect 7 1 9 1;
+#X connect 8 0 12 0;
+#X connect 8 1 10 0;
+#X connect 9 0 8 0;
+#X connect 10 1 31 0;
+#X connect 11 0 45 0;
+#X connect 12 0 5 0;
+#X connect 20 0 3 0;
+#X connect 28 0 29 0;
+#X connect 29 0 30 0;
+#X connect 30 0 28 1;
+#X connect 30 0 38 0;
+#X connect 30 0 36 0;
+#X connect 31 0 5 0;
+#X connect 32 0 33 0;
+#X connect 33 0 35 0;
+#X connect 33 1 36 1;
+#X connect 33 2 38 1;
+#X connect 33 3 36 3;
+#X connect 33 4 36 4;
+#X connect 33 5 36 5;
+#X connect 33 6 36 6;
+#X connect 35 0 28 0;
+#X connect 35 1 36 2;
+#X connect 36 0 37 0;
+#X connect 38 0 39 0;
+#X connect 39 0 37 0;
+#X connect 45 0 46 0;
+#X connect 46 0 47 0;
+#X connect 47 0 48 0;
+#X connect 48 0 49 0;
+#X connect 49 0 50 0;
+#X connect 50 0 51 0;
+#X connect 51 0 6 0;
+#X connect 51 0 6 1;
diff --git a/pd/doc/3.audio.examples/E01.pulse.pd b/pd/doc/3.audio.examples/E01.pulse.pd
deleted file mode 100644
index 8efe6390..00000000
--- a/pd/doc/3.audio.examples/E01.pulse.pd
+++ /dev/null
@@ -1,126 +0,0 @@
-#N canvas 15 126 821 582 12;
-#X obj 285 163 line~;
-#X floatatom 66 64 0 0 0;
-#X obj 43 315 cos~;
-#X graph graph1 0 -1.02 882 1.02 599 472 799 342;
-#X array pulse-output 882 float 0;
-#X pop;
-#X floatatom 72 407 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 43 435 pd output;
-#X msg 111 405 MUTE;
-#X text 158 406 <-- output amplitude;
-#X obj 66 91 phasor~ 0;
-#X obj 285 139 pack 0 50;
-#X floatatom 285 54 0 0 0;
-#X text 63 43 frequency;
-#X obj 66 115 -~ 0.5;
-#X obj 66 207 *~;
-#X obj 285 78 / 10;
-#X obj 43 265 clip~ -0.5 0.5;
-#X obj 43 371 hip~ 5;
-#X graph graph1 0 -1.02 882 1.02 599 168 799 108;
-#X array phase-output 882 float 0;
-#X pop;
-#X graph graph1 0 -1.02 882 1.02 599 335 799 205;
-#X array clip-output 882 float 0;
-#X pop;
-#X text 280 34 bandwidth;
-#X text 130 114 phase -1/2 to 1/2;
-#X text 152 91 phase 0 to 1;
-#X text 132 5 PULSE GENERATOR;
-#X obj 32 234 tabwrite~ phase-output;
-#X obj 32 346 tabwrite~ pulse-output;
-#X text 116 372 high pass filter to cut DC;
-#X msg 32 147 bang;
-#X text 332 79 fix range;
-#X text 337 100 force;
-#X text 337 117 nonnegative;
-#X text 339 164 smooth it;
-#X text 327 187 add 1;
-#X text 78 148 <-- click to graph;
-#X text 96 209 increase amplitude;
-#X text 177 264 clip back to range -1/2 to 1/2;
-#X text 103 316 cosine wave lookup (-1/2 and 1/2 give -1);
-#X text 24 470 This patch computes a pulse train \, with a "bandwidth"
-control that essentually squeezes the pulses. If "bandwidth" is zero
-you get a pure cosine wave \, and for larger values of the bandwidth
-\, the cosine wave is squeezed to fill smaller portions of the waveform.
-;
-#X obj 285 188 +~ 1;
-#X obj 32 292 tabwrite~ clip-output;
-#X text 601 478 ---- 0.02 seconds ----;
-#X obj 285 102 max 0;
-#X text 544 551 updated for Pd version 0.34;
-#X connect 0 0 37 0;
-#X connect 1 0 8 0;
-#X connect 2 0 16 0;
-#X connect 2 0 24 0;
-#X connect 4 0 5 1;
-#X connect 5 0 4 0;
-#X connect 6 0 5 2;
-#X connect 8 0 12 0;
-#X connect 9 0 0 0;
-#X connect 10 0 14 0;
-#X connect 12 0 13 0;
-#X connect 13 0 15 0;
-#X connect 13 0 23 0;
-#X connect 14 0 40 0;
-#X connect 15 0 2 0;
-#X connect 15 0 38 0;
-#X connect 16 0 5 0;
-#X connect 26 0 23 0;
-#X connect 26 0 24 0;
-#X connect 26 0 38 0;
-#X connect 37 0 13 1;
-#X connect 40 0 9 0;
diff --git a/pd/doc/3.audio.examples/E01.spectrum.pd b/pd/doc/3.audio.examples/E01.spectrum.pd
new file mode 100644
index 00000000..6754bda1
--- /dev/null
+++ b/pd/doc/3.audio.examples/E01.spectrum.pd
@@ -0,0 +1,179 @@
+#N canvas 190 29 773 821 12;
+#N canvas 0 0 450 300 graph1 0;
+#X array E01-signal 882 float 0;
+#X coords 0 5 882 -5 200 130 1;
+#X restore 531 41 graph;
+#X obj 40 304 hip~ 5;
+#N canvas 0 0 450 300 graph1 0;
+#X array E01-spectrum 128 float 0;
+#X coords 0 4300 127 -40 257 130 1;
+#X restore 485 226 graph;
+#X text 134 243 <-- click to graph;
+#N canvas 45 83 558 569 fft 0;
+#X obj 19 62 inlet~;
+#X obj 85 214 inlet;
+#X obj 19 92 rfft~;
+#X obj 19 125 *~;
+#X obj 50 125 *~;
+#X obj 19 155 sqrt~;
+#X obj 85 248 tabwrite~ E01-spectrum;
+#X obj 332 109 block~ 4096 1;
+#X obj 19 181 biquad~ 0 0 0 0 1;
+#X text 83 93 Fourier series;
+#X text 88 146 magnitude;
+#X text 86 131 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 62 signal to analyze;
+#X text 182 166 delay two samples;
+#X text 181 182 for better graphing;
+#X obj 90 425 samplerate~;
+#X obj 90 402 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 90 472 5 0 0 0 - - -;
+#X obj 90 448 / 256;
+#X obj 90 378 loadbang;
+#X floatatom 90 541 5 0 0 0 - - -;
+#X obj 98 494 s fundamental;
+#X obj 90 517 ftom;
+#X text 146 540 <-just out of curiosity \, here's the pitch;
+#X text 14 319 At load time \, calculate a good choice of fundamental
+frequency for showing spectra: the 16th bin in a 4096-point spectrum
+\, so SR*16/4096 or SR/256.;
+#X text 135 216 "bang" into this inlet to graph it;
+#X connect 0 0 2 0;
+#X connect 1 0 6 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 8 0;
+#X connect 8 0 6 0;
+#X connect 16 0 19 0;
+#X connect 17 0 16 0;
+#X connect 18 0 22 0;
+#X connect 18 0 23 0;
+#X connect 19 0 18 0;
+#X connect 20 0 17 0;
+#X connect 23 0 21 0;
+#X restore 51 279 pd fft;
+#X text 531 173 ---- 0.02 seconds ----;
+#X obj 111 244 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 40 332 output~;
+#X obj 111 279 tabwrite~ E01-signal;
+#X text 523 800 updated for Pd version 0.37;
+#X text 516 359 1;
+#X text 550 359 2;
+#X text 582 359 3;
+#X text 614 359 4;
+#X text 647 359 5;
+#X text 677 359 6;
+#X text 708 359 7;
+#X text 484 359 0;
+#X text 520 378 -- partial number --;
+#X text 733 97 0;
+#X obj 42 42 r fundamental;
+#X obj 42 111 osc~;
+#X obj 63 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
+;
+#X obj 41 161 *~;
+#X obj 85 111 osc~;
+#X obj 106 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 84 161 *~;
+#X obj 128 111 osc~;
+#X obj 149 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 127 161 *~;
+#X obj 128 88 * 2;
+#X obj 171 111 osc~;
+#X obj 192 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 170 161 *~;
+#X obj 214 111 osc~;
+#X obj 235 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 213 161 *~;
+#X obj 257 111 osc~;
+#X obj 278 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 256 161 *~;
+#X obj 42 88 * 0;
+#X obj 85 88 * 1;
+#X obj 171 88 * 3;
+#X obj 214 88 * 4;
+#X obj 257 88 * 5;
+#X text 303 136 <-- On/Off;
+#X text 337 152 for each;
+#X text 339 168 partial;
+#X text 595 11 WAVEFORM;
+#X text 578 204 SPECTRUM;
+#X text 25 415 The next series of patches demonstrates various kinds
+of modulation: AM \, waveshaping \, and FM. We will need a tool for
+graphing spectra which is introduced here. In this patch the signal
+to be analyzed is a simple sum of up to six partials of a fundamental
+frequency (which is 172 Hz \, close to F below middle C \, if your
+sample rate happens to be 44100 Hz. The fundamental is chosen to agree
+with the analysis patch ("pd FFT") and is computed within it).;
+#X text 25 546 The partials are numbered 0 through 5 \, where 0 means
+DC \, or zero frequency \, 1 is the fundamental \, and so on. The toggle
+switches allow you to turn them on and off separately. You have to
+press the "click to graph" button to update the two graphs.;
+#X text 745 344 0;
+#X text 743 223 1;
+#X text 744 282 0.5;
+#X text 26 631 The upper graph is just the (time domain) waveform \,
+about four periods long. The lower graph is the magnitude spectrum.
+Its peaks are the magnitudes of the partials. Note that a DC signal
+of amplitude one is considered a partial of magnitude 1 \, but the
+other partials \, which have peak amplitudes of 1 (and RMS 0.707) \,
+have peak magnitudes of only 0.5 in the spectrum.;
+#X obj 41 222 *~ 1;
+#X text 733 37 5;
+#X text 734 157 -5;
+#X text 81 221 sum;
+#X text 96 5 GRAPHING SPECTRA OF AUDIO SIGNALS;
+#X text 24 742 Here we're introducing a new feature: multiple signals
+connected to a signal inlet (as in the "*~ 1") are added. This is the
+most convenient way to sum the six partials.;
+#X connect 1 0 7 0;
+#X connect 1 0 7 1;
+#X connect 6 0 4 1;
+#X connect 6 0 8 0;
+#X connect 20 0 40 0;
+#X connect 20 0 41 0;
+#X connect 20 0 30 0;
+#X connect 20 0 42 0;
+#X connect 20 0 43 0;
+#X connect 20 0 44 0;
+#X connect 21 0 23 0;
+#X connect 22 0 23 1;
+#X connect 23 0 56 0;
+#X connect 24 0 26 0;
+#X connect 25 0 26 1;
+#X connect 26 0 56 0;
+#X connect 27 0 29 0;
+#X connect 28 0 29 1;
+#X connect 29 0 56 0;
+#X connect 30 0 27 0;
+#X connect 31 0 33 0;
+#X connect 32 0 33 1;
+#X connect 33 0 56 0;
+#X connect 34 0 36 0;
+#X connect 35 0 36 1;
+#X connect 36 0 56 0;
+#X connect 37 0 39 0;
+#X connect 38 0 39 1;
+#X connect 39 0 56 0;
+#X connect 40 0 21 0;
+#X connect 41 0 24 0;
+#X connect 42 0 31 0;
+#X connect 43 0 34 0;
+#X connect 44 0 37 0;
+#X connect 56 0 4 0;
+#X connect 56 0 1 0;
+#X connect 56 0 8 0;
diff --git a/pd/doc/3.audio.examples/E02.just.say.pd b/pd/doc/3.audio.examples/E02.just.say.pd
deleted file mode 100644
index b82b4953..00000000
--- a/pd/doc/3.audio.examples/E02.just.say.pd
+++ /dev/null
@@ -1,152 +0,0 @@
-#N canvas 32 67 900 421 12;
-#X obj 39 247 cos~;
-#X graph graph1 0 -1.02 44100 1.02 452 206 652 76;
-#X array env-output 44100 float 0;
-#X pop;
-#X floatatom 71 305 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 39 333 pd output;
-#X msg 115 306 MUTE;
-#X msg 162 93 bang;
-#X text 203 93 <-- click to graph;
-#X obj 39 168 -~ 0.5;
-#X obj 39 192 *~;
-#X obj 39 219 clip~ -0.5 0.5;
-#X obj 39 274 hip~ 5;
-#X obj 126 60 *~;
-#X floatatom 205 142 0 0 0;
-#X floatatom 205 168 0 0 0;
-#X obj 126 27 phasor~ -4;
-#X obj 126 191 +~ 0.5;
-#X obj 162 117 tabwrite~ env-output;
-#X text 451 211 --------- 1 second ---------;
-#X floatatom 205 194 0 0 0;
-#X obj 126 142 lop~ 130;
-#N canvas 168 232 351 420 freq 0;
-#X obj 180 176 t f f;
-#X obj 181 202 *;
-#X obj 60 320 line 0 30;
-#X obj 90 132 t b b;
-#X obj 90 107 metro 100;
-#X obj 61 287 pack;
-#X obj 60 376 outlet;
-#X floatatom 89 82 0 0 0;
-#X floatatom 54 243 0 0 0;
-#X floatatom 94 248 0 0 0;
-#X obj 60 348 pack 0 30;
-#X obj 55 202 + 150;
-#X obj 88 34 loadbang;
-#X msg 89 58 1;
-#X obj 56 175 random 300;
-#X obj 181 226 + 100;
-#X obj 179 152 random 35;
-#X connect 0 0 1 0;
-#X connect 0 1 1 1;
-#X connect 1 0 15 0;
-#X connect 2 0 10 0;
-#X connect 3 0 14 0;
-#X connect 3 1 16 0;
-#X connect 4 0 3 0;
-#X connect 5 0 2 0;
-#X connect 7 0 4 0;
-#X connect 8 0 5 0;
-#X connect 9 0 5 1;
-#X connect 10 0 6 0;
-#X connect 11 0 8 0;
-#X connect 12 0 13 0;
-#X connect 13 0 7 0;
-#X connect 14 0 11 0;
-#X connect 15 0 4 1;
-#X connect 15 0 9 0;
-#X connect 16 0 0 0;
-#X restore 38 94 pd freq;
-#X obj 39 119 line~;
-#X obj 39 144 phasor~;
-#X text 225 19 negative frequency;
-#X text 226 35 makes falling sawtooth;
-#X text 155 59 square it to make a curve;
-#X text 245 152 you can;
-#X text 243 170 adjust these;
-#X text 247 189 values;
-#X text 334 250 We interrupt this series of patches to bring you an
-important message from Nancy Reagan. If \, anywhere \, at any time
-\, someone offers you an illicit drug \, just say one word in reply...
-;
-#X text 334 313 Now that I'm sure you've heard this important message
-\, we can return to the essentially frivolous occupation of making
-turn-of-the-millenium western art music.;
-#X obj 126 165 *~ 6;
-#X text 561 384 updated for Pd version 0.34;
-#X text 156 305 <-- output;
-#X connect 0 0 10 0;
-#X connect 2 0 3 1;
-#X connect 3 0 2 0;
-#X connect 4 0 3 2;
-#X connect 5 0 16 0;
-#X connect 7 0 8 0;
-#X connect 8 0 9 0;
-#X connect 9 0 0 0;
-#X connect 10 0 3 0;
-#X connect 11 0 16 0;
-#X connect 11 0 19 0;
-#X connect 12 0 19 1;
-#X connect 13 0 31 1;
-#X connect 14 0 11 0;
-#X connect 14 0 11 1;
-#X connect 15 0 8 1;
-#X connect 18 0 15 1;
-#X connect 19 0 31 0;
-#X connect 20 0 21 0;
-#X connect 21 0 22 0;
-#X connect 22 0 7 0;
-#X connect 31 0 15 0;
diff --git a/pd/doc/3.audio.examples/E02.ring.modulation.pd b/pd/doc/3.audio.examples/E02.ring.modulation.pd
new file mode 100644
index 00000000..81004cf2
--- /dev/null
+++ b/pd/doc/3.audio.examples/E02.ring.modulation.pd
@@ -0,0 +1,197 @@
+#N canvas 269 43 755 746 12;
+#N canvas 0 0 450 300 graph1 0;
+#X array E02-signal 882 float 0;
+#X coords 0 5 882 -5 200 130 1;
+#X restore 501 66 graph;
+#X obj 15 370 hip~ 5;
+#N canvas 0 0 450 300 graph1 0;
+#X array E02-spectrum 128 float 0;
+#X coords 0 4300 127 -40 257 130 1;
+#X restore 455 251 graph;
+#N canvas 45 83 558 569 fft 0;
+#X obj 19 61 inlet~;
+#X obj 95 214 inlet;
+#X obj 29 92 rfft~;
+#X obj 29 125 *~;
+#X obj 60 125 *~;
+#X obj 29 155 sqrt~;
+#X obj 332 109 block~ 4096 1;
+#X obj 29 181 biquad~ 0 0 0 0 1;
+#X text 93 93 Fourier series;
+#X text 98 146 magnitude;
+#X text 96 131 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 192 166 delay two samples;
+#X text 191 182 for better graphing;
+#X obj 16 425 samplerate~;
+#X obj 16 402 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 16 472 5 0 0 0 - - -;
+#X obj 16 448 / 256;
+#X obj 16 378 loadbang;
+#X floatatom 16 541 5 0 0 0 - - -;
+#X obj 24 494 s fundamental;
+#X obj 16 517 ftom;
+#X text 14 319 At load time \, calculate a good choice of fundamental
+frequency for showing spectra: the 16th bin in a 4096-point spectrum
+\, so SR*16/4096 or SR/256.;
+#X text 145 216 "bang" into this inlet to graph it;
+#X floatatom 191 480 5 0 0 0 - - -;
+#X obj 191 456 / 4096;
+#X text 187 425 One bin is SR/4096:;
+#X text 72 540 <-just out of curiosity \, here's the fundamental pitch
+;
+#X obj 191 502 s freq-step;
+#X obj 95 248 tabwrite~ E02-spectrum;
+#X obj 20 281 tabwrite~ E02-signal;
+#X connect 0 0 2 0;
+#X connect 0 0 31 0;
+#X connect 1 0 30 0;
+#X connect 1 0 31 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 30 0;
+#X connect 15 0 18 0;
+#X connect 15 0 26 0;
+#X connect 16 0 15 0;
+#X connect 17 0 21 0;
+#X connect 17 0 22 0;
+#X connect 18 0 17 0;
+#X connect 19 0 16 0;
+#X connect 22 0 20 0;
+#X connect 25 0 29 0;
+#X connect 26 0 25 0;
+#X restore 23 343 pd fft;
+#X text 501 198 ---- 0.02 seconds ----;
+#X obj 84 344 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 15 398 output~;
+#X text 501 720 updated for Pd version 0.37;
+#X text 486 384 1;
+#X text 520 384 2;
+#X text 552 384 3;
+#X text 584 384 4;
+#X text 617 384 5;
+#X text 647 384 6;
+#X text 678 384 7;
+#X text 454 384 0;
+#X text 490 403 -- partial number --;
+#X text 703 120 0;
+#X obj 18 32 r fundamental;
+#X obj 18 94 osc~;
+#X obj 39 119 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
+;
+#X obj 17 144 *~;
+#X obj 61 94 osc~;
+#X obj 82 119 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
+;
+#X obj 60 144 *~;
+#X obj 104 94 osc~;
+#X obj 125 119 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
+1;
+#X obj 103 144 *~;
+#X obj 104 71 * 2;
+#X obj 147 94 osc~;
+#X obj 168 119 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 146 144 *~;
+#X obj 190 94 osc~;
+#X obj 211 119 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 189 144 *~;
+#X obj 233 94 osc~;
+#X obj 254 119 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 232 144 *~;
+#X obj 18 71 * 0;
+#X obj 61 71 * 1;
+#X obj 147 71 * 3;
+#X obj 190 71 * 4;
+#X obj 233 71 * 5;
+#X text 282 118 <-- On/Off;
+#X text 565 46 WAVEFORM;
+#X text 548 229 SPECTRUM;
+#X text 715 367 0;
+#X text 713 246 1;
+#X text 714 305 0.5;
+#X text 703 60 5;
+#X text 704 180 -5;
+#X obj 16 239 *~;
+#X text 300 102 partials;
+#X obj 154 270 osc~;
+#X floatatom 154 210 3 0 200 0 - - -;
+#X obj 154 239 *;
+#X obj 187 239 r freq-step;
+#X text 226 177 modulation;
+#X text 222 192 frequency in;
+#X text 185 209 <-- "steps" of f/16;
+#X text 97 -1 RING MODULATION: multiplying a complex tone by a sinusoid
+;
+#X obj 84 299 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
+;
+#X text 107 343 <-- graph once;
+#X obj 84 321 metro 500;
+#X text 107 298 <-- graph repeatedly;
+#X text 35 463 Now we ring modulate the signal by multiplying it by
+another sinusoid. The modulation frequency is controlled in steps of
+f/16 where "f" is the fundamental frequency \, giving roughly 11 Hz.
+per step. Note that if the modulation frequency is set to zero we can't
+predict the overall amplitude because it depends on what phase the
+modulation oscillator happened to have at that moment.;
+#X text 32 579 If you choose a multiple of the fundamental as a modulation
+frequency (16 \, 32 \, 48 \, 64 \, ... "steps") the result is again
+periodic at the original frequency. If you select a half-integer times
+the fundamental (8 \, 24 \, 40 \, ... steps) the pitch drops by an
+octave and you get only odd partials. For most other settings you'll
+get an inharmonic complex of tones. These are sometimes heard as separate
+pitches and other times they seem to fuse into a single timbre with
+indeterminate pitch.;
+#X connect 1 0 6 0;
+#X connect 1 0 6 1;
+#X connect 5 0 3 1;
+#X connect 18 0 38 0;
+#X connect 18 0 39 0;
+#X connect 18 0 28 0;
+#X connect 18 0 40 0;
+#X connect 18 0 41 0;
+#X connect 18 0 42 0;
+#X connect 19 0 21 0;
+#X connect 20 0 21 1;
+#X connect 21 0 51 0;
+#X connect 22 0 24 0;
+#X connect 23 0 24 1;
+#X connect 24 0 51 0;
+#X connect 25 0 27 0;
+#X connect 26 0 27 1;
+#X connect 27 0 51 0;
+#X connect 28 0 25 0;
+#X connect 29 0 31 0;
+#X connect 30 0 31 1;
+#X connect 31 0 51 0;
+#X connect 32 0 34 0;
+#X connect 33 0 34 1;
+#X connect 34 0 51 0;
+#X connect 35 0 37 0;
+#X connect 36 0 37 1;
+#X connect 37 0 51 0;
+#X connect 38 0 19 0;
+#X connect 39 0 22 0;
+#X connect 40 0 29 0;
+#X connect 41 0 32 0;
+#X connect 42 0 35 0;
+#X connect 51 0 3 0;
+#X connect 51 0 1 0;
+#X connect 53 0 51 1;
+#X connect 54 0 55 0;
+#X connect 55 0 53 0;
+#X connect 56 0 55 1;
+#X connect 61 0 63 0;
+#X connect 63 0 5 0;
diff --git a/pd/doc/3.audio.examples/E03.octave.divider.pd b/pd/doc/3.audio.examples/E03.octave.divider.pd
new file mode 100644
index 00000000..a0f77844
--- /dev/null
+++ b/pd/doc/3.audio.examples/E03.octave.divider.pd
@@ -0,0 +1,137 @@
+#N canvas 129 17 793 665 12;
+#X obj 477 135 loadbang;
+#X obj 32 286 hip~ 5;
+#X obj 477 53 adc~ 1;
+#X obj 477 190 soundfiler;
+#X obj 32 313 output~;
+#X text 544 646 updated for Pd version 0.37;
+#X obj 478 100 tabwrite~ E03-table;
+#X msg 477 162 read ../sound/voice.wav E03-table;
+#X obj 117 64 fiddle~ 2048;
+#X obj 118 95 unpack;
+#X obj 111 199 osc~;
+#X obj 118 119 moses 1;
+#X obj 77 199 *~;
+#X obj 145 147 mtof;
+#X obj 145 170 *;
+#X msg 194 125 0.5;
+#X floatatom 194 154 3 0 0 0 - - -;
+#X msg 232 125 15;
+#N canvas 0 0 446 202 /SUBPATCH/ 0;
+#X obj 261 30 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
+;
+#X obj 100 20 inlet~;
+#X obj 99 87 *~;
+#X obj 98 159 outlet~;
+#X text 381 181 corner;
+#X connect 0 0 2 1;
+#X connect 1 0 2 0;
+#X connect 2 0 3 0;
+#X coords 0 0 100 100 40 18 1;
+#X restore 78 248 pd;
+#N canvas 0 0 446 202 /SUBPATCH/ 0;
+#X obj 261 30 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
+;
+#X obj 100 20 inlet~;
+#X obj 99 87 *~;
+#X obj 98 159 outlet~;
+#X text 381 181 corner;
+#X connect 0 0 2 1;
+#X connect 1 0 2 0;
+#X connect 2 0 3 0;
+#X coords 0 0 100 100 40 18 1;
+#X restore 32 248 pd;
+#X obj 78 222 *~ 2;
+#X obj 194 100 loadbang;
+#N canvas 414 195 613 302 looper 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array E03-table 44103 float 0;
+#X coords 0 1.02 44103 -1.02 200 130 1;
+#X restore 349 22 graph;
+#X text 347 161 ---- 44103 samples ----;
+#X obj 35 77 +~ 1;
+#X obj 35 25 phasor~ 1;
+#X obj 35 50 *~ 44100;
+#X obj 35 106 tabread4~ E03-table;
+#X obj 35 132 outlet~;
+#X text 46 238 one-second sample reader loop. You can replace this
+with an adc~ if you want to go live.;
+#X connect 2 0 5 0;
+#X connect 3 0 4 0;
+#X connect 4 0 2 0;
+#X connect 5 0 6 0;
+#X restore 31 30 pd looper;
+#X text 561 141 re-read original sample;
+#X obj 489 77 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#N canvas 300 203 758 306 delay 0;
+#X obj 15 222 outlet~;
+#X obj 14 21 inlet~;
+#X obj 15 102 loadbang;
+#X obj 14 49 delwrite~ E03-del 40;
+#X obj 15 195 delread~ E03-del;
+#X obj 15 152 expr 1000*1024/$f1;
+#X obj 15 128 samplerate~;
+#X text 208 47 write to delay line which has enough memory to hold
+40 msec;
+#X text 125 128 get sample rate at load time;
+#X text 185 152 divide 1024 by sample rate to give time in seconds
+\; multiply by 1000 to convert to milliseconds.;
+#X text 168 197 read from the delay line at the calculater delay;
+#X text 317 268 1024-sample delay;
+#X connect 1 0 3 0;
+#X connect 2 0 6 0;
+#X connect 4 0 0 0;
+#X connect 5 0 4 0;
+#X connect 6 0 5 0;
+#X restore 31 71 pd delay;
+#X text 242 4 OCTAVE DIVIDING VIA RING MODULATION;
+#X text 508 75 <-- record a sample;
+#X text 265 125 <-- choose an effect;
+#X text 157 231 on/off for original;
+#X text 128 247 <--and processed sounds;
+#X text 196 274 This patch demonstrates using ring modulation to alias
+a sound down one octave. The ring modulation itself ("osc~" and multiplier)
+is easy. (We step it up by a factor of 2 to balance the original better.)
+;
+#X text 198 340 Harder is getting the fundamental frequency of the
+original sound. We do this with the complicated "fiddle~" object \,
+which puts out a stream of analysis data for an incoming signal. The
+"2048" argument specifies the analysis window size. The analysis is
+most closely aligned with what the sound was doing at the middle of
+the window \, i.e. \, 1024 samples ago. The "pd delay" window delays
+the signal itself 1024 samples so it will be as tightly synchronized
+with the analysis data as possible. (If you're doing this on a real-time
+input \, you might drop the delay and settle for less perfect synchronization.)
+;
+#X text 198 512 About fiddle~ \, suffice it to say that the third outlet
+contains (pitch \, amplitude) pairs. We unpack the pitch and strip
+out any zeros (when fiddle~ fails to find a pitch it outputs zero but
+we'd rather stick with the most recent good one). This is converted
+from MIDI to Hertz \, and multiplied by 1/2 to control the modulation
+oscillator. (You can also try large-ish integers which leave the pitch
+intact but introduce funny formants.);
+#X connect 0 0 7 0;
+#X connect 1 0 4 0;
+#X connect 1 0 4 1;
+#X connect 2 0 6 0;
+#X connect 7 0 3 0;
+#X connect 8 2 9 0;
+#X connect 9 0 11 0;
+#X connect 10 0 12 1;
+#X connect 11 1 13 0;
+#X connect 12 0 20 0;
+#X connect 13 0 14 0;
+#X connect 14 0 10 0;
+#X connect 15 0 16 0;
+#X connect 16 0 14 1;
+#X connect 17 0 16 0;
+#X connect 18 0 1 0;
+#X connect 19 0 1 0;
+#X connect 20 0 18 0;
+#X connect 21 0 15 0;
+#X connect 22 0 8 0;
+#X connect 22 0 25 0;
+#X connect 24 0 6 0;
+#X connect 25 0 19 0;
+#X connect 25 0 12 0;
diff --git a/pd/doc/3.audio.examples/E03.pulse.spectrum.pd b/pd/doc/3.audio.examples/E03.pulse.spectrum.pd
deleted file mode 100644
index 49d21cbd..00000000
--- a/pd/doc/3.audio.examples/E03.pulse.spectrum.pd
+++ /dev/null
@@ -1,136 +0,0 @@
-#N canvas 15 126 887 588 12;
-#X obj 189 166 line~;
-#X obj 42 187 cos~;
-#X graph graph1 0 -1.02 882 1.02 633 508 833 378;
-#X array pulse-output 882 float 0;
-#X pop;
-#X floatatom 71 317 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 42 345 pd output;
-#X msg 118 319 MUTE;
-#X obj 189 142 pack 0 50;
-#X floatatom 189 41 0 0 0;
-#X text 598 545 updated for Pd version 0.26;
-#X obj 43 114 -~ 0.5;
-#X obj 43 140 *~;
-#X obj 189 67 / 10;
-#X obj 189 91 moses 0;
-#X msg 189 115 0;
-#X obj 42 163 clip~ -0.5 0.5;
-#X obj 42 289 hip~ 5;
-#X graph graph1 0 0 128 500 503 285 759 155;
-#X array spectrum 128 float 0;
-#X pop;
-#X text 184 23 bandwidth;
-#X obj 115 267 tabwrite~ pulse-output;
-#X msg 105 229 bang;
-#X text 143 226 <-- click to graph;
-#X obj 189 191 +~ 1;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 53 267 pd fft;
-#X obj 43 90 phasor~ 172.266;
-#X obj 42 211 +~ 1;
-#X text 63 1 PULSE SPECTRUM MEASUREMENT;
-#X text 16 377 Here is a measured amplitude spectrum for the pulse
-train. Nutice that \, other than a smallish spillover \, the energy
-sits in one "lobe" whose changing width justifies our calling the squeeze
-factor the "bandwidth.";
-#X text 16 442 The spectrum is in units of amplitude. THe sidelobes
-\, although they look small \, are actually only about 34 dB down.
-You can design more complicated pulse trains \, little Blackman window
-functions \, which control the sidelobes much better.;
-#X text 17 518 The spectrum measurement is done in the "pd fft" subwindow
-\, but see the "FFT examples" for information about that.;
-#X text 501 291 0;
-#X text 749 288 5512;
-#X text 633 511 ---- 0.02 seconds ----;
-#X text 160 319 <-- output;
-#X connect 0 0 21 0;
-#X connect 1 0 24 0;
-#X connect 3 0 4 1;
-#X connect 4 0 3 0;
-#X connect 5 0 4 2;
-#X connect 6 0 0 0;
-#X connect 7 0 11 0;
-#X connect 9 0 10 0;
-#X connect 10 0 14 0;
-#X connect 11 0 12 0;
-#X connect 12 0 13 0;
-#X connect 12 1 6 0;
-#X connect 13 0 6 0;
-#X connect 14 0 1 0;
-#X connect 15 0 4 0;
-#X connect 19 0 18 0;
-#X connect 19 0 22 1;
-#X connect 21 0 10 1;
-#X connect 23 0 9 0;
-#X connect 24 0 22 0;
-#X connect 24 0 15 0;
-#X connect 24 0 18 0;
diff --git a/pd/doc/3.audio.examples/E04.difference.tone.pd b/pd/doc/3.audio.examples/E04.difference.tone.pd
new file mode 100644
index 00000000..7272222b
--- /dev/null
+++ b/pd/doc/3.audio.examples/E04.difference.tone.pd
@@ -0,0 +1,45 @@
+#N canvas 266 135 637 523 12;
+#X obj 19 128 +~;
+#X obj 18 209 output~;
+#X text 141 3 NONLINEAR DISTORTION AND DIFFERENCE TONES;
+#X obj 154 171 / 100;
+#X floatatom 154 151 5 0 500 0 - - -;
+#X obj 18 181 clip~ -1 1;
+#X floatatom 42 81 5 0 0 0 - - -;
+#X obj 42 103 osc~ 200;
+#X obj 18 155 *~;
+#X obj 42 35 loadbang;
+#X msg 154 127 50;
+#X obj 154 103 loadbang;
+#X text 385 494 updated for Pd version 0.37;
+#X text 94 80 <-- frequency of second tone;
+#X text 209 151 <-- before clipping;
+#X text 234 134 amplitude of sum;
+#X obj 18 9 osc~ 300;
+#X msg 42 58 225;
+#X text 99 226 This patch demonstrates how nonlinear distortion (also
+known as "waveshaping") can create difference tones from a pair of
+sinusoids. The sinusoids are initially tuned to 225 and 300 Hz \, a
+musical fourth \, and have amplitude of 50 percent (0.5) so that the
+sum is always less than 1 in absolute value. At these settings the
+"clip~" object passes its input through unchanged.;
+#X text 100 344 If the amplitude rises above 50 percent \, the clip~
+object starts altering the signal nonlinearly \, and the result is
+no longer as if the two sinusoids had been processed separately. Instead
+\, they "intermodulate" \, finding a common subharmonic if one exists.
+At 300 and 225 Hz \, the subharmonic is at 75 \, two octaves below
+the upper tone and a twelveth below the lower one. Change the frequency
+of the second tone and you will hear a variety of effects.;
+#X connect 0 0 8 0;
+#X connect 3 0 8 1;
+#X connect 4 0 3 0;
+#X connect 5 0 1 0;
+#X connect 5 0 1 1;
+#X connect 6 0 7 0;
+#X connect 7 0 0 1;
+#X connect 8 0 5 0;
+#X connect 9 0 17 0;
+#X connect 10 0 4 0;
+#X connect 11 0 10 0;
+#X connect 16 0 0 0;
+#X connect 17 0 6 0;
diff --git a/pd/doc/3.audio.examples/E04.more.pulses.pd b/pd/doc/3.audio.examples/E04.more.pulses.pd
deleted file mode 100644
index 1aa97555..00000000
--- a/pd/doc/3.audio.examples/E04.more.pulses.pd
+++ /dev/null
@@ -1,138 +0,0 @@
-#N canvas 15 126 902 581 12;
-#X obj 220 171 line~;
-#X msg 350 15 \; pd dsp 1;
-#X msg 434 16 \; pd dsp 0;
-#X text 371 46 ON;
-#X text 451 47 OFF;
-#X floatatom 68 303 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 39 331 pd output;
-#X msg 106 303 MUTE;
-#X text 150 302 <-- output amplitude;
-#X obj 220 147 pack 0 50;
-#X floatatom 220 46 0 0 0;
-#X text 640 544 updated for Pd version 0.26;
-#X obj 70 108 *~;
-#X obj 220 72 / 10;
-#X obj 220 96 moses 0;
-#X msg 220 120 0;
-#X obj 39 275 hip~ 5;
-#X graph graph1 0 0 128 300 620 491 876 361;
-#X array spectrum 128 float 0;
-#X pop;
-#X text 215 28 bandwidth;
-#X msg 135 235 bang;
-#X text 177 234 <-- click to graph;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 68 237 pd fft;
-#X text 618 497 0;
-#X text 851 492 5512;
-#X obj 78 141 *~;
-#X obj 18 141 sig~ 1;
-#X obj 39 194 /~;
-#X obj 54 168 +~;
-#X obj 70 79 osc~ 86.1328;
-#X text 103 107 call this X;
-#X text 111 141 X^2;
-#X text 84 171 1+X^2;
-#X text 71 196 1/(1+X^2);
-#X text 10 357 This is the form of pulse train used in the Phase Aligned
-Formant (PAF) algorithm. It has the neat property that its amplitude
-spectrum drops off as a perfectly exponential function of frequency.
-This algorithm is protected by French and US patents. contact Vincent
-Puig to learn what restrictions may apply.;
-#X text 11 457 On the other hand \, there are rumors that exp(-X*X)
-actually sounds better than 1/(1+X*X). To compute exp(-X*X) efficiently
-you will want to employ tabread4~ with a stored bell curve. I don't
-want to know you're doing this. However \, the first Pd user who e-mails
-me the correct formula for the output spectrum wins a free CO2 fire
-extinguisher.;
-#X text 28 4 ANOTHER PULSE WIDTH MOD ALGORITHM;
-#X connect 0 0 12 1;
-#X connect 5 0 6 1;
-#X connect 6 0 5 0;
-#X connect 7 0 6 2;
-#X connect 9 0 0 0;
-#X connect 10 0 13 0;
-#X connect 12 0 24 0;
-#X connect 12 0 24 1;
-#X connect 13 0 14 0;
-#X connect 14 0 15 0;
-#X connect 14 1 9 0;
-#X connect 15 0 9 0;
-#X connect 16 0 6 0;
-#X connect 19 0 21 1;
-#X connect 24 0 27 1;
-#X connect 25 0 26 0;
-#X connect 25 0 27 0;
-#X connect 26 0 16 0;
-#X connect 26 0 21 0;
-#X connect 27 0 26 1;
-#X connect 28 0 12 0;
diff --git a/pd/doc/3.audio.examples/E05.chebychev.pd b/pd/doc/3.audio.examples/E05.chebychev.pd
new file mode 100644
index 00000000..90c628db
--- /dev/null
+++ b/pd/doc/3.audio.examples/E05.chebychev.pd
@@ -0,0 +1,257 @@
+#N canvas 224 60 657 571 12;
+#X obj 23 269 output~;
+#X obj 45 74 / 100;
+#X floatatom 45 54 5 0 100 0 - - -;
+#X obj 23 144 *~;
+#X text 403 539 updated for Pd version 0.37;
+#X obj 22 29 osc~ 220;
+#X obj 45 97 pack 0 50;
+#X obj 45 121 line~;
+#X text 97 54 <-- index in;
+#X text 117 68 hundredths;
+#X obj 23 169 *~ 128;
+#X obj 23 217 tabread4~ E05-tab;
+#N canvas 0 0 450 300 graph1 0;
+#X array E05-tab 259 float 1;
+#A 0 -1.20148 -1 -0.810724 -0.63326 -0.467216 -0.31221 -0.167866 -0.0338144
+0.0903053 0.204849 0.310166 0.406597 0.494477 0.574137 0.645895 0.71007
+0.766969 0.816895 0.860145 0.897008 0.927771 0.952708 0.972093 0.98619
+0.995261 0.999557 0.999329 0.994816 0.986257 0.97388 0.957912 0.938572
+0.916074 0.890625 0.86243 0.831684 0.798582 0.76331 0.726049 0.686977
+0.646266 0.60408 0.560583 0.515931 0.470276 0.423765 0.37654 0.328738
+0.280493 0.231934 0.183183 0.13436 0.0855808 0.0369554 -0.01141 -0.0594134
+-0.106956 -0.153946 -0.200292 -0.245909 -0.290715 -0.334633 -0.377589
+-0.419512 -0.460337 -0.5 -0.538443 -0.57561 -0.611449 -0.645912 -0.678953
+-0.710532 -0.740609 -0.76915 -0.796122 -0.821497 -0.845248 -0.867354
+-0.887794 -0.906551 -0.923612 -0.938965 -0.952601 -0.964516 -0.974704
+-0.983167 -0.989906 -0.994925 -0.99823 -0.999832 -0.999741 -0.997972
+-0.994539 -0.98946 -0.982757 -0.97445 -0.964564 -0.953125 -0.94016
+-0.925699 -0.909772 -0.892414 -0.873658 -0.85354 -0.832098 -0.809372
+-0.785401 -0.760228 -0.733895 -0.706446 -0.677928 -0.648387 -0.61787
+-0.586426 -0.554105 -0.520957 -0.487033 -0.452386 -0.417069 -0.381135
+-0.344638 -0.307632 -0.270174 -0.232319 -0.194122 -0.15564 -0.11693
+-0.0780487 -0.039053 0 0.039053 0.0780487 0.11693 0.15564 0.194122
+0.232319 0.270174 0.307632 0.344638 0.381135 0.417069 0.452386 0.487033
+0.520957 0.554105 0.586426 0.61787 0.648387 0.677928 0.706446 0.733895
+0.760228 0.785401 0.809372 0.832098 0.85354 0.873658 0.892414 0.909772
+0.925699 0.94016 0.953125 0.964564 0.97445 0.982757 0.98946 0.994539
+0.997972 0.999741 0.999832 0.99823 0.994925 0.989906 0.983167 0.974704
+0.964516 0.952601 0.938965 0.923612 0.906551 0.887794 0.867354 0.845248
+0.821497 0.796122 0.76915 0.740609 0.710532 0.678953 0.645912 0.611449
+0.57561 0.538443 0.5 0.460337 0.419512 0.377589 0.334633 0.290715 0.245909
+0.200292 0.153946 0.106956 0.0594134 0.01141 -0.0369554 -0.0855808
+-0.13436 -0.183183 -0.231934 -0.280493 -0.328738 -0.37654 -0.423765
+-0.470276 -0.515931 -0.560583 -0.60408 -0.646266 -0.686977 -0.726049
+-0.76331 -0.798582 -0.831684 -0.86243 -0.890625 -0.916074 -0.938572
+-0.957912 -0.97388 -0.986257 -0.994816 -0.999329 -0.999557 -0.995261
+-0.98619 -0.972093 -0.952708 -0.927771 -0.897008 -0.860145 -0.816895
+-0.766969 -0.71007 -0.645895 -0.574137 -0.494477 -0.406597 -0.310166
+-0.204849 -0.0903053 0.0338144 0.167866 0.31221 0.467216 0.63326 0.810724
+1 1.20148;
+#X coords 0 1 258 -1 200 140 1;
+#X restore 262 46 graph;
+#X text 497 28 subpatch to;
+#N canvas 113 0 849 700 make-table 0;
+#X obj 141 304 t b b;
+#X obj 213 329 f;
+#X obj 251 329 + 1;
+#X msg 235 306 0;
+#X obj 141 327 until;
+#X obj 213 359 t f f;
+#X obj 114 436 tabwrite E05-tab;
+#X obj 140 355 sel 258;
+#X text 203 172 normalize from -1 to 1;
+#X obj 141 285 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 88 386 expr ($f1-129)/128;
+#X obj 141 262 inlet;
+#X obj 171 534 t b b;
+#X obj 243 559 f;
+#X obj 281 559 + 1;
+#X msg 265 536 0;
+#X obj 171 557 until;
+#X obj 243 589 t f f;
+#X obj 144 666 tabwrite E05-tab;
+#X obj 170 585 sel 258;
+#X obj 171 515 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 118 616 expr ($f1-129)/128;
+#X obj 171 492 inlet;
+#X obj 444 228 t b b;
+#X obj 516 253 f;
+#X obj 554 253 + 1;
+#X msg 538 230 0;
+#X obj 444 251 until;
+#X obj 516 283 t f f;
+#X obj 417 360 tabwrite E05-tab;
+#X obj 443 279 sel 258;
+#X obj 391 334 expr 16*$f1*$f1*$f1*$f1*$f1-20*$f1*$f1*$f1+5*$f1;
+#X obj 444 209 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 391 310 expr ($f1-129)/128;
+#X obj 444 186 inlet;
+#X obj 504 476 t b b;
+#X obj 576 501 f;
+#X obj 614 501 + 1;
+#X msg 598 478 0;
+#X obj 504 499 until;
+#X obj 576 531 t f f;
+#X obj 477 624 tabwrite E05-tab;
+#X obj 503 527 sel 258;
+#X obj 504 457 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 448 558 expr ($f1-129)/128;
+#X obj 504 434 inlet;
+#X obj 88 410 expr 4*$f1*$f1*$f1-3*$f1;
+#X obj 118 640 expr 8*$f1*$f1*$f1*$f1-8*$f1*$f1+1;
+#X obj 448 582 expr 32*$f1*$f1*$f1*$f1*$f1*$f1 -48*$f1*$f1*$f1*$f1+18*$f1*$f1-1
+;
+#X text 641 622 6th C.P. and basta.;
+#X obj 83 92 t b b;
+#X obj 155 117 f;
+#X obj 193 117 + 1;
+#X msg 177 94 0;
+#X obj 83 115 until;
+#X obj 155 147 t f f;
+#X obj 56 224 tabwrite E05-tab;
+#X obj 82 143 sel 258;
+#X obj 83 73 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 30 174 expr ($f1-129)/128;
+#X obj 83 50 inlet;
+#X obj 30 198 expr 2*$f1*$f1-1;
+#X text 203 198 2nd C.P.;
+#X text 309 410 3rd C.P.;
+#X text 331 660 4th C.P.;
+#X text 613 357 5th C.P.;
+#X text 259 51 This patch computes Chebychev polynomials and stores
+them in a wavetable for use later.;
+#X connect 0 0 4 0;
+#X connect 0 1 3 0;
+#X connect 1 0 2 0;
+#X connect 1 0 5 0;
+#X connect 1 0 7 0;
+#X connect 2 0 1 1;
+#X connect 3 0 1 1;
+#X connect 4 0 1 0;
+#X connect 5 0 10 0;
+#X connect 5 1 6 1;
+#X connect 7 0 4 1;
+#X connect 9 0 0 0;
+#X connect 10 0 46 0;
+#X connect 11 0 9 0;
+#X connect 12 0 16 0;
+#X connect 12 1 15 0;
+#X connect 13 0 14 0;
+#X connect 13 0 17 0;
+#X connect 13 0 19 0;
+#X connect 14 0 13 1;
+#X connect 15 0 13 1;
+#X connect 16 0 13 0;
+#X connect 17 0 21 0;
+#X connect 17 1 18 1;
+#X connect 19 0 16 1;
+#X connect 20 0 12 0;
+#X connect 21 0 47 0;
+#X connect 22 0 20 0;
+#X connect 23 0 27 0;
+#X connect 23 1 26 0;
+#X connect 24 0 25 0;
+#X connect 24 0 28 0;
+#X connect 24 0 30 0;
+#X connect 25 0 24 1;
+#X connect 26 0 24 1;
+#X connect 27 0 24 0;
+#X connect 28 0 33 0;
+#X connect 28 1 29 1;
+#X connect 30 0 27 1;
+#X connect 31 0 29 0;
+#X connect 32 0 23 0;
+#X connect 33 0 31 0;
+#X connect 34 0 32 0;
+#X connect 35 0 39 0;
+#X connect 35 1 38 0;
+#X connect 36 0 37 0;
+#X connect 36 0 40 0;
+#X connect 36 0 42 0;
+#X connect 37 0 36 1;
+#X connect 38 0 36 1;
+#X connect 39 0 36 0;
+#X connect 40 0 44 0;
+#X connect 40 1 41 1;
+#X connect 42 0 39 1;
+#X connect 43 0 35 0;
+#X connect 44 0 48 0;
+#X connect 45 0 43 0;
+#X connect 46 0 6 0;
+#X connect 47 0 18 0;
+#X connect 48 0 41 0;
+#X connect 50 0 54 0;
+#X connect 50 1 53 0;
+#X connect 51 0 52 0;
+#X connect 51 0 55 0;
+#X connect 51 0 57 0;
+#X connect 52 0 51 1;
+#X connect 53 0 51 1;
+#X connect 54 0 51 0;
+#X connect 55 0 59 0;
+#X connect 55 1 56 1;
+#X connect 57 0 54 1;
+#X connect 58 0 50 0;
+#X connect 59 0 61 0;
+#X connect 60 0 58 0;
+#X connect 61 0 56 0;
+#X restore 489 146 pd make-table;
+#X obj 489 126 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 517 126 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 545 126 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 573 126 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 600 126 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X text 497 45 calculate;
+#X text 495 64 Chebychev;
+#X text 496 83 polynomials;
+#X text 490 107 2;
+#X text 517 107 3;
+#X text 546 107 4;
+#X text 572 108 5;
+#X text 601 107 6;
+#X text 134 2 waveshaping with Chebychev polynomials;
+#X obj 23 193 +~ 129;
+#X obj 23 242 hip~ 5;
+#X text 107 256 This patch demonstrates using Chebychev polynomials
+(of the first kind) to generate pure harmonics using waveshaping. The
+pure harmonic only comes out when the index is one (top of the scale).
+Smaller indices will give various mixes of harmonics. The table initially
+holds the fifth Chebychev polynomial \, so you can get the fifth harmonic.
+;
+#X text 106 355 There is an audible "rolling" sound as the index changes
+for the higher degree polynomials \, because the amplitudes of the
+lower partials can rise and fall several times apiece as the index
+rises from zero to one.;
+#X text 105 422 Indices greater than one will try to read values outside
+the table (which would be clipped appropriately). Anyway \, the polynomials
+increase rapidly in value outside the interval from -1 to 1 that we
+are using here.;
+#X text 106 491 When you get tired of Chebychef polynomials you can
+draw your own functions by hand and/or try other formulas.;
+#X connect 1 0 6 0;
+#X connect 2 0 1 0;
+#X connect 3 0 10 0;
+#X connect 5 0 3 0;
+#X connect 6 0 7 0;
+#X connect 7 0 3 1;
+#X connect 10 0 29 0;
+#X connect 11 0 30 0;
+#X connect 15 0 14 0;
+#X connect 16 0 14 1;
+#X connect 17 0 14 2;
+#X connect 18 0 14 3;
+#X connect 19 0 14 4;
+#X connect 29 0 11 0;
+#X connect 30 0 0 0;
+#X connect 30 0 0 1;
diff --git a/pd/doc/3.audio.examples/E05.pulse.width.mod.pd b/pd/doc/3.audio.examples/E05.pulse.width.mod.pd
deleted file mode 100644
index 214d250a..00000000
--- a/pd/doc/3.audio.examples/E05.pulse.width.mod.pd
+++ /dev/null
@@ -1,98 +0,0 @@
-#N canvas 27 355 931 532 12;
-#X floatatom 86 104 0 0 0;
-#X graph graph1 0 -1.02 882 1.02 669 456 869 326;
-#X array difference-output 882 float 0;
-#X pop;
-#X floatatom 123 324 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 86 351 pd output;
-#X msg 162 324 MUTE;
-#X obj 86 137 phasor~ 0;
-#X text 83 86 frequency;
-#X graph graph1 0 -1.02 882 1.02 668 179 868 49;
-#X array phasor1-output 882 float 0;
-#X pop;
-#X msg 191 77 bang;
-#X text 231 76 <-- click to graph;
-#X text 57 9 CLASSICAL PULSE WIDTH MODULATION;
-#X obj 102 196 phasor~ 0;
-#X obj 102 172 + 0.2;
-#X obj 86 246 -~;
-#X graph graph1 0 -1.02 882 1.02 668 316 868 186;
-#X array phasor2-output 882 float 0;
-#X pop;
-#X obj 191 164 tabwrite~ phasor1-output;
-#X obj 191 222 tabwrite~ phasor2-output;
-#X obj 191 276 tabwrite~ difference-output;
-#X text 12 386 This patch demonstrates pulse width modulation \, which
-is accomplished simply by subtracting two sawtooth waves at a varying
-phase difference. Here their frequencies are set to differ by 1/5 Hz.
-so that the relative phase wanders continuously.;
-#X text 669 459 ---- 0.02 seconds ----;
-#X text 665 498 updated for Pd version 0.34;
-#X text 203 325 <-- output;
-#X connect 0 0 5 0;
-#X connect 0 0 12 0;
-#X connect 2 0 3 1;
-#X connect 3 0 2 0;
-#X connect 4 0 3 2;
-#X connect 5 0 13 0;
-#X connect 5 0 15 0;
-#X connect 8 0 15 0;
-#X connect 8 0 16 0;
-#X connect 8 0 17 0;
-#X connect 11 0 13 1;
-#X connect 11 0 16 0;
-#X connect 12 0 11 0;
-#X connect 13 0 17 0;
-#X connect 13 0 3 0;
diff --git a/pd/doc/3.audio.examples/E06.exponential.pd b/pd/doc/3.audio.examples/E06.exponential.pd
new file mode 100644
index 00000000..02fe058b
--- /dev/null
+++ b/pd/doc/3.audio.examples/E06.exponential.pd
@@ -0,0 +1,335 @@
+#N canvas 88 112 754 729 12;
+#N canvas 0 0 450 300 graph1 0;
+#X array E06-signal 882 float 0;
+#X coords 0 1.02 882 -1.02 200 130 1;
+#X restore 509 46 graph;
+#X obj 14 265 hip~ 5;
+#N canvas 0 0 450 300 graph1 0;
+#X array E06-spectrum 128 float 0;
+#X coords 0 4300 127 -40 257 130 1;
+#X restore 463 222 graph;
+#N canvas 45 83 558 569 fft 0;
+#X obj 19 61 inlet~;
+#X obj 208 212 inlet;
+#X obj 29 92 rfft~;
+#X obj 29 125 *~;
+#X obj 60 125 *~;
+#X obj 29 155 sqrt~;
+#X obj 332 109 block~ 4096 1;
+#X obj 29 181 biquad~ 0 0 0 0 1;
+#X text 93 93 Fourier series;
+#X text 98 146 magnitude;
+#X text 96 131 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 193 164 delay two samples;
+#X text 191 182 for better graphing;
+#X obj 16 425 samplerate~;
+#X obj 16 402 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 16 472 5 0 0 0 - - -;
+#X obj 16 448 / 256;
+#X obj 16 378 loadbang;
+#X floatatom 16 541 5 0 0 0 - - -;
+#X obj 24 494 s fundamental;
+#X obj 16 517 ftom;
+#X text 14 319 At load time \, calculate a good choice of fundamental
+frequency for showing spectra: the 16th bin in a 4096-point spectrum
+\, so SR*16/4096 or SR/256.;
+#X floatatom 191 480 5 0 0 0 - - -;
+#X obj 191 456 / 4096;
+#X text 187 425 One bin is SR/4096:;
+#X obj 191 502 s freq-step;
+#X obj 208 295 tabwrite~ E06-spectrum;
+#X obj 19 295 tabwrite~ E06-signal;
+#X text 71 540 <-fundamental pitch;
+#X obj 220 257 metro 500;
+#X obj 220 234 inlet;
+#X text 273 232 toggle to graph repeatedly;
+#X text 262 212 bang to graph once;
+#X connect 0 0 2 0;
+#X connect 0 0 29 0;
+#X connect 1 0 28 0;
+#X connect 1 0 29 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 28 0;
+#X connect 15 0 18 0;
+#X connect 15 0 25 0;
+#X connect 16 0 15 0;
+#X connect 17 0 21 0;
+#X connect 17 0 22 0;
+#X connect 18 0 17 0;
+#X connect 19 0 16 0;
+#X connect 22 0 20 0;
+#X connect 24 0 27 0;
+#X connect 25 0 24 0;
+#X connect 31 0 28 0;
+#X connect 31 0 29 0;
+#X connect 32 0 31 0;
+#X restore 22 238 pd fft;
+#X text 509 178 ---- 0.02 seconds ----;
+#X obj 82 217 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 14 293 output~;
+#X text 499 708 updated for Pd version 0.37;
+#X text 494 355 1;
+#X text 528 355 2;
+#X text 560 355 3;
+#X text 592 355 4;
+#X text 625 355 5;
+#X text 655 355 6;
+#X text 686 355 7;
+#X text 462 355 0;
+#X text 496 372 -- partial number --;
+#X text 711 100 0;
+#X obj 12 30 r fundamental;
+#X obj 12 57 osc~;
+#X text 573 26 WAVEFORM;
+#X text 557 204 SPECTRUM;
+#X text 723 338 0;
+#X text 721 217 1;
+#X text 722 276 0.5;
+#X obj 82 238 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
+;
+#N canvas 0 0 450 300 graph1 0;
+#X array E06-tab 1003 float 1;
+#A 0 1.01005 1 0.99005 0.980199 0.970446 0.960789 0.951229 0.941765
+0.932394 0.923116 0.913931 0.904837 0.895834 0.88692 0.878095 0.869358
+0.860708 0.852144 0.843665 0.83527 0.826959 0.818731 0.810584 0.802519
+0.794534 0.786628 0.778801 0.771052 0.76338 0.755784 0.748264 0.740818
+0.733447 0.726149 0.718924 0.71177 0.704688 0.697676 0.690734 0.683861
+0.677057 0.67032 0.66365 0.657047 0.650509 0.644036 0.637628 0.631284
+0.625002 0.618783 0.612626 0.606531 0.600496 0.594521 0.588605 0.582748
+0.57695 0.571209 0.565525 0.559898 0.554327 0.548812 0.543351 0.537944
+0.532592 0.527292 0.522046 0.516851 0.511709 0.506617 0.501576 0.496585
+0.491644 0.486752 0.481909 0.477114 0.472367 0.467666 0.463013 0.458406
+0.453845 0.449329 0.444858 0.440432 0.436049 0.431711 0.427415 0.423162
+0.418952 0.414783 0.410656 0.40657 0.402524 0.398519 0.394554 0.390628
+0.386741 0.382893 0.379083 0.375311 0.371577 0.367879 0.364219 0.360595
+0.357007 0.353455 0.349938 0.346456 0.343008 0.339595 0.336216 0.332871
+0.329559 0.32628 0.323033 0.319819 0.316637 0.313486 0.310367 0.307279
+0.304221 0.301194 0.298197 0.29523 0.292293 0.289384 0.286505 0.283654
+0.280832 0.278037 0.275271 0.272532 0.26982 0.267135 0.264477 0.261846
+0.25924 0.256661 0.254107 0.251579 0.249075 0.246597 0.244143 0.241714
+0.239309 0.236928 0.23457 0.232236 0.229925 0.227638 0.225373 0.22313
+0.22091 0.218712 0.216536 0.214381 0.212248 0.210136 0.208045 0.205975
+0.203926 0.201897 0.199888 0.197899 0.19593 0.19398 0.19205 0.190139
+0.188247 0.186374 0.18452 0.182684 0.180866 0.179066 0.177284 0.17552
+0.173774 0.172045 0.170333 0.168638 0.16696 0.165299 0.163654 0.162026
+0.160414 0.158817 0.157237 0.155673 0.154124 0.15259 0.151072 0.149569
+0.14808 0.146607 0.145148 0.143704 0.142274 0.140858 0.139457 0.138069
+0.136695 0.135335 0.133989 0.132655 0.131336 0.130029 0.128735 0.127454
+0.126186 0.12493 0.123687 0.122456 0.121238 0.120032 0.118837 0.117655
+0.116484 0.115325 0.114178 0.113042 0.111917 0.110803 0.109701 0.108609
+0.107528 0.106459 0.105399 0.10435 0.103312 0.102284 0.101266 0.100259
+0.0992613 0.0982736 0.0972958 0.0963276 0.0953692 0.0944202 0.0934807
+0.0925506 0.0916297 0.0907179 0.0898153 0.0889216 0.0880368 0.0871608
+0.0862936 0.085435 0.0845849 0.0837432 0.08291 0.082085 0.0812682 0.0804596
+0.079659 0.0788664 0.0780817 0.0773047 0.0765356 0.075774 0.07502 0.0742736
+0.0735345 0.0728029 0.0720785 0.0713613 0.0706512 0.0699482 0.0692522
+0.0685631 0.0678809 0.0672055 0.0665368 0.0658748 0.0652193 0.0645703
+0.0639279 0.0632918 0.062662 0.0620385 0.0614212 0.0608101 0.060205
+0.0596059 0.0590129 0.0584257 0.0578443 0.0572688 0.0566989 0.0561348
+0.0555762 0.0550232 0.0544757 0.0539337 0.053397 0.0528657 0.0523397
+0.0518189 0.0513033 0.0507928 0.0502874 0.0497871 0.0492917 0.0488012
+0.0483156 0.0478349 0.0473589 0.0468877 0.0464212 0.0459593 0.045502
+0.0450492 0.044601 0.0441572 0.0437178 0.0432828 0.0428521 0.0424257
+0.0420036 0.0415857 0.0411719 0.0407622 0.0403566 0.0399551 0.0395575
+0.0391639 0.0387742 0.0383884 0.0380064 0.0376283 0.0372538 0.0368832
+0.0365162 0.0361528 0.0357931 0.035437 0.0350844 0.0347353 0.0343896
+0.0340475 0.0337087 0.0333733 0.0330412 0.0327124 0.0323869 0.0320647
+0.0317456 0.0314298 0.031117 0.0308074 0.0305009 0.0301974 0.0298969
+0.0295994 0.0293049 0.0290133 0.0287246 0.0284388 0.0281559 0.0278757
+0.0275983 0.0273237 0.0270518 0.0267827 0.0265162 0.0262523 0.0259911
+0.0257325 0.0254765 0.025223 0.024972 0.0247235 0.0244775 0.024234
+0.0239928 0.0237541 0.0235177 0.0232837 0.0230521 0.0228227 0.0225956
+0.0223708 0.0221482 0.0219278 0.0217096 0.0214936 0.0212797 0.021068
+0.0208584 0.0206508 0.0204453 0.0202419 0.0200405 0.0198411 0.0196437
+0.0194482 0.0192547 0.0190631 0.0188734 0.0186856 0.0184997 0.0183156
+0.0181334 0.017953 0.0177743 0.0175975 0.0174224 0.017249 0.0170774
+0.0169075 0.0167392 0.0165727 0.0164078 0.0162445 0.0160829 0.0159229
+0.0157644 0.0156076 0.0154523 0.0152985 0.0151463 0.0149956 0.0148464
+0.0146986 0.0145524 0.0144076 0.0142642 0.0141223 0.0139818 0.0138427
+0.0137049 0.0135686 0.0134336 0.0132999 0.0131675 0.0130365 0.0129068
+0.0127784 0.0126512 0.0125254 0.0124007 0.0122773 0.0121552 0.0120342
+0.0119145 0.0117959 0.0116786 0.0115624 0.0114473 0.0113334 0.0112206
+0.011109 0.0109985 0.010889 0.0107807 0.0106734 0.0105672 0.0104621
+0.010358 0.0102549 0.0101529 0.0100518 0.00995182 0.0098528 0.00975476
+0.0096577 0.0095616 0.00946646 0.00937227 0.00927902 0.00918669 0.00909528
+0.00900478 0.00891518 0.00882647 0.00873865 0.0086517 0.00856561 0.00848038
+0.008396 0.00831246 0.00822975 0.00814786 0.00806679 0.00798652 0.00790705
+0.00782838 0.00775048 0.00767337 0.00759701 0.00752142 0.00744658 0.00737249
+0.00729913 0.0072265 0.0071546 0.00708341 0.00701293 0.00694315 0.00687406
+0.00680567 0.00673795 0.0066709 0.00660453 0.00653881 0.00647375 0.00640933
+0.00634556 0.00628242 0.00621991 0.00615802 0.00609675 0.00603608 0.00597602
+0.00591656 0.00585769 0.0057994 0.0057417 0.00568457 0.00562801 0.00557201
+0.00551657 0.00546167 0.00540733 0.00535353 0.00530026 0.00524752 0.0051953
+0.00514361 0.00509243 0.00504176 0.00499159 0.00494193 0.00489275 0.00484407
+0.00479587 0.00474815 0.00470091 0.00465413 0.00460782 0.00456197 0.00451658
+0.00447164 0.00442715 0.0043831 0.00433948 0.00429631 0.00425356 0.00421123
+0.00416933 0.00412785 0.00408677 0.00404611 0.00400585 0.00396599 0.00392653
+0.00388746 0.00384878 0.00381048 0.00377257 0.00373503 0.00369786 0.00366107
+0.00362464 0.00358857 0.00355287 0.00351752 0.00348252 0.00344786 0.00341356
+0.00337959 0.00334597 0.00331267 0.00327971 0.00324708 0.00321477 0.00318278
+0.00315111 0.00311976 0.00308871 0.00305798 0.00302755 0.00299743 0.0029676
+0.00293808 0.00290884 0.0028799 0.00285124 0.00282287 0.00279478 0.00276698
+0.00273944 0.00271219 0.0026852 0.00265848 0.00263203 0.00260584 0.00257991
+0.00255424 0.00252883 0.00250366 0.00247875 0.00245409 0.00242967 0.00240549
+0.00238156 0.00235786 0.0023344 0.00231117 0.00228818 0.00226541 0.00224287
+0.00222055 0.00219846 0.00217658 0.00215492 0.00213348 0.00211225 0.00209124
+0.00207043 0.00204983 0.00202943 0.00200924 0.00198925 0.00196945 0.00194986
+0.00193045 0.00191125 0.00189223 0.0018734 0.00185476 0.0018363 0.00181803
+0.00179994 0.00178203 0.0017643 0.00174675 0.00172937 0.00171216 0.00169512
+0.00167826 0.00166156 0.00164502 0.00162866 0.00161245 0.00159641 0.00158052
+0.0015648 0.00154923 0.00153381 0.00151855 0.00150344 0.00148848 0.00147367
+0.00145901 0.00144449 0.00143012 0.00141589 0.0014018 0.00138785 0.00137404
+0.00136037 0.00134683 0.00133343 0.00132016 0.00130703 0.00129402 0.00128115
+0.0012684 0.00125578 0.00124328 0.00123091 0.00121866 0.00120654 0.00119453
+0.00118265 0.00117088 0.00115923 0.00114769 0.00113627 0.00112497 0.00111377
+0.00110269 0.00109172 0.00108086 0.0010701 0.00105946 0.00104891 0.00103848
+0.00102814 0.00101791 0.00100779 0.000997758 0.00098783 0.000978001
+0.00096827 0.000958635 0.000949097 0.000939653 0.000930303 0.000921047
+0.000911882 0.000902808 0.000893825 0.000884932 0.000876127 0.000867409
+0.000858778 0.000850233 0.000841773 0.000833397 0.000825105 0.000816895
+0.000808767 0.000800719 0.000792752 0.000784864 0.000777055 0.000769323
+0.000761668 0.000754089 0.000746586 0.000739157 0.000731803 0.000724521
+0.000717312 0.000710174 0.000703108 0.000696112 0.000689185 0.000682328
+0.000675539 0.000668817 0.000662162 0.000655574 0.00064905 0.000642592
+0.000636198 0.000629868 0.000623601 0.000617396 0.000611253 0.000605171
+0.000599149 0.000593188 0.000587285 0.000581442 0.000575656 0.000569928
+0.000564257 0.000558643 0.000553084 0.000547581 0.000542133 0.000536738
+0.000531398 0.00052611 0.000520875 0.000515692 0.000510561 0.000505481
+0.000500451 0.000495472 0.000490542 0.000485661 0.000480829 0.000476044
+0.000471307 0.000466618 0.000461975 0.000457378 0.000452827 0.000448321
+0.000443861 0.000439444 0.000435072 0.000430743 0.000426456 0.000422213
+0.000418012 0.000413853 0.000409735 0.000405658 0.000401622 0.000397626
+0.000393669 0.000389752 0.000385874 0.000382034 0.000378233 0.00037447
+0.000370744 0.000367055 0.000363402 0.000359786 0.000356206 0.000352662
+0.000349153 0.000345679 0.000342239 0.000338834 0.000335463 0.000332125
+0.00032882 0.000325548 0.000322309 0.000319102 0.000315927 0.000312783
+0.000309671 0.00030659 0.000303539 0.000300519 0.000297529 0.000294568
+0.000291637 0.000288735 0.000285862 0.000283018 0.000280202 0.000277414
+0.000274654 0.000271921 0.000269215 0.000266536 0.000263884 0.000261259
+0.000258659 0.000256085 0.000253537 0.000251014 0.000248517 0.000246044
+0.000243596 0.000241172 0.000238772 0.000236396 0.000234044 0.000231716
+0.00022941 0.000227127 0.000224867 0.00022263 0.000220415 0.000218221
+0.00021605 0.0002139 0.000211772 0.000209665 0.000207579 0.000205513
+0.000203468 0.000201444 0.000199439 0.000197455 0.00019549 0.000193545
+0.000191619 0.000189713 0.000187825 0.000185956 0.000184106 0.000182274
+0.00018046 0.000178665 0.000176887 0.000175127 0.000173384 0.000171659
+0.000169951 0.00016826 0.000166586 0.000164928 0.000163287 0.000161663
+0.000160054 0.000158461 0.000156885 0.000155324 0.000153778 0.000152248
+0.000150733 0.000149233 0.000147748 0.000146278 0.000144823 0.000143382
+0.000141955 0.000140543 0.000139144 0.00013776 0.000136389 0.000135032
+0.000133688 0.000132358 0.000131041 0.000129737 0.000128446 0.000127168
+0.000125903 0.00012465 0.00012341 0.000122182 0.000120966 0.000119763
+0.000118571 0.000117391 0.000116223 0.000115067 0.000113922 0.000112788
+0.000111666 0.000110555 0.000109455 0.000108366 0.000107287 0.00010622
+0.000105163 0.000104117 0.00010308 0.000102055 0.000101039 0.000100034
+9.90387e-05 9.80533e-05 9.70776e-05 9.61117e-05 9.51553e-05 9.42085e-05
+9.32711e-05 9.23431e-05 9.14242e-05 9.05145e-05 8.96139e-05 8.87222e-05
+8.78394e-05 8.69654e-05 8.61001e-05 8.52434e-05 8.43952e-05 8.35554e-05
+8.27241e-05 8.1901e-05 8.1086e-05 8.02792e-05 7.94804e-05 7.86896e-05
+7.79066e-05 7.71314e-05 7.6364e-05 7.56041e-05 7.48518e-05 7.4107e-05
+7.33696e-05 7.26396e-05 7.19169e-05 7.12012e-05 7.04928e-05 6.97914e-05
+6.9097e-05 6.84094e-05 6.77287e-05 6.70548e-05 6.63876e-05 6.5727e-05
+6.5073e-05 6.44256e-05 6.37845e-05 6.31498e-05 6.25215e-05 6.18994e-05
+6.12835e-05 6.06737e-05 6.007e-05 5.94723e-05 5.88805e-05 5.82947e-05
+5.77146e-05 5.71403e-05 5.65718e-05 5.60089e-05 5.54516e-05 5.48998e-05
+5.43536e-05 5.38128e-05 5.32773e-05 5.27472e-05 5.22224e-05 5.17027e-05
+5.11883e-05 5.06789e-05 5.01747e-05 4.96754e-05 4.91812e-05 4.86918e-05
+4.82073e-05 4.77276e-05 4.72527e-05 4.67826e-05 4.63171e-05;
+#A 1000 0 0 0;
+#X coords 0 1 1002 0 180 100 1;
+#X restore 254 118 graph;
+#N canvas 140 79 589 249 make-table 0;
+#X obj 164 81 t b b;
+#X obj 236 106 f;
+#X obj 274 106 + 1;
+#X msg 258 83 0;
+#X obj 164 104 until;
+#X obj 236 136 t f f;
+#X obj 164 62 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 104 164 expr exp(-($f1-1)/100);
+#X obj 163 132 sel 999;
+#X text 35 10 This patch computes a decaying exponential function \,
+100 points per unit.;
+#X obj 137 196 tabwrite E06-tab;
+#X connect 0 0 4 0;
+#X connect 0 1 3 0;
+#X connect 1 0 2 0;
+#X connect 1 0 5 0;
+#X connect 1 0 8 0;
+#X connect 2 0 1 1;
+#X connect 3 0 1 1;
+#X connect 4 0 1 0;
+#X connect 5 0 7 0;
+#X connect 5 1 10 1;
+#X connect 6 0 0 0;
+#X connect 7 0 10 0;
+#X connect 8 0 4 1;
+#X restore 302 258 pd make-table;
+#X text 251 95 waveshaping function;
+#X text 438 210 0;
+#X text 437 114 1;
+#X obj 12 168 +~ 1;
+#X obj 12 146 *~ 100;
+#X obj 12 83 +~ 1;
+#X floatatom 68 53 5 0 200 0 - - -;
+#X obj 68 96 pack 0 50;
+#X obj 68 120 line~;
+#X text 157 69 tenths;
+#X obj 68 73 / 10;
+#X obj 12 124 *~;
+#X obj 13 190 tabread4~ E06-tab;
+#X text 711 40 1;
+#X text 712 160 -1;
+#X text 103 237 <-- repeatedly;
+#X text 104 217 <-- graph once;
+#X text 121 0 Waveshaping using an exponential function;
+#X text 120 53 <--index in;
+#X text 250 218 0;
+#X text 417 220 10;
+#X text 14 652 When the index of modulation exceeds 5 we scan past
+the right hand border of the table (the thousandth point \, corresponding
+to exp(-10). This isn't a problem because the values are all close
+to zero there.;
+#X text 14 555 Table lookup is prepared as follows. First add one to
+the sinusoid and adjust its amplitude according to index \; it ranges
+from 0 to 2*index. Then adjust for the table's input scale (100 points
+per unit \, so multiply by 100) and add one to skip the interpolation
+point at the beginning of the table.;
+#X text 13 398 Here we use an exponential function as a waveshaping
+transfer function. The theory is shown in detail in the accompanying
+book \, but in short \, we adjust the sinusoid so that \, as the index
+increases \, we scan starting from the left of the transfer function
+(previously the reading location grew from the center). The table contains
+exp(-x) with x varying from 0 to 10 When the index is zero \, the output
+is the constant 1 and the spectrum holds only DC. As the index grows
+\, the output is a sequence of steadily narrower pulses \, whose spectrum
+gets progressively fatter.;
+#X connect 1 0 6 0;
+#X connect 1 0 6 1;
+#X connect 5 0 3 1;
+#X connect 18 0 19 0;
+#X connect 19 0 33 0;
+#X connect 25 0 3 2;
+#X connect 31 0 40 0;
+#X connect 32 0 31 0;
+#X connect 33 0 39 0;
+#X connect 34 0 38 0;
+#X connect 35 0 36 0;
+#X connect 36 0 39 1;
+#X connect 38 0 35 0;
+#X connect 39 0 32 0;
+#X connect 40 0 3 0;
+#X connect 40 0 1 0;
diff --git a/pd/doc/3.audio.examples/E06.stereo.pd b/pd/doc/3.audio.examples/E06.stereo.pd
deleted file mode 100644
index 1c417df5..00000000
--- a/pd/doc/3.audio.examples/E06.stereo.pd
+++ /dev/null
@@ -1,87 +0,0 @@
-#N canvas 27 355 553 341 12;
-#X floatatom 59 63;
-#X msg 340 12 \; pd dsp 1;
-#X msg 407 12 \; pd dsp 0;
-#X text 361 45 ON;
-#X text 424 43 OFF;
-#X floatatom 123 196;
-#N canvas 159 26 618 383 output 0;
-#X obj 393 156 t b;
-#X obj 393 106 f;
-#X obj 393 56 inlet;
-#X text 399 25 mute;
-#X obj 393 181 f;
-#X msg 480 174 0;
-#X msg 393 81 bang;
-#X obj 393 131 moses 1;
-#X obj 480 149 t b f;
-#X obj 452 113 moses 1;
-#X obj 138 144 dbtorms;
-#X obj 452 88 r master-lvl;
-#X obj 138 38 r master-lvl;
-#X obj 393 206 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 254 37 inlet;
-#X text 254 14 level;
-#X obj 254 96 s master-lvl;
-#X msg 151 61 set \$1;
-#X obj 151 85 outlet;
-#X msg 269 60 \; pd dsp 1;
-#X obj 138 190 line~;
-#X obj 22 212 *~;
-#X obj 138 167 pack 0 50;
-#X text 34 159 audio;
-#X text 148 106 show level;
-#X obj 73 182 inlet~;
-#X obj 73 213 *~;
-#X obj 22 241 dac~ 1;
-#X obj 73 241 dac~ 2;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 23 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 21 0 27 1;
-#X connect 22 0 28 0;
-#X connect 23 0 21 0;
-#X connect 26 0 27 0;
-#X connect 27 0 29 0;
-#X restore 61 224 pd output;
-#X msg 152 196 MUTE;
-#X text 186 195 <-- output amplitude;
-#X obj 59 111 phasor~ 0;
-#X text 56 45 frequency;
-#X text 331 323 updated for Pd version 0.26;
-#X text 57 9 CLASSICAL PULSE WIDTH MODULATION;
-#X obj 131 110 phasor~ 0;
-#X obj 59 134 -~ 0.5;
-#X obj 131 85 + 0.5;
-#X obj 131 135 -~ 0.5;
-#X obj 131 160 *~ -1;
-#X text 34 262 Here's what happens if you take the previous patch but \, instead of subtracting the two sawtooth waves \, we put them in two speakers with opposite phase.;
-#X connect 0 0 9 0;
-#X connect 0 0 15 0;
-#X connect 5 0 6 2;
-#X connect 6 0 5 0;
-#X connect 7 0 6 3;
-#X connect 9 0 14 0;
-#X connect 13 0 16 0;
-#X connect 14 0 6 0;
-#X connect 15 0 13 0;
-#X connect 16 0 17 0;
-#X connect 17 0 6 1;
diff --git a/pd/doc/3.audio.examples/E07.envelope.mod.pd b/pd/doc/3.audio.examples/E07.envelope.mod.pd
deleted file mode 100644
index 52551163..00000000
--- a/pd/doc/3.audio.examples/E07.envelope.mod.pd
+++ /dev/null
@@ -1,148 +0,0 @@
-#N canvas 75 15 1014 733 12;
-#X graph graph1 0 -1.02 44100 1.02 764 446 964 316;
-#X array cos-output 44100 float 0;
-#X pop;
-#X graph graph1 0 -1.02 44103 1.02 761 148 961 18;
-#X array sample-table 44103 float 0;
-#X pop;
-#X obj 593 579 loadbang;
-#X floatatom 96 489 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 67 517 pd output;
-#X msg 133 490 MUTE;
-#X text 176 490 <-- output amplitude;
-#X obj 67 460 hip~ 5;
-#X obj 47 408 tabread4~ sample-table;
-#X floatatom 46 50 0 0 0;
-#X text 85 49 <-- frequency (Hz.);
-#X floatatom 97 358 0 0 0;
-#X obj 97 385 * 441;
-#X obj 47 358 *~ 0;
-#X obj 47 383 +~ 1;
-#X text 271 274 <-- click to display output;
-#X msg 229 275 bang;
-#X text 136 357 <-- chunk size (100ths of a second);
-#X obj 588 471 adc~ 1;
-#X obj 588 495 hip~ 5;
-#X obj 588 545 tabwrite~ sample-table;
-#X msg 603 518 bang;
-#X text 635 518 <-- click here to record your own sample;
-#X text 704 583 v-- re-read the original sample;
-#X text 40 9 ENVELOPING YOUR LOOPING SAMPLER;
-#X obj 88 101 -~ 0.5;
-#X obj 88 259 clip~ -0.5 0.5;
-#X obj 88 237 *~ 1;
-#X graph graph1 0 -1.02 44100 1.02 763 311 963 181;
-#X array cos-input 44100 float 0;
-#X pop;
-#X obj 229 303 tabwrite~ cos-input;
-#X obj 88 284 cos~;
-#X obj 88 126 wrap~;
-#X obj 88 155 -~ 0.5;
-#X obj 88 332 *~ -0.5;
-#X obj 88 307 -~ 1;
-#X obj 229 329 tabwrite~ cos-output;
-#X floatatom 119 187 0 0 0;
-#X obj 67 433 *~;
-#X text 157 98 subtracting 0.5 and wrapping produces a sawtooth wave
-180 degrees out of phase from the original.;
-#X text 153 150 as before we subtract 1/2 again to center the sawtooth
-from -1/2 to 1/2.;
-#X text 153 188 <-- sharpness (at least 1);
-#X msg 593 608 read ../sound/voice.wav sample-table;
-#X obj 593 633 soundfiler;
-#X text 776 150 -- 44103 samples ---;
-#X text 767 447 ----- 1 second ------;
-#X obj 119 211 max 1;
-#X obj 46 77 phasor~;
-#X text 24 560 Here we apply an amplitude envelope to protect against
-discontinuities at the loop point. The envelope is based on the pulse
-width modulation example \, except that the widening is applied to
-the "1" part of the pulse \, not the "0" part.;
-#X text 23 647 To see the envelope \, put the phasor on 2 Hz \, select
-"sharpness" values between 1 and 3 \, and look at "cos-input" and "cos-output."
-You should both see and hear the effect of the "sharpness" parameter.
-;
-#X text 734 688 updated for Pd version 0.34;
-#X connect 2 0 41 0;
-#X connect 3 0 4 1;
-#X connect 4 0 3 0;
-#X connect 5 0 4 2;
-#X connect 7 0 4 0;
-#X connect 8 0 37 0;
-#X connect 9 0 46 0;
-#X connect 11 0 12 0;
-#X connect 12 0 13 1;
-#X connect 13 0 14 0;
-#X connect 14 0 8 0;
-#X connect 16 0 29 0;
-#X connect 16 0 35 0;
-#X connect 18 0 19 0;
-#X connect 19 0 20 0;
-#X connect 21 0 20 0;
-#X connect 25 0 31 0;
-#X connect 26 0 30 0;
-#X connect 26 0 29 0;
-#X connect 27 0 26 0;
-#X connect 30 0 34 0;
-#X connect 31 0 32 0;
-#X connect 32 0 27 0;
-#X connect 33 0 35 0;
-#X connect 33 0 37 1;
-#X connect 34 0 33 0;
-#X connect 36 0 45 0;
-#X connect 37 0 7 0;
-#X connect 41 0 42 0;
-#X connect 45 0 27 1;
-#X connect 46 0 13 0;
-#X connect 46 0 25 0;
diff --git a/pd/doc/3.audio.examples/E07.evenodd.pd b/pd/doc/3.audio.examples/E07.evenodd.pd
new file mode 100644
index 00000000..9715e1ea
--- /dev/null
+++ b/pd/doc/3.audio.examples/E07.evenodd.pd
@@ -0,0 +1,109 @@
+#N canvas 187 149 784 591 12;
+#X obj 230 101 f;
+#X obj 264 77 + 1;
+#X obj 264 101 mod 11;
+#N canvas 0 0 450 300 graph1 0;
+#X array E07 11 float 0;
+#X coords 0 96 11 36 100 160 1;
+#X restore 528 15 graph;
+#X floatatom 320 53 0 10 999 0 - - -;
+#X obj 230 173 mtof;
+#X msg 26 92 1;
+#X obj 27 217 *~;
+#X obj 27 267 cos~;
+#X obj 27 292 hip~ 5;
+#X obj 27 244 +~ 0.1;
+#X floatatom 61 144 0 0 0 0 - - -;
+#X floatatom 166 145 0 0 200 0 - - -;
+#X floatatom 96 144 0 0 999 0 - - -;
+#X floatatom 131 144 0 0 999 0 - - -;
+#X msg 112 267 0;
+#X msg 112 245 0.1;
+#X msg 112 289 0.25;
+#X text 68 108 ADSR controls;
+#X text 106 125 A;
+#X text 141 125 D;
+#X text 176 125 S;
+#X floatatom 320 77 0 1 11 0 - - -;
+#X text 354 79 <--increment;
+#X text 355 56 <--msec;
+#X obj 26 193 *~ 0.01;
+#X obj 230 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
+;
+#X obj 27 321 output~;
+#X text 527 562 updated for Pd version 0.37;
+#X obj 26 170 adsr 70 10 90 50 500;
+#X obj 230 150 +;
+#X floatatom 265 150 0 -48 120 0 - - -;
+#X text 299 152 <--transpose;
+#N canvas 0 0 538 208 make-table 0;
+#X obj 38 71 loadbang;
+#X text 16 11 This patch loads a sequence of pitches into array1. The
+values are floating-point \, so we could use microtones (60.5 \, for
+example) if we wish.;
+#X msg 38 99 \; array1 0 55 56 57 55 57 61 55 61 63 57 63 \; array1
+yticks 36 12 1 \; array1 ylabel 12 36 48 60 72 84 96;
+#X connect 0 0 2 0;
+#X restore 527 195 pd make-table;
+#X obj 176 50 sel 0;
+#X msg 26 69 0;
+#X text 48 125 level;
+#X obj 230 53 metro 130;
+#X obj 60 217 osc~;
+#X text 111 225 symmetry;
+#X text 157 265 even;
+#X text 165 288 odd;
+#X text 147 244 mixed;
+#X obj 230 126 tabread E07;
+#X text 253 26 <--ON/OFF;
+#X text 238 232 This patch uses a stepping sequencer to control a waveshaping
+instrument. A metronome (metro 130) drives a counter (f \, +1 \, and
+mod 11) which counts repeatedly through 11 values which are read from
+the stored table (tabread E07). The values may be read in sequence
+\, by twos or threes \, etc. \, according to the "increment" parameter.
+;
+#X text 239 328 The metronome also triggers an ADSR envelope \, whose
+parameters may also be changed using the "level" \, "A" \, "D" \, and
+"S" controls.;
+#X text 142 5 SEQUENCED WAVESHAPING SYNTHESIZER;
+#X text 240 380 The synthesis (osc~ \, *~ \, +~ 0.1 \, cos~) is a very
+simple application of the waveshaping technique. The oscillator (whose
+amplitude depends on the ADSR generator) is used as an index into the
+"cos~" wavetable. An additional offset ("symmetry") controls how the
+oscillator's waveform is centered on the wavetable. If the offset is
+zero \, the oscillator reads into the (even) cosine function (producing
+only even harmonics). If the offset is 0.25 \, we read 1/4 wave into
+the cosine function: the result is an odd function and we get odd harmonics.
+Between the two we get mixtures of even and odd.;
+#X connect 0 0 1 0;
+#X connect 0 0 43 0;
+#X connect 1 0 2 0;
+#X connect 2 0 0 1;
+#X connect 4 0 37 1;
+#X connect 5 0 38 0;
+#X connect 6 0 29 0;
+#X connect 7 0 10 0;
+#X connect 8 0 9 0;
+#X connect 9 0 27 0;
+#X connect 9 0 27 1;
+#X connect 10 0 8 0;
+#X connect 11 0 29 1;
+#X connect 12 0 29 4;
+#X connect 13 0 29 2;
+#X connect 14 0 29 3;
+#X connect 15 0 10 1;
+#X connect 16 0 10 1;
+#X connect 17 0 10 1;
+#X connect 22 0 1 1;
+#X connect 25 0 7 0;
+#X connect 26 0 34 0;
+#X connect 26 0 37 0;
+#X connect 29 0 25 0;
+#X connect 30 0 5 0;
+#X connect 31 0 30 1;
+#X connect 34 0 35 0;
+#X connect 35 0 29 0;
+#X connect 37 0 0 0;
+#X connect 37 0 6 0;
+#X connect 38 0 7 1;
+#X connect 43 0 30 0;
diff --git a/pd/doc/3.audio.examples/E08.even.odd.pd b/pd/doc/3.audio.examples/E08.even.odd.pd
deleted file mode 100644
index bfa950a9..00000000
--- a/pd/doc/3.audio.examples/E08.even.odd.pd
+++ /dev/null
@@ -1,116 +0,0 @@
-#N canvas 213 27 840 639 12;
-#X floatatom 45 74 0 0 0;
-#X obj 99 164 wrap~;
-#X graph graph1 0 -1.02 882 1.02 624 153 824 23;
-#X array phasor-output 882 float 0;
-#X pop;
-#X obj 45 102 phasor~ 0;
-#X text 81 73 frequency;
-#X obj 45 130 -~ 0.5;
-#X obj 99 192 -~ 0.5;
-#X obj 36 244 -~;
-#X obj 98 244 +~;
-#X graph graph1 0 -1.02 882 1.02 625 288 825 158;
-#X array wrap-output 882 float 0;
-#X pop;
-#X graph graph1 0 -1.02 882 1.02 626 423 826 293;
-#X array sum 882 float 0;
-#X pop;
-#X graph graph1 0 -1.02 882 1.02 626 563 826 433;
-#X array difference 882 float 0;
-#X pop;
-#X obj 172 166 tabwrite~ phasor-output;
-#X obj 172 218 tabwrite~ wrap-output;
-#X obj 172 282 tabwrite~ sum;
-#X obj 172 327 tabwrite~ difference;
-#X msg 172 120 bang;
-#X text 106 13 BUCHLA'S METHOD;
-#X floatatom 119 369 0 0 0;
-#N canvas 159 26 618 383 output 0;
-#X obj 393 156 t b;
-#X obj 393 106 f;
-#X obj 393 56 inlet;
-#X text 399 25 mute;
-#X obj 393 181 f;
-#X msg 480 174 0;
-#X msg 393 81 bang;
-#X obj 393 131 moses 1;
-#X obj 480 149 t b f;
-#X obj 452 113 moses 1;
-#X obj 138 144 dbtorms;
-#X obj 452 88 r master-lvl;
-#X obj 138 38 r master-lvl;
-#X obj 393 206 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 254 37 inlet;
-#X text 254 14 level;
-#X obj 254 96 s master-lvl;
-#X msg 151 61 set \$1;
-#X obj 151 85 outlet;
-#X msg 269 60 \; pd dsp 1;
-#X obj 138 190 line~;
-#X obj 22 212 *~;
-#X obj 138 167 pack 0 50;
-#X text 34 159 audio;
-#X text 148 106 show level;
-#X obj 73 182 inlet~;
-#X obj 73 213 *~;
-#X obj 22 241 dac~ 1;
-#X obj 73 241 dac~ 2;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 23 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 21 0 27 1;
-#X connect 22 0 28 0;
-#X connect 23 0 21 0;
-#X connect 26 0 27 0;
-#X connect 27 0 29 0;
-#X restore 81 392 pd output;
-#X msg 156 369 MUTE;
-#X text 13 430 A patch to split a sawtooth into even and odd harmonics
-ala Buchla. The wrap~ object folds its input into the interval [0 \,
-1) so taht \, for instance \, subtracting 1/5 from a phasor and wrapping
-it gives another phasor a half cycle out of phase frmo the original.
-Adding and subtracting the two give the results shown and heard. (Listen
-to the two outputs separately \, then together.);
-#X text 631 567 ---- 0.02 seconds ----;
-#X text 577 613 updated for Pd version 0.34;
-#X text 193 369 <-- output;
-#X connect 0 0 3 0;
-#X connect 1 0 6 0;
-#X connect 3 0 5 0;
-#X connect 5 0 1 0;
-#X connect 5 0 12 0;
-#X connect 5 0 8 0;
-#X connect 5 0 7 0;
-#X connect 6 0 13 0;
-#X connect 6 0 8 1;
-#X connect 6 0 7 1;
-#X connect 7 0 15 0;
-#X connect 7 0 19 0;
-#X connect 8 0 14 0;
-#X connect 8 0 19 1;
-#X connect 16 0 13 0;
-#X connect 16 0 14 0;
-#X connect 16 0 15 0;
-#X connect 16 0 12 0;
-#X connect 18 0 19 2;
-#X connect 19 0 18 0;
-#X connect 20 0 19 3;
diff --git a/pd/doc/3.audio.examples/08.phase.mod.pd b/pd/doc/3.audio.examples/E08.phase.mod.pd
index 716ba6ab..53a6e052 100644
--- a/pd/doc/3.audio.examples/08.phase.mod.pd
+++ b/pd/doc/3.audio.examples/E08.phase.mod.pd
@@ -1,104 +1,45 @@
#N canvas 36 68 722 738 12;
-#X obj 216 145 *~;
-#X floatatom 216 88 0 0 0;
-#X obj 297 125 line~;
-#X floatatom 128 108 0 0 0;
-#X obj 128 222 cos~;
-#X obj 128 178 +~;
-#X floatatom 166 299 0 0 100;
-#N canvas 159 26 495 270 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 159 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 128 326 pd output;
-#X msg 204 299 MUTE;
-#X obj 216 113 osc~ 0;
-#X obj 297 99 pack 0 50;
-#X floatatom 297 46 0 0 0;
-#X obj 297 73 / 100;
-#X text 271 8 modulation index;
-#X text 271 23 in hundredths;
-#X text 125 65 carrier;
-#X text 124 83 frequency;
-#X text 201 64 frequency;
-#X text 202 47 modulation;
-#X text 33 119 carrier;
-#X text 33 134 phase -->;
-#X text 6 162 phase;
-#X text 5 177 modulation-->;
-#X text 12 204 output;
-#X text 11 221 waveform -->;
-#X text 527 6 PHASE MODULATION;
-#X text 417 703 updated for Pd version 0.34;
-#X text 13 377 Most implementations of "FM" actually use phase \, not
+#X obj 224 164 *~;
+#X floatatom 224 107 0 0 0 0 - - -;
+#X obj 312 144 line~;
+#X floatatom 128 121 0 0 0 0 - - -;
+#X obj 128 235 cos~;
+#X obj 128 191 +~;
+#X obj 224 132 osc~ 0;
+#X obj 312 118 pack 0 50;
+#X floatatom 312 65 0 0 0 0 - - -;
+#X obj 312 92 / 100;
+#X text 286 27 modulation index;
+#X text 286 42 in hundredths;
+#X text 125 78 carrier;
+#X text 124 96 frequency;
+#X text 209 83 frequency;
+#X text 210 66 modulation;
+#X text 33 132 carrier;
+#X text 33 147 phase -->;
+#X text 6 175 phase;
+#X text 5 190 modulation-->;
+#X text 12 217 output;
+#X text 11 234 waveform -->;
+#X text 129 1 PHASE MODULATION;
+#X text 16 378 Most implementations of "FM" actually use phase \, not
frequency \, modulation \, because it extends in a more natural way
to "multi-operator FM" with three or more oscillators.;
-#X text 15 437 To do phase modulation \, we split the "carrier oscillator"
+#X text 16 434 To do phase modulation \, we split the "carrier oscillator"
into its phase calculation (phasor~) and its waveform lookup (cos~).
These together would be equivalent to an osc~ object \, but the "+~"
between them adds the modulating oscillator's output to the phase.
;
-#X text 18 587 The units of the "modulation" index change--it is now
-dimensionless and relative to the modulation frequency \, and "good"
-values tend to be between 0 and 1 In this patch it's in hundredths.
-;
-#X text 19 658 We also have to use a line~ to smooth changes in the
+#X text 20 652 We also have to use a line~ to smooth changes in the
modulation index \, which wasn't necessary in the previous patch.;
-#X obj 128 135 phasor~;
+#X obj 128 148 phasor~;
#X obj 117 557 cos~;
#X obj 117 529 phasor~;
#X text 60 539 this:;
#X text 219 532 is the same;
#X text 220 551 as this:;
#X obj 335 544 osc~;
-#X graph graph2 0 -1 440 1 509 330 709 190;
+#N canvas 0 0 450 300 graph2 0;
#X array phase-out 441 float 1;
#A 0 0.43245 0.433463 0.434452 0.435418 0.43636 0.43728 0.438178 0.439056
0.439912 0.440749 0.441567 0.442366 0.443148 0.443912 0.444659 0.445391
@@ -219,28 +160,37 @@ modulation index \, which wasn't necessary in the previous patch.;
-0.720826 -0.703952 -0.686912 -0.669731 -0.652436 -0.635043 -0.617572
-0.600055 -0.582513 -0.564966 -0.547418 -0.529898 -0.512429 -0.495016
-0.477676 -0.460438 -0.443287 -0.426265 -0.409364;
-#X pop;
-#X obj 251 241 tabwrite~ phase-out;
-#X obj 251 268 tabwrite~ cos-out;
-#X msg 251 216 bang;
-#X text 298 215 <-- graph them;
-#X text 386 99 <-- change smoothly to avoid clicks;
+#X coords 0 1 440 -1 200 140 1;
+#X restore 509 190 graph;
+#X obj 213 246 tabwrite~ phase-out;
+#X obj 213 273 tabwrite~ cos-out;
+#X msg 213 221 bang;
+#X text 260 220 <-- graph them;
+#X obj 126 296 output~;
+#X obj 127 270 hip~;
+#X text 408 98 ramped to avoid;
+#X text 407 114 clicks.);
+#X text 407 82 (the index is;
+#X text 435 704 updated for Pd version 0.37;
+#X text 21 588 The "modulation" index \, which in true FM is in units
+of Hertz \, is dimensionless for phase moduation. "Good" values tend
+to be between 0 and 1... in this patch the index is in hundredths.
+;
#X connect 0 0 5 1;
-#X connect 1 0 9 0;
+#X connect 1 0 6 0;
#X connect 2 0 0 1;
-#X connect 3 0 31 0;
-#X connect 4 0 7 0;
-#X connect 4 0 40 0;
+#X connect 3 0 26 0;
+#X connect 4 0 35 0;
+#X connect 4 0 39 0;
#X connect 5 0 4 0;
-#X connect 5 0 39 0;
-#X connect 6 0 7 1;
-#X connect 7 0 6 0;
-#X connect 8 0 7 2;
-#X connect 9 0 0 0;
-#X connect 10 0 2 0;
-#X connect 11 0 12 0;
-#X connect 12 0 10 0;
-#X connect 31 0 5 0;
-#X connect 33 0 32 0;
-#X connect 41 0 39 0;
-#X connect 41 0 40 0;
+#X connect 5 0 34 0;
+#X connect 6 0 0 0;
+#X connect 7 0 2 0;
+#X connect 8 0 9 0;
+#X connect 9 0 7 0;
+#X connect 26 0 5 0;
+#X connect 28 0 27 0;
+#X connect 36 0 34 0;
+#X connect 36 0 35 0;
+#X connect 39 0 38 0;
+#X connect 39 0 38 1;
diff --git a/pd/doc/3.audio.examples/E09.FM.spectrum.pd b/pd/doc/3.audio.examples/E09.FM.spectrum.pd
new file mode 100644
index 00000000..21094b41
--- /dev/null
+++ b/pd/doc/3.audio.examples/E09.FM.spectrum.pd
@@ -0,0 +1,139 @@
+#N canvas 127 136 697 536 12;
+#X obj 94 188 *~;
+#X obj 136 188 line~;
+#X obj 18 179 cos~;
+#X obj 18 154 +~;
+#X obj 136 165 pack 0 50;
+#X floatatom 136 117 0 0 0 0 - - -;
+#X obj 136 141 / 100;
+#X obj 18 129 phasor~;
+#X obj 18 284 output~;
+#X obj 17 253 hip~;
+#X text 442 513 updated for Pd version 0.37;
+#N canvas 122 211 558 609 fft 1;
+#X obj 19 61 inlet~;
+#X obj 208 212 inlet;
+#X obj 29 92 rfft~;
+#X obj 29 125 *~;
+#X obj 60 125 *~;
+#X obj 29 155 sqrt~;
+#X obj 332 109 block~ 4096 1;
+#X obj 29 181 biquad~ 0 0 0 0 1;
+#X text 93 93 Fourier series;
+#X text 98 146 magnitude;
+#X text 96 131 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 193 164 delay two samples;
+#X text 191 182 for better graphing;
+#X obj 19 459 samplerate~;
+#X obj 19 436 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 19 506 5 0 0 0 - - -;
+#X obj 19 482 / 256;
+#X obj 19 412 loadbang;
+#X obj 75 528 s fundamental;
+#X text 17 359 At load time \, calculate a good choice of fundamental
+frequency for showing spectra: the 16th bin in a 4096-point spectrum
+\, so SR*16/4096 or SR/256.;
+#X obj 231 259 metro 500;
+#X obj 231 236 inlet;
+#X text 284 234 toggle to graph repeatedly;
+#X text 262 212 bang to graph once;
+#X obj 19 295 tabwrite~ E09-signal;
+#X obj 231 298 tabwrite~ E09-spectrum;
+#X obj 19 528 t b f;
+#X msg 19 551 \; cm 6;
+#X text 25 585 set carrier multiplier after fundamental;
+#X obj 29 205 /~ 4096;
+#X msg 209 322 \; pd dsp 1;
+#X connect 0 0 2 0;
+#X connect 0 0 26 0;
+#X connect 1 0 26 0;
+#X connect 1 0 27 0;
+#X connect 1 0 32 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 31 0;
+#X connect 15 0 18 0;
+#X connect 16 0 15 0;
+#X connect 17 0 28 0;
+#X connect 18 0 17 0;
+#X connect 19 0 16 0;
+#X connect 22 0 26 0;
+#X connect 22 0 27 0;
+#X connect 23 0 22 0;
+#X connect 23 0 32 0;
+#X connect 28 0 29 0;
+#X connect 28 1 20 0;
+#X connect 31 0 27 0;
+#X restore 62 243 pd fft;
+#X obj 122 222 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 122 243 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X text 143 242 <-- repeatedly;
+#X text 144 222 <-- graph once;
+#N canvas 0 0 450 300 graph1 0;
+#X array E09-signal 882 float 0;
+#X coords 0 1.02 882 -1.02 200 80 1;
+#X restore 433 28 graph;
+#N canvas 0 0 450 300 graph1 0;
+#X array E09-spectrum 259 float 0;
+#X coords 0 0.51 258 -0.008 259 130 1;
+#X restore 403 175 graph;
+#X text 442 114 ---- 0.02 seconds ----;
+#X text 433 306 2;
+#X text 464 306 4;
+#X text 403 306 0;
+#X text 441 321 -- partial number --;
+#X text 497 8 WAVEFORM;
+#X text 497 157 SPECTRUM;
+#X text 663 291 0;
+#X text 664 173 0.5;
+#X obj 93 117 osc~;
+#X obj 93 86 r fundamental;
+#X text 171 117 index (x100);
+#X text 496 306 6;
+#X text 529 306 8;
+#X text 557 306 10;
+#X text 589 306 12;
+#X text 621 306 14;
+#X text 43 3 SPECTRUM OF TWO-OPERATOR PHASE MODULATION;
+#X floatatom 18 58 3 0 15 0 - - -;
+#X obj 18 105 *;
+#X obj 18 33 r cm;
+#X text 52 57 carrier harmonic #;
+#X text 71 367 This patch measures the spectrum of two-operator phase
+modulation. The carrier frequency is initially six times the modulation
+frequency \, but you can change it with the "carrier harmonic #" control.
+Changing the index changes the relative strengths of the harmonics.
+Past a certain index (which depends on the carrier frequency) the lower
+sidebands begin to reflect about the left edge of the spectrum \, causing
+complicated interference effects.;
+#X connect 0 0 3 1;
+#X connect 1 0 0 1;
+#X connect 2 0 9 0;
+#X connect 2 0 11 0;
+#X connect 3 0 2 0;
+#X connect 4 0 1 0;
+#X connect 5 0 6 0;
+#X connect 6 0 4 0;
+#X connect 7 0 3 0;
+#X connect 9 0 8 0;
+#X connect 9 0 8 1;
+#X connect 12 0 11 1;
+#X connect 13 0 11 2;
+#X connect 27 0 0 0;
+#X connect 28 0 27 0;
+#X connect 28 0 37 1;
+#X connect 36 0 37 0;
+#X connect 37 0 7 0;
+#X connect 38 0 36 0;
diff --git a/pd/doc/3.audio.examples/E09.bandlimited.pd b/pd/doc/3.audio.examples/E09.bandlimited.pd
deleted file mode 100644
index f49bcb68..00000000
--- a/pd/doc/3.audio.examples/E09.bandlimited.pd
+++ /dev/null
@@ -1,166 +0,0 @@
-#N canvas 21 90 540 752 12;
-#X floatatom 183 91;
-#X obj 183 115 mtof;
-#X floatatom 340 183;
-#X obj 164 431 -~;
-#N canvas 391 51 561 806 tables 1;
-#X graph graph1 0 -1 1002 1 99 322 499 22;
-#X array array1 1002 float;
-#X pop;
-#X graph graph1 0 -1 882 1 96 684 496 384;
-#X array array2 882 float;
-#X pop;
-#X text 138 326 ---------------- 1002 samples ---------------;
-#X text 150 693 ---------------- 0.02 sec ---------------;
-#X restore 33 201 pd tables;
-#N canvas 104 390 728 408 make-table 0;
-#X obj 469 146 cos~;
-#X obj 303 146 cos~;
-#X obj 255 141 cos~;
-#X msg 199 210 bang;
-#X obj 255 229 tabwrite~ array1;
-#X text 366 79 period is 2000 samples \, twice the table length;
-#X msg 94 94 \; pd dsp 1;
-#X text 118 286 this network puts a half cycle of a band-limited square wave into the table "array1.";
-#X text 114 335 logically the half-cycle is in samples 1 through 1000 \; samples 0 and 1001 are provided so that the 4-point interpolation will work everywhere.;
-#X text 401 57 back the phase up one sample;
-#X msg 336 56 -0.0005;
-#X obj 171 16 loadbang;
-#X obj 303 120 *~ 3;
-#X obj 468 122 *~ 5;
-#X obj 303 171 *~ 0.33333;
-#X obj 468 172 *~ -0.2;
-#X obj 255 169 *~ -1;
-#X msg 171 38 bang;
-#X obj 254 80 phasor~ 22.05;
-#X obj 255 202 *~ 0.57692;
-#X connect 0 0 15 0;
-#X connect 1 0 14 0;
-#X connect 2 0 16 0;
-#X connect 3 0 4 0;
-#X connect 10 0 18 1;
-#X connect 11 0 17 0;
-#X connect 12 0 1 0;
-#X connect 13 0 0 0;
-#X connect 14 0 19 0;
-#X connect 15 0 19 0;
-#X connect 16 0 19 0;
-#X connect 17 0 10 0;
-#X connect 17 0 6 0;
-#X connect 17 0 3 0;
-#X connect 18 0 2 0;
-#X connect 18 0 12 0;
-#X connect 18 0 13 0;
-#X connect 19 0 4 0;
-#X restore 34 224 pd make-table;
-#X obj 183 163 sig~;
-#X obj 341 283 /~;
-#X obj 357 256 clip~ 1 999999;
-#X obj 183 218 phasor~;
-#X obj 196 301 *~;
-#X obj 196 325 clip~ -0.5 0.5;
-#X floatatom 183 139;
-#X obj 196 397 tabread4~ array1;
-#X floatatom 340 135;
-#X obj 340 206 * 0.33333;
-#X obj 340 159 mtof;
-#X text 374 110 band limit (MIDI units);
-#X text 220 78 pitch;
-#X obj 340 87 loadbang;
-#X msg 340 111 130;
-#X obj 340 230 sig~;
-#X text 246 139 frequency;
-#X obj 196 349 *~ 1000;
-#X obj 196 373 +~ 501;
-#X obj 183 242 -~ 0.5;
-#X floatatom 206 441;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 177 469 pd output;
-#X msg 235 441 MUTE;
-#X text 276 440 <-- output amplitude;
-#X text 27 503 Patch to make an approximately band-limited sawtooth. This is useful if you intend to use sawtooth generators above about 200 Hz. \, perhaps to use any of the techniques shown in the previous four patches.;
-#X text 28 562 We generate a perfect square wave at Nyquist/6 \; this will have partials 1 \, 3 \, and 5 \, but the Nyquist frequency at partial 6 will cut off the rest of the partials. This is stored in array1 using the "make-table" subpatch.;
-#X text 64 34 BAND-LIMITED SAWTOOTH GENERATOR;
-#X obj 43 459 tabwrite~ array2;
-#X msg 44 435 bang;
-#X text 28 632 Now any time we wish to make a discontinuity in the output signal \, we make it look exactly like the bandlimited square wave looks. We do this by reading through the table we recorded \, carefully adding a "digital" \, non-band-limited \, sawtooth to "array1" so that the discontinuities in the two cancel out and what you have left is the transition in the table.;
-#X text 338 737 updated for Pd version 0.26;
-#X text 41 409 graph output;
-#X connect 0 0 1 0;
-#X connect 1 0 12 0;
-#X connect 2 0 15 0;
-#X connect 3 0 27 0;
-#X connect 3 0 33 0;
-#X connect 6 0 8 0;
-#X connect 6 0 9 0;
-#X connect 7 0 10 1;
-#X connect 8 0 7 1;
-#X connect 9 0 25 0;
-#X connect 10 0 11 0;
-#X connect 11 0 23 0;
-#X connect 12 0 6 0;
-#X connect 13 0 3 0;
-#X connect 14 0 16 0;
-#X connect 15 0 21 0;
-#X connect 16 0 2 0;
-#X connect 19 0 20 0;
-#X connect 20 0 14 0;
-#X connect 21 0 7 0;
-#X connect 23 0 24 0;
-#X connect 24 0 13 0;
-#X connect 25 0 10 0;
-#X connect 25 0 3 1;
-#X connect 26 0 27 1;
-#X connect 27 0 26 0;
-#X connect 28 0 27 2;
-#X connect 34 0 33 0;
diff --git a/pd/doc/3.audio.examples/E10.complex.FM.pd b/pd/doc/3.audio.examples/E10.complex.FM.pd
new file mode 100644
index 00000000..094d68ed
--- /dev/null
+++ b/pd/doc/3.audio.examples/E10.complex.FM.pd
@@ -0,0 +1,156 @@
+#N canvas 165 123 695 505 12;
+#X obj 94 247 *~;
+#X obj 109 223 line~;
+#X obj 18 179 cos~;
+#X obj 18 154 +~;
+#X obj 109 200 pack 0 50;
+#X floatatom 109 152 0 0 300 0 - - -;
+#X obj 109 176 / 100;
+#X obj 18 129 phasor~;
+#X obj 20 340 output~;
+#X obj 19 309 hip~;
+#X text 437 472 updated for Pd version 0.37;
+#N canvas 62 299 558 609 fft 0;
+#X obj 19 61 inlet~;
+#X obj 208 212 inlet;
+#X obj 29 92 rfft~;
+#X obj 29 125 *~;
+#X obj 60 125 *~;
+#X obj 29 155 sqrt~;
+#X obj 332 109 block~ 4096 1;
+#X obj 29 181 biquad~ 0 0 0 0 1;
+#X text 93 93 Fourier series;
+#X text 98 146 magnitude;
+#X text 96 131 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 193 164 delay two samples;
+#X text 191 182 for better graphing;
+#X obj 16 425 samplerate~;
+#X obj 16 402 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 16 472 5 0 0 0 - - -;
+#X obj 16 448 / 256;
+#X obj 16 378 loadbang;
+#X obj 72 494 s fundamental;
+#X text 14 319 At load time \, calculate a good choice of fundamental
+frequency for showing spectra: the 16th bin in a 4096-point spectrum
+\, so SR*16/4096 or SR/256.;
+#X obj 220 257 metro 500;
+#X obj 220 234 inlet;
+#X text 273 232 toggle to graph repeatedly;
+#X text 262 212 bang to graph once;
+#X obj 16 494 t b f;
+#X obj 19 295 tabwrite~ E10-signal;
+#X obj 208 295 tabwrite~ E10-spectrum;
+#X text 72 536 set carrier multiplier and modulation multipliers after
+fundamental;
+#X msg 16 516 \; cm 8 \; m1 2 \; m2 3;
+#X connect 0 0 2 0;
+#X connect 0 0 27 0;
+#X connect 1 0 27 0;
+#X connect 1 0 28 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 28 0;
+#X connect 15 0 18 0;
+#X connect 16 0 15 0;
+#X connect 17 0 26 0;
+#X connect 18 0 17 0;
+#X connect 19 0 16 0;
+#X connect 22 0 27 0;
+#X connect 22 0 28 0;
+#X connect 23 0 22 0;
+#X connect 26 0 30 0;
+#X connect 26 1 20 0;
+#X restore 65 311 pd fft;
+#X obj 125 290 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 125 311 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
+1;
+#X text 146 310 <-- repeatedly;
+#X text 147 290 <-- graph once;
+#N canvas 0 0 450 300 graph1 0;
+#X array E10-spectrum 259 float 0;
+#X coords 0 2100 258 -20 259 130 1;
+#X restore 396 122 graph;
+#X text 426 253 2;
+#X text 457 253 4;
+#X text 396 253 0;
+#X text 434 268 -- partial number --;
+#X text 490 104 SPECTRUM;
+#X text 656 238 0;
+#X text 657 120 0.5;
+#X obj 93 128 osc~;
+#X obj 267 79 r fundamental;
+#X text 489 253 6;
+#X text 522 253 8;
+#X text 550 253 10;
+#X text 582 253 12;
+#X text 614 253 14;
+#X floatatom 18 58 3 0 15 0 - - -;
+#X obj 18 105 *;
+#X obj 18 33 r cm;
+#X text 43 3 SPECTRUM OF COMPLEX PHASE MODULATION;
+#X text 23 73 carrier;
+#X obj 93 107 *;
+#X floatatom 93 60 3 0 15 0 - - -;
+#X text 99 74 mod 1;
+#X obj 93 35 r m1;
+#X text 138 154 index1;
+#X obj 197 249 *~;
+#X obj 212 225 line~;
+#X obj 212 202 pack 0 50;
+#X floatatom 212 154 0 0 300 0 - - -;
+#X obj 212 178 / 100;
+#X obj 196 130 osc~;
+#X obj 196 109 *;
+#X floatatom 196 62 3 0 15 0 - - -;
+#X text 202 76 mod 2;
+#X text 246 154 index2;
+#X obj 196 37 r m2;
+#X text 126 349 Now we introduce a second modulator oscillator. The
+carrier is on the 8th harmonic and the two modulators are at 2 and
+3 times the fundamental. When either index of modulation is zero \,
+changing the other index gives the familiar 2-operator FM result. But
+if index2 is nonzero (try around 10 \, for example) then sliding index1
+upward from 0 introduces sidebands around each of the sidebands.;
+#X connect 0 0 3 1;
+#X connect 1 0 0 1;
+#X connect 2 0 9 0;
+#X connect 2 0 11 0;
+#X connect 3 0 2 0;
+#X connect 4 0 1 0;
+#X connect 5 0 6 0;
+#X connect 6 0 4 0;
+#X connect 7 0 3 0;
+#X connect 9 0 8 0;
+#X connect 9 0 8 1;
+#X connect 12 0 11 1;
+#X connect 13 0 11 2;
+#X connect 24 0 0 0;
+#X connect 25 0 32 1;
+#X connect 25 0 36 1;
+#X connect 25 0 47 1;
+#X connect 31 0 32 0;
+#X connect 32 0 7 0;
+#X connect 33 0 31 0;
+#X connect 36 0 24 0;
+#X connect 37 0 36 0;
+#X connect 39 0 37 0;
+#X connect 41 0 3 1;
+#X connect 42 0 41 1;
+#X connect 43 0 42 0;
+#X connect 44 0 45 0;
+#X connect 45 0 43 0;
+#X connect 46 0 41 0;
+#X connect 47 0 46 0;
+#X connect 48 0 47 0;
+#X connect 51 0 48 0;
diff --git a/pd/doc/3.audio.examples/F01.PART7.filters.pd b/pd/doc/3.audio.examples/F01.PART7.filters.pd
deleted file mode 100644
index 4a64a0b5..00000000
--- a/pd/doc/3.audio.examples/F01.PART7.filters.pd
+++ /dev/null
@@ -1,72 +0,0 @@
-#N canvas 124 28 964 549 12;
-#X floatatom 20 391;
-#X floatatom 297 394;
-#X floatatom 210 394;
-#X graph graph1 0 -1 400 1 544 335 944 35;
-#X array orig 400 float;
-#X array lop 400 float;
-#X array hip 400 float;
-#X array bp 400 float;
-#X pop;
-#X obj 334 457 r metro;
-#X obj 180 322 hip~ 100;
-#X obj 105 320 lop~ 100;
-#X obj 273 322 bp~ 100 10;
-#X floatatom 255 245;
-#X floatatom 338 295;
-#X floatatom 118 393;
-#X text 9 11 Filters;
-#X msg 87 130 \; pd dsp 1 \; metro bang;
-#X msg 191 135 \; pd dsp 0;
-#X text 15 417 Original;
-#X text 122 417 Low pass;
-#X text 210 417 High pass;
-#X text 298 416 Band pass;
-#X obj 14 517 tabwrite~ orig;
-#X obj 309 520 tabwrite~ bp;
-#X obj 213 520 tabwrite~ hip;
-#X obj 116 519 tabwrite~ lop;
-#X text 97 110 start;
-#X text 193 111 stop;
-#X floatatom 14 235;
-#X obj 14 261 osc~ 440;
-#X text 51 236 <-- change frequency;
-#X text 294 247 <-- center/rolloff frequency;
-#X text 374 297 <-- Q;
-#X text 548 341 This graph holds 4 arrays for the input and three filter outputs.;
-#X text 375 389 RMS amplitudes of the original signal and the three filter outputs;
-#X text 746 536 updated for Pd version 0.26;
-#X obj 334 482 metro 1000;
-#X text 29 33 Pd provides low \, high \, and band pass filters \, as shown here. By changing the test frequency \, the filter frequency \, and the "Q" value \, you can see how these filters affect the amplitude and phase of incoming signals;
-#X obj 20 366 env~ 4096;
-#X obj 118 368 env~ 4096;
-#X obj 210 369 env~ 4096;
-#X obj 297 369 env~ 4096;
-#X obj 91 213 print~;
-#X text 456 434 Notice how the phase of the graphed sinusoids slips back and forth... this is because graphing always starts on the nearest 64-sample boundary to the time the metronome fires. If you run at 48K the slippage disappears \, because then the metronome fires every 48K samples \, which is a multiple of 64;
-#X connect 4 0 32 0;
-#X connect 5 0 20 0;
-#X connect 5 0 36 0;
-#X connect 6 0 21 0;
-#X connect 6 0 35 0;
-#X connect 7 0 19 0;
-#X connect 7 0 37 0;
-#X connect 8 0 6 1;
-#X connect 8 0 5 1;
-#X connect 8 0 7 1;
-#X connect 9 0 7 2;
-#X connect 24 0 25 0;
-#X connect 25 0 18 0;
-#X connect 25 0 6 0;
-#X connect 25 0 5 0;
-#X connect 25 0 7 0;
-#X connect 25 0 34 0;
-#X connect 25 0 38 0;
-#X connect 32 0 18 0;
-#X connect 32 0 21 0;
-#X connect 32 0 20 0;
-#X connect 32 0 19 0;
-#X connect 34 0 0 0;
-#X connect 35 0 10 0;
-#X connect 36 0 2 0;
-#X connect 37 0 1 0;
diff --git a/pd/doc/3.audio.examples/F01.pulse.pd b/pd/doc/3.audio.examples/F01.pulse.pd
new file mode 100644
index 00000000..5ef7e862
--- /dev/null
+++ b/pd/doc/3.audio.examples/F01.pulse.pd
@@ -0,0 +1,82 @@
+#N canvas 15 126 835 625 12;
+#X obj 272 163 line~;
+#X floatatom 53 64 0 0 0 0 - - -;
+#X obj 30 315 cos~;
+#N canvas 0 0 450 300 graph1 0;
+#X array pulse-output 882 float 0;
+#X coords 0 1.02 882 -1.02 200 130 1;
+#X restore 583 409 graph;
+#X obj 53 91 phasor~ 0;
+#X obj 272 139 pack 0 50;
+#X floatatom 272 90 0 0 100 0 - - -;
+#X text 50 43 frequency;
+#X obj 53 115 -~ 0.5;
+#X obj 53 207 *~;
+#X obj 272 114 / 10;
+#X obj 30 265 clip~ -0.5 0.5;
+#X obj 30 418 hip~ 5;
+#N canvas 0 0 450 300 graph1 0;
+#X array phase-output 882 float 0;
+#X coords 0 1.02 882 -1.02 200 60 1;
+#X restore 583 150 graph;
+#N canvas 0 0 450 300 graph1 0;
+#X array clip-output 882 float 0;
+#X coords 0 1.02 882 -1.02 200 130 1;
+#X restore 583 272 graph;
+#X text 113 114 phase -1/2 to 1/2;
+#X text 139 91 phase 0 to 1;
+#X text 119 5 PULSE GENERATOR;
+#X obj 19 234 tabwrite~ phase-output;
+#X obj 19 393 tabwrite~ pulse-output;
+#X text 103 419 high pass filter to cut DC;
+#X text 319 115 fix range;
+#X text 326 164 smooth it;
+#X text 314 187 add 1;
+#X text 41 148 <-- click to graph;
+#X text 83 209 increase amplitude;
+#X text 164 264 clip back to range -1/2 to 1/2;
+#X text 90 316 cosine wave lookup (-1/2 and 1/2 give -1);
+#X obj 272 188 +~ 1;
+#X obj 19 292 tabwrite~ clip-output;
+#X text 585 539 ---- 0.02 seconds ----;
+#X obj 19 148 bng 20 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 30 446 output~;
+#X obj 30 338 +~ 1;
+#X obj 30 361 *~ 0.5;
+#X text 574 589 updated for Pd version 0.37;
+#X text 88 337 add one (range now from 0 to 2);
+#X text 96 360 ...and now from 0 to 1;
+#X text 20 531 This patch computes a pulse train \, with an "index"
+control that essentually squeezes the pulses. If "bandwidth" is zero
+you get a pure cosine wave \, and for larger values of the bandwidth
+\, the cosine wave is squeezed to fill smaller portions of the waveform.
+;
+#X text 269 71 index;
+#X text 790 142 0.5;
+#X text 787 198 -0.5;
+#X text 785 264 1;
+#X text 787 390 -1;
+#X text 785 405 1;
+#X text 786 528 -1;
+#X connect 0 0 28 0;
+#X connect 1 0 4 0;
+#X connect 2 0 33 0;
+#X connect 4 0 8 0;
+#X connect 5 0 0 0;
+#X connect 6 0 10 0;
+#X connect 8 0 9 0;
+#X connect 9 0 11 0;
+#X connect 9 0 18 0;
+#X connect 10 0 5 0;
+#X connect 11 0 2 0;
+#X connect 11 0 29 0;
+#X connect 12 0 32 0;
+#X connect 12 0 32 1;
+#X connect 28 0 9 1;
+#X connect 31 0 18 0;
+#X connect 31 0 29 0;
+#X connect 31 0 19 0;
+#X connect 33 0 34 0;
+#X connect 34 0 19 0;
+#X connect 34 0 12 0;
diff --git a/pd/doc/3.audio.examples/F02.bandpass.pd b/pd/doc/3.audio.examples/F02.bandpass.pd
deleted file mode 100644
index 0ce9cc47..00000000
--- a/pd/doc/3.audio.examples/F02.bandpass.pd
+++ /dev/null
@@ -1,146 +0,0 @@
-#N canvas 58 17 943 765 12;
-#X floatatom 91 731 0 0 0;
-#X graph graph1 0 -1 155947 1 624 401 824 251;
-#X array array1 155948 float 0;
-#X pop;
-#X floatatom 247 705 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 406 192 t b;
-#X obj 406 132 f;
-#X obj 406 72 inlet;
-#X text 413 35 mute;
-#X obj 406 222 f;
-#X msg 510 214 0;
-#X msg 406 102 bang;
-#X obj 406 162 moses 1;
-#X obj 510 184 t b f;
-#X obj 476 140 moses 1;
-#X obj 100 178 dbtorms;
-#X obj 476 110 r master-lvl;
-#X obj 100 50 r master-lvl;
-#X obj 406 252 s master-lvl;
-#X obj 26 217 inlet~;
-#X obj 239 49 inlet;
-#X text 239 22 level;
-#X obj 239 120 s master-lvl;
-#X msg 115 78 set \$1;
-#X obj 115 107 outlet;
-#X msg 257 77 \; pd dsp 1;
-#X obj 100 233 line~;
-#X obj 26 254 *~;
-#X obj 26 289 dac~;
-#X obj 100 205 pack 0 50;
-#X text 24 190 audio;
-#X text 112 132 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 210 740 pd output;
-#X msg 280 707 MUTE;
-#X text 320 706 <-- output amplitude;
-#X obj 206 654 hip~ 5;
-#X obj 31 545 tabread4~ array1;
-#X obj 31 340 r totsamps;
-#X obj 31 430 /;
-#X obj 206 625 bp~;
-#X obj 206 596 bp~;
-#X obj 216 463 mtof;
-#X floatatom 216 491 0 0 0;
-#X floatatom 319 570 0 0 0;
-#X obj 319 541 r q;
-#X floatatom 216 434 0 0 0;
-#X msg 227 550 \; p set \$1;
-#X obj 216 406 r p;
-#X obj 90 647 env~ 4096;
-#X obj 31 487 *~ 0;
-#X obj 31 458 phasor~ 0;
-#X obj 31 516 +~ 1;
-#X obj 227 521 ftom;
-#X msg 826 49 \; pd dsp 0;
-#X obj 90 674 + 0.5;
-#X obj 91 702 int;
-#X msg 31 400 44100;
-#X obj 31 368 t b f;
-#X text 648 14 START;
-#X text 845 19 STOP;
-#X text 88 11 BANDPASS FILTERS;
-#X text 12 41 In this example we use two cascaded bandpass filters
-to troll for partials in Jonathan Harvey's famous bell sample.;
-#X obj 78 487 r totsamps;
-#X text 14 82 Note that filters can give unexpected level changes.
-The bp~ object is designed to have roughly unit gain at teh pass band
-\, so the higher you set "Q" the more amplitude is lost. YOu can correct
-for this by pushing the output amplitude \, but be sure to remember
-to reset the output amplitude before you reduce Q again. I set the
-Q to 100 and the output amplitude to 110 or 120 (with the room gain
-way down.) Then holding the shift key \, slowly drag the center pitch
-upward listening for modes.;
-#X text 16 233 You can hear partials around 48 \, 51.3 \, 55 (faint!)
-\, 57 (fainter!) \, 60 \, two beating partials around 65 \, 67 \, 69
-\, 70.9 \, 71.75 \, 72.6 \, 74 \, 74.65 \, 75.6 \, 77 \, 81.2 \, 84.6
-\, 86.5 \, and probably many more. There's also one down at 36 \, but
-it's easier to see it on the meter than hear it.;
-#X text 271 436 <-- center pitch;
-#X text 281 450 (shift-drag to fine tune);
-#X text 292 492 <-- center frequency;
-#X text 359 570 <-- Q (filter selectivity);
-#X obj 683 453 r readfile;
-#X obj 683 530 soundfiler;
-#X msg 683 503 read -resize \$1 array1;
-#X obj 683 478 symbol;
-#X msg 553 48 \; readfile ../sound/bell.aiff \; totsamps 143718 \;
-p 69 \; q 0 \; pd dsp 1;
-#X text 681 739 updated for Pd version 0.33;
-#X connect 2 0 3 1;
-#X connect 3 0 2 0;
-#X connect 4 0 3 2;
-#X connect 6 0 3 0;
-#X connect 7 0 11 0;
-#X connect 8 0 28 0;
-#X connect 9 0 21 0;
-#X connect 10 0 6 0;
-#X connect 10 0 19 0;
-#X connect 11 0 10 0;
-#X connect 12 0 13 0;
-#X connect 13 0 11 1;
-#X connect 13 0 10 1;
-#X connect 13 0 23 0;
-#X connect 14 0 11 2;
-#X connect 14 0 10 2;
-#X connect 15 0 14 0;
-#X connect 16 0 12 0;
-#X connect 18 0 16 0;
-#X connect 19 0 25 0;
-#X connect 20 0 22 0;
-#X connect 21 0 20 0;
-#X connect 22 0 7 0;
-#X connect 23 0 17 0;
-#X connect 25 0 26 0;
-#X connect 26 0 0 0;
-#X connect 27 0 9 0;
-#X connect 28 0 27 0;
-#X connect 28 1 9 1;
-#X connect 33 0 20 1;
-#X connect 40 0 43 0;
-#X connect 42 0 41 0;
-#X connect 43 0 42 0;
diff --git a/pd/doc/3.audio.examples/19.just.say.pd b/pd/doc/3.audio.examples/F02.just.say.pd
index b82b4953..b82b4953 100644
--- a/pd/doc/3.audio.examples/19.just.say.pd
+++ b/pd/doc/3.audio.examples/F02.just.say.pd
diff --git a/pd/doc/3.audio.examples/F03.filter.sweep.pd b/pd/doc/3.audio.examples/F03.filter.sweep.pd
deleted file mode 100644
index 0d478275..00000000
--- a/pd/doc/3.audio.examples/F03.filter.sweep.pd
+++ /dev/null
@@ -1,173 +0,0 @@
-#N canvas 194 58 693 586 12;
-#X text 437 559 updated for Pd version 0.26;
-#X floatatom 70 539 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 41 567 pd output;
-#X msg 99 539 MUTE;
-#X text 138 538 <-- output amplitude;
-#X obj 41 212 line~;
-#X floatatom 41 164 0 0 0;
-#X obj 41 188 pack 0 100;
-#X obj 528 110 loadbang;
-#X text 35 6 SWEEPING FILTERS;
-#N canvas 0 0 600 392 conversion-tables 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 302 48 graph;
-#X text 504 141 0;
-#X text 506 41 10;
-#X text 321 151 ------ 123 samples ------;
-#N canvas 0 0 450 300 graph2 0;
-#X array mtof 130 float 1;
-#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
-12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
-21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
-36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
-61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
-103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
-174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
-293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
-493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
-830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
-1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
-2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
-4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
-7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
-11839.8 12543.9 13289.8 14080;
-#X coords 0 12000 130 0 200 100 1;
-#X restore 309 225 graph;
-#X text 319 333 ------ 130 samples ------;
-#X text 518 318 0;
-#X text 520 218 12000;
-#X restore 461 256 pd conversion-tables;
-#X obj 41 260 phasor~;
-#X obj 41 236 tabread4~ mtof;
-#X obj 174 384 +~;
-#X obj 190 361 line~;
-#X obj 190 337 pack 0 100;
-#X floatatom 190 313 0 0 0;
-#X floatatom 174 164 0 0 0;
-#X floatatom 197 238 0 0 0;
-#X obj 41 140 r pitch;
-#X obj 197 214 r depth;
-#X obj 174 140 r speed;
-#X obj 190 289 r offset;
-#X obj 121 465 r q;
-#X floatatom 121 489 0 0 0;
-#X obj 41 484 vcf~;
-#X obj 41 508 hip~ 5;
-#X obj 174 263 *~ 0;
-#X obj 174 188 phasor~ 0;
-#X obj 174 408 tabread4~ mtof;
-#X msg 528 134 \; pitch 48 \; speed -2 \; depth 27 \; offset 56 \;
-q 2;
-#X text 160 490 <-- Q (selectivity);
-#X text 51 277 sawtooth;
-#X text 50 291 oscillator;
-#X text 228 167 <-- sweep speed;
-#X text 265 189 LFO for sweep;
-#X text 251 241 <-- sweep depth;
-#X text 242 316 <-- base center frequency;
-#X text 218 383 add base to sweep;
-#X text 307 408 convert to Hz.;
-#X text 13 28 If you want actively changing center frequencies \, use
-"vcf~" instead of "bp~". The vcf~ module takes an audio signal to set
-center frequency. (Q is still set by messages though.) Vcf is somewhat
-more expensive than bp~.;
-#X text 78 165 <-- pitch;
-#X text 13 95 Note the effect of negative and positive sweep speed.
-;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 5 0 12 0;
-#X connect 6 0 7 0;
-#X connect 7 0 5 0;
-#X connect 8 0 30 0;
-#X connect 11 0 25 0;
-#X connect 12 0 11 0;
-#X connect 13 0 29 0;
-#X connect 14 0 13 1;
-#X connect 15 0 14 0;
-#X connect 16 0 15 0;
-#X connect 17 0 28 0;
-#X connect 18 0 27 1;
-#X connect 19 0 6 0;
-#X connect 20 0 18 0;
-#X connect 21 0 17 0;
-#X connect 22 0 16 0;
-#X connect 23 0 24 0;
-#X connect 24 0 25 2;
-#X connect 25 0 26 0;
-#X connect 26 0 2 0;
-#X connect 27 0 13 0;
-#X connect 28 0 27 0;
-#X connect 29 0 25 1;
diff --git a/pd/doc/3.audio.examples/F03.pulse.spectrum.pd b/pd/doc/3.audio.examples/F03.pulse.spectrum.pd
new file mode 100644
index 00000000..1d04bf85
--- /dev/null
+++ b/pd/doc/3.audio.examples/F03.pulse.spectrum.pd
@@ -0,0 +1,126 @@
+#N canvas 227 143 860 515 12;
+#X obj 189 166 line~;
+#X obj 42 187 cos~;
+#X obj 189 142 pack 0 50;
+#X floatatom 189 41 0 0 100 0 - - -;
+#X obj 43 114 -~ 0.5;
+#X obj 43 140 *~;
+#X obj 189 67 / 10;
+#X obj 189 91 moses 0;
+#X msg 189 115 0;
+#X obj 42 163 clip~ -0.5 0.5;
+#X text 184 23 bandwidth;
+#X obj 189 191 +~ 1;
+#X obj 42 211 +~ 1;
+#X text 63 1 PULSE SPECTRUM MEASUREMENT;
+#X text 14 357 Here is a measured amplitude spectrum for the pulse
+train. Nutice that \, other than a smallish spillover \, the energy
+sits in one "lobe" whose changing width justifies our calling the squeeze
+factor the "bandwidth.";
+#X text 16 428 The spectrum is in units of amplitude. THe sidelobes
+\, although they look small \, are actually only about 34 dB down.
+You can design more complicated pulse trains \, little Blackman window
+functions \, which control the sidelobes much better.;
+#X obj 42 293 output~;
+#X obj 41 262 hip~;
+#N canvas 122 211 558 609 fft 0;
+#X obj 19 61 inlet~;
+#X obj 208 212 inlet;
+#X obj 29 92 rfft~;
+#X obj 29 125 *~;
+#X obj 60 125 *~;
+#X obj 29 155 sqrt~;
+#X obj 332 109 block~ 4096 1;
+#X obj 29 181 biquad~ 0 0 0 0 1;
+#X text 93 93 Fourier series;
+#X text 98 146 magnitude;
+#X text 96 131 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 193 164 delay two samples;
+#X text 191 182 for better graphing;
+#X obj 264 434 samplerate~;
+#X obj 264 457 / 256;
+#X obj 238 261 metro 500;
+#X obj 238 238 inlet;
+#X text 291 236 toggle to graph repeatedly;
+#X text 262 212 bang to graph once;
+#X obj 29 205 /~ 4096;
+#X obj 19 295 tabwrite~ F03-signal;
+#X obj 235 299 tabwrite~ F03-spectrum;
+#X obj 264 409 bang~;
+#X msg 209 322 \; pd dsp 1;
+#X obj 264 482 s freq;
+#X connect 0 0 2 0;
+#X connect 0 0 22 0;
+#X connect 1 0 22 0;
+#X connect 1 0 23 0;
+#X connect 1 0 25 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 21 0;
+#X connect 15 0 16 0;
+#X connect 16 0 26 0;
+#X connect 17 0 22 0;
+#X connect 17 0 23 0;
+#X connect 18 0 17 0;
+#X connect 18 0 25 0;
+#X connect 21 0 23 0;
+#X connect 24 0 15 0;
+#X restore 95 264 pd fft;
+#X obj 155 243 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 155 264 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X text 176 263 <-- repeatedly;
+#X text 177 243 <-- graph once;
+#X obj 42 235 *~ 0.5;
+#X obj 43 90 phasor~;
+#N canvas 0 0 450 300 graph1 0;
+#X array F03-signal 882 float 0;
+#X coords 0 1.02 882 -1.02 200 130 1;
+#X restore 640 321 graph;
+#N canvas 0 0 450 300 graph1 0;
+#X array F03-spectrum 259 float 0;
+#X coords 0 0.51 258 -0.008 256 130 1;
+#X restore 579 99 graph;
+#X text 640 454 ---- 0.02 seconds ----;
+#X text 608 230 2;
+#X text 639 230 4;
+#X text 578 230 0;
+#X text 616 245 -- partial number --;
+#X text 671 230 6;
+#X text 704 230 8;
+#X text 732 230 10;
+#X text 764 230 12;
+#X text 796 230 14;
+#X text 605 488 updated for Pd version 0.37;
+#X obj 43 63 r freq;
+#X connect 0 0 11 0;
+#X connect 1 0 12 0;
+#X connect 2 0 0 0;
+#X connect 3 0 6 0;
+#X connect 4 0 5 0;
+#X connect 5 0 9 0;
+#X connect 6 0 7 0;
+#X connect 7 0 8 0;
+#X connect 7 1 2 0;
+#X connect 8 0 2 0;
+#X connect 9 0 1 0;
+#X connect 11 0 5 1;
+#X connect 12 0 23 0;
+#X connect 17 0 16 0;
+#X connect 17 0 16 1;
+#X connect 19 0 18 1;
+#X connect 20 0 18 2;
+#X connect 23 0 17 0;
+#X connect 23 0 18 0;
+#X connect 24 0 4 0;
+#X connect 38 0 24 0;
diff --git a/pd/doc/3.audio.examples/F04.filter.floyd.pd b/pd/doc/3.audio.examples/F04.filter.floyd.pd
deleted file mode 100644
index 02027117..00000000
--- a/pd/doc/3.audio.examples/F04.filter.floyd.pd
+++ /dev/null
@@ -1,193 +0,0 @@
-#N canvas 133 190 795 593 12;
-#X floatatom 44 540 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 15 568 pd output;
-#X msg 90 540 MUTE;
-#X text 151 539 <-- output amplitude;
-#X obj 487 217 loadbang;
-#N canvas 0 0 600 392 conversion-tables 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 302 48 graph;
-#X text 504 141 0;
-#X text 506 41 10;
-#X text 321 151 ------ 123 samples ------;
-#N canvas 0 0 450 300 graph2 0;
-#X array mtof 130 float 1;
-#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
-12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
-21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
-36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
-61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
-103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
-174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
-293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
-493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
-830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
-1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
-2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
-4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
-7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
-11839.8 12543.9 13289.8 14080;
-#X coords 0 12000 130 0 200 100 1;
-#X restore 309 225 graph;
-#X text 319 333 ------ 130 samples ------;
-#X text 518 318 0;
-#X text 520 218 12000;
-#X restore 490 428 pd conversion-tables;
-#X obj 250 308 line~;
-#X obj 250 284 pack 0 100;
-#X floatatom 251 213 0 0 0;
-#X obj 171 413 r q;
-#X floatatom 171 437 0 0 0;
-#X obj 15 492 vcf~;
-#X obj 15 516 hip~ 5;
-#X obj 250 333 tabread4~ mtof;
-#X text 214 436 <-- Q (selectivity);
-#X text 277 354 convert to Hz.;
-#X text 35 6 ANOTHER SWEEPING FILTER EXAMPLE;
-#X obj 15 286 clip~ 0 0.5;
-#X obj 15 310 *~ 2;
-#X obj 15 334 -~;
-#X text 121 270 trick to;
-#X text 121 291 make symmetric;
-#X text 121 312 triangle wave;
-#X obj 31 161 f;
-#X obj 64 159 + 1;
-#X obj 31 211 tabread array1;
-#X obj 31 235 mtof;
-#X obj 31 113 r metro;
-#X obj 64 183 mod 8;
-#X obj 31 259 phasor~ 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array array1 8 float 0;
-#X coords 0 96 8 36 200 100 1;
-#X restore 464 75 graph;
-#X obj 251 189 r cf;
-#X text 293 210 <-- center frequency;
-#X obj 31 137 metro 85;
-#X obj 15 376 hip~ 5000;
-#X obj 15 399 *~ 100;
-#X obj 252 237 moses 61;
-#X msg 251 260 61;
-#X msg 487 241 \; cf 61 \; q 30 \; metro 1 \; array1 0 45 48 50 48
-55 53 55 57;
-#X text 13 28 Here's an approximate reconstruction of an old riff by
-Pink Floyd (I haven't checked the tempo or transposition against the
-original yet.) Because we're filtering a waveform with odd partials
-\, it's easier to pick out the partials in the filtered sound.;
-#X text 104 352 Here we fudge;
-#X text 100 371 to better imitate;
-#X text 100 390 the EMS3 bandpass;
-#X text 85 403 sound;
-#X text 340 231 protect against;
-#X text 341 252 hitting the;
-#X text 341 271 fundamental;
-#X text 137 139 sequencer for;
-#X text 137 158 8 note loop;
-#X obj 171 459 moses 1;
-#X msg 144 459 1;
-#X text 241 460 speaker protection;
-#X text 437 558 updated for Pd version 0.35;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 38 0;
-#X connect 6 0 13 0;
-#X connect 7 0 6 0;
-#X connect 8 0 36 0;
-#X connect 9 0 10 0;
-#X connect 10 0 49 0;
-#X connect 11 0 12 0;
-#X connect 12 0 1 0;
-#X connect 13 0 11 1;
-#X connect 17 0 18 0;
-#X connect 18 0 19 0;
-#X connect 19 0 34 0;
-#X connect 23 0 24 0;
-#X connect 23 0 25 0;
-#X connect 24 0 28 0;
-#X connect 25 0 26 0;
-#X connect 26 0 29 0;
-#X connect 27 0 33 0;
-#X connect 28 0 23 1;
-#X connect 29 0 17 0;
-#X connect 29 0 19 1;
-#X connect 31 0 8 0;
-#X connect 33 0 23 0;
-#X connect 34 0 35 0;
-#X connect 35 0 11 0;
-#X connect 36 0 37 0;
-#X connect 36 1 7 0;
-#X connect 37 0 7 0;
-#X connect 49 0 50 0;
-#X connect 49 1 11 2;
-#X connect 50 0 11 2;
diff --git a/pd/doc/3.audio.examples/F04.waveshaping.pulse.pd b/pd/doc/3.audio.examples/F04.waveshaping.pulse.pd
new file mode 100644
index 00000000..5724aeba
--- /dev/null
+++ b/pd/doc/3.audio.examples/F04.waveshaping.pulse.pd
@@ -0,0 +1,133 @@
+#N canvas 240 229 900 586 12;
+#X obj 220 171 line~;
+#X obj 220 147 pack 0 50;
+#X floatatom 220 46 0 0 0 0 - - -;
+#X obj 70 108 *~;
+#X obj 220 72 / 10;
+#X obj 220 96 moses 0;
+#X msg 220 120 0;
+#X text 215 28 bandwidth;
+#X obj 78 141 *~;
+#X obj 18 141 sig~ 1;
+#X obj 39 194 /~;
+#X obj 54 168 +~;
+#X text 111 141 X^2;
+#X text 84 171 1+X^2;
+#X text 71 196 1/(1+X^2);
+#X text 28 4 ANOTHER PULSE WIDTH MOD ALGORITHM;
+#N canvas 0 0 450 300 graph1 0;
+#X array F04-signal 882 float 0;
+#X coords 0 1.02 882 -1.02 200 130 1;
+#X restore 646 328 graph;
+#N canvas 0 0 450 300 graph1 0;
+#X array F04-spectrum 259 float 0;
+#X coords 0 1.01 258 -0.008 256 200 1;
+#X restore 587 38 graph;
+#X text 646 461 ---- 0.02 seconds ----;
+#X text 614 237 2;
+#X text 645 237 4;
+#X text 584 237 0;
+#X text 622 252 -- partial number --;
+#X text 677 237 6;
+#X text 710 237 8;
+#X text 738 237 10;
+#X text 770 237 12;
+#X text 802 237 14;
+#X obj 40 277 output~;
+#X obj 39 246 hip~;
+#N canvas 122 211 558 609 fft 0;
+#X obj 19 61 inlet~;
+#X obj 224 210 inlet;
+#X obj 29 92 rfft~;
+#X obj 29 125 *~;
+#X obj 60 125 *~;
+#X obj 29 155 sqrt~;
+#X obj 332 109 block~ 4096 1;
+#X obj 29 181 biquad~ 0 0 0 0 1;
+#X text 93 93 Fourier series;
+#X text 98 146 magnitude;
+#X text 96 131 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 193 164 delay two samples;
+#X text 191 182 for better graphing;
+#X obj 264 434 samplerate~;
+#X obj 251 255 metro 500;
+#X obj 251 232 inlet;
+#X text 301 232 toggle to graph repeatedly;
+#X text 278 210 bang to graph once;
+#X obj 29 205 /~ 4096;
+#X obj 264 409 bang~;
+#X obj 264 457 / 512;
+#X obj 19 295 tabwrite~ F04-signal;
+#X obj 250 291 tabwrite~ F04-spectrum;
+#X obj 264 483 s freq/2;
+#X msg 224 321 \; pd dsp 1;
+#X connect 0 0 2 0;
+#X connect 0 0 23 0;
+#X connect 1 0 23 0;
+#X connect 1 0 24 0;
+#X connect 1 0 26 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 20 0;
+#X connect 15 0 22 0;
+#X connect 16 0 23 0;
+#X connect 16 0 24 0;
+#X connect 17 0 16 0;
+#X connect 17 0 26 0;
+#X connect 20 0 24 0;
+#X connect 21 0 15 0;
+#X connect 22 0 25 0;
+#X restore 93 248 pd fft;
+#X obj 153 227 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 153 248 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X text 174 247 <-- repeatedly;
+#X text 175 227 <-- graph once;
+#X obj 69 81 osc~;
+#X text 632 540 updated for Pd version 0.37;
+#X text 23 515 NOTE: The PAF algorithm is protected by patents belonging
+to IRCAM. Noncommercial use seems to be fine with them but contact
+them first if you want to sell something using this.;
+#X text 24 473 This is the form of pulse train used in the original
+Phase Aligned Formant (PAF) algorithm.;
+#X text 23 342 Here we use waveshaping to make another form of pulse
+train. This one has a neat spectrum: the partials drop off exponentially
+(with the "bandwidth" controlling the rate of dropoff.) In later patches
+we'll use a wavetable to do the waveshaping but for simplicity \, it's
+done algebraically here. The oscillator runs at half the fundamental
+frequency. The symmetry of the waveshaping doubles the frequency of
+the output.;
+#X text 849 222 0;
+#X text 846 35 1;
+#X obj 69 56 r freq/2;
+#X connect 0 0 3 1;
+#X connect 1 0 0 0;
+#X connect 2 0 4 0;
+#X connect 3 0 8 0;
+#X connect 3 0 8 1;
+#X connect 4 0 5 0;
+#X connect 5 0 6 0;
+#X connect 5 1 1 0;
+#X connect 6 0 1 0;
+#X connect 8 0 11 1;
+#X connect 9 0 10 0;
+#X connect 9 0 11 0;
+#X connect 10 0 29 0;
+#X connect 10 0 30 0;
+#X connect 11 0 10 1;
+#X connect 29 0 28 0;
+#X connect 29 0 28 1;
+#X connect 31 0 30 1;
+#X connect 32 0 30 2;
+#X connect 35 0 3 0;
+#X connect 42 0 35 0;
diff --git a/pd/doc/3.audio.examples/F05.filter.noise.pd b/pd/doc/3.audio.examples/F05.filter.noise.pd
deleted file mode 100644
index 7421c180..00000000
--- a/pd/doc/3.audio.examples/F05.filter.noise.pd
+++ /dev/null
@@ -1,196 +0,0 @@
-#N canvas 137 175 735 587 12;
-#X text 437 559 updated for Pd version 0.26;
-#X floatatom 67 397 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 38 425 pd output;
-#X msg 96 397 MUTE;
-#X text 135 396 <-- output amplitude;
-#X obj 515 150 loadbang;
-#N canvas 0 0 600 392 conversion-tables 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array dbtorms 123 float 1;
-#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
-2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
-4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
-8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
-0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
-0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
-0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
-0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
-0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
-0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
-2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
-6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
-#X coords 0 10 123 0 200 100 1;
-#X restore 70 45 graph;
-#X text 272 138 0;
-#X text 274 38 10;
-#X text 89 148 ------ 123 samples ------;
-#N canvas 0 0 450 300 graph2 0;
-#X array mtof 130 float 1;
-#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
-12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
-21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
-36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
-61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
-103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
-174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
-293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
-493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
-830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
-1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
-2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
-4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
-7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
-11839.8 12543.9 13289.8 14080;
-#X coords 0 12000 130 0 200 100 1;
-#X restore 77 222 graph;
-#X text 87 330 ------ 130 samples ------;
-#X text 286 315 0;
-#X text 288 215 12000;
-#N canvas 244 212 672 338 regenerate-tables 0;
-#X msg 415 84 bang;
-#X obj 415 113 t b b;
-#X obj 474 177 f;
-#X obj 512 177 + 1;
-#X msg 483 147 0;
-#X obj 415 142 until;
-#X obj 474 211 t f f;
-#X obj 414 238 mtof;
-#X obj 405 202 sel 129;
-#X obj 413 264 tabwrite mtof;
-#X obj 35 227 moses 2;
-#X msg 19 76 bang;
-#X obj 19 105 t b b;
-#X obj 90 166 f;
-#X obj 128 166 + 1;
-#X msg 112 138 0;
-#X obj 19 134 until;
-#X obj 11 194 sel 122;
-#X msg 35 258 0;
-#X obj 79 259 dbtorms;
-#X obj 90 194 t f f;
-#X obj 35 291 tabwrite dbtorms;
-#X text 18 49 bang to recalculate dbtorms table;
-#X text 356 50 bang to recalculate the mtof table;
-#X connect 0 0 1 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 2 0 8 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 6 1 9 1;
-#X connect 7 0 9 0;
-#X connect 8 0 5 1;
-#X connect 10 0 18 0;
-#X connect 10 1 19 0;
-#X connect 11 0 12 0;
-#X connect 12 0 16 0;
-#X connect 12 1 15 0;
-#X connect 13 0 14 0;
-#X connect 13 0 17 0;
-#X connect 13 0 20 0;
-#X connect 14 0 13 1;
-#X connect 15 0 13 1;
-#X connect 16 0 13 0;
-#X connect 17 0 16 1;
-#X connect 18 0 21 0;
-#X connect 19 0 21 0;
-#X connect 20 0 10 0;
-#X connect 20 1 21 1;
-#X restore 375 76 pd regenerate-tables;
-#X restore 449 418 pd conversion-tables;
-#X obj 49 201 line~;
-#X obj 49 177 pack 0 100;
-#X floatatom 49 151 0 0 0;
-#X obj 88 254 r q;
-#X floatatom 88 278 0 0 0;
-#X obj 38 342 vcf~;
-#X obj 38 366 hip~ 5;
-#X obj 49 226 tabread4~ mtof;
-#X text 124 277 <-- Q (selectivity);
-#X obj 49 127 r cf;
-#X text 84 145 <-- center frequency;
-#X text 35 6 FILTERING NOISE;
-#X obj 39 102 noise~;
-#X msg 515 174 \; cf 60 \; q 3 \;;
-#X text 13 28 THe noise~ module puts out unit-amplitude white noise.
-Be careful again here about surging amplitudes if Q hits zero.;
-#X obj 88 305 moses 1;
-#X msg 60 305 1;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 5 0 20 0;
-#X connect 7 0 14 0;
-#X connect 8 0 7 0;
-#X connect 9 0 8 0;
-#X connect 10 0 11 0;
-#X connect 11 0 22 0;
-#X connect 12 0 13 0;
-#X connect 13 0 2 0;
-#X connect 14 0 12 1;
-#X connect 16 0 9 0;
-#X connect 19 0 12 0;
-#X connect 22 0 23 0;
-#X connect 22 1 12 2;
-#X connect 23 0 12 2;
diff --git a/pd/doc/3.audio.examples/F05.ring.modulation.pd b/pd/doc/3.audio.examples/F05.ring.modulation.pd
new file mode 100644
index 00000000..937b579e
--- /dev/null
+++ b/pd/doc/3.audio.examples/F05.ring.modulation.pd
@@ -0,0 +1,160 @@
+#N canvas 83 89 793 595 12;
+#N canvas 0 0 450 300 graph1 0;
+#X array F05-signal 882 float 0;
+#X coords 0 1 882 -1 200 130 1;
+#X restore 554 218 graph;
+#N canvas 0 0 450 300 graph1 0;
+#X array F05-spectrum 256 float 0;
+#X coords 0 0.51 255 -0.008 256 130 1;
+#X restore 499 22 graph;
+#X text 552 349 ---- 0.02 seconds ----;
+#X text 507 563 updated for Pd version 0.37;
+#X text 495 155 0;
+#X text 534 174 -- partial number --;
+#X text 761 142 0;
+#X text 758 19 0.5;
+#X floatatom 51 61 0 0 100 0 - - -;
+#N canvas 329 22 680 421 pulse-train 0;
+#X obj 184 348 line~;
+#X obj 39 317 cos~;
+#X obj 184 324 pack 0 50;
+#X obj 39 245 -~ 0.5;
+#X obj 39 269 *~;
+#X obj 184 252 / 10;
+#X obj 184 276 moses 0;
+#X msg 184 300 0;
+#X obj 39 293 clip~ -0.5 0.5;
+#X obj 184 372 +~ 1;
+#X obj 39 341 +~ 1;
+#X obj 184 228 inlet;
+#X obj 39 389 outlet~;
+#X obj 39 365 *~ 0.5;
+#X text 53 5 This is a modified version of the pulse train generator
+from two examples back.;
+#X text 107 140 We have to add 1/2 and wrap so that the center of the
+pulse comes at phase zero (previously it was 1/2 cycle out of phase).
+This wasn't a problem before but now we have to be in phase with the
+oscillator we're multpplying with.;
+#X text 276 262 otherwise it's the same as before.;
+#X obj 40 85 phasor~;
+#X obj 40 58 r freq;
+#X connect 0 0 9 0;
+#X connect 1 0 10 0;
+#X connect 2 0 0 0;
+#X connect 3 0 4 0;
+#X connect 4 0 8 0;
+#X connect 5 0 6 0;
+#X connect 6 0 7 0;
+#X connect 6 1 2 0;
+#X connect 7 0 2 0;
+#X connect 8 0 1 0;
+#X connect 9 0 4 1;
+#X connect 10 0 13 0;
+#X connect 11 0 5 0;
+#X connect 13 0 12 0;
+#X connect 17 0 3 0;
+#X connect 18 0 17 0;
+#X restore 51 86 pd pulse-train;
+#X text 83 61 <-- bandwidth;
+#X obj 51 219 *~;
+#X text 113 123 <-- modulation frequency as;
+#X text 152 137 multiple of fundamental;
+#X obj 51 277 output~;
+#X obj 50 246 hip~;
+#N canvas 122 211 563 534 fft 0;
+#X obj 19 61 inlet~;
+#X obj 208 212 inlet;
+#X obj 29 92 rfft~;
+#X obj 29 125 *~;
+#X obj 60 125 *~;
+#X obj 29 155 sqrt~;
+#X obj 332 109 block~ 4096 1;
+#X obj 29 181 biquad~ 0 0 0 0 1;
+#X text 93 93 Fourier series;
+#X text 98 146 magnitude;
+#X text 96 131 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 193 164 delay two samples;
+#X text 191 182 for better graphing;
+#X obj 264 434 samplerate~;
+#X obj 245 262 metro 500;
+#X obj 245 233 inlet;
+#X text 298 231 toggle to graph repeatedly;
+#X text 262 212 bang to graph once;
+#X obj 29 205 /~ 4096;
+#X obj 264 409 bang~;
+#X obj 264 483 s freq;
+#X obj 264 457 / 256;
+#X obj 19 295 tabwrite~ F05-signal;
+#X obj 245 294 tabwrite~ F05-spectrum;
+#X msg 224 321 \; pd dsp 1;
+#X connect 0 0 2 0;
+#X connect 0 0 24 0;
+#X connect 1 0 24 0;
+#X connect 1 0 25 0;
+#X connect 1 0 26 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 20 0;
+#X connect 15 0 23 0;
+#X connect 16 0 24 0;
+#X connect 16 0 25 0;
+#X connect 17 0 16 0;
+#X connect 17 0 26 0;
+#X connect 20 0 25 0;
+#X connect 21 0 15 0;
+#X connect 23 0 22 0;
+#X restore 98 245 pd fft;
+#X obj 158 224 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 158 245 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
+1;
+#X text 179 244 <-- repeatedly;
+#X text 180 224 <-- graph once;
+#X text 527 155 2;
+#X text 559 155 4;
+#X text 591 155 6;
+#X text 623 155 8;
+#X text 656 155 10;
+#X text 688 155 12;
+#X text 719 155 14;
+#X text 759 213 1;
+#X text 759 337 -1;
+#X text 122 185 modulating oscillator;
+#X text 153 6 RING MODULATED PULSE TRAINS;
+#X text 23 357 Now we take a pulse train and ring modulate it \, which
+effectively aliases the spectrum so that it is centered at any desired
+partial number. The "bandwidth" control still affects the shape of
+the peak \, independently of where it is centered. This generates a
+formant centered at the given partial.;
+#X floatatom 73 123 0 0 100 0 - - -;
+#X obj 73 182 osc~;
+#X obj 73 157 *;
+#X obj 107 157 r freq;
+#X text 23 457 This patch is limited to making formants centered on
+harmonics. The center frequency thus can't be moved smoothly up and
+down at will (try shift-clicking on modulation frequency to make fractions).
+Next we'll look at two techniques for sliding a formant frequency without
+losing harmonicity.;
+#X text 184 85 <-- pulse train;
+#X text 220 101 generator from before;
+#X connect 8 0 9 0;
+#X connect 9 0 11 0;
+#X connect 11 0 15 0;
+#X connect 11 0 16 0;
+#X connect 15 0 14 0;
+#X connect 15 0 14 1;
+#X connect 17 0 16 1;
+#X connect 18 0 16 2;
+#X connect 33 0 35 0;
+#X connect 34 0 11 1;
+#X connect 35 0 34 0;
+#X connect 36 0 35 1;
diff --git a/pd/doc/3.audio.examples/F06.packets.pd b/pd/doc/3.audio.examples/F06.packets.pd
new file mode 100644
index 00000000..ef098bba
--- /dev/null
+++ b/pd/doc/3.audio.examples/F06.packets.pd
@@ -0,0 +1,117 @@
+#N canvas 207 159 864 663 12;
+#X obj 327 413 line~;
+#X obj 55 456 cos~;
+#N canvas 0 0 450 300 graph1 0;
+#X array pulse-output 882 float 0;
+#X coords 0 1 882 -1 200 130 1;
+#X restore 627 339 graph;
+#X obj 327 390 pack 0 50;
+#X floatatom 327 344 0 0 0 0 - - -;
+#X obj 55 355 -~ 0.5;
+#X obj 55 410 *~;
+#X obj 327 367 / 10;
+#X obj 55 433 clip~ -0.5 0.5;
+#X text 327 322 bandwidth;
+#X obj 327 436 +~ 1;
+#X obj 55 479 +~ 1;
+#X obj 206 491 cos~;
+#X obj 56 547 *~;
+#X floatatom 228 346 4 0 0 0 - - -;
+#X obj 228 366 / 10;
+#X text 627 472 --- 0.02 seconds ---;
+#X obj 206 465 *~;
+#N canvas 129 316 777 218 graph 1;
+#X obj 70 76 inlet~;
+#X obj 662 76 inlet;
+#X obj 67 143 tabwrite~ pulse-output;
+#X obj 298 81 inlet~;
+#X obj 472 74 inlet~;
+#X obj 295 148 tabwrite~ window;
+#X obj 477 149 tabwrite~ carrier;
+#X msg 654 140 \; pd dsp 1;
+#X connect 0 0 2 0;
+#X connect 1 0 2 0;
+#X connect 1 0 5 0;
+#X connect 1 0 6 0;
+#X connect 1 0 7 0;
+#X connect 3 0 5 0;
+#X connect 4 0 6 0;
+#X restore 100 572 pd graph;
+#X obj 228 412 line~;
+#X obj 228 389 pack 0 50;
+#N canvas 0 0 450 300 graph3 0;
+#X array carrier 882 float 0;
+#X coords 0 1 881 -1 200 140 1;
+#X restore 627 188 graph;
+#N canvas 0 0 450 300 graph4 0;
+#X array window 882 float 0;
+#X coords 0 1 881 -1 200 140 1;
+#X restore 628 35 graph;
+#X text 204 573 <-- graph;
+#X floatatom 55 310 4 0 0 0 - - -;
+#X obj 55 331 phasor~ 100;
+#X text 31 2 WINDOWED PACKETS;
+#X text 51 266 fundamental;
+#X text 206 260 center;
+#X text 204 279 freq. (in;
+#X text 203 298 tenths of;
+#X text 202 318 fundamental);
+#X text 119 493 window;
+#X text 241 469 magnified phase;
+#X text 283 509 desired center frequency;
+#X text 255 492 <--this cosine goes at the;
+#X text 284 528 but its phase is reset each;
+#X text 282 547 fundamental period.;
+#X text 28 32 The simpler of two techniques for making slidable center
+frequencies is to synthesize enveloped sinusoidal wave packets. The
+packets should repeat at the fundamental frequency \, but the frequency
+of the packet itself controls the center frequency of the formant.
+The length of the packet varies inversely with bandwidth.;
+#X obj 55 604 output~;
+#X obj 55 580 hip~;
+#X obj 182 573 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X text 601 635 updated for Pd version 0.37;
+#X obj 55 502 *~ 0.5;
+#X text 831 161 -1;
+#X text 833 31 1;
+#X text 831 314 -1;
+#X text 835 184 1;
+#X text 832 458 -1;
+#X text 835 333 1;
+#X text 26 132 In the patch below \, the "clip~" followed by "cos~"
+and "+~ 1" is the enveloping ("windowing") function \, which appears
+in the top graph. The carrier \, on the other hand \, is a broken sinusoid
+made by amplifying the phasor~ (the "*~" controlled by "center freq.")
+and taking the cos~ of the result. The "breaks" in the sinusoid only
+occur when the enveloping signal is zero.;
+#X text 105 464 raised;
+#X text 113 479 cosine;
+#X text 51 285 frequency;
+#X connect 0 0 10 0;
+#X connect 1 0 11 0;
+#X connect 3 0 0 0;
+#X connect 4 0 7 0;
+#X connect 5 0 6 0;
+#X connect 5 0 17 0;
+#X connect 6 0 8 0;
+#X connect 7 0 3 0;
+#X connect 8 0 1 0;
+#X connect 10 0 6 1;
+#X connect 11 0 43 0;
+#X connect 12 0 13 1;
+#X connect 12 0 18 2;
+#X connect 13 0 18 0;
+#X connect 13 0 40 0;
+#X connect 14 0 15 0;
+#X connect 15 0 20 0;
+#X connect 17 0 12 0;
+#X connect 19 0 17 1;
+#X connect 20 0 19 0;
+#X connect 24 0 25 0;
+#X connect 25 0 5 0;
+#X connect 40 0 39 0;
+#X connect 40 0 39 1;
+#X connect 41 0 18 3;
+#X connect 43 0 13 0;
+#X connect 43 0 18 1;
diff --git a/pd/doc/3.audio.examples/F06.ring.modulation.pd b/pd/doc/3.audio.examples/F06.ring.modulation.pd
deleted file mode 100644
index 0380a07d..00000000
--- a/pd/doc/3.audio.examples/F06.ring.modulation.pd
+++ /dev/null
@@ -1,153 +0,0 @@
-#N canvas 1 23 809 567 12;
-#X graph graph1 0 -1.02 882 1.02 542 471 742 341;
-#X array pulse-output 882 float 0;
-#X pop;
-#X floatatom 101 331 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 63 359 pd output;
-#X msg 139 332 MUTE;
-#X text 179 331 <-- output amplitude;
-#X floatatom 63 48 0 0 0;
-#X obj 63 303 hip~ 5;
-#X graph graph1 0 0 128 1000 490 259 746 129;
-#X array spectrum 128 float 0;
-#X pop;
-#X obj 129 278 tabwrite~ pulse-output;
-#X msg 129 243 bang;
-#X text 170 244 <-- click to graph;
-#N canvas 204 17 358 234 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 2048 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 74 281 pd fft;
-#X text 488 265 0;
-#X obj 79 194 osc~ 0;
-#N canvas 0 0 600 384 pulse-train 0;
-#X obj 185 162 line~;
-#X obj 39 251 cos~;
-#X obj 185 138 pack 0 50;
-#X obj 40 178 -~ 0.5;
-#X obj 40 204 *~;
-#X obj 185 63 / 10;
-#X obj 185 87 moses 0;
-#X msg 185 111 0;
-#X obj 39 227 clip~ -0.5 0.5;
-#X obj 185 187 +~ 1;
-#X obj 38 274 +~ 1;
-#X obj 184 38 inlet;
-#X obj 38 299 outlet~;
-#X obj 40 154 phasor~ 344.532;
-#X text 51 13 This is the pulse train generator from example 17;
-#X connect 0 0 9 0;
-#X connect 1 0 10 0;
-#X connect 2 0 0 0;
-#X connect 3 0 4 0;
-#X connect 4 0 8 0;
-#X connect 5 0 6 0;
-#X connect 6 0 7 0;
-#X connect 6 1 2 0;
-#X connect 7 0 2 0;
-#X connect 8 0 1 0;
-#X connect 9 0 4 1;
-#X connect 10 0 12 0;
-#X connect 11 0 5 0;
-#X connect 13 0 3 0;
-#X restore 63 75 pd pulse-train;
-#X floatatom 79 168 0 0 0;
-#X text 124 167 <-- modulation frequency;
-#X text 102 48 <-- bandwidth;
-#X obj 63 218 *~;
-#X text 736 262 2656 Hz.;
-#X text 196 77 fundamental is 344.5 Hz;
-#X text 157 210 an oscillator...;
-#X text 66 22 RING MODULATION;
-#X text 542 473 ---- 0.02 seconds ----;
-#X text 528 533 updated for Pd version 0.34;
-#X text 156 195 Just multiply by;
-#X text 12 422 Ring modulation is just multiplication by an oscillator.
-This patch shows the effect of ring modulation on a pulse train. When
-bandwidth is high and modulation frequency is moderately low \, you
-see the spectrum reflect off the "y axis".;
-#X obj 79 140 * 344.5;
-#X floatatom 79 114 0 0 0;
-#X text 120 114 <-- modulation frequency as;
-#X text 159 128 multiple of fundamental;
-#X connect 1 0 2 1;
-#X connect 2 0 1 0;
-#X connect 3 0 2 2;
-#X connect 5 0 14 0;
-#X connect 6 0 2 0;
-#X connect 9 0 8 0;
-#X connect 9 0 11 1;
-#X connect 13 0 18 1;
-#X connect 14 0 18 0;
-#X connect 15 0 13 0;
-#X connect 18 0 11 0;
-#X connect 18 0 6 0;
-#X connect 18 0 8 0;
-#X connect 27 0 15 0;
-#X connect 28 0 27 0;
diff --git a/pd/doc/3.audio.examples/60.packet.spectrum.pd b/pd/doc/3.audio.examples/F07.packet.spectrum.pd
index bef1483b..bef1483b 100644
--- a/pd/doc/3.audio.examples/60.packet.spectrum.pd
+++ b/pd/doc/3.audio.examples/F07.packet.spectrum.pd
diff --git a/pd/doc/3.audio.examples/F07.ssb.modulation.pd b/pd/doc/3.audio.examples/F07.ssb.modulation.pd
deleted file mode 100644
index 968b3b45..00000000
--- a/pd/doc/3.audio.examples/F07.ssb.modulation.pd
+++ /dev/null
@@ -1,150 +0,0 @@
-#N canvas 7 6 923 594 12;
-#X obj 170 349 phasor~ 0;
-#X obj 170 393 cos~;
-#X obj 206 371 +~ -0.25;
-#X obj 206 394 cos~;
-#X obj 23 438 *~;
-#X obj 88 438 *~;
-#X obj 22 462 -~;
-#X floatatom 170 322 0 0 0;
-#X obj 23 238 tabread4~ array1;
-#X obj 23 67 r totsamps;
-#X obj 23 142 /;
-#X obj 23 190 *~ 0;
-#X obj 23 166 phasor~ 0;
-#X obj 23 214 +~ 1;
-#X msg 23 117 44100;
-#X obj 23 91 t b f;
-#X obj 62 190 r totsamps;
-#X msg 636 38 \; pd dsp 0;
-#X text 429 14 START;
-#X text 653 20 STOP;
-#X floatatom 51 499 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 22 527 pd output;
-#X msg 87 500 MUTE;
-#X text 121 499 <-- output amplitude;
-#N canvas 0 0 600 388 hilbert 0;
-#X obj 166 190 biquad~ 0.83774 -0.06338 0.06338 -0.83774 1;
-#X obj 166 164 biquad~ 1.94632 -0.94657 0.94657 -1.94632 1;
-#X obj 99 111 biquad~ -0.02569 0.260502 -0.260502 0.02569 1;
-#X obj 99 137 biquad~ 1.8685 -0.870686 0.870686 -1.8685 1;
-#X obj 98 76 inlet~;
-#X obj 166 213 outlet~;
-#X obj 99 213 outlet~;
-#X text 95 261 This is a pair of all-pass filters whose outputs somehow
-manage to be about 90 degrees out of phase from each other. I don't
-know what phase relation they have with the original signal. I adapted
-this from a 4X patch by Emmanuel Favreau \, circa 1982;
-#X connect 0 0 5 0;
-#X connect 1 0 0 0;
-#X connect 2 0 3 0;
-#X connect 3 0 6 0;
-#X connect 4 0 1 0;
-#X connect 4 0 2 0;
-#X restore 23 400 pd hilbert;
-#X graph graph1 0 -1 155947 1 441 284 641 134;
-#X array array1 155948 float 0;
-#X pop;
-#X text 36 257 sample loop for;
-#X text 36 271 test signal;
-#X text 35 314 pair of allpass;
-#X text 34 333 filters to make;
-#X text 34 353 90 degree phase;
-#X text 32 373 shifted versions;
-#X text 201 323 <-- shift frequency;
-#X text 122 438 <-- complex multiply;
-#X text 123 452 (calculate real part);
-#X text 161 412 cosine and sine waves;
-#X text 55 7 SINGLE SIDEBAND MODULATION;
-#X text 55 26 (AKA FREQUENCY SHIFTING);
-#X text 394 296 The signal sideband modulator gives you only one sideband
-for each frequency in teh input signal (whereas ring modulation gave
-both a positie and negative sideband.) You can set the shift frequency
-positive to shift all frequencies upward \, or negative to shift them
-downwards.;
-#X obj 484 417 r readfile;
-#X msg 334 34 \; readfile ../sound/bell.aiff \; pd dsp 1;
-#X obj 484 444 symbol;
-#X msg 483 470 read -resize \$1 array1;
-#X obj 483 496 soundfiler;
-#X obj 483 521 s totsamps;
-#X text 671 568 updated for Pd version 0.33;
-#X connect 0 0 2 0;
-#X connect 0 0 1 0;
-#X connect 1 0 4 1;
-#X connect 2 0 3 0;
-#X connect 3 0 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 1;
-#X connect 6 0 21 0;
-#X connect 7 0 0 0;
-#X connect 8 0 24 0;
-#X connect 9 0 15 0;
-#X connect 10 0 12 0;
-#X connect 11 0 13 0;
-#X connect 12 0 11 0;
-#X connect 13 0 8 0;
-#X connect 14 0 10 0;
-#X connect 15 0 14 0;
-#X connect 15 1 10 1;
-#X connect 16 0 11 1;
-#X connect 20 0 21 1;
-#X connect 21 0 20 0;
-#X connect 22 0 21 2;
-#X connect 24 0 4 0;
-#X connect 24 1 5 0;
-#X connect 39 0 41 0;
-#X connect 41 0 42 0;
-#X connect 42 0 43 0;
-#X connect 43 0 44 0;
diff --git a/pd/doc/3.audio.examples/F08.two.cosines.pd b/pd/doc/3.audio.examples/F08.two.cosines.pd
new file mode 100644
index 00000000..ae4788f6
--- /dev/null
+++ b/pd/doc/3.audio.examples/F08.two.cosines.pd
@@ -0,0 +1,70 @@
+#N canvas 534 115 698 613 12;
+#X obj 157 408 cos~;
+#X floatatom 204 198 4 0 100 0 - - -;
+#X obj 204 222 / 10;
+#X text 461 275 --- 0.02 seconds ---;
+#X obj 157 378 *~;
+#X obj 204 294 line~;
+#X obj 204 246 max 0;
+#N canvas 0 0 450 300 graph3 0;
+#X array F08-carrier 882 float 0;
+#X coords 0 2 881 -2 200 140 1;
+#X restore 447 123 graph;
+#X floatatom 57 295 4 0 0 0 - - -;
+#X text 53 251 fundamental;
+#X text 53 270 frequency;
+#X obj 199 408 cos~;
+#X obj 240 321 wrap~;
+#X obj 204 348 -~;
+#X obj 199 378 +~;
+#X obj 204 445 -~;
+#X obj 219 475 *~;
+#X obj 197 500 +~;
+#X obj 204 270 pack 0 50;
+#X text 254 408 synthesize the two partials;
+#X text 447 590 updated for Pd version 0.37;
+#X obj 198 526 hip~;
+#X obj 199 552 output~;
+#X text 26 29 The other \, spiffier way is to make a sum of cosines
+to interpolate between adjacent harmonics. Suppose for example we want
+a center frequency of 5.3 (in units of the fundamental.) We just take
+partial 5 with amplitude 0.7 and partial 6 with amplitude 0.3:;
+#X obj 286 552 tabwrite~ F08-carrier;
+#X text 316 528 <-graph;
+#X obj 284 527 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 57 319 phasor~ 100;
+#X text 83 149 center frequency (in;
+#X text 82 169 tenths of fundamental);
+#X text 125 3 MOVABLE CENTER FREQUENCY BY ADDING TWO COSINES;
+#X text 295 320 the fractional part "q";
+#X text 253 347 subtract to get the integer part "k";
+#X text 249 380 multiply phase by k and k+1;
+#X text 252 444 c2 - c1;
+#X text 267 473 q * (c2 - c1);
+#X text 236 500 q * c2 + (1-q) * c1;
+#X connect 0 0 15 1;
+#X connect 0 0 17 0;
+#X connect 1 0 2 0;
+#X connect 2 0 6 0;
+#X connect 4 0 0 0;
+#X connect 4 0 14 0;
+#X connect 5 0 13 0;
+#X connect 5 0 12 0;
+#X connect 6 0 18 0;
+#X connect 8 0 27 0;
+#X connect 11 0 15 0;
+#X connect 12 0 13 1;
+#X connect 12 0 16 1;
+#X connect 13 0 4 1;
+#X connect 14 0 11 0;
+#X connect 15 0 16 0;
+#X connect 16 0 17 1;
+#X connect 17 0 21 0;
+#X connect 17 0 24 0;
+#X connect 18 0 5 0;
+#X connect 21 0 22 0;
+#X connect 21 0 22 1;
+#X connect 26 0 24 0;
+#X connect 27 0 4 0;
+#X connect 27 0 14 1;
diff --git a/pd/doc/3.audio.examples/F09.declickit.pd b/pd/doc/3.audio.examples/F09.declickit.pd
new file mode 100644
index 00000000..f35f5da8
--- /dev/null
+++ b/pd/doc/3.audio.examples/F09.declickit.pd
@@ -0,0 +1,94 @@
+#N canvas 10 49 579 665 12;
+#X obj 130 481 cos~;
+#X obj 130 451 *~;
+#X obj 172 481 cos~;
+#X obj 214 397 wrap~;
+#X obj 177 402 -~;
+#X obj 172 451 +~;
+#X obj 172 516 -~;
+#X obj 192 548 *~;
+#X obj 170 573 +~;
+#X obj 204 159 loadbang;
+#X obj 204 185 metro 400;
+#X obj 216 209 del 200;
+#X obj 252 326 samphold~;
+#N canvas 0 0 405 406 switch 0;
+#X obj 15 383 outlet~;
+#X obj 8 193 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
+;
+#X obj 329 195 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X obj 18 99 loadbang;
+#X obj 18 131 1;
+#X obj 53 261 sel 1;
+#X obj 53 287 0;
+#X obj 339 259 sel 1;
+#X obj 339 288 0;
+#X obj 47 316 inlet~;
+#X obj 15 344 *~;
+#X obj 340 312 inlet~;
+#X obj 308 340 *~;
+#X connect 1 0 5 0;
+#X connect 1 0 10 1;
+#X connect 2 0 7 0;
+#X connect 2 0 12 1;
+#X connect 3 0 4 0;
+#X connect 4 0 1 0;
+#X connect 5 0 6 0;
+#X connect 6 0 2 0;
+#X connect 7 0 8 0;
+#X connect 8 0 1 0;
+#X connect 9 0 10 0;
+#X connect 10 0 0 0;
+#X connect 11 0 12 0;
+#X connect 12 0 0 0;
+#X coords 0 0 1 1 80 35 1;
+#X restore 177 351 pd switch;
+#X text 31 2 CHANGING THE CENTER FREQUENCY QUICKLY;
+#X text 34 27 Since in the previous patch the amplitudes of the two
+cosines depend on "center frequency" we can't change that discontinuously
+without clicking \, as you hear in this patch. The fix is to use a
+samphold~ object to keep the center frequency frozen except at phase
+crossings. At the phase crossings the two weighted cosines add to one
+\, so we can discontinuously change the frequencies and weights there.
+;
+#X text 266 365 <--toggles to select which one;
+#X text 369 384 is actually used;
+#X obj 171 602 output~;
+#X floatatom 225 264 3 0 50 0 - - -;
+#X obj 178 263 pack;
+#X text 258 263 <--gliss time;
+#X text 324 647 updated for Pd version 0.37;
+#X obj 178 287 line~;
+#X msg 216 239 13.5;
+#X msg 178 239 4;
+#X obj 70 287 phasor~ 80;
+#X connect 0 0 6 1;
+#X connect 0 0 8 0;
+#X connect 1 0 0 0;
+#X connect 1 0 5 0;
+#X connect 2 0 6 0;
+#X connect 3 0 4 1;
+#X connect 3 0 7 1;
+#X connect 4 0 1 1;
+#X connect 5 0 2 0;
+#X connect 6 0 7 0;
+#X connect 7 0 8 1;
+#X connect 8 0 18 0;
+#X connect 8 0 18 1;
+#X connect 9 0 10 0;
+#X connect 10 0 25 0;
+#X connect 10 0 11 0;
+#X connect 11 0 24 0;
+#X connect 12 0 13 1;
+#X connect 13 0 4 0;
+#X connect 13 0 3 0;
+#X connect 19 0 20 1;
+#X connect 20 0 23 0;
+#X connect 23 0 13 0;
+#X connect 23 0 12 0;
+#X connect 24 0 20 0;
+#X connect 25 0 20 0;
+#X connect 26 0 1 0;
+#X connect 26 0 5 1;
+#X connect 26 0 12 1;
diff --git a/pd/doc/3.audio.examples/F10.sweepable.FM.pd b/pd/doc/3.audio.examples/F10.sweepable.FM.pd
new file mode 100644
index 00000000..17fc920b
--- /dev/null
+++ b/pd/doc/3.audio.examples/F10.sweepable.FM.pd
@@ -0,0 +1,152 @@
+#N canvas 60 64 834 697 12;
+#X obj 168 476 cos~;
+#X obj 168 430 *~;
+#X obj 211 478 cos~;
+#X obj 252 379 wrap~;
+#X obj 215 378 -~;
+#X obj 211 455 +~;
+#X obj 209 513 -~;
+#X obj 230 539 *~;
+#X obj 215 348 samphold~;
+#X text 167 6 APPLYING TWO-COSINE CARRIER TO FM;
+#X floatatom 232 228 4 0 200 0 - - -;
+#X obj 232 251 / 10;
+#X text 232 147 center;
+#X obj 232 300 line~;
+#X text 232 167 freq. (in;
+#X text 232 187 tenths of;
+#X text 232 207 fundamental);
+#X obj 232 277 pack 0 50;
+#X obj 121 283 phasor~;
+#X floatatom 121 260 4 0 0 0 - - -;
+#X text 106 207 fundamental;
+#X text 106 227 (= mod freq);
+#X text 435 254 index;
+#X text 435 274 (percent);
+#X floatatom 435 295 4 0 500 0 - - -;
+#X obj 385 361 cos~;
+#X obj 435 364 line~;
+#X obj 385 384 *~;
+#X obj 435 318 / 100;
+#X obj 435 341 pack 0 50;
+#X obj 168 453 +~;
+#X text 388 410 modulating;
+#X text 388 430 oscillator;
+#X text 40 452 both phases-->;
+#X text 9 435 add modulator to;
+#X obj 233 632 output~;
+#X obj 232 601 hip~;
+#N canvas 122 211 558 609 fft 0;
+#X obj 23 55 inlet~;
+#X obj 210 303 inlet;
+#X obj 27 215 rfft~;
+#X obj 27 248 *~;
+#X obj 58 248 *~;
+#X obj 27 278 sqrt~;
+#X obj 334 200 block~ 4096 1;
+#X obj 27 304 biquad~ 0 0 0 0 1;
+#X text 91 216 Fourier series;
+#X text 96 269 magnitude;
+#X text 94 254 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 195 255 delay two samples;
+#X text 193 273 for better graphing;
+#X obj 292 79 samplerate~;
+#X obj 240 352 metro 500;
+#X obj 240 329 inlet;
+#X text 293 327 toggle to graph repeatedly;
+#X text 264 303 bang to graph once;
+#X obj 27 328 /~ 4096;
+#X obj 292 54 bang~;
+#X msg 211 413 \; pd dsp 1;
+#X obj 237 390 tabwrite~ F10-spectrum;
+#X obj 292 102 / 4096;
+#X obj 58 135 osc~;
+#X obj 58 163 +~ 1;
+#X obj 28 188 *~;
+#X text 113 138 hanning window;
+#X obj 254 79 0.5;
+#X connect 0 0 27 0;
+#X connect 1 0 22 0;
+#X connect 1 0 23 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 20 0;
+#X connect 15 0 24 0;
+#X connect 16 0 23 0;
+#X connect 17 0 16 0;
+#X connect 17 0 22 0;
+#X connect 20 0 23 0;
+#X connect 21 0 15 0;
+#X connect 21 0 29 0;
+#X connect 24 0 25 0;
+#X connect 25 0 26 0;
+#X connect 26 0 27 1;
+#X connect 27 0 2 0;
+#X connect 29 0 25 1;
+#X restore 286 601 pd fft;
+#X obj 346 580 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 346 601 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
+1;
+#X text 367 600 <-- repeatedly;
+#X text 368 580 <-- graph once;
+#X text 580 663 updated for Pd version 0.37;
+#N canvas 0 0 450 300 graph1 0;
+#X array F10-spectrum 259 float 0;
+#X coords 0 0.51 258 -0.008 256 130 1;
+#X restore 560 386 graph;
+#X text 552 517 0;
+#X obj 207 565 +~;
+#X text 31 30 We can apply the two-cosine method to FM synthesis to
+get FM spectra which slide up and down: we just treat the cosines like
+carrier signals in an FM instrument. This doesn't work as well as you'd
+wish \, because the phases of the partials of the two FM instruments
+don't line up \, so that \, for indices of modulation above about 20%
+\, you get beating effects as the center frequency goes up and down.
+;
+#X text 614 527 -- frequency --;
+#X text 792 518 2700;
+#X connect 0 0 6 1;
+#X connect 0 0 45 0;
+#X connect 1 0 30 0;
+#X connect 2 0 6 0;
+#X connect 3 0 4 1;
+#X connect 3 0 7 1;
+#X connect 4 0 1 1;
+#X connect 5 0 2 0;
+#X connect 6 0 7 0;
+#X connect 7 0 45 1;
+#X connect 8 0 4 0;
+#X connect 8 0 3 0;
+#X connect 10 0 11 0;
+#X connect 11 0 17 0;
+#X connect 13 0 8 0;
+#X connect 17 0 13 0;
+#X connect 18 0 8 1;
+#X connect 18 0 25 0;
+#X connect 18 0 1 0;
+#X connect 18 0 5 1;
+#X connect 19 0 18 0;
+#X connect 24 0 28 0;
+#X connect 25 0 27 0;
+#X connect 26 0 27 1;
+#X connect 27 0 30 1;
+#X connect 28 0 29 0;
+#X connect 29 0 26 0;
+#X connect 30 0 5 0;
+#X connect 30 0 0 0;
+#X connect 36 0 35 0;
+#X connect 36 0 35 1;
+#X connect 38 0 37 1;
+#X connect 39 0 37 2;
+#X connect 45 0 36 0;
+#X connect 45 0 37 0;
diff --git a/pd/doc/3.audio.examples/F11.anharmonic.FM.pd b/pd/doc/3.audio.examples/F11.anharmonic.FM.pd
new file mode 100644
index 00000000..333a6e44
--- /dev/null
+++ b/pd/doc/3.audio.examples/F11.anharmonic.FM.pd
@@ -0,0 +1,126 @@
+#N canvas 60 64 790 527 12;
+#X obj 122 381 cos~;
+#X floatatom 173 184 4 0 200 0 - - -;
+#X obj 173 207 / 10;
+#X text 173 103 center;
+#X text 173 123 freq. (in;
+#X text 173 143 tenths of;
+#X text 173 163 fundamental);
+#X floatatom 70 192 4 0 0 0 - - -;
+#X text 46 145 fundamental;
+#X text 46 165 (= mod freq);
+#X text 251 208 index;
+#X text 251 228 (percent);
+#X floatatom 251 249 4 0 500 0 - - -;
+#X obj 251 318 line~;
+#X obj 201 338 *~;
+#X obj 251 272 / 100;
+#X obj 251 295 pack 0 50;
+#X obj 122 358 +~;
+#X text 204 364 modulating;
+#X text 209 381 oscillator;
+#X obj 123 459 output~;
+#X obj 122 428 hip~;
+#N canvas 122 211 558 609 fft 0;
+#X obj 23 55 inlet~;
+#X obj 210 303 inlet;
+#X obj 27 215 rfft~;
+#X obj 27 248 *~;
+#X obj 58 248 *~;
+#X obj 27 278 sqrt~;
+#X obj 334 200 block~ 4096 1;
+#X obj 27 304 biquad~ 0 0 0 0 1;
+#X text 91 216 Fourier series;
+#X text 96 269 magnitude;
+#X text 94 254 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 195 255 delay two samples;
+#X text 193 273 for better graphing;
+#X obj 292 79 samplerate~;
+#X obj 240 352 metro 500;
+#X obj 240 329 inlet;
+#X text 293 327 toggle to graph repeatedly;
+#X text 264 303 bang to graph once;
+#X obj 27 328 /~ 4096;
+#X obj 292 54 bang~;
+#X msg 211 413 \; pd dsp 1;
+#X obj 292 102 / 4096;
+#X obj 58 135 osc~;
+#X obj 58 163 +~ 1;
+#X obj 28 188 *~;
+#X text 113 138 hanning window;
+#X obj 254 79 0.5;
+#X obj 240 390 tabwrite~ F11-spectrum;
+#X connect 0 0 26 0;
+#X connect 1 0 22 0;
+#X connect 1 0 29 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 20 0;
+#X connect 15 0 23 0;
+#X connect 16 0 29 0;
+#X connect 17 0 16 0;
+#X connect 17 0 22 0;
+#X connect 20 0 29 0;
+#X connect 21 0 15 0;
+#X connect 21 0 28 0;
+#X connect 23 0 24 0;
+#X connect 24 0 25 0;
+#X connect 25 0 26 1;
+#X connect 26 0 2 0;
+#X connect 28 0 24 1;
+#X restore 176 428 pd fft;
+#X obj 236 407 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 236 428 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X text 257 427 <-- repeatedly;
+#X text 258 407 <-- graph once;
+#X text 530 479 updated for Pd version 0.37;
+#N canvas 0 0 450 300 graph1 0;
+#X array F11-spectrum 259 float 0;
+#X coords 0 0.51 258 -0.008 256 130 1;
+#X restore 514 291 graph;
+#X text 506 422 0;
+#X text 568 432 -- frequency --;
+#X text 743 427 2700;
+#X obj 173 256 *;
+#X obj 173 233 t b f;
+#X obj 201 315 osc~;
+#X obj 122 322 phasor~;
+#X text 31 30 Here's what happens if you just slide the carrier frequency
+around. The spectrum moves up and down all right \, but is only periodic
+at the original period when the center frequency roosts on a harmonic.
+;
+#X text 50 308 carrier;
+#X text 24 325 oscillator;
+#X text 167 6 HOW NOT TO APPLY TWO-COSINE CARRIER TO FM;
+#X connect 0 0 21 0;
+#X connect 0 0 22 0;
+#X connect 1 0 2 0;
+#X connect 2 0 33 0;
+#X connect 7 0 32 0;
+#X connect 7 0 34 0;
+#X connect 12 0 15 0;
+#X connect 13 0 14 1;
+#X connect 14 0 17 1;
+#X connect 15 0 16 0;
+#X connect 16 0 13 0;
+#X connect 17 0 0 0;
+#X connect 21 0 20 0;
+#X connect 21 0 20 1;
+#X connect 23 0 22 1;
+#X connect 24 0 22 2;
+#X connect 32 0 35 0;
+#X connect 33 0 32 0;
+#X connect 33 1 32 1;
+#X connect 34 0 14 0;
+#X connect 35 0 17 0;
diff --git a/pd/doc/3.audio.examples/F12.paf.pd b/pd/doc/3.audio.examples/F12.paf.pd
new file mode 100644
index 00000000..f220bd45
--- /dev/null
+++ b/pd/doc/3.audio.examples/F12.paf.pd
@@ -0,0 +1,226 @@
+#N canvas 262 0 692 819 12;
+#X obj 38 593 cos~;
+#X obj 38 570 *~;
+#X obj 81 593 cos~;
+#X obj 137 527 wrap~;
+#X obj 101 527 -~;
+#X obj 81 570 +~;
+#X obj 74 623 -~;
+#X obj 94 655 *~;
+#X obj 56 655 +~;
+#X obj 100 500 samphold~;
+#X floatatom 159 378 4 0 500 0 - - -;
+#X obj 159 401 / 10;
+#X text 157 311 center;
+#X obj 159 449 line~;
+#X text 157 359 fundamental);
+#X obj 159 426 pack 0 50;
+#X obj 39 446 phasor~;
+#X floatatom 39 425 4 0 0 0 - - -;
+#X text 19 398 fundamental;
+#X text 303 460 index;
+#X text 303 477 (percent);
+#X floatatom 303 498 4 0 500 0 - - -;
+#X obj 303 544 line~;
+#X obj 224 564 *~;
+#X obj 303 521 pack 0 50;
+#N canvas 0 0 450 300 graph4 0;
+#X array bell-curve 200 float 1;
+#A 0 1.12535e-07 1.54727e-07 2.12059e-07 2.89706e-07 3.94519e-07 5.35535e-07
+7.24633e-07 9.77371e-07 1.31404e-06 1.76105e-06 2.35258e-06 3.13275e-06
+4.15832e-06 5.50199e-06 7.25659e-06 9.54016e-06 1.25023e-05 1.63317e-05
+2.1266e-05 2.76026e-05 3.57128e-05 4.60584e-05 5.92113e-05 7.58768e-05
+9.69224e-05 0.00012341 0.000156634 0.000198167 0.000249912 0.000314163
+0.000393669 0.000491721 0.000612231 0.000759842 0.000940028 0.00115923
+0.00142498 0.00174605 0.00213263 0.00259648 0.00315111 0.00381201 0.00459678
+0.0055254 0.0066204 0.00790705 0.0094136 0.0111714 0.013215 0.0155826
+0.0183156 0.0214592 0.0250621 0.0291763 0.0338573 0.0391639 0.0451575
+0.0519019 0.0594631 0.0679081 0.0773047 0.0877205 0.0992216 0.111872
+0.125732 0.140858 0.1573 0.1751 0.194291 0.214896 0.236928 0.260383
+0.285247 0.311486 0.339053 0.367879 0.397882 0.428956 0.46098 0.493812
+0.527292 0.561244 0.595473 0.62977 0.663916 0.697676 0.730811 0.763074
+0.794216 0.823987 0.852144 0.878447 0.902668 0.924595 0.944027 0.960789
+0.974725 0.985703 0.99362 0.998401 1 0.998401 0.99362 0.985703 0.974725
+0.960789 0.944027 0.924595 0.902668 0.878447 0.852144 0.823987 0.794216
+0.763074 0.730811 0.697676 0.663916 0.62977 0.595473 0.561244 0.527292
+0.493812 0.46098 0.428956 0.397882 0.367879 0.339053 0.311486 0.285247
+0.260383 0.236928 0.214896 0.194291 0.1751 0.1573 0.140858 0.125732
+0.111872 0.0992216 0.0877205 0.0773047 0.0679081 0.0594631 0.0519019
+0.0451575 0.0391639 0.0338573 0.0291763 0.0250621 0.0214592 0.0183156
+0.0155826 0.013215 0.0111714 0.0094136 0.00790705 0.0066204 0.0055254
+0.00459678 0.00381201 0.00315111 0.00259648 0.00213263 0.00174605 0.00142498
+0.00115923 0.000940028 0.000759842 0.000612231 0.000491721 0.000393669
+0.000314163 0.000249912 0.000198167 0.000156634 0.00012341 9.69224e-05
+7.58768e-05 5.92113e-05 4.60584e-05 3.57128e-05 2.76026e-05 2.1266e-05
+1.63317e-05 1.25023e-05 9.54016e-06 7.25659e-06 5.50199e-06 4.15832e-06
+3.13275e-06 2.35258e-06 1.76105e-06 1.31404e-06 9.77371e-07 7.24633e-07
+5.35535e-07 3.94519e-07 2.89706e-07 2.12059e-07 1.54727e-07;
+#X coords 0 1 199 0 200 140 1;
+#X restore 443 555 graph;
+#N canvas 94 264 600 388 make-table 0;
+#X msg 81 44 bang;
+#X obj 81 73 t b b;
+#X obj 159 142 f;
+#X obj 197 142 + 1;
+#X msg 175 112 0;
+#X obj 81 102 until;
+#X obj 161 177 t f f;
+#X obj 76 306 tabwrite bell-curve;
+#X obj 52 270 expr exp(-$f1*$f1);
+#X obj 63 168 sel 199;
+#X obj 51 241 expr ($f1-100)/25;
+#X connect 0 0 1 0;
+#X connect 1 0 5 0;
+#X connect 1 1 4 0;
+#X connect 2 0 3 0;
+#X connect 2 0 6 0;
+#X connect 2 0 9 0;
+#X connect 3 0 2 1;
+#X connect 4 0 2 1;
+#X connect 5 0 2 0;
+#X connect 6 0 10 0;
+#X connect 6 1 7 1;
+#X connect 8 0 7 0;
+#X connect 9 0 5 1;
+#X connect 10 0 8 0;
+#X restore 507 515 pd make-table;
+#X obj 224 541 cos~;
+#X obj 224 518 -~ 0.25;
+#X obj 224 587 +~ 100;
+#X obj 224 610 tabread4~ bell-curve;
+#X obj 95 684 *~;
+#X text 131 682 <--ring mod step;
+#X text 256 635 waveshaper;
+#X text 425 791 updated for Pd version 0.37;
+#X text 157 326 frequency;
+#X text 157 342 (tenths of;
+#X text 441 698 0;
+#X text 632 697 200;
+#N canvas 0 0 450 300 graph1 0;
+#X array F12-spectrum 259 float 0;
+#X coords 0 0.51 258 -0.008 256 130 1;
+#X restore 421 308 graph;
+#X text 418 440 0;
+#X text 475 444 -- frequency --;
+#X text 644 441 2700;
+#X obj 95 756 output~;
+#X obj 94 725 hip~;
+#N canvas 122 211 558 609 fft 0;
+#X obj 23 55 inlet~;
+#X obj 210 303 inlet;
+#X obj 27 215 rfft~;
+#X obj 27 248 *~;
+#X obj 58 248 *~;
+#X obj 27 278 sqrt~;
+#X obj 334 200 block~ 4096 1;
+#X obj 27 304 biquad~ 0 0 0 0 1;
+#X text 91 216 Fourier series;
+#X text 96 269 magnitude;
+#X text 94 254 calculate;
+#X text 21 3 This subpatch computes the spectrum of the incoming signal
+with a (rectangular windowed) FFT. FFTs aren't properly introduced
+until much later.;
+#X text 83 61 signal to analyze;
+#X text 195 255 delay two samples;
+#X text 193 273 for better graphing;
+#X obj 292 79 samplerate~;
+#X obj 240 352 metro 500;
+#X obj 240 329 inlet;
+#X text 293 327 toggle to graph repeatedly;
+#X text 264 303 bang to graph once;
+#X obj 27 328 /~ 4096;
+#X obj 292 54 bang~;
+#X msg 211 413 \; pd dsp 1;
+#X obj 292 102 / 4096;
+#X obj 58 135 osc~;
+#X obj 58 163 +~ 1;
+#X obj 28 188 *~;
+#X text 113 138 hanning window;
+#X obj 254 79 0.5;
+#X obj 240 390 tabwrite~ F12-spectrum;
+#X connect 0 0 26 0;
+#X connect 1 0 22 0;
+#X connect 1 0 29 0;
+#X connect 2 0 3 0;
+#X connect 2 0 3 1;
+#X connect 2 1 4 0;
+#X connect 2 1 4 1;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 20 0;
+#X connect 15 0 23 0;
+#X connect 16 0 29 0;
+#X connect 17 0 16 0;
+#X connect 17 0 22 0;
+#X connect 20 0 29 0;
+#X connect 21 0 15 0;
+#X connect 21 0 28 0;
+#X connect 23 0 24 0;
+#X connect 24 0 25 0;
+#X connect 25 0 26 1;
+#X connect 26 0 2 0;
+#X connect 28 0 24 1;
+#X restore 148 725 pd fft;
+#X obj 208 704 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 208 725 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
+1;
+#X text 229 724 <-- repeatedly;
+#X text 230 704 <-- graph once;
+#X text 17 21 Instead of using the two cosines as FM carrier oscillators
+\, we can use them as ring modulators for a natural or synthetic tone.
+Here we use waveshaping - to wit \, a sinusoid looking up a Gaussian
+bell curve. This has the nice properties that the partials are always
+positive cosines in phase \, and the spectrum spreads out smoothly
+as the index changes.;
+#X text 98 1 PAF: TWO-COSINE RING MODULATOR FOR WAVESHAPER;
+#X text 17 253 Then with ~* we do the ring modulation and we're done.
+This is the PAF (phase-aligned formant) synthesis algorithm (patented
+1993 by IRCAM).;
+#X obj 224 492 *~ 0.5;
+#X text 17 129 For phase coherency \, the waveshaper and the cosine
+pair are driven from the same phasor~ object. Since the waveshaping
+is done using a symmetric curve \, its output is at double the frequency
+of the input. So for each cycle of the phasor we compute a half-cycle
+of the sine function (by multiplying by 0.5 and subtracting 0.25 before
+the cosine lookup). We center the cosine output for lookup in a 200-point
+table containing a bell curve.;
+#X connect 0 0 6 1;
+#X connect 0 0 8 0;
+#X connect 1 0 5 0;
+#X connect 1 0 0 0;
+#X connect 2 0 6 0;
+#X connect 3 0 4 1;
+#X connect 3 0 7 1;
+#X connect 4 0 1 1;
+#X connect 5 0 2 0;
+#X connect 6 0 7 0;
+#X connect 7 0 8 1;
+#X connect 8 0 31 0;
+#X connect 9 0 4 0;
+#X connect 9 0 3 0;
+#X connect 10 0 11 0;
+#X connect 11 0 15 0;
+#X connect 13 0 9 0;
+#X connect 15 0 13 0;
+#X connect 16 0 9 1;
+#X connect 16 0 5 1;
+#X connect 16 0 1 0;
+#X connect 16 0 53 0;
+#X connect 17 0 16 0;
+#X connect 21 0 24 0;
+#X connect 22 0 23 1;
+#X connect 23 0 29 0;
+#X connect 24 0 22 0;
+#X connect 27 0 23 0;
+#X connect 28 0 27 0;
+#X connect 29 0 30 0;
+#X connect 30 0 31 1;
+#X connect 31 0 44 0;
+#X connect 31 0 45 0;
+#X connect 44 0 43 0;
+#X connect 44 0 43 1;
+#X connect 46 0 45 1;
+#X connect 47 0 45 2;
+#X connect 53 0 28 0;
diff --git a/pd/doc/3.audio.examples/F13.paf.control.pd b/pd/doc/3.audio.examples/F13.paf.control.pd
new file mode 100644
index 00000000..59ebd334
--- /dev/null
+++ b/pd/doc/3.audio.examples/F13.paf.control.pd
@@ -0,0 +1,164 @@
+#N canvas 89 36 756 792 12;
+#X obj 127 608 cos~;
+#X obj 127 585 *~;
+#X obj 170 608 cos~;
+#X obj 225 553 wrap~;
+#X obj 189 553 -~;
+#X obj 170 585 +~;
+#X obj 163 638 -~;
+#X obj 183 670 *~;
+#X obj 145 670 +~;
+#X obj 189 521 samphold~;
+#X floatatom 189 321 4 0 127 0 - - -;
+#X text 185 283 center;
+#X obj 189 388 line~;
+#X obj 189 365 pack 0 50;
+#X obj 80 464 phasor~;
+#X floatatom 80 370 4 0 127 0 - - -;
+#X text 71 331 fundamental;
+#X floatatom 387 384 4 0 127 0 - - -;
+#X obj 387 455 line~;
+#X obj 298 584 *~;
+#X obj 387 432 pack 0 50;
+#N canvas 94 264 600 388 make-table 0;
+#X msg 81 44 bang;
+#X obj 81 73 t b b;
+#X obj 159 142 f;
+#X obj 197 142 + 1;
+#X msg 175 112 0;
+#X obj 81 102 until;
+#X obj 161 177 t f f;
+#X obj 76 306 tabwrite bell-curve;
+#X obj 52 270 expr exp(-$f1*$f1);
+#X obj 63 168 sel 199;
+#X obj 51 241 expr ($f1-100)/25;
+#N canvas 0 0 450 300 graph4 0;
+#X array bell-curve 200 float 1;
+#A 0 1.12535e-07 1.54727e-07 2.12059e-07 2.89706e-07 3.94519e-07 5.35535e-07
+7.24633e-07 9.77371e-07 1.31404e-06 1.76105e-06 2.35258e-06 3.13275e-06
+4.15832e-06 5.50199e-06 7.25659e-06 9.54016e-06 1.25023e-05 1.63317e-05
+2.1266e-05 2.76026e-05 3.57128e-05 4.60584e-05 5.92113e-05 7.58768e-05
+9.69224e-05 0.00012341 0.000156634 0.000198167 0.000249912 0.000314163
+0.000393669 0.000491721 0.000612231 0.000759842 0.000940028 0.00115923
+0.00142498 0.00174605 0.00213263 0.00259648 0.00315111 0.00381201 0.00459678
+0.0055254 0.0066204 0.00790705 0.0094136 0.0111714 0.013215 0.0155826
+0.0183156 0.0214592 0.0250621 0.0291763 0.0338573 0.0391639 0.0451575
+0.0519019 0.0594631 0.0679081 0.0773047 0.0877205 0.0992216 0.111872
+0.125732 0.140858 0.1573 0.1751 0.194291 0.214896 0.236928 0.260383
+0.285247 0.311486 0.339053 0.367879 0.397882 0.428956 0.46098 0.493812
+0.527292 0.561244 0.595473 0.62977 0.663916 0.697676 0.730811 0.763074
+0.794216 0.823987 0.852144 0.878447 0.902668 0.924595 0.944027 0.960789
+0.974725 0.985703 0.99362 0.998401 1 0.998401 0.99362 0.985703 0.974725
+0.960789 0.944027 0.924595 0.902668 0.878447 0.852144 0.823987 0.794216
+0.763074 0.730811 0.697676 0.663916 0.62977 0.595473 0.561244 0.527292
+0.493812 0.46098 0.428956 0.397882 0.367879 0.339053 0.311486 0.285247
+0.260383 0.236928 0.214896 0.194291 0.1751 0.1573 0.140858 0.125732
+0.111872 0.0992216 0.0877205 0.0773047 0.0679081 0.0594631 0.0519019
+0.0451575 0.0391639 0.0338573 0.0291763 0.0250621 0.0214592 0.0183156
+0.0155826 0.013215 0.0111714 0.0094136 0.00790705 0.0066204 0.0055254
+0.00459678 0.00381201 0.00315111 0.00259648 0.00213263 0.00174605 0.00142498
+0.00115923 0.000940028 0.000759842 0.000612231 0.000491721 0.000393669
+0.000314163 0.000249912 0.000198167 0.000156634 0.00012341 9.69224e-05
+7.58768e-05 5.92113e-05 4.60584e-05 3.57128e-05 2.76026e-05 2.1266e-05
+1.63317e-05 1.25023e-05 9.54016e-06 7.25659e-06 5.50199e-06 4.15832e-06
+3.13275e-06 2.35258e-06 1.76105e-06 1.31404e-06 9.77371e-07 7.24633e-07
+5.35535e-07 3.94519e-07 2.89706e-07 2.12059e-07 1.54727e-07;
+#X coords 0 1 199 0 200 140 1;
+#X restore 342 85 graph;
+#X connect 0 0 1 0;
+#X connect 1 0 5 0;
+#X connect 1 1 4 0;
+#X connect 2 0 3 0;
+#X connect 2 0 6 0;
+#X connect 2 0 9 0;
+#X connect 3 0 2 1;
+#X connect 4 0 2 1;
+#X connect 5 0 2 0;
+#X connect 6 0 10 0;
+#X connect 6 1 7 1;
+#X connect 8 0 7 0;
+#X connect 9 0 5 1;
+#X connect 10 0 8 0;
+#X restore 536 647 pd make-table;
+#X obj 298 558 cos~;
+#X obj 298 533 -~ 0.25;
+#X obj 298 610 +~ 100;
+#X obj 298 633 tabread4~ bell-curve;
+#X obj 184 699 *~;
+#X text 330 658 waveshaper;
+#X text 31 2 CHANGING PAF CONTROLS TO NATURAL UNITS;
+#X obj 80 394 mtof;
+#X obj 211 413 expr 1/$f1;
+#X obj 189 341 mtof;
+#X text 184 298 freq.;
+#X obj 189 437 *~;
+#X text 385 357 bandwidth;
+#X obj 387 406 mtof;
+#X obj 387 491 *~;
+#X obj 387 515 *~ 25;
+#X text 18 23 The more "natural" units for describing a formant might
+be center frequency and bandwidth \, so that you can change the fundamental
+without having the formant shift up and down in parallel. Here all
+three frequencies are expressed in MIDI units. The bandwidth and center
+frequency have to be divided by the fundamental (the expr 1/$f1 takes
+its reciprocal and two *~ objects finish the division.);
+#X text 427 490 divide by fundamental;
+#X text 445 514 range for table;
+#X text 364 609 offset to middle of table;
+#X text 196 459 C.F. relative;
+#X text 197 475 to fundamental;
+#X text 69 346 (MIDI units);
+#X text 220 697 ring mod;
+#X obj 184 726 output~;
+#X text 483 762 updated for Pd version 0.37;
+#X text 19 137 Here we take a somewhat lax approach to sampholding
+the center frequency control. The frequency itself changes instantly
+\, but the center/fundamental frequency ratio waits for the next period.
+This gives a slight "chirp" if the fundamental is abruptly raised a
+couple of octaves. There's no easy way using Pd's built-in primitives
+to avoid this. Note however that there's a "paf~" extern available
+which solves this problem better and \, moreover \, runs much faster.
+;
+#X obj 298 508 *~ 0.5;
+#X connect 0 0 6 1;
+#X connect 0 0 8 0;
+#X connect 1 0 5 0;
+#X connect 1 0 0 0;
+#X connect 2 0 6 0;
+#X connect 3 0 4 1;
+#X connect 3 0 7 1;
+#X connect 4 0 1 1;
+#X connect 5 0 2 0;
+#X connect 6 0 7 0;
+#X connect 7 0 8 1;
+#X connect 8 0 26 0;
+#X connect 9 0 4 0;
+#X connect 9 0 3 0;
+#X connect 10 0 31 0;
+#X connect 12 0 33 0;
+#X connect 13 0 12 0;
+#X connect 14 0 9 1;
+#X connect 14 0 1 0;
+#X connect 14 0 5 1;
+#X connect 14 0 49 0;
+#X connect 15 0 29 0;
+#X connect 17 0 35 0;
+#X connect 18 0 36 0;
+#X connect 19 0 24 0;
+#X connect 20 0 18 0;
+#X connect 22 0 19 0;
+#X connect 23 0 22 0;
+#X connect 24 0 25 0;
+#X connect 25 0 26 1;
+#X connect 26 0 46 0;
+#X connect 26 0 46 1;
+#X connect 29 0 30 0;
+#X connect 29 0 14 0;
+#X connect 30 0 33 1;
+#X connect 30 0 36 1;
+#X connect 31 0 13 0;
+#X connect 33 0 9 0;
+#X connect 35 0 20 0;
+#X connect 36 0 37 0;
+#X connect 37 0 19 1;
+#X connect 49 0 23 0;
diff --git a/pd/doc/3.audio.examples/G05.delay.reverb.pd b/pd/doc/3.audio.examples/G05.delay.reverb.pd
index aad17023..0f5827f9 100644
--- a/pd/doc/3.audio.examples/G05.delay.reverb.pd
+++ b/pd/doc/3.audio.examples/G05.delay.reverb.pd
@@ -4,7 +4,7 @@
#X obj 74 201 -~;
#X obj 74 177 *~ 3;
#X obj 111 183 *~ 2;
-#X floatatom 74 81 0 0 0;
+#X floatatom 74 81 0 0 0 0 - - -;
#X obj 74 153 clip~ 0 0.667;
#X text 124 80 <-- pitch;
#X obj 74 105 mtof;
@@ -134,9 +134,9 @@
#X restore 75 129 pd test-input;
#X text 328 322 updated for Pd version 0.26;
#X text 62 8 REVERBERATOR;
-#X floatatom 75 100 0 0 0;
+#X floatatom 75 100 0 0 0 0 - - -;
#X text 126 105 <-- pitch;
-#X floatatom 137 219 0 0 0;
+#X floatatom 137 219 0 0 0 0 - - -;
#N canvas 159 26 618 379 output 0;
#X obj 393 156 t b;
#X obj 393 106 f;
@@ -200,21 +200,16 @@
#X restore 75 247 pd output;
#X msg 166 219 MUTE;
#X text 184 217 <-- output amplitude;
-#N canvas 137 269 1056 577 reverb 0;
-#X obj 77 37 inlet~;
-#X obj 77 85 echo echo-del2 8.45346;
-#X obj 77 61 echo echo-del1 5.43216;
-#X obj 77 109 echo echo-del3 13.4367;
-#X obj 77 133 echo echo-del4 21.5463;
-#X obj 77 157 echo echo-del5 34.3876;
-#X obj 77 181 echo echo-del6 55.5437;
-#X obj 253 545 delwrite~ loop-del1 70;
-#X obj 295 157 delread~ loop-del1 70;
-#X obj 466 157 delread~ loop-del2 81.9345;
-#X obj 416 545 delwrite~ loop-del2 81.9345;
-#X obj 665 154 delread~ loop-del3 94.7545;
-#X obj 855 154 delread~ loop-del4 115.945;
-#X obj 622 545 delwrite~ loop-del3 94.7545;
+#N canvas 42 106 1114 602 reverb 1;
+#X obj 13 19 inlet~;
+#X obj 13 43 reverb-echo echo-del1 5.43216;
+#X obj 124 547 delwrite~ loop-del1 70;
+#X obj 303 154 delread~ loop-del1 70;
+#X obj 441 177 delread~ loop-del2 81.9345;
+#X obj 326 547 delwrite~ loop-del2 81.9345;
+#X obj 727 163 delread~ loop-del3 94.7545;
+#X obj 788 186 delread~ loop-del4 115.945;
+#X obj 572 547 delwrite~ loop-del3 94.7545;
#X obj 820 545 delwrite~ loop-del4 115.945;
#X obj 282 215 +~;
#X obj 443 215 +~;
@@ -228,12 +223,12 @@
#X obj 411 397 +~;
#X obj 615 407 -~;
#X obj 785 388 -~;
-#X obj 620 474 *~ 0;
-#X obj 620 511 lop~ 5000;
-#X obj 415 472 *~ 0;
-#X obj 415 510 lop~ 5000;
-#X obj 246 475 *~ 0;
-#X obj 246 513 lop~ 5000;
+#X obj 570 476 *~ 0;
+#X obj 570 513 lop~ 5000;
+#X obj 325 474 *~ 0;
+#X obj 325 512 lop~ 5000;
+#X obj 117 477 *~ 0;
+#X obj 117 515 lop~ 5000;
#X obj 821 472 *~ 0;
#X obj 821 506 lop~ 5000;
#X obj 924 254 inlet;
@@ -242,64 +237,69 @@
#X msg 979 303 100;
#X msg 930 349 -100;
#X obj 934 386 / 200;
-#X connect 0 0 2 0;
-#X connect 1 0 3 0;
-#X connect 1 1 3 1;
-#X connect 2 0 1 0;
-#X connect 2 1 1 1;
-#X connect 3 0 4 0;
-#X connect 3 1 4 1;
-#X connect 4 0 5 0;
-#X connect 4 1 5 1;
-#X connect 5 0 6 0;
-#X connect 5 1 6 1;
-#X connect 6 0 15 0;
-#X connect 6 1 16 0;
-#X connect 8 0 15 1;
-#X connect 9 0 16 1;
-#X connect 11 0 19 1;
-#X connect 11 0 21 1;
-#X connect 12 0 20 1;
-#X connect 12 0 22 1;
-#X connect 15 0 17 0;
-#X connect 15 0 19 0;
-#X connect 15 0 21 0;
-#X connect 16 0 18 0;
-#X connect 16 0 20 0;
-#X connect 16 0 22 0;
-#X connect 19 0 23 0;
-#X connect 19 0 25 0;
-#X connect 20 0 25 1;
-#X connect 20 0 23 1;
-#X connect 21 0 24 0;
-#X connect 21 0 26 0;
-#X connect 22 0 24 1;
-#X connect 22 0 26 1;
-#X connect 23 0 27 0;
-#X connect 24 0 29 0;
-#X connect 25 0 31 0;
-#X connect 26 0 33 0;
-#X connect 27 0 28 0;
-#X connect 28 0 13 0;
-#X connect 29 0 30 0;
-#X connect 30 0 10 0;
+#X obj 13 67 reverb-echo echo-del2 8.45346;
+#X obj 13 91 reverb-echo echo-del3 13.4367;
+#X obj 13 115 reverb-echo echo-del4 21.5463;
+#X obj 13 139 reverb-echo echo-del5 34.3876;
+#X obj 13 163 reverb-echo echo-del6 55.5437;
+#X connect 0 0 1 0;
+#X connect 1 0 36 0;
+#X connect 1 1 36 1;
+#X connect 3 0 10 1;
+#X connect 4 0 11 1;
+#X connect 6 0 14 1;
+#X connect 6 0 16 1;
+#X connect 7 0 15 1;
+#X connect 7 0 17 1;
+#X connect 10 0 12 0;
+#X connect 10 0 14 0;
+#X connect 10 0 16 0;
+#X connect 11 0 13 0;
+#X connect 11 0 15 0;
+#X connect 11 0 17 0;
+#X connect 14 0 18 0;
+#X connect 14 0 20 0;
+#X connect 15 0 20 1;
+#X connect 15 0 18 1;
+#X connect 16 0 19 0;
+#X connect 16 0 21 0;
+#X connect 17 0 19 1;
+#X connect 17 0 21 1;
+#X connect 18 0 22 0;
+#X connect 19 0 24 0;
+#X connect 20 0 26 0;
+#X connect 21 0 28 0;
+#X connect 22 0 23 0;
+#X connect 23 0 8 0;
+#X connect 24 0 25 0;
+#X connect 25 0 5 0;
+#X connect 26 0 27 0;
+#X connect 27 0 2 0;
+#X connect 28 0 29 0;
+#X connect 29 0 9 0;
+#X connect 30 0 31 0;
#X connect 31 0 32 0;
-#X connect 32 0 7 0;
-#X connect 33 0 34 0;
-#X connect 34 0 14 0;
-#X connect 35 0 36 0;
+#X connect 31 1 33 0;
+#X connect 32 0 34 0;
+#X connect 32 1 35 0;
+#X connect 33 0 32 0;
+#X connect 34 0 35 0;
+#X connect 35 0 28 1;
+#X connect 35 0 26 1;
+#X connect 35 0 24 1;
+#X connect 35 0 22 1;
#X connect 36 0 37 0;
-#X connect 36 1 38 0;
-#X connect 37 0 39 0;
-#X connect 37 1 40 0;
-#X connect 38 0 37 0;
+#X connect 36 1 37 1;
+#X connect 37 0 38 0;
+#X connect 37 1 38 1;
+#X connect 38 0 39 0;
+#X connect 38 1 39 1;
#X connect 39 0 40 0;
-#X connect 40 0 33 1;
-#X connect 40 0 31 1;
-#X connect 40 0 29 1;
-#X connect 40 0 27 1;
+#X connect 39 1 40 1;
+#X connect 40 0 10 0;
+#X connect 40 1 11 0;
#X restore 50 193 pd reverb;
-#X floatatom 108 163 0 0 0;
+#X floatatom 108 163 0 0 0 0 - - -;
#X text 143 163 <-- feedback (100 maximum);
#X text 32 41 Here is a simple recirculating reverberator. "Feedback"
should be between -100 and 100;
diff --git a/pd/doc/3.audio.examples/46.PART7.filters.pd b/pd/doc/3.audio.examples/H01.intro.filters.pd
index 4a64a0b5..4a64a0b5 100644
--- a/pd/doc/3.audio.examples/46.PART7.filters.pd
+++ b/pd/doc/3.audio.examples/H01.intro.filters.pd
diff --git a/pd/doc/3.audio.examples/H01.more.FM.pd b/pd/doc/3.audio.examples/H01.more.FM.pd
deleted file mode 100644
index 1b0e112b..00000000
--- a/pd/doc/3.audio.examples/H01.more.FM.pd
+++ /dev/null
@@ -1,132 +0,0 @@
-#N canvas 25 100 785 694 12;
-#X floatatom 197 602 0 0 0;
-#N canvas 159 26 541 274 output 0;
-#X obj 351 166 t b;
-#X obj 351 114 f;
-#X obj 351 62 inlet;
-#X text 358 30 mute;
-#X obj 351 192 f;
-#X msg 442 186 0;
-#X msg 351 88 bang;
-#X obj 351 140 moses 1;
-#X obj 413 114 moses 1;
-#X obj 86 153 dbtorms;
-#X obj 413 88 r master-lvl;
-#X obj 86 44 r master-lvl;
-#X obj 351 218 s master-lvl;
-#X obj 12 166 inlet~;
-#X obj 207 43 inlet;
-#X text 207 19 level;
-#X obj 207 104 s master-lvl;
-#X msg 100 67 set \$1;
-#X obj 100 93 outlet;
-#X msg 222 67 \; pd dsp 1;
-#X obj 86 205 line~;
-#X obj 12 218 *~;
-#X obj 12 244 dac~;
-#X obj 86 179 pack 0 50;
-#X text 12 142 audio;
-#X text 100 118 show level;
-#X obj 12 192 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 158 630 pd output;
-#X msg 234 602 MUTE;
-#X text 528 618 updated for Pd version 0.34;
-#X text 277 601 <-- output;
-#X text 79 4 FM \, PWM \, PAF as formant generators;
-#X text 39 22 The next several patches illustrate "Synthesizing Sounds
-with Specified \, Time-Varying Spectra" presented at ICMC 2001 and
-reprinted on http://www.crca.ucsd.edu/~msp/publications.html.;
-#X obj 146 468 line~;
-#X obj 146 444 pack 0 50;
-#X floatatom 146 389 0 0 0;
-#X obj 124 493 *~;
-#X text 145 367 index;
-#X floatatom 248 398 0 0 0;
-#X text 250 370 carrier freq;
-#X obj 158 547 cos~;
-#X graph graph1 0 0 128 500 499 556 755 426;
-#X array spectrum 128 float 0;
-#X pop;
-#X msg 233 546 bang;
-#X text 271 543 <-- click to graph;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 187 574 pd fft;
-#X text 490 562 0;
-#X text 738 559 5512;
-#X obj 153 520 +~;
-#X obj 248 448 phasor~;
-#X obj 23 458 osc~ 172.266;
-#X obj 146 417 / 100;
-#X obj 248 422 * 172.266;
-#X text 34 93 First compare this phase modulation example with the
-ring modulation example from the section on processing (patch 51).
-Here we choose a convenient \, fixed modulation frequency and consider
-the effect of changing carrier frequency and modulation index. It's
-exactly as if the carrier frequency were a ring modulation frequency.
-;
-#X text 33 331 Next we'll look at two techniques for sliding a formant
-frequency without losing harmonicity.;
-#X text 33 191 Using either method we can synthesize the hat-shaped
-spectra called "formants." However \, if you try to move the formant
-up or down in frequency \, you'll lose harmonicity \; the partials
-are only integer multiples of the fundamental \, 172.266 \, when the
-carrier is an integer multiple. To hear this \, set index to 20 and
-carrier frequency to zero \, and scroll carrier through integers. Then
-shift-drag on the carrier frequency to change it in hundredths. Presto
-\, inharmonic sounds...;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 7 0 10 1;
-#X connect 8 0 7 0;
-#X connect 9 0 24 0;
-#X connect 10 0 21 0;
-#X connect 12 0 25 0;
-#X connect 14 0 1 0;
-#X connect 14 0 18 0;
-#X connect 16 0 18 1;
-#X connect 21 0 14 0;
-#X connect 22 0 21 1;
-#X connect 23 0 10 0;
-#X connect 24 0 8 0;
-#X connect 25 0 22 0;
diff --git a/pd/doc/3.audio.examples/47.bandpass.pd b/pd/doc/3.audio.examples/H02.bandpass.pd
index 0ce9cc47..0ce9cc47 100644
--- a/pd/doc/3.audio.examples/47.bandpass.pd
+++ b/pd/doc/3.audio.examples/H02.bandpass.pd
diff --git a/pd/doc/3.audio.examples/H02.packets.pd b/pd/doc/3.audio.examples/H02.packets.pd
deleted file mode 100644
index 072ae27d..00000000
--- a/pd/doc/3.audio.examples/H02.packets.pd
+++ /dev/null
@@ -1,161 +0,0 @@
-#N canvas 83 221 878 705 12;
-#X obj 315 424 line~;
-#X obj 47 517 cos~;
-#X graph graph1 0 -2 882 2 644 469 844 339;
-#X array pulse-output 882 float 0;
-#X pop;
-#X floatatom 84 633 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 48 660 pd output;
-#X msg 124 633 MUTE;
-#X obj 315 400 pack 0 50;
-#X floatatom 315 328 0 0 0;
-#X obj 47 429 -~ 0.5;
-#X obj 47 468 *~;
-#X obj 315 352 / 10;
-#X obj 47 493 clip~ -0.5 0.5;
-#X text 315 306 bandwidth;
-#X msg 165 602 bang;
-#X obj 315 448 +~ 1;
-#X obj 48 540 +~ 1;
-#X obj 197 513 cos~;
-#X obj 48 569 *~;
-#X floatatom 219 342 4 0 0;
-#X obj 219 366 / 10;
-#X text 644 472 --- 0.02 seconds ---;
-#X obj 197 487 *~;
-#N canvas 204 427 939 588 graph 0;
-#X obj 91 345 inlet~;
-#X obj 729 341 inlet;
-#X obj 74 395 tabwrite~ pulse-output;
-#X obj 319 350 inlet~;
-#X obj 493 343 inlet~;
-#X obj 302 400 tabwrite~ window;
-#X obj 484 401 tabwrite~ carrier;
-#X msg 390 53 \; array2 rename window;
-#X connect 0 0 2 0;
-#X connect 1 0 2 0;
-#X connect 1 0 5 0;
-#X connect 1 0 6 0;
-#X connect 3 0 5 0;
-#X connect 4 0 6 0;
-#X restore 76 602 pd graph;
-#X obj 315 376 max 0;
-#X obj 219 438 line~;
-#X obj 219 414 pack 0 50;
-#X obj 219 390 max 0;
-#X graph graph3 0 -2 881 2 644 328 844 188;
-#X array carrier 882 float 0;
-#X pop;
-#X graph graph4 0 -2 881 2 645 175 845 35;
-#X array window 882 float 0;
-#X pop;
-#X text 211 601 <-- graph;
-#X floatatom 47 381 4 0 0;
-#X obj 47 405 phasor~ 100;
-#X text 31 2 WINDOWED PACKETS;
-#X text 169 632 <-- output;
-#X text 43 356 freq.;
-#X text 43 337 fundamental;
-#X text 28 51 The simpler technique is to synthesize enveloped sinusoidal
-wave packets. The packets should repeat at the fundamental frequency
-\, but the frequency of the packet itself controls the center frequency
-of the formant. The length of the packet varies inversely with bandwidth.
-;
-#X text 27 132 In the patch below \, the "clip~" followed by "cos~"
-and "+~ 1" is the enveloping ("windowing" function \, which appears
-in the top graph. This is just the original PWM patch from part 2 The
-carrier \, on the other hand \, is a broken sinusoid made by amplifying
-the phasor~ (the "*~" controlled by "center freq.") and taking the
-cos~ of the result. The "breaks" in the sinusoid only occur when the
-enveloping signal is zero.;
-#X text 197 256 center;
-#X text 195 275 freq. (in;
-#X text 194 294 tenths of;
-#X text 193 314 fundamental);
-#X text 92 535 window;
-#X text 233 487 magnified phase;
-#X text 278 531 desired center frequency;
-#X text 250 514 <--this cosine goes at the;
-#X text 279 550 but its phase is reset each;
-#X text 277 569 fundamental period.;
-#X text 612 666 updated for Pd version 0.34;
-#X connect 0 0 14 0;
-#X connect 1 0 15 0;
-#X connect 3 0 4 1;
-#X connect 4 0 3 0;
-#X connect 5 0 4 2;
-#X connect 6 0 0 0;
-#X connect 7 0 10 0;
-#X connect 8 0 9 0;
-#X connect 8 0 21 0;
-#X connect 9 0 11 0;
-#X connect 10 0 23 0;
-#X connect 11 0 1 0;
-#X connect 13 0 22 3;
-#X connect 14 0 9 1;
-#X connect 15 0 17 0;
-#X connect 15 0 22 1;
-#X connect 16 0 17 1;
-#X connect 16 0 22 2;
-#X connect 17 0 22 0;
-#X connect 17 0 4 0;
-#X connect 18 0 19 0;
-#X connect 19 0 26 0;
-#X connect 21 0 16 0;
-#X connect 23 0 6 0;
-#X connect 24 0 21 1;
-#X connect 25 0 24 0;
-#X connect 26 0 25 0;
-#X connect 30 0 31 0;
-#X connect 31 0 8 0;
diff --git a/pd/doc/3.audio.examples/48.filter.sweep.pd b/pd/doc/3.audio.examples/H03.filter.sweep.pd
index 0d478275..0d478275 100644
--- a/pd/doc/3.audio.examples/48.filter.sweep.pd
+++ b/pd/doc/3.audio.examples/H03.filter.sweep.pd
diff --git a/pd/doc/3.audio.examples/H03.packet.spectrum.pd b/pd/doc/3.audio.examples/H03.packet.spectrum.pd
deleted file mode 100644
index bef1483b..00000000
--- a/pd/doc/3.audio.examples/H03.packet.spectrum.pd
+++ /dev/null
@@ -1,147 +0,0 @@
-#N canvas 83 221 774 628 12;
-#X obj 302 351 line~;
-#X obj 34 444 cos~;
-#X floatatom 71 560 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 35 587 pd output;
-#X msg 111 560 MUTE;
-#X obj 302 327 pack 0 50;
-#X floatatom 302 255 0 0 0;
-#X obj 34 356 -~ 0.5;
-#X obj 34 395 *~;
-#X obj 302 279 / 10;
-#X obj 34 420 clip~ -0.5 0.5;
-#X text 302 233 bandwidth;
-#X obj 302 375 +~ 1;
-#X obj 35 467 +~ 1;
-#X obj 184 440 cos~;
-#X obj 35 496 *~;
-#X floatatom 206 269 4 0 0;
-#X obj 206 293 / 10;
-#X obj 184 414 *~;
-#X text 204 224 center;
-#X text 204 243 freq.;
-#X obj 302 303 max 0;
-#X obj 206 365 line~;
-#X obj 206 341 pack 0 50;
-#X obj 206 317 max 0;
-#X floatatom 34 308 4 0 0;
-#X obj 34 332 phasor~ 100;
-#X text 156 559 <-- output;
-#X text 30 283 freq.;
-#X text 30 264 fundamental;
-#X graph graph1 0 0 128 500 440 492 696 362;
-#X array spectrum 128 float 0;
-#X pop;
-#X msg 108 498 bang;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 59 524 pd fft;
-#X text 439 502 0;
-#X text 687 499 5512;
-#X text 149 498 <-- graph;
-#X text 31 2 WINDOWED PACKET SPECTRUM;
-#X text 19 34 Here's the spectrum you get. Note that even if you put
-the center frequency right on a partial \, there is significant energy
-in neighboring partials (try fundamental 440 \, "center freq" 30 \,
-bandwidth 0.);
-#X text 18 104 The center frequency is in units of ten per partial
-\, or in other words a value of "30" means "centered on the third partial".
-;
-#X text 505 596 updated for Pd version 0.34;
-#X text 22 155 This technique only works if you're doing Hanning-window
-shaped PWM--you can't combine this naturally with FM or with the waveshaping
-technique we'll see later.;
-#X connect 0 0 12 0;
-#X connect 1 0 13 0;
-#X connect 2 0 3 1;
-#X connect 3 0 2 0;
-#X connect 4 0 3 2;
-#X connect 5 0 0 0;
-#X connect 6 0 9 0;
-#X connect 7 0 8 0;
-#X connect 7 0 18 0;
-#X connect 8 0 10 0;
-#X connect 9 0 21 0;
-#X connect 10 0 1 0;
-#X connect 12 0 8 1;
-#X connect 13 0 15 0;
-#X connect 14 0 15 1;
-#X connect 15 0 3 0;
-#X connect 15 0 32 0;
-#X connect 16 0 17 0;
-#X connect 17 0 24 0;
-#X connect 18 0 14 0;
-#X connect 21 0 5 0;
-#X connect 22 0 18 1;
-#X connect 23 0 22 0;
-#X connect 24 0 23 0;
-#X connect 25 0 26 0;
-#X connect 26 0 7 0;
-#X connect 31 0 32 1;
diff --git a/pd/doc/3.audio.examples/49.filter.floyd.pd b/pd/doc/3.audio.examples/H04.filter.floyd.pd
index 02027117..02027117 100644
--- a/pd/doc/3.audio.examples/49.filter.floyd.pd
+++ b/pd/doc/3.audio.examples/H04.filter.floyd.pd
diff --git a/pd/doc/3.audio.examples/H04.two.cosines.pd b/pd/doc/3.audio.examples/H04.two.cosines.pd
deleted file mode 100644
index 0f813164..00000000
--- a/pd/doc/3.audio.examples/H04.two.cosines.pd
+++ /dev/null
@@ -1,124 +0,0 @@
-#N canvas 10 49 705 610 12;
-#X floatatom 262 549 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 226 576 pd output;
-#X msg 302 549 MUTE;
-#X msg 59 550 bang;
-#X obj 185 427 cos~;
-#X floatatom 232 217 4 0 0;
-#X obj 232 241 / 10;
-#X text 464 288 --- 0.02 seconds ---;
-#X obj 185 397 *~;
-#X text 236 133 center;
-#X obj 232 313 line~;
-#X obj 232 265 max 0;
-#X graph graph3 0 -2 881 2 450 276 650 136;
-#X array carrier 882 float 0;
-#X pop;
-#X floatatom 33 284 4 0 0;
-#X text 29 240 fundamental;
-#X text 31 2 ADDING TWO COSINES;
-#X text 234 152 freq. (in;
-#X text 233 171 tenths of;
-#X text 232 191 fundamental);
-#X text 29 259 frequency;
-#X obj 227 427 cos~;
-#X obj 268 340 wrap~;
-#X obj 232 367 -~;
-#X obj 227 397 +~;
-#X obj 232 464 -~;
-#X obj 247 494 *~;
-#X obj 225 519 +~;
-#X obj 59 578 tabwrite~ carrier;
-#X obj 33 308 phasor~ 40;
-#X obj 232 289 pack 0 50;
-#X text 27 36 The other \, spiffier way is to make a sum of cosines
-to interpolate between adjacent harmonics. Suppose for example we want
-a center frequency of 5.3 (in units of the fundamental.) We just take
-partial 5 with amplitude 0.7 and partial 6 with amplitude 0.7:;
-#X text 451 581 updated for Pd version 0.34;
-#X text 281 366 subtract to get the integer part "n";
-#X text 277 399 multiply phase by n and n+1;
-#X text 282 427 synthesize the two partials;
-#X text 54 526 graph;
-#X text 347 548 <--output;
-#X text 323 339 the fractional part "b";
-#X text 280 463 p2 - p1;
-#X text 295 492 b * (p2 - p1);
-#X text 264 519 b * p2 + (1-b) * p1;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 27 0;
-#X connect 4 0 24 1;
-#X connect 4 0 26 0;
-#X connect 5 0 6 0;
-#X connect 6 0 11 0;
-#X connect 8 0 4 0;
-#X connect 8 0 23 0;
-#X connect 10 0 22 0;
-#X connect 10 0 21 0;
-#X connect 11 0 29 0;
-#X connect 13 0 28 0;
-#X connect 20 0 24 0;
-#X connect 21 0 22 1;
-#X connect 21 0 25 1;
-#X connect 22 0 8 1;
-#X connect 23 0 20 0;
-#X connect 24 0 25 0;
-#X connect 25 0 26 1;
-#X connect 26 0 1 0;
-#X connect 26 0 27 0;
-#X connect 28 0 8 0;
-#X connect 28 0 23 1;
-#X connect 29 0 10 0;
diff --git a/pd/doc/3.audio.examples/H05.declickit.pd b/pd/doc/3.audio.examples/H05.declickit.pd
deleted file mode 100644
index eb296e63..00000000
--- a/pd/doc/3.audio.examples/H05.declickit.pd
+++ /dev/null
@@ -1,132 +0,0 @@
-#N canvas 10 49 715 680 12;
-#X floatatom 242 612 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 206 639 pd output;
-#X msg 282 612 MUTE;
-#X obj 165 490 cos~;
-#X obj 165 460 *~;
-#X obj 207 490 cos~;
-#X obj 249 406 wrap~;
-#X obj 212 415 -~;
-#X obj 207 460 +~;
-#X obj 207 525 -~;
-#X obj 227 557 *~;
-#X obj 205 582 +~;
-#X text 454 648 updated for Pd version 0.34;
-#X text 327 611 <--output;
-#X obj 191 184 loadbang;
-#X obj 191 210 metro 400;
-#X obj 203 234 del 200;
-#X obj 204 335 samphold~;
-#X obj 259 364 toggle 20 0 empty empty empty 20 8 0 10 -262144 -1 -1
-0 1;
-#X obj 166 290 sig~;
-#X msg 203 263 3.5;
-#X msg 166 263 2;
-#X obj 23 280 phasor~ 169;
-#N canvas 0 0 600 400 switch 0;
-#X obj 85 52 inlet~;
-#X obj 177 58 inlet~;
-#X obj 298 66 inlet;
-#X obj 112 107 -~;
-#X obj 112 131 *~ 0;
-#X obj 90 157 +~;
-#X obj 160 249 outlet~;
-#X connect 0 0 3 1;
-#X connect 0 0 5 0;
-#X connect 1 0 3 0;
-#X connect 2 0 4 1;
-#X connect 3 0 4 0;
-#X connect 4 0 5 1;
-#X connect 5 0 6 0;
-#X restore 166 364 pd switch;
-#X text 31 2 CHANGING THE CENTER FREQUENCY QUICKLY;
-#X text 313 381 off to hear the straight sig~;
-#X text 286 363 <--on to hear the "samphold~" \,;
-#X text 25 27 Since in the previous patch the amplitudes of the two
-cosines depend on "center frequency" we can't change that discontinuously
-without clicking \, as you hear in this patch. The fix is to use a
-samphold~ object to keep the center frequency frozen except at phase
-crossings. At the phase crossings the two weighted cosines add to one
-\, so we can discontinuously change the frequencies and weights there.
-;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 9 1;
-#X connect 3 0 11 0;
-#X connect 4 0 3 0;
-#X connect 4 0 8 0;
-#X connect 5 0 9 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 4 1;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 1 0;
-#X connect 14 0 15 0;
-#X connect 15 0 21 0;
-#X connect 15 0 16 0;
-#X connect 16 0 20 0;
-#X connect 17 0 23 1;
-#X connect 18 0 23 2;
-#X connect 19 0 17 0;
-#X connect 19 0 23 0;
-#X connect 20 0 19 0;
-#X connect 21 0 19 0;
-#X connect 22 0 4 0;
-#X connect 22 0 8 1;
-#X connect 22 0 17 1;
-#X connect 23 0 7 0;
-#X connect 23 0 6 0;
diff --git a/pd/doc/3.audio.examples/50.filter.noise.pd b/pd/doc/3.audio.examples/H05.filter.noise.pd
index 7421c180..7421c180 100644
--- a/pd/doc/3.audio.examples/50.filter.noise.pd
+++ b/pd/doc/3.audio.examples/H05.filter.noise.pd
diff --git a/pd/doc/3.audio.examples/H06.sweepable.FM.pd b/pd/doc/3.audio.examples/H06.sweepable.FM.pd
deleted file mode 100644
index ff3827ee..00000000
--- a/pd/doc/3.audio.examples/H06.sweepable.FM.pd
+++ /dev/null
@@ -1,161 +0,0 @@
-#N canvas 89 117 803 661 12;
-#X floatatom 242 605 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 204 634 pd output;
-#X msg 280 606 MUTE;
-#X obj 165 506 cos~;
-#X obj 165 460 *~;
-#X obj 208 508 cos~;
-#X obj 249 409 wrap~;
-#X obj 212 408 -~;
-#X obj 208 485 +~;
-#X obj 206 543 -~;
-#X obj 226 575 *~;
-#X obj 204 600 +~;
-#X text 520 628 updated for Pd version 0.34;
-#X text 325 605 <--output;
-#X obj 212 378 samphold~;
-#X text 31 2 APPLYING TWO-COSINE CARRIER TO FM;
-#X floatatom 229 238 4 0 0;
-#X obj 229 261 / 10;
-#X text 229 157 center;
-#X obj 229 330 line~;
-#X obj 229 284 max 0;
-#X text 229 177 freq. (in;
-#X text 229 197 tenths of;
-#X text 229 217 fundamental);
-#X obj 229 307 pack 0 50;
-#X obj 118 313 phasor~;
-#X floatatom 118 290 4 0 0;
-#X text 103 237 fundamental;
-#X text 103 257 (= mod freq);
-#X text 432 284 index;
-#X text 432 304 (percent);
-#X floatatom 432 325 4 0 0;
-#X obj 382 391 cos~;
-#X obj 432 394 line~;
-#X obj 382 414 *~;
-#X obj 432 348 / 100;
-#X obj 432 371 pack 0 50;
-#X obj 165 483 +~;
-#X graph graph1 0 0 128 500 515 256 771 126;
-#X array spectrum 128 float 0;
-#X pop;
-#X text 511 261 0;
-#X text 759 258 5512;
-#X msg 117 599 bang;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 68 630 pd fft;
-#X text 25 33 And now we just treat the cosines like carrier signals
-in an FM instrument. This doesn't work as well as you'd wish \, because
-the phases of the partials of the two FM instruments don't line up
-\, so that \, for indices of modulation above about 20% \, you get
-beating effects as the center frequency goes up and down.;
-#X text 385 440 modulating;
-#X text 385 460 oscillator;
-#X text 37 482 both phases-->;
-#X text 6 465 add modulator to;
-#X text 117 577 graph;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 9 1;
-#X connect 3 0 11 0;
-#X connect 4 0 37 0;
-#X connect 5 0 9 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 4 1;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 1 0;
-#X connect 11 0 42 0;
-#X connect 14 0 7 0;
-#X connect 14 0 6 0;
-#X connect 16 0 17 0;
-#X connect 17 0 20 0;
-#X connect 19 0 14 0;
-#X connect 20 0 24 0;
-#X connect 24 0 19 0;
-#X connect 25 0 14 1;
-#X connect 25 0 32 0;
-#X connect 25 0 4 0;
-#X connect 25 0 8 1;
-#X connect 26 0 25 0;
-#X connect 31 0 35 0;
-#X connect 32 0 34 0;
-#X connect 33 0 34 1;
-#X connect 34 0 37 1;
-#X connect 35 0 36 0;
-#X connect 36 0 33 0;
-#X connect 37 0 8 0;
-#X connect 37 0 3 0;
-#X connect 41 0 42 1;
diff --git a/pd/doc/3.audio.examples/H07.paf.pd b/pd/doc/3.audio.examples/H07.paf.pd
deleted file mode 100644
index 56c024c0..00000000
--- a/pd/doc/3.audio.examples/H07.paf.pd
+++ /dev/null
@@ -1,234 +0,0 @@
-#N canvas 53 0 782 687 12;
-#X floatatom 253 735 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 215 764 pd output;
-#X msg 291 735 MUTE;
-#X obj 158 616 cos~;
-#X obj 158 593 *~;
-#X obj 201 616 cos~;
-#X obj 257 542 wrap~;
-#X obj 221 542 -~;
-#X obj 201 593 +~;
-#X obj 194 646 -~;
-#X obj 214 678 *~;
-#X obj 176 678 +~;
-#X text 515 768 updated for Pd version 0.34;
-#X text 336 734 <--output;
-#X obj 221 510 samphold~;
-#X floatatom 221 369 4 0 0;
-#X obj 221 392 / 10;
-#X text 221 288 center;
-#X obj 221 461 line~;
-#X obj 221 415 max 0;
-#X text 221 308 freq. (in;
-#X text 221 328 tenths of;
-#X text 221 348 fundamental);
-#X obj 221 438 pack 0 50;
-#X obj 104 445 phasor~;
-#X floatatom 104 399 4 0 0;
-#X text 84 372 fundamental;
-#X text 435 441 index;
-#X text 435 461 (percent);
-#X floatatom 435 482 4 0 0;
-#X obj 435 528 line~;
-#X obj 343 550 *~;
-#X obj 435 505 pack 0 50;
-#X graph graph1 0 0 128 500 510 395 766 265;
-#X array spectrum 128 float 0;
-#X pop;
-#X text 501 397 0;
-#X text 745 398 5512;
-#X msg 80 713 bang;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 31 745 pd fft;
-#X text 82 687 graph;
-#X text 31 2 THE PAF: TWO-COSINE RING MODULATOR FOR WAVESHAPER;
-#X graph graph4 0 0 199 1 563 718 763 578;
-#X array bell-curve 200 float 1;
-#A 0 1.12535e-07 1.54727e-07 2.12059e-07 2.89706e-07 3.94519e-07 5.35535e-07
-7.24633e-07 9.77371e-07 1.31404e-06 1.76105e-06 2.35258e-06 3.13275e-06
-4.15832e-06 5.50199e-06 7.25659e-06 9.54016e-06 1.25023e-05 1.63317e-05
-2.1266e-05 2.76026e-05 3.57128e-05 4.60584e-05 5.92113e-05 7.58768e-05
-9.69224e-05 0.00012341 0.000156634 0.000198167 0.000249912 0.000314163
-0.000393669 0.000491721 0.000612231 0.000759842 0.000940028 0.00115923
-0.00142498 0.00174605 0.00213263 0.00259648 0.00315111 0.00381201 0.00459678
-0.0055254 0.0066204 0.00790705 0.0094136 0.0111714 0.013215 0.0155826
-0.0183156 0.0214592 0.0250621 0.0291763 0.0338573 0.0391639 0.0451575
-0.0519019 0.0594631 0.0679081 0.0773047 0.0877205 0.0992216 0.111872
-0.125732 0.140858 0.1573 0.1751 0.194291 0.214896 0.236928 0.260383
-0.285247 0.311486 0.339053 0.367879 0.397882 0.428956 0.46098 0.493812
-0.527292 0.561244 0.595473 0.62977 0.663916 0.697676 0.730811 0.763074
-0.794216 0.823987 0.852144 0.878447 0.902668 0.924595 0.944027 0.960789
-0.974725 0.985703 0.99362 0.998401 1 0.998401 0.99362 0.985703 0.974725
-0.960789 0.944027 0.924595 0.902668 0.878447 0.852144 0.823987 0.794216
-0.763074 0.730811 0.697676 0.663916 0.62977 0.595473 0.561244 0.527292
-0.493812 0.46098 0.428956 0.397882 0.367879 0.339053 0.311486 0.285247
-0.260383 0.236928 0.214896 0.194291 0.1751 0.1573 0.140858 0.125732
-0.111872 0.0992216 0.0877205 0.0773047 0.0679081 0.0594631 0.0519019
-0.0451575 0.0391639 0.0338573 0.0291763 0.0250621 0.0214592 0.0183156
-0.0155826 0.013215 0.0111714 0.0094136 0.00790705 0.0066204 0.0055254
-0.00459678 0.00381201 0.00315111 0.00259648 0.00213263 0.00174605 0.00142498
-0.00115923 0.000940028 0.000759842 0.000612231 0.000491721 0.000393669
-0.000314163 0.000249912 0.000198167 0.000156634 0.00012341 9.69224e-05
-7.58768e-05 5.92113e-05 4.60584e-05 3.57128e-05 2.76026e-05 2.1266e-05
-1.63317e-05 1.25023e-05 9.54016e-06 7.25659e-06 5.50199e-06 4.15832e-06
-3.13275e-06 2.35258e-06 1.76105e-06 1.31404e-06 9.77371e-07 7.24633e-07
-5.35535e-07 3.94519e-07 2.89706e-07 2.12059e-07 1.54727e-07;
-#X pop;
-#N canvas 94 264 600 388 make-table 0;
-#X msg 81 44 bang;
-#X obj 81 73 t b b;
-#X obj 159 142 f;
-#X obj 197 142 + 1;
-#X msg 175 112 0;
-#X obj 81 102 until;
-#X obj 161 177 t f f;
-#X obj 76 306 tabwrite bell-curve;
-#X obj 52 270 expr exp(-$f1*$f1);
-#X obj 63 168 sel 199;
-#X obj 51 241 expr ($f1-100)/25;
-#X connect 0 0 1 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 2 0 9 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 0;
-#X connect 6 0 10 0;
-#X connect 6 1 7 1;
-#X connect 8 0 7 0;
-#X connect 9 0 5 1;
-#X connect 10 0 8 0;
-#X restore 627 538 pd make-table;
-#X obj 104 422 * 0.5;
-#X obj 343 527 cos~;
-#X obj 343 504 -~ 0.25;
-#X obj 343 573 +~ 100;
-#X obj 343 596 tabread4~ bell-curve;
-#X obj 104 474 *~ 2;
-#X obj 215 707 *~;
-#X text 25 33 Instead of using the two cosines as FM carrier oscillators
-\, we can use them as ring modulators for a synthetic tone. Here (as
-described in the paper) we use a sinusoid looking up a Gaussian bell
-curve. This has the nice properties that the partials are always positive
-cosines in phase \, and the spectrum spreads out smoothly as the index
-changes.;
-#X text 26 137 We needed the sine wave to have half the fundamental
-frequency \, so we run the phasor~ at half speed but double its output
-to the cosine pair and the samphold~ \, thus giving us the original
-frequency. As to the half-speed signal \, we take its sine (-~ 0.25
-and cos~) \, then center it for lookup in a 200-point table containing
-a bell curve.;
-#X text 251 705 <--ring mod step;
-#X text 375 621 waveshaper;
-#X text 27 239 Then with ~* we do the ring modulation and we're done.
-;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 9 1;
-#X connect 3 0 11 0;
-#X connect 4 0 8 0;
-#X connect 4 0 3 0;
-#X connect 5 0 9 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 4 1;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 48 0;
-#X connect 14 0 7 0;
-#X connect 14 0 6 0;
-#X connect 15 0 16 0;
-#X connect 16 0 19 0;
-#X connect 18 0 14 0;
-#X connect 19 0 23 0;
-#X connect 23 0 18 0;
-#X connect 24 0 44 0;
-#X connect 24 0 47 0;
-#X connect 25 0 42 0;
-#X connect 29 0 32 0;
-#X connect 30 0 31 1;
-#X connect 31 0 45 0;
-#X connect 32 0 30 0;
-#X connect 36 0 37 1;
-#X connect 42 0 24 0;
-#X connect 43 0 31 0;
-#X connect 44 0 43 0;
-#X connect 45 0 46 0;
-#X connect 46 0 48 1;
-#X connect 47 0 14 1;
-#X connect 47 0 4 0;
-#X connect 47 0 8 0;
-#X connect 48 0 1 0;
-#X connect 48 0 37 0;
diff --git a/pd/doc/3.audio.examples/52.ssb.modulation.pd b/pd/doc/3.audio.examples/H07.ssb.modulation.pd
index 968b3b45..968b3b45 100644
--- a/pd/doc/3.audio.examples/52.ssb.modulation.pd
+++ b/pd/doc/3.audio.examples/H07.ssb.modulation.pd
diff --git a/pd/doc/3.audio.examples/H08.paf.control.pd b/pd/doc/3.audio.examples/H08.paf.control.pd
deleted file mode 100644
index 7d329357..00000000
--- a/pd/doc/3.audio.examples/H08.paf.control.pd
+++ /dev/null
@@ -1,219 +0,0 @@
-#N canvas 89 36 743 752 12;
-#X floatatom 217 684 0 0 0;
-#N canvas 176 241 532 273 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 398 111 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 398 86 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 17 148 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 15 125 audio;
-#X text 93 110 show level;
-#X obj 17 177 hip~ 1;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 26 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X connect 26 0 21 0;
-#X restore 179 713 pd output;
-#X msg 255 684 MUTE;
-#X obj 122 565 cos~;
-#X obj 122 542 *~;
-#X obj 165 565 cos~;
-#X obj 220 510 wrap~;
-#X obj 184 510 -~;
-#X obj 165 542 +~;
-#X obj 158 595 -~;
-#X obj 178 627 *~;
-#X obj 140 627 +~;
-#X text 478 719 updated for Pd version 0.34;
-#X text 299 702 <--output;
-#X obj 184 478 samphold~;
-#X floatatom 183 266 4 0 0;
-#X text 181 218 center;
-#X obj 184 345 line~;
-#X obj 184 322 pack 0 50;
-#X obj 67 413 phasor~;
-#X floatatom 69 305 4 0 0;
-#X text 52 256 fundamental;
-#X floatatom 408 361 4 0 0;
-#X obj 408 438 line~;
-#X obj 306 518 *~;
-#X obj 408 415 pack 0 50;
-#N canvas 94 264 600 388 make-table 0;
-#X msg 81 44 bang;
-#X obj 81 73 t b b;
-#X obj 159 142 f;
-#X obj 197 142 + 1;
-#X msg 175 112 0;
-#X obj 81 102 until;
-#X obj 161 177 t f f;
-#X obj 76 306 tabwrite bell-curve;
-#X obj 52 270 expr exp(-$f1*$f1);
-#X obj 63 168 sel 199;
-#X obj 51 241 expr ($f1-100)/25;
-#X graph graph4 0 0 199 1 342 225 542 85;
-#X array bell-curve 200 float 1;
-#A 0 1.12535e-07 1.54727e-07 2.12059e-07 2.89706e-07 3.94519e-07 5.35535e-07
-7.24633e-07 9.77371e-07 1.31404e-06 1.76105e-06 2.35258e-06 3.13275e-06
-4.15832e-06 5.50199e-06 7.25659e-06 9.54016e-06 1.25023e-05 1.63317e-05
-2.1266e-05 2.76026e-05 3.57128e-05 4.60584e-05 5.92113e-05 7.58768e-05
-9.69224e-05 0.00012341 0.000156634 0.000198167 0.000249912 0.000314163
-0.000393669 0.000491721 0.000612231 0.000759842 0.000940028 0.00115923
-0.00142498 0.00174605 0.00213263 0.00259648 0.00315111 0.00381201 0.00459678
-0.0055254 0.0066204 0.00790705 0.0094136 0.0111714 0.013215 0.0155826
-0.0183156 0.0214592 0.0250621 0.0291763 0.0338573 0.0391639 0.0451575
-0.0519019 0.0594631 0.0679081 0.0773047 0.0877205 0.0992216 0.111872
-0.125732 0.140858 0.1573 0.1751 0.194291 0.214896 0.236928 0.260383
-0.285247 0.311486 0.339053 0.367879 0.397882 0.428956 0.46098 0.493812
-0.527292 0.561244 0.595473 0.62977 0.663916 0.697676 0.730811 0.763074
-0.794216 0.823987 0.852144 0.878447 0.902668 0.924595 0.944027 0.960789
-0.974725 0.985703 0.99362 0.998401 1 0.998401 0.99362 0.985703 0.974725
-0.960789 0.944027 0.924595 0.902668 0.878447 0.852144 0.823987 0.794216
-0.763074 0.730811 0.697676 0.663916 0.62977 0.595473 0.561244 0.527292
-0.493812 0.46098 0.428956 0.397882 0.367879 0.339053 0.311486 0.285247
-0.260383 0.236928 0.214896 0.194291 0.1751 0.1573 0.140858 0.125732
-0.111872 0.0992216 0.0877205 0.0773047 0.0679081 0.0594631 0.0519019
-0.0451575 0.0391639 0.0338573 0.0291763 0.0250621 0.0214592 0.0183156
-0.0155826 0.013215 0.0111714 0.0094136 0.00790705 0.0066204 0.0055254
-0.00459678 0.00381201 0.00315111 0.00259648 0.00213263 0.00174605 0.00142498
-0.00115923 0.000940028 0.000759842 0.000612231 0.000491721 0.000393669
-0.000314163 0.000249912 0.000198167 0.000156634 0.00012341 9.69224e-05
-7.58768e-05 5.92113e-05 4.60584e-05 3.57128e-05 2.76026e-05 2.1266e-05
-1.63317e-05 1.25023e-05 9.54016e-06 7.25659e-06 5.50199e-06 4.15832e-06
-3.13275e-06 2.35258e-06 1.76105e-06 1.31404e-06 9.77371e-07 7.24633e-07
-5.35535e-07 3.94519e-07 2.89706e-07 2.12059e-07 1.54727e-07;
-#X pop;
-#X connect 0 0 1 0;
-#X connect 1 0 5 0;
-#X connect 1 1 4 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 2 0 9 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 0;
-#X connect 6 0 10 0;
-#X connect 6 1 7 1;
-#X connect 8 0 7 0;
-#X connect 9 0 5 1;
-#X connect 10 0 8 0;
-#X restore 573 591 pd make-table;
-#X obj 67 390 * 0.5;
-#X obj 306 495 cos~;
-#X obj 306 472 -~ 0.25;
-#X obj 306 549 +~ 100;
-#X obj 306 572 tabread4~ bell-curve;
-#X obj 67 442 *~ 2;
-#X obj 179 656 *~;
-#X text 338 597 waveshaper;
-#X text 31 2 CHANGING PAF CONTROLS TO NATURAL UNITS;
-#X obj 67 362 mtof;
-#X obj 68 335 max 0;
-#X obj 206 370 expr 1/$f1;
-#X obj 183 296 mtof;
-#X text 181 238 freq.;
-#X obj 184 394 *~;
-#X text 406 340 bandwidth;
-#X obj 408 389 mtof;
-#X obj 408 474 *~;
-#X obj 408 498 *~ 25;
-#X text 25 33 The more "natural" units for describing a formant might
-be center frequency and bandwidth \, so that you can change the fundamental
-without having the formant shift up and down in parallel. Here all
-three frequencies are expressed in MIDI units. The bandwidth and center
-frequency have to be divided by the fundamental (the expr 1/$f1 takes
-its reciprocal and two *~ objects finish the division.);
-#X text 448 473 divide by fundamental;
-#X text 466 497 range for table;
-#X text 372 548 offset to middle of table;
-#X text 191 416 C.F. relative;
-#X text 192 432 to fundamental;
-#X text 48 275 (MIDI units);
-#X text 215 654 ring mod;
-#X text 25 150 And now you essentially have the PAF. Note \, however
-\, that there's a nice paf~ "external" object in the "extras" library
-that does this all more efficiently and takes care of a couple of subtle
-details we don't see here...;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 9 1;
-#X connect 3 0 11 0;
-#X connect 4 0 8 0;
-#X connect 4 0 3 0;
-#X connect 5 0 9 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 4 1;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 33 0;
-#X connect 14 0 7 0;
-#X connect 14 0 6 0;
-#X connect 15 0 39 0;
-#X connect 17 0 41 0;
-#X connect 18 0 17 0;
-#X connect 19 0 29 0;
-#X connect 19 0 32 0;
-#X connect 20 0 37 0;
-#X connect 22 0 43 0;
-#X connect 23 0 44 0;
-#X connect 24 0 30 0;
-#X connect 25 0 23 0;
-#X connect 27 0 19 0;
-#X connect 28 0 24 0;
-#X connect 29 0 28 0;
-#X connect 30 0 31 0;
-#X connect 31 0 33 1;
-#X connect 32 0 14 1;
-#X connect 32 0 4 0;
-#X connect 32 0 8 0;
-#X connect 33 0 1 0;
-#X connect 36 0 27 0;
-#X connect 36 0 38 0;
-#X connect 37 0 36 0;
-#X connect 38 0 41 1;
-#X connect 38 0 44 1;
-#X connect 39 0 18 0;
-#X connect 41 0 14 0;
-#X connect 43 0 25 0;
-#X connect 44 0 45 0;
-#X connect 45 0 24 1;
diff --git a/pd/doc/3.audio.examples/J01.quartic.pd b/pd/doc/3.audio.examples/J01.quartic.pd
deleted file mode 100644
index d71da05a..00000000
--- a/pd/doc/3.audio.examples/J01.quartic.pd
+++ /dev/null
@@ -1,140 +0,0 @@
-#N canvas 57 35 614 650 12;
-#X graph graph1 0 0 40 1 151 551 551 301;
-#X array array-ampdb 41 float 1;
-#A 0 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
-0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
-0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
-0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
-0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
-0.794328 0.891251 1;
-#X array array-dbdb 41 float 1;
-#A 0 0 0.025 0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225 0.25 0.275 0.3
-0.325 0.35 0.375 0.4 0.425 0.45 0.475 0.5 0.525 0.55 0.575 0.6 0.625
-0.65 0.675 0.7 0.725 0.75 0.775 0.8 0.825 0.85 0.875 0.9 0.925 0.95
-0.975 1;
-#X array array-4thpow 41 float 1;
-#A 0 0 3.90624e-07 6.25001e-06 3.16406e-05 1e-04 0.000244141 0.00050625
-0.000937891 0.0016 0.00256289 0.00390625 0.00571914 0.0081 0.0111566
-0.0150063 0.0197754 0.0256 0.0326254 0.0410062 0.0509067 0.0625 0.0759691
-0.0915063 0.109313 0.1296 0.152588 0.178506 0.207594 0.2401 0.276282
-0.316406 0.36075 0.4096 0.46325 0.522006 0.586182 0.6561 0.732094 0.814506
-0.903688 1;
-#X pop;
-#N canvas 293 37 890 657 otherstuff 0;
-#X obj 42 438 loadbang;
-#X msg 259 94 bang;
-#X obj 259 123 t b b;
-#X obj 337 192 f;
-#X obj 375 192 + 1;
-#X msg 353 162 0;
-#X obj 259 152 until;
-#X obj 263 329 dbtorms;
-#X obj 339 227 t f f;
-#X msg 51 101 bang;
-#X obj 51 130 t b b;
-#X obj 129 199 f;
-#X obj 167 199 + 1;
-#X msg 145 169 0;
-#X obj 51 159 until;
-#X obj 131 234 t f f;
-#X obj 59 339 tabwrite array-dbdb;
-#X obj 263 355 tabwrite array-ampdb;
-#X msg 505 98 bang;
-#X obj 505 127 t b b;
-#X obj 583 196 f;
-#X obj 621 196 + 1;
-#X msg 599 166 0;
-#X obj 505 156 until;
-#X obj 585 231 t f f;
-#X obj 559 432 expr $f1 * $f1 * $f1 * $f1;
-#X obj 559 341 expr 1 + $f2 * ($f1 - 1);
-#X obj 705 253 loadbang;
-#X floatatom 703 309 0 0 0;
-#X msg 705 281 1;
-#X obj 559 385 max 0;
-#X obj 561 464 tabwrite array-4thpow;
-#X obj 263 274 + 100;
-#X obj 51 232 sel 40;
-#X obj 258 221 sel 40;
-#X obj 503 226 sel 40;
-#X obj 559 300 / 40;
-#X obj 263 302 - 40;
-#X obj 93 303 / 40;
-#X msg 43 465 \; graph1 xlabel -0.03 0 10 20 30 40 \; graph1 ylabel
--2 0.25 0.5 0.75 1;
-#X text 53 27 (here's how I computed the three transfer functions...)
-;
-#X connect 0 0 39 0;
-#X connect 1 0 2 0;
-#X connect 2 0 6 0;
-#X connect 2 1 5 0;
-#X connect 3 0 4 0;
-#X connect 3 0 8 0;
-#X connect 3 0 34 0;
-#X connect 4 0 3 1;
-#X connect 5 0 3 1;
-#X connect 6 0 3 0;
-#X connect 7 0 17 0;
-#X connect 8 0 32 0;
-#X connect 8 1 17 1;
-#X connect 9 0 10 0;
-#X connect 10 0 14 0;
-#X connect 10 1 13 0;
-#X connect 11 0 12 0;
-#X connect 11 0 15 0;
-#X connect 11 0 33 0;
-#X connect 12 0 11 1;
-#X connect 13 0 11 1;
-#X connect 14 0 11 0;
-#X connect 15 0 38 0;
-#X connect 15 1 16 1;
-#X connect 18 0 19 0;
-#X connect 19 0 23 0;
-#X connect 19 1 22 0;
-#X connect 20 0 21 0;
-#X connect 20 0 24 0;
-#X connect 20 0 35 0;
-#X connect 21 0 20 1;
-#X connect 22 0 20 1;
-#X connect 23 0 20 0;
-#X connect 24 0 36 0;
-#X connect 24 1 31 1;
-#X connect 25 0 31 0;
-#X connect 26 0 30 0;
-#X connect 27 0 29 0;
-#X connect 28 0 26 1;
-#X connect 29 0 28 0;
-#X connect 30 0 25 0;
-#X connect 32 0 37 0;
-#X connect 33 0 14 1;
-#X connect 34 0 6 1;
-#X connect 35 0 23 1;
-#X connect 36 0 26 0;
-#X connect 37 0 7 0;
-#X connect 38 0 16 0;
-#X restore 53 608 pd otherstuff;
-#X text 292 403 linear;
-#X text 279 509 decibels;
-#X text 387 518 quartic;
-#X text 45 5 QUARTIC CURVES AS THE IDEAL AMPLITUDE AND FREQUENCY SCALERS
-;
-#X text 346 611 updated for Pd version 0.34;
-#X text 246 578 units-->;
-#X text 45 447 amplitude;
-#X text 79 429 |;
-#X text 79 420 |;
-#X text 79 410 |;
-#X text 79 402 |;
-#X text 78 398 ^;
-#X text 38 149 The graph below shows that a simple quartic curve \,
-x-to-the-fourth-power \, twists like decibels but--unlike decibels--actually
-hits zero at left. You get the best of both worlds. Moreover \, raising
-something to the fourth power is very cheap: just two multiplications--whereas
-\, if you're computing envelopes in dB \, eventually you'll have to
-exponentiate \, sample by sample \, to get to linear units.;
-#X text 36 34 It's an old saw that we perceive amplitude and frequency
-logarithmically. But using decibels as a unit for controlling amplitude
-and frequency gets ugly for two reasons. First \, it's expensive to
-do the conversion. Second and more profoundly \, decibels grow by shifting
-\, and things should grow by scaling \, so that \, for example \, zero
-really means "nothing.";
diff --git a/pd/doc/3.audio.examples/J02.more.quartic.pd b/pd/doc/3.audio.examples/J02.more.quartic.pd
deleted file mode 100644
index fdb01dab..00000000
--- a/pd/doc/3.audio.examples/J02.more.quartic.pd
+++ /dev/null
@@ -1,147 +0,0 @@
-#N canvas 130 66 880 587 12;
-#X floatatom 89 506 0 0 100;
-#N canvas 159 26 516 274 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 396 182 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 391 110 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 391 85 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 20 182 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 104 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 90 outlet;
-#X msg 214 65 \; pd dsp 1;
-#X obj 83 198 line~;
-#X obj 20 207 *~;
-#X obj 20 232 dac~;
-#X obj 83 173 pack 0 50;
-#X text 20 159 audio;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 12 0;
-#X connect 5 0 12 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 5 0;
-#X connect 8 1 4 1;
-#X connect 9 0 23 0;
-#X connect 10 0 1 1;
-#X connect 10 0 8 0;
-#X connect 11 0 9 0;
-#X connect 11 0 17 0;
-#X connect 13 0 21 0;
-#X connect 14 0 16 0;
-#X connect 14 0 19 0;
-#X connect 17 0 18 0;
-#X connect 20 0 21 1;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 23 0 20 0;
-#X restore 51 534 pd output;
-#X msg 127 507 MUTE;
-#X obj 32 441 *~;
-#X obj 12 469 -~;
-#X obj 73 446 *~;
-#X floatatom 170 421 1 0 100;
-#X obj 365 337 osc~;
-#X obj 365 362 *~;
-#X obj 425 342 line~;
-#X obj 365 312 line~;
-#X obj 550 468 osc~;
-#X obj 599 496 *~;
-#X obj 621 379 line~;
-#X obj 550 379 line~;
-#X obj 550 326 sqrt;
-#X obj 550 352 sqrt;
-#X obj 621 326 sqrt;
-#X obj 621 352 sqrt;
-#X obj 550 411 *~;
-#X obj 550 441 *~;
-#X obj 621 411 *~;
-#X obj 621 440 *~;
-#X obj 550 301 unpack;
-#X obj 621 301 unpack;
-#X obj 365 287 r freq;
-#X obj 425 318 r amp;
-#X obj 550 276 r freq;
-#X obj 621 276 r amp;
-#X obj 365 388 s~ linear;
-#X obj 599 523 s~ quartic;
-#X obj 12 377 r~ linear;
-#X obj 56 406 r~ quartic;
-#X msg 27 185 \; amp 0 5000 \;;
-#X msg 29 139 \; amp 1 5000 \;;
-#X msg 139 185 \; amp 0 1000 \;;
-#X msg 141 139 \; amp 1 1000 \;;
-#X msg 26 238 \; freq 1760 5000 \;;
-#X msg 29 286 \; freq 55 5000 \;;
-#X msg 180 238 \; freq 1760 1000 \;;
-#X msg 183 286 \; freq 55 1000 \;;
-#X text 90 15 QUARTIC AND LINEAR ENVELOPES COMPARED;
-#X obj 202 488 loadbang;
-#X msg 202 516 \; amp 1 \; freq 1760;
-#X text 194 414 1 for quartic \; 0 for linear;
-#X text 19 39 This patch has two sine wave oscillators \, one with
-linear envelopes \, the other with quartic ones which sound more uniform.
-The "toggle switch" at bottom selects between the two \, and the message
-boxes sweep the amplitude and frequency up and down.;
-#X text 366 257 LINEAR;
-#X text 555 249 QUARTIC;
-#X text 335 120 The two oscillators are below. In the quartic one \,
-for both the amplitude and the frequency \, we have to take the fourth
-root of the target value (which we get by taking square root twice.)
-Then we raise the line~ output to the fourth power by squaring twice
-(the *~ objects \, whose left and right inlets are the same.) The cost
-is mostly that of the four additional *~ objects.;
-#X text 579 560 updated for Pd version 0.34;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 3 0 4 1;
-#X connect 4 0 1 0;
-#X connect 5 0 1 0;
-#X connect 6 0 5 1;
-#X connect 6 0 3 1;
-#X connect 7 0 8 0;
-#X connect 8 0 29 0;
-#X connect 9 0 8 1;
-#X connect 10 0 7 0;
-#X connect 11 0 12 0;
-#X connect 12 0 30 0;
-#X connect 13 0 21 0;
-#X connect 13 0 21 1;
-#X connect 14 0 19 0;
-#X connect 14 0 19 1;
-#X connect 15 0 16 0;
-#X connect 16 0 14 0;
-#X connect 17 0 18 0;
-#X connect 18 0 13 0;
-#X connect 19 0 20 0;
-#X connect 19 0 20 1;
-#X connect 20 0 11 0;
-#X connect 21 0 22 0;
-#X connect 21 0 22 1;
-#X connect 22 0 12 1;
-#X connect 23 0 15 0;
-#X connect 23 1 14 1;
-#X connect 24 0 17 0;
-#X connect 24 1 13 1;
-#X connect 25 0 10 0;
-#X connect 26 0 9 0;
-#X connect 27 0 23 0;
-#X connect 28 0 24 0;
-#X connect 31 0 3 0;
-#X connect 31 0 4 0;
-#X connect 32 0 5 0;
-#X connect 42 0 43 0;
diff --git a/pd/doc/3.audio.examples/J10.waveshaping.pd b/pd/doc/3.audio.examples/J10.waveshaping.pd
deleted file mode 100644
index b217112f..00000000
--- a/pd/doc/3.audio.examples/J10.waveshaping.pd
+++ /dev/null
@@ -1,133 +0,0 @@
-#N canvas 222 24 761 466 12;
-#X floatatom 61 408 0 0 0;
-#N canvas 159 26 495 266 output 0;
-#X obj 338 160 t b;
-#X obj 338 110 f;
-#X obj 338 60 inlet;
-#X text 344 29 mute;
-#X obj 338 185 f;
-#X msg 425 178 0;
-#X msg 338 85 bang;
-#X obj 338 135 moses 1;
-#X obj 425 153 t b f;
-#X obj 397 117 moses 1;
-#X obj 83 148 dbtorms;
-#X obj 397 92 r master-lvl;
-#X obj 83 42 r master-lvl;
-#X obj 338 210 s master-lvl;
-#X obj 22 181 inlet~;
-#X obj 199 41 inlet;
-#X text 199 18 level;
-#X obj 199 100 s master-lvl;
-#X msg 96 65 set \$1;
-#X obj 96 89 outlet;
-#X msg 214 64 \; pd dsp 1;
-#X obj 83 194 line~;
-#X obj 22 212 *~;
-#X obj 22 241 dac~;
-#X obj 83 171 pack 0 50;
-#X text 20 158 audio;
-#X text 93 110 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 23 433 pd output;
-#X msg 99 405 MUTE;
-#X text 139 406 <-- output amplitude;
-#X obj 336 272 loadbang;
-#X text 35 6 ANALOG SYNTH SEQUENCER;
-#X obj 215 152 metro 100;
-#X obj 214 178 f;
-#X obj 248 181 + 1;
-#X obj 248 205 mod 11;
-#X graph graph1 0 36 11 96 511 197 711 97;
-#X array array1 11 float 0;
-#X pop;
-#X floatatom 215 127 0 0 0;
-#X floatatom 304 152 0 0 0;
-#X obj 214 230 tabread array1;
-#X obj 214 256 mtof;
-#X obj 214 283 osc~ 0;
-#X msg 26 171 1;
-#X obj 24 303 *~;
-#X obj 24 350 cos~;
-#X obj 24 375 hip~ 5;
-#X obj 24 327 +~ 0.1;
-#X msg 336 298 \; array1 0 50 51 52 50 52 56 50 56 58 52 58;
-#X floatatom 43 219 0 0 0;
-#X floatatom 163 221 0 0 0;
-#X floatatom 93 219 0 0 0;
-#X floatatom 128 220 0 0 0;
-#X msg 93 311 0;
-#X msg 93 329 0.1;
-#X msg 93 348 0.25;
-#X msg 215 101 1;
-#X text 244 101 <--START;
-#X text 126 331 <--symmetry;
-#X text 72 185 ADSR controls;
-#X text 43 199 lvl;
-#X text 95 200 A;
-#X text 137 201 D;
-#X text 170 202 S;
-#X floatatom 298 181 0 0 0;
-#X text 332 183 <--increment;
-#X text 339 155 <--msec;
-#X text 20 35 Analog synths had sequencers which could be used in a
-wide variety of ways. You can use an array to hold a sequence of control
-values as shown here.;
-#X obj 23 274 adsr 1 65 13 10 1000;
-#X obj 42 243 / 100;
-#X text 336 340 You can also do microtones \; 50.5 is a quarter tone
-sharper than 50;
-#X text 505 431 updated for Pd version 0.34;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 21 0;
-#X connect 6 0 7 0;
-#X connect 6 0 16 0;
-#X connect 7 0 8 0;
-#X connect 7 0 13 0;
-#X connect 8 0 9 0;
-#X connect 9 0 7 1;
-#X connect 11 0 6 0;
-#X connect 12 0 6 1;
-#X connect 13 0 14 0;
-#X connect 14 0 15 0;
-#X connect 15 0 17 1;
-#X connect 16 0 41 0;
-#X connect 17 0 20 0;
-#X connect 18 0 19 0;
-#X connect 19 0 1 0;
-#X connect 20 0 18 0;
-#X connect 22 0 42 0;
-#X connect 23 0 41 4;
-#X connect 24 0 41 2;
-#X connect 25 0 41 3;
-#X connect 26 0 20 1;
-#X connect 27 0 20 1;
-#X connect 28 0 20 1;
-#X connect 29 0 11 0;
-#X connect 37 0 8 1;
-#X connect 41 0 17 0;
-#X connect 42 0 41 1;
diff --git a/pd/doc/3.audio.examples/22.pulse.width.mod.pd b/pd/doc/3.audio.examples/K01.pulse.width.mod.pd
index 214d250a..214d250a 100644
--- a/pd/doc/3.audio.examples/22.pulse.width.mod.pd
+++ b/pd/doc/3.audio.examples/K01.pulse.width.mod.pd
diff --git a/pd/doc/3.audio.examples/23.stereo.pd b/pd/doc/3.audio.examples/K02.stereo.pd
index 1c417df5..1c417df5 100644
--- a/pd/doc/3.audio.examples/23.stereo.pd
+++ b/pd/doc/3.audio.examples/K02.stereo.pd
diff --git a/pd/doc/3.audio.examples/29.sampler.loop.smooth.pd b/pd/doc/3.audio.examples/K03.envelope.mod.pd
index 52551163..52551163 100644
--- a/pd/doc/3.audio.examples/29.sampler.loop.smooth.pd
+++ b/pd/doc/3.audio.examples/K03.envelope.mod.pd
diff --git a/pd/doc/3.audio.examples/24.even.odd.pd b/pd/doc/3.audio.examples/K04.even.odd.pd
index bfa950a9..bfa950a9 100644
--- a/pd/doc/3.audio.examples/24.even.odd.pd
+++ b/pd/doc/3.audio.examples/K04.even.odd.pd
diff --git a/pd/doc/3.audio.examples/25.bandlimited.pd b/pd/doc/3.audio.examples/K05.bandlimited.pd
index f49bcb68..f49bcb68 100644
--- a/pd/doc/3.audio.examples/25.bandlimited.pd
+++ b/pd/doc/3.audio.examples/K05.bandlimited.pd
diff --git a/pd/doc/3.audio.examples/adsr2.pd b/pd/doc/3.audio.examples/adsr2.pd
deleted file mode 100644
index 157a9c51..00000000
--- a/pd/doc/3.audio.examples/adsr2.pd
+++ /dev/null
@@ -1,110 +0,0 @@
-#N canvas 207 5 728 714 12;
-#X obj 101 90 inlet;
-#X obj 328 115 inlet;
-#X text 101 69 trigger;
-#X obj 101 126 sel 0;
-#X obj 309 321 f \$1;
-#X obj 394 117 inlet;
-#X obj 474 385 line~;
-#X obj 456 242 f \$4;
-#X obj 474 334 pack 0 \$3;
-#X obj 461 117 inlet;
-#X obj 537 118 inlet;
-#X obj 616 117 inlet;
-#X msg 76 150 stop;
-#X obj 594 311 pack 0 \$5;
-#X text 328 94 level;
-#X obj 456 281 * \$1;
-#X text 309 377 ATTACK;
-#X obj 474 408 outlet~;
-#X text 44 125 release;
-#X text 54 47 This patch is used as an abstraction in 27.envelope.slew.pd
-;
-#X obj 295 421 snapshot~;
-#X obj 259 135 t b b;
-#X text 587 333 RELEASE;
-#X obj 181 261 * -1;
-#X text 480 353 DECAY;
-#X text 180 71 attack;
-#X text 2 238 correct the attack;
-#X text 12 254 multiplying by;
-#X text 5 275 (target-current)/;
-#X text 83 289 target;
-#X text 8 321 which is the;
-#X text 8 341 relative amount;
-#X text 8 361 of slew in the attack.;
-#X text 20 468 This version of the adsr envelope generator maintains
-a constant rate of climb in the attact portion rather than a constant
-attack time as the previous one did.;
-#X obj 174 290 / \$1;
-#X obj 174 313 * \$2;
-#X obj 309 355 pack;
-#X obj 181 238 - \$1;
-#X obj 174 336 abs;
-#X text 8 401 current value is greater than;
-#X text 6 421 the target.;
-#X text 8 381 The "abs" is in case the;
-#X text 19 519 The "attack time" input here controls the time needed
-to rist from 0 to the output level. When we get an attack \, we take
-a snapshot~ of ouy current output level and adjust the attack time
-accordingly.;
-#X obj 183 89 moses;
-#X text 267 106 from;
-#X text 269 118 here;
-#X obj 174 136 t b b;
-#X text 182 107 from;
-#X text 184 119 zero;
-#X msg 223 136 0;
-#X text 19 584 Another feature: if you give a negative number for the
-trigger \, the output jumps to zero and slews from there \, instead
-of slewing from the current level. This is often appropriate for pitch
-envelopes.;
-#X obj 456 305 * 0.01;
-#X text 457 679 updated for Pd version 0.34;
-#X obj 455 217 del;
-#X text 391 95 attack;
-#X text 458 93 decay;
-#X text 55 4 adsr2 - arguments: level \, attack time \, decay time
-\, sustain percentage \, release time;
-#X text 533 91 sustain;
-#X text 609 93 release;
-#X connect 0 0 3 0;
-#X connect 1 0 4 1;
-#X connect 1 0 15 1;
-#X connect 1 0 34 1;
-#X connect 1 0 37 1;
-#X connect 3 0 12 0;
-#X connect 3 0 13 0;
-#X connect 3 1 43 0;
-#X connect 4 0 36 0;
-#X connect 5 0 35 1;
-#X connect 6 0 17 0;
-#X connect 6 0 20 0;
-#X connect 7 0 15 0;
-#X connect 8 0 6 0;
-#X connect 9 0 8 1;
-#X connect 10 0 7 1;
-#X connect 11 0 13 1;
-#X connect 12 0 53 0;
-#X connect 13 0 6 0;
-#X connect 15 0 51 0;
-#X connect 20 0 37 0;
-#X connect 21 0 4 0;
-#X connect 21 0 53 0;
-#X connect 21 1 20 0;
-#X connect 23 0 34 0;
-#X connect 34 0 35 0;
-#X connect 35 0 38 0;
-#X connect 36 0 6 0;
-#X connect 37 0 23 0;
-#X connect 38 0 36 1;
-#X connect 38 0 53 1;
-#X connect 43 0 46 0;
-#X connect 43 1 21 0;
-#X connect 46 0 4 0;
-#X connect 46 0 53 0;
-#X connect 46 1 49 0;
-#X connect 49 0 6 0;
-#X connect 49 0 37 0;
-#X connect 51 0 8 0;
-#X connect 53 0 7 0;
diff --git a/pd/doc/3.audio.examples/output~.pd b/pd/doc/3.audio.examples/output~.pd
index d1ccdc9f..07fb59f8 100644
--- a/pd/doc/3.audio.examples/output~.pd
+++ b/pd/doc/3.audio.examples/output~.pd
@@ -6,28 +6,28 @@
#X obj 516 499 moses 1;
#X obj 630 518 t b f;
#X obj 596 479 moses 1;
-#X obj 30 117 dbtorms;
-#X obj 86 207 inlet~;
-#X msg 341 285 \; pd dsp 1;
-#X obj 30 207 line~;
-#X obj 64 241 *~;
-#X obj 64 271 dac~;
-#X obj 30 147 pack 0 50;
-#X text 113 183 audio in;
+#X obj 29 97 dbtorms;
+#X obj 85 170 inlet~;
+#X msg 278 300 \; pd dsp 1;
+#X obj 29 170 line~;
+#X obj 64 242 *~;
+#X obj 64 272 dac~;
+#X obj 29 127 pack 0 50;
+#X text 121 146 audio in;
#X text 301 496 test if less than 1 -->;
#X text 267 523 if true convert to bang -->;
-#X text 101 116 <-- convert from dB to linear units;
-#X floatatom 341 221 3 0 100 0 dB - -;
+#X text 100 96 <-- convert from dB to linear units;
+#X floatatom 278 221 3 0 100 0 dB - -;
#X obj 516 449 bng 15 250 50 0 empty empty mute -38 7 0 12 -262144
-1 -1;
-#X text 119 146 <-- make a ramp to avoid clicks or zipper noise;
-#X obj 175 208 inlet~;
-#X obj 154 240 *~;
+#X text 118 126 <-- make a ramp to avoid clicks or zipper noise;
+#X obj 148 170 inlet~;
+#X obj 154 241 *~;
#X text 502 399 MUTE logic:;
-#X obj 341 193 r \$0-master-lvl;
+#X obj 278 193 r \$0-master-lvl;
#X obj 516 573 s \$0-master-lvl;
-#X obj 356 248 s \$0-master-out;
-#X obj 30 91 r \$0-master-out;
+#X obj 293 247 s \$0-master-out;
+#X obj 29 71 r \$0-master-out;
#X obj 596 450 r \$0-master-out;
#X text 60 10 Level control abstraction \, used in many of the Pd example
patches. The "level" and "mute" controls show up on the parent \, calling
@@ -35,7 +35,9 @@ patch.;
#X text 229 549 previous nonzero master-lvl -->;
#X text 301 453 recall previous;
#X text 301 471 value of master-lvl -->;
-#X text 79 295 automatically start DSP -->;
+#X text 16 310 automatically start DSP -->;
+#X obj 85 192 hip~ 3;
+#X obj 147 192 hip~ 3;
#X connect 0 0 2 0;
#X connect 1 0 4 0;
#X connect 2 0 25 0;
@@ -45,7 +47,7 @@ patch.;
#X connect 5 0 3 0;
#X connect 6 1 2 1;
#X connect 7 0 13 0;
-#X connect 8 0 11 1;
+#X connect 8 0 34 0;
#X connect 10 0 22 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
@@ -53,10 +55,12 @@ patch.;
#X connect 18 0 9 0;
#X connect 18 0 26 0;
#X connect 19 0 1 0;
-#X connect 21 0 22 1;
+#X connect 21 0 35 0;
#X connect 22 0 12 1;
#X connect 24 0 18 0;
#X connect 27 0 7 0;
#X connect 28 0 1 1;
#X connect 28 0 6 0;
+#X connect 34 0 11 1;
+#X connect 35 0 22 1;
#X coords 0 0 1 1 65 55 1;
diff --git a/pd/doc/3.audio.examples/partial.pd b/pd/doc/3.audio.examples/partial.pd
index dae4a151..03bb925d 100644
--- a/pd/doc/3.audio.examples/partial.pd
+++ b/pd/doc/3.audio.examples/partial.pd
@@ -1,51 +1,76 @@
-#N canvas 439 152 649 445 12;
-#X obj 495 257 sqrt;
-#X text 78 85 trigger;
-#X msg 82 143 bang;
-#X obj 81 211 * \$2;
-#X text 126 210 relative frequency;
-#X obj 83 340 *~;
-#X obj 262 307 line~;
-#X obj 262 335 *~;
-#X obj 260 364 *~;
-#X obj 264 229 float;
-#X msg 264 280 0 \$1;
-#X obj 494 280 sqrt;
-#X obj 82 110 r trigger;
-#X obj 495 232 float \$1;
-#X obj 294 206 r duration;
-#X obj 81 179 float;
-#X obj 126 180 r frequency;
-#X text 497 199 amplitude;
-#X obj 83 311 osc~ 0;
-#X obj 278 168 t b b;
-#X obj 81 238 + \$3;
-#X text 119 240 detune;
-#X obj 264 255 * \$4;
-#X text 306 256 relative duration;
-#X text 106 6 partial - arguments: amplitude \, frequency \, detune \, duration;
-#X obj 83 367 throw~ sum;
-#X text 74 35 This patch is used as an abstraction in 15.additive.pd;
-#X connect 0 0 11 0;
-#X connect 2 0 15 0;
-#X connect 2 0 19 0;
-#X connect 3 0 20 0;
-#X connect 5 0 25 0;
-#X connect 6 0 7 0;
-#X connect 6 0 7 1;
-#X connect 7 0 8 0;
-#X connect 7 0 8 1;
-#X connect 8 0 5 1;
-#X connect 9 0 22 0;
-#X connect 10 0 6 0;
-#X connect 11 0 6 0;
-#X connect 12 0 2 0;
-#X connect 13 0 0 0;
-#X connect 14 0 9 1;
-#X connect 15 0 3 0;
-#X connect 16 0 15 1;
-#X connect 18 0 5 0;
-#X connect 19 0 9 0;
-#X connect 19 1 13 0;
-#X connect 20 0 18 0;
-#X connect 22 0 10 0;
+#N canvas 18 78 880 448 12;
+#X obj 465 234 sqrt;
+#X text 17 88 trigger;
+#X text 33 175 relative frequency;
+#X obj 17 341 *~;
+#X obj 227 322 line~;
+#X obj 227 349 *~;
+#X obj 227 376 *~;
+#X msg 227 285 0 \$1;
+#X obj 465 261 sqrt;
+#X obj 17 113 r trigger;
+#X obj 465 180 float \$1;
+#X obj 249 235 r duration;
+#X obj 39 226 r frequency;
+#X obj 227 158 t b b;
+#X text 303 209 relative duration;
+#X obj 17 368 throw~ sum;
+#X obj 17 140 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 465 288 \$1 5;
+#X obj 227 185 del 5;
+#X obj 465 207 * 0.1;
+#X obj 17 279 + \$4;
+#X text 550 178 get amplitude from argument 1;
+#X text 524 206 normalize to 0.1;
+#X text 516 233 take fourth root (square root twice);
+#X text 544 250 because we'll raise line~ output to;
+#X text 543 267 fourth power;
+#X text 515 292 attack time 5 msec;
+#X text 280 184 decay after 5 msec;
+#X text 469 157 attack;
+#X obj 226 211 float \$2;
+#X obj 227 258 *;
+#X text 264 258 actual duration;
+#X obj 17 200 float \$3;
+#X obj 17 252 *;
+#X obj 17 314 osc~;
+#X text 49 252 times global freq.;
+#X text 60 279 plus detune;
+#X text 271 285 decay msg to line~;
+#X text 266 350 raise to fourth power for;
+#X text 267 368 natural-sounding decay shape;
+#X text 20 396 add to global;
+#X text 19 415 summing bus;
+#X text 21 45 This patch is used as an abstraction in the additive
+synthesis example \, D06.additive.pd;
+#X text 25 4 partial -- sinusoidal partial for additive synthesis;
+#X text 631 12 arguments:;
+#X text 605 37 1 amplitude \; 2 relative duration \; 3 relative frequency
+\; 4 detune;
+#X connect 0 0 8 0;
+#X connect 3 0 15 0;
+#X connect 4 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 6 0;
+#X connect 5 0 6 1;
+#X connect 6 0 3 1;
+#X connect 7 0 4 0;
+#X connect 8 0 17 0;
+#X connect 9 0 16 0;
+#X connect 10 0 19 0;
+#X connect 11 0 30 1;
+#X connect 12 0 33 1;
+#X connect 13 0 18 0;
+#X connect 13 1 10 0;
+#X connect 16 0 13 0;
+#X connect 16 0 32 0;
+#X connect 17 0 4 0;
+#X connect 18 0 29 0;
+#X connect 19 0 0 0;
+#X connect 20 0 34 0;
+#X connect 29 0 30 0;
+#X connect 30 0 7 0;
+#X connect 32 0 33 0;
+#X connect 33 0 20 0;
+#X connect 34 0 3 0;
diff --git a/pd/doc/3.audio.examples/echo.pd b/pd/doc/3.audio.examples/reverb-echo.pd
index 7666d5a7..e627e9fc 100644
--- a/pd/doc/3.audio.examples/echo.pd
+++ b/pd/doc/3.audio.examples/reverb-echo.pd
@@ -2,12 +2,13 @@
#X obj 66 95 inlet~;
#X obj 130 96 inlet~;
#X obj 69 216 outlet~;
-#X obj 134 217 outlet~;
+#X obj 141 215 outlet~;
#X obj 67 143 +~;
-#X obj 133 143 -~;
-#X obj 134 167 delwrite~ \$1 \$2;
-#X obj 133 193 delread~ \$1 \$2;
-#X text 67 24 This appears as an abstraction in patch 44;
+#X obj 140 141 -~;
+#X obj 141 165 delwrite~ \$1 \$2;
+#X obj 140 191 delread~ \$1 \$2;
+#X text 68 24 This appears as an abstraction in patch G05.reverb.pd
+;
#X connect 0 0 4 0;
#X connect 0 0 5 0;
#X connect 1 0 4 1;
diff --git a/pd/doc/3.audio.examples/sampvoice.pd b/pd/doc/3.audio.examples/sampvoice.pd
index dafa3c67..ee9c19b4 100644
--- a/pd/doc/3.audio.examples/sampvoice.pd
+++ b/pd/doc/3.audio.examples/sampvoice.pd
@@ -1,105 +1,114 @@
-#N canvas 231 67 574 676 12;
-#X obj 95 396 line~;
-#X obj 301 396 line~;
-#X obj 285 476 *~;
-#X obj 317 607 outlet~;
-#X obj 144 396 makefilename sample%d;
-#X msg 144 419 set \$1;
-#X obj 144 442 tabread4~ sample1;
-#X obj 349 419 dbtorms;
-#X obj 349 396 unpack;
-#X obj 349 442 sqrt;
-#X obj 349 465 sqrt;
-#X obj 349 488 line~;
-#X obj 333 559 *~;
-#X obj 349 511 *~;
-#X obj 349 534 *~;
-#X msg 201 49 bang;
+#N canvas 231 67 705 628 12;
+#X obj 278 476 *~;
+#X obj 177 604 outlet~;
+#X obj 104 396 makefilename sample%d;
+#X msg 104 419 set \$1;
+#X obj 104 442 tabread4~ sample1;
+#X obj 360 419 dbtorms;
+#X obj 360 396 unpack;
+#X obj 360 442 sqrt;
+#X obj 360 465 sqrt;
+#X obj 360 488 line~;
+#X obj 338 559 *~;
+#X obj 360 511 *~;
+#X obj 360 534 *~;
+#X msg 201 42 bang;
#X obj 201 72 delay 5;
#X obj 289 95 unpack 0 0 0 0 0 0 0;
-#X obj 421 184 f;
+#X obj 426 184 f;
#X obj 367 161 f;
#X obj 309 161 f;
#X obj 278 161 f;
-#X obj 252 161 f;
-#X obj 173 161 f;
-#X obj 173 184 mtof;
-#X obj 173 207 / 261.62;
-#X obj 173 230 * 4.41e+08;
-#X obj 173 253 +;
-#X obj 394 161 delay;
-#X obj 252 303 pack 0 0 0 0 0;
+#X obj 247 161 f;
+#X obj 156 159 f;
+#X obj 156 182 mtof;
+#X obj 156 205 / 261.62;
+#X obj 156 228 * 4.41e+08;
+#X obj 156 251 +;
+#X obj 399 161 delay;
+#X obj 247 303 pack 0 0 0 0 0;
#X obj 201 95 t b b b;
#X obj 309 207 + 1;
#X obj 309 184 * 44.1;
-#X msg 85 337 0 5;
-#X msg 286 337 1 5;
-#X msg 319 337 0 \, \$1 \$2;
-#X msg 158 337 \$3 \, \$4 1e+07;
+#X msg 55 338 0 5;
+#X msg 289 337 1 5;
+#X msg 325 337 0 \, \$1 \$2;
+#X msg 128 338 \$3 \, \$4 1e+07;
#X msg 253 337 \$5;
-#X msg 393 337 0 \$1;
+#X msg 405 337 0 \$1;
#X obj 289 72 inlet;
-#X obj 61 565 inlet~;
-#X obj 317 583 +~;
-#X text 82 21 This is an abstraction used by a polyphonic sampler (example 24.);
-#X connect 0 0 6 0;
-#X connect 1 0 2 1;
-#X connect 2 0 12 0;
-#X connect 4 0 5 0;
-#X connect 5 0 6 0;
-#X connect 6 0 2 0;
-#X connect 7 0 9 0;
-#X connect 8 0 7 0;
-#X connect 8 1 11 1;
-#X connect 9 0 10 0;
-#X connect 10 0 11 0;
-#X connect 11 0 13 0;
-#X connect 11 0 13 1;
-#X connect 12 0 41 1;
+#X obj 177 553 inlet~;
+#X obj 177 579 +~;
+#X text 44 15 This is an abstraction used by the polyphonic sampler.
+;
+#X text 505 67 ARGUMENTS FOR NOTES:;
+#X text 505 89 pitch in halftones;
+#X text 505 113 amplitude (dB);
+#X text 505 161 sample number;
+#X text 505 137 duration (msec);
+#X text 505 185 start location (msec);
+#X text 505 209 rise time (msec);
+#X text 505 233 decay time (msec);
+#X obj 45 396 vline~;
+#X obj 301 396 vline~;
+#X connect 0 0 10 0;
+#X connect 2 0 3 0;
+#X connect 3 0 4 0;
+#X connect 4 0 0 0;
+#X connect 5 0 7 0;
+#X connect 6 0 5 0;
+#X connect 6 1 9 1;
+#X connect 7 0 8 0;
+#X connect 8 0 9 0;
+#X connect 9 0 11 0;
+#X connect 9 0 11 1;
+#X connect 10 0 39 1;
+#X connect 11 0 12 0;
+#X connect 11 0 12 1;
+#X connect 12 0 10 1;
#X connect 13 0 14 0;
-#X connect 13 0 14 1;
-#X connect 14 0 12 1;
-#X connect 15 0 16 0;
-#X connect 15 0 33 0;
-#X connect 16 0 30 0;
-#X connect 17 0 23 1;
-#X connect 17 0 15 0;
-#X connect 17 1 22 1;
-#X connect 17 2 28 1;
-#X connect 17 3 21 1;
-#X connect 17 4 20 1;
-#X connect 17 5 19 1;
-#X connect 17 6 18 1;
-#X connect 18 0 38 0;
-#X connect 19 0 29 1;
-#X connect 20 0 32 0;
-#X connect 21 0 29 4;
-#X connect 22 0 29 0;
+#X connect 13 0 31 0;
+#X connect 14 0 28 0;
+#X connect 15 0 21 1;
+#X connect 15 0 13 0;
+#X connect 15 1 20 1;
+#X connect 15 2 26 1;
+#X connect 15 3 19 1;
+#X connect 15 4 18 1;
+#X connect 15 5 17 1;
+#X connect 15 6 16 1;
+#X connect 16 0 36 0;
+#X connect 17 0 27 1;
+#X connect 18 0 30 0;
+#X connect 19 0 27 4;
+#X connect 20 0 27 0;
+#X connect 21 0 22 0;
+#X connect 22 0 23 0;
#X connect 23 0 24 0;
#X connect 24 0 25 0;
-#X connect 25 0 26 0;
-#X connect 26 0 27 0;
-#X connect 27 0 29 3;
-#X connect 28 0 18 0;
-#X connect 29 0 34 0;
-#X connect 29 0 35 0;
-#X connect 29 0 36 0;
-#X connect 29 0 37 0;
-#X connect 30 0 22 0;
-#X connect 30 1 23 0;
-#X connect 30 2 19 0;
-#X connect 30 2 20 0;
-#X connect 30 2 21 0;
-#X connect 30 2 28 0;
-#X connect 31 0 29 2;
-#X connect 31 0 27 1;
-#X connect 32 0 31 0;
-#X connect 33 0 1 0;
-#X connect 34 0 1 0;
-#X connect 35 0 8 0;
-#X connect 36 0 0 0;
-#X connect 37 0 4 0;
-#X connect 38 0 8 0;
-#X connect 39 0 17 0;
-#X connect 40 0 41 0;
-#X connect 41 0 3 0;
+#X connect 25 0 27 3;
+#X connect 26 0 16 0;
+#X connect 27 0 32 0;
+#X connect 27 0 33 0;
+#X connect 27 0 34 0;
+#X connect 27 0 35 0;
+#X connect 28 0 20 0;
+#X connect 28 1 21 0;
+#X connect 28 2 17 0;
+#X connect 28 2 18 0;
+#X connect 28 2 19 0;
+#X connect 28 2 26 0;
+#X connect 29 0 27 2;
+#X connect 29 0 25 1;
+#X connect 30 0 29 0;
+#X connect 31 0 50 0;
+#X connect 32 0 50 0;
+#X connect 33 0 6 0;
+#X connect 34 0 49 0;
+#X connect 35 0 2 0;
+#X connect 36 0 6 0;
+#X connect 37 0 15 0;
+#X connect 38 0 39 0;
+#X connect 39 0 1 0;
+#X connect 49 0 4 0;
+#X connect 50 0 0 1;
diff --git a/pd/doc/3.audio.examples/sampvoice2.pd b/pd/doc/3.audio.examples/sampvoice2.pd
new file mode 100644
index 00000000..4350ea48
--- /dev/null
+++ b/pd/doc/3.audio.examples/sampvoice2.pd
@@ -0,0 +1,122 @@
+#N canvas 231 67 770 791 12;
+#X obj 284 616 *~;
+#X obj 183 744 outlet~;
+#X obj 110 536 makefilename sample%d;
+#X msg 110 559 set \$1;
+#X obj 110 582 tabread4~ sample1;
+#X obj 367 559 dbtorms;
+#X obj 367 536 unpack;
+#X obj 367 582 sqrt;
+#X obj 367 605 sqrt;
+#X obj 367 628 line~;
+#X obj 344 699 *~;
+#X obj 367 651 *~;
+#X obj 367 674 *~;
+#X msg 122 184 bang;
+#X obj 130 207 delay 5;
+#X obj 437 275 f;
+#X obj 399 276 f;
+#X obj 322 276 f;
+#X obj 283 276 f;
+#X obj 252 276 f;
+#X obj 159 263 f;
+#X obj 159 286 mtof;
+#X obj 159 309 / 261.62;
+#X obj 159 332 * 4.41e+08;
+#X obj 159 363 +;
+#X obj 253 443 pack 0 0 0 0 0;
+#X obj 130 230 t b b b;
+#X obj 322 322 + 1;
+#X obj 322 299 * 44.1;
+#X msg 85 478 0 5;
+#X msg 295 477 1 5;
+#X msg 331 477 0 \, \$1 \$2;
+#X msg 134 478 \$3 \, \$4 1e+07;
+#X msg 259 477 \$5;
+#X msg 411 477 0 \$1;
+#X obj 230 119 inlet;
+#X obj 183 693 inlet~;
+#X obj 183 719 +~;
+#X text 498 181 pitch in halftones;
+#X text 499 158 amplitude (dB);
+#X text 499 206 sample number;
+#X text 499 230 start location (msec);
+#X text 499 254 rise time (msec);
+#X text 499 278 decay time (msec);
+#X text 498 133 ARGUMENTS FOR NOTE ON:;
+#X text 460 317 (Zero amplitude means note off \;;
+#X text 481 338 other parameters are ignored.);
+#X obj 230 144 route 0;
+#X obj 288 175 unpack 0 0 0 0 0 0;
+#X text 35 5 This is an abstraction used by the polyphonic sampler
+\, version 2 \, which takes separate note-on and note-off messages.
+Unlike "sampvoice" (the first version) \, there is no "duration" field
+\, and the amplitude and pitch fields are reversed to make it easy
+to separate note-on from note-off messages (which have amplitude zero.)
+;
+#X text 299 153 note-on;
+#X text 155 153 note-off;
+#X obj 50 536 vline~;
+#X obj 307 536 vline~;
+#X msg 230 166 bang;
+#X connect 0 0 10 0;
+#X connect 2 0 3 0;
+#X connect 3 0 4 0;
+#X connect 4 0 0 0;
+#X connect 5 0 7 0;
+#X connect 6 0 5 0;
+#X connect 6 1 9 1;
+#X connect 7 0 8 0;
+#X connect 8 0 9 0;
+#X connect 9 0 11 0;
+#X connect 9 0 11 1;
+#X connect 10 0 37 1;
+#X connect 11 0 12 0;
+#X connect 11 0 12 1;
+#X connect 12 0 10 1;
+#X connect 13 0 14 0;
+#X connect 13 0 29 0;
+#X connect 14 0 26 0;
+#X connect 15 0 34 0;
+#X connect 16 0 25 1;
+#X connect 17 0 28 0;
+#X connect 18 0 25 4;
+#X connect 19 0 25 0;
+#X connect 20 0 21 0;
+#X connect 21 0 22 0;
+#X connect 22 0 23 0;
+#X connect 23 0 24 0;
+#X connect 24 0 25 3;
+#X connect 25 0 30 0;
+#X connect 25 0 31 0;
+#X connect 25 0 32 0;
+#X connect 25 0 33 0;
+#X connect 26 0 19 0;
+#X connect 26 1 20 0;
+#X connect 26 2 16 0;
+#X connect 26 2 17 0;
+#X connect 26 2 18 0;
+#X connect 27 0 25 2;
+#X connect 27 0 24 1;
+#X connect 28 0 27 0;
+#X connect 29 0 53 0;
+#X connect 30 0 53 0;
+#X connect 31 0 6 0;
+#X connect 32 0 52 0;
+#X connect 33 0 2 0;
+#X connect 34 0 6 0;
+#X connect 35 0 47 0;
+#X connect 36 0 37 0;
+#X connect 37 0 1 0;
+#X connect 47 0 54 0;
+#X connect 47 1 48 0;
+#X connect 48 0 13 0;
+#X connect 48 0 19 1;
+#X connect 48 1 20 1;
+#X connect 48 2 18 1;
+#X connect 48 3 17 1;
+#X connect 48 4 16 1;
+#X connect 48 5 15 1;
+#X connect 52 0 4 0;
+#X connect 53 0 0 1;
+#X connect 54 0 15 0;
diff --git a/pd/doc/3.audio.examples/shepvoice.pd b/pd/doc/3.audio.examples/shepvoice.pd
index f1929976..9e05c48b 100644
--- a/pd/doc/3.audio.examples/shepvoice.pd
+++ b/pd/doc/3.audio.examples/shepvoice.pd
@@ -1,22 +1,32 @@
-#N canvas 63 20 638 403 12;
-#X obj 300 253 pack 0 50;
-#X obj 243 203 pack 0 50;
-#X obj 151 216 inlet~;
-#X obj 243 232 line~;
-#X obj 300 278 line~;
-#X obj 243 297 *~;
-#X obj 151 316 +~;
-#X obj 151 342 outlet~;
-#X obj 399 121 r pitch+;
-#X obj 326 108 r interval+;
-#X obj 297 144 expr $f1 * $f2 + $f3;
-#X obj 537 90 r dropoff+;
-#X obj 297 75 expr ($i1% 10000) * 0.0002 - 1;
-#X obj 296 20 r phase;
-#X obj 296 47 + \$1;
-#X obj 457 114 expr exp(-$f1*$f1*$f2);
-#X obj 243 179 mtof;
-#X obj 243 258 osc~;
+#N canvas 471 146 638 403 12;
+#X obj 156 262 pack 0 50;
+#X obj 98 216 pack 0 50;
+#X obj 29 298 inlet~;
+#X obj 98 242 line~;
+#X obj 156 288 line~;
+#X obj 99 306 *~;
+#X obj 29 324 +~;
+#X obj 29 350 outlet~;
+#X obj 285 165 r pitch+;
+#X obj 185 139 r interval+;
+#X obj 98 164 expr $f1 * $f2 + $f3;
+#X obj 481 137 r dropoff+;
+#X obj 297 63 expr ($i1% 10000) * 0.0002 - 1;
+#X obj 297 11 r phase;
+#X obj 297 37 + \$1;
+#X obj 376 165 expr exp(-$f1*$f1*$f2);
+#X obj 98 190 mtof;
+#X obj 98 268 osc~;
+#X text 64 8 our local phase =;
+#X text 61 26 overall phase + our;
+#X text 60 45 relative phase;
+#X text 57 64 (modulo 10000);
+#X text 59 81 normalized from -1 to 1;
+#X text 349 36 \$1: relative phase;
+#X text 9 110 pitch is center pitch;
+#X text 16 125 + interval*phase;
+#X text 373 194 amplitude is Gaussian \, with;
+#X text 321 215 peak width controlled by "dropoff";
#X connect 0 0 4 0;
#X connect 1 0 3 0;
#X connect 2 0 6 0;
diff --git a/pd/doc/3.audio.examples/spectrum-partial.pd b/pd/doc/3.audio.examples/spectrum-partial.pd
index 584d3489..3c242504 100644
--- a/pd/doc/3.audio.examples/spectrum-partial.pd
+++ b/pd/doc/3.audio.examples/spectrum-partial.pd
@@ -1,7 +1,6 @@
#N canvas 211 116 826 530 12;
#X obj 28 412 osc~;
#X obj 94 197 r poll-table;
-#X obj 78 311 moses 0;
#X obj 129 337 + 50;
#X obj 129 363 dbtorms;
#X msg 78 339 0;
@@ -36,22 +35,23 @@ one "catch~ sum-bus" at the output.;
#X obj 78 284 tabread4 spectrum-tab;
#X text 285 288 Finally get the strength from the table. Note that
we use the control object \, tabread4 \, not tabread4~.;
-#X connect 0 0 9 0;
-#X connect 1 0 12 0;
-#X connect 2 0 5 0;
-#X connect 2 1 3 0;
-#X connect 3 0 4 0;
-#X connect 4 0 6 0;
+#X obj 78 311 moses 1;
+#X connect 0 0 8 0;
+#X connect 1 0 11 0;
+#X connect 2 0 3 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
#X connect 5 0 6 0;
-#X connect 6 0 7 0;
-#X connect 7 0 9 1;
-#X connect 9 0 8 0;
-#X connect 10 0 11 0;
-#X connect 11 0 13 0;
-#X connect 12 0 15 0;
-#X connect 13 0 14 0;
-#X connect 13 0 0 0;
-#X connect 14 0 12 1;
-#X connect 15 0 28 0;
-#X connect 16 0 15 1;
-#X connect 28 0 2 0;
+#X connect 6 0 8 1;
+#X connect 8 0 7 0;
+#X connect 9 0 10 0;
+#X connect 10 0 12 0;
+#X connect 11 0 14 0;
+#X connect 12 0 13 0;
+#X connect 12 0 0 0;
+#X connect 13 0 11 1;
+#X connect 14 0 27 0;
+#X connect 15 0 14 1;
+#X connect 27 0 29 0;
+#X connect 29 0 4 0;
+#X connect 29 1 2 0;
diff --git a/pd/doc/3.audio.examples/x.ps b/pd/doc/3.audio.examples/x.ps
deleted file mode 100644
index 372dc540..00000000
--- a/pd/doc/3.audio.examples/x.ps
+++ /dev/null
@@ -1,844 +0,0 @@
-%!PS-Adobe-3.0 EPSF-3.0
-%%Creator: Tk Canvas Widget
-%%For: msp
-%%Title: Window .x80edcf8.c
-%%CreationDate: Thu Aug 8 13:49:09 2002
-%%BoundingBox: 115 319 497 473
-%%Pages: 1
-%%DocumentData: Clean7Bit
-%%Orientation: Portrait
-%%DocumentNeededResources: font Courier-Bold
-%%EndComments
-
-%%BeginProlog
-50 dict begin
-
-% This is a standard prolog for Postscript generated by Tk's canvas
-% widget.
-% RCS: @(#) $Id: x.ps,v 1.1.1.1 2002-11-25 10:47:48 ggeiger Exp $
-
-% The definitions below just define all of the variables used in
-% any of the procedures here. This is needed for obscure reasons
-% explained on p. 716 of the Postscript manual (Section H.2.7,
-% "Initializing Variables," in the section on Encapsulated Postscript).
-
-/baseline 0 def
-/stipimage 0 def
-/height 0 def
-/justify 0 def
-/lineLength 0 def
-/spacing 0 def
-/stipple 0 def
-/strings 0 def
-/xoffset 0 def
-/yoffset 0 def
-/tmpstip null def
-
-% Define the array ISOLatin1Encoding (which specifies how characters are
-% encoded for ISO-8859-1 fonts), if it isn't already present (Postscript
-% level 2 is supposed to define it, but level 1 doesn't).
-
-systemdict /ISOLatin1Encoding known not {
- /ISOLatin1Encoding [
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /exclam /quotedbl /numbersign /dollar /percent /ampersand
- /quoteright
- /parenleft /parenright /asterisk /plus /comma /minus /period /slash
- /zero /one /two /three /four /five /six /seven
- /eight /nine /colon /semicolon /less /equal /greater /question
- /at /A /B /C /D /E /F /G
- /H /I /J /K /L /M /N /O
- /P /Q /R /S /T /U /V /W
- /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
- /quoteleft /a /b /c /d /e /f /g
- /h /i /j /k /l /m /n /o
- /p /q /r /s /t /u /v /w
- /x /y /z /braceleft /bar /braceright /asciitilde /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
- /dieresis /space /ring /cedilla /space /hungarumlaut /ogonek /caron
- /space /exclamdown /cent /sterling /currency /yen /brokenbar /section
- /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen
- /registered /macron
- /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph
- /periodcentered
- /cedillar /onesuperior /ordmasculine /guillemotright /onequarter
- /onehalf /threequarters /questiondown
- /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
- /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex
- /Idieresis
- /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
- /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn
- /germandbls
- /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
- /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex
- /idieresis
- /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
- /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn
- /ydieresis
- ] def
-} if
-
-% font ISOEncode font
-% This procedure changes the encoding of a font from the default
-% Postscript encoding to ISOLatin1. It's typically invoked just
-% before invoking "setfont". The body of this procedure comes from
-% Section 5.6.1 of the Postscript book.
-
-/ISOEncode {
- dup length dict begin
- {1 index /FID ne {def} {pop pop} ifelse} forall
- /Encoding ISOLatin1Encoding def
- currentdict
- end
-
- % I'm not sure why it's necessary to use "definefont" on this new
- % font, but it seems to be important; just use the name "Temporary"
- % for the font.
-
- /Temporary exch definefont
-} bind def
-
-% StrokeClip
-%
-% This procedure converts the current path into a clip area under
-% the assumption of stroking. It's a bit tricky because some Postscript
-% interpreters get errors during strokepath for dashed lines. If
-% this happens then turn off dashes and try again.
-
-/StrokeClip {
- {strokepath} stopped {
- (This Postscript printer gets limitcheck overflows when) =
- (stippling dashed lines; lines will be printed solid instead.) =
- [] 0 setdash strokepath} if
- clip
-} bind def
-
-% desiredSize EvenPixels closestSize
-%
-% The procedure below is used for stippling. Given the optimal size
-% of a dot in a stipple pattern in the current user coordinate system,
-% compute the closest size that is an exact multiple of the device's
-% pixel size. This allows stipple patterns to be displayed without
-% aliasing effects.
-
-/EvenPixels {
- % Compute exact number of device pixels per stipple dot.
- dup 0 matrix currentmatrix dtransform
- dup mul exch dup mul add sqrt
-
- % Round to an integer, make sure the number is at least 1, and compute
- % user coord distance corresponding to this.
- dup round dup 1 lt {pop 1} if
- exch div mul
-} bind def
-
-% width height string StippleFill --
-%
-% Given a path already set up and a clipping region generated from
-% it, this procedure will fill the clipping region with a stipple
-% pattern. "String" contains a proper image description of the
-% stipple pattern and "width" and "height" give its dimensions. Each
-% stipple dot is assumed to be about one unit across in the current
-% user coordinate system. This procedure trashes the graphics state.
-
-/StippleFill {
- % The following code is needed to work around a NeWSprint bug.
-
- /tmpstip 1 index def
-
- % Change the scaling so that one user unit in user coordinates
- % corresponds to the size of one stipple dot.
- 1 EvenPixels dup scale
-
- % Compute the bounding box occupied by the path (which is now
- % the clipping region), and round the lower coordinates down
- % to the nearest starting point for the stipple pattern. Be
- % careful about negative numbers, since the rounding works
- % differently on them.
-
- pathbbox
- 4 2 roll
- 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll
- 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll
-
- % Stack now: width height string y1 y2 x1 x2
- % Below is a doubly-nested for loop to iterate across this area
- % in units of the stipple pattern size, going up columns then
- % across rows, blasting out a stipple-pattern-sized rectangle at
- % each position
-
- 6 index exch {
- 2 index 5 index 3 index {
- % Stack now: width height string y1 y2 x y
-
- gsave
- 1 index exch translate
- 5 index 5 index true matrix tmpstip imagemask
- grestore
- } for
- pop
- } for
- pop pop pop pop pop
-} bind def
-
-% -- AdjustColor --
-% Given a color value already set for output by the caller, adjusts
-% that value to a grayscale or mono value if requested by the CL
-% variable.
-
-/AdjustColor {
- CL 2 lt {
- currentgray
- CL 0 eq {
- .5 lt {0} {1} ifelse
- } if
- setgray
- } if
-} bind def
-
-% x y strings spacing xoffset yoffset justify stipple DrawText --
-% This procedure does all of the real work of drawing text. The
-% color and font must already have been set by the caller, and the
-% following arguments must be on the stack:
-%
-% x, y - Coordinates at which to draw text.
-% strings - An array of strings, one for each line of the text item,
-% in order from top to bottom.
-% spacing - Spacing between lines.
-% xoffset - Horizontal offset for text bbox relative to x and y: 0 for
-% nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se.
-% yoffset - Vertical offset for text bbox relative to x and y: 0 for
-% nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se.
-% justify - 0 for left justification, 0.5 for center, 1 for right justify.
-% stipple - Boolean value indicating whether or not text is to be
-% drawn in stippled fashion. If text is stippled,
-% procedure StippleText must have been defined to call
-% StippleFill in the right way.
-%
-% Also, when this procedure is invoked, the color and font must already
-% have been set for the text.
-
-/DrawText {
- /stipple exch def
- /justify exch def
- /yoffset exch def
- /xoffset exch def
- /spacing exch def
- /strings exch def
-
- % First scan through all of the text to find the widest line.
-
- /lineLength 0 def
- strings {
- stringwidth pop
- dup lineLength gt {/lineLength exch def} {pop} ifelse
- newpath
- } forall
-
- % Compute the baseline offset and the actual font height.
-
- 0 0 moveto (TXygqPZ) false charpath
- pathbbox dup /baseline exch def
- exch pop exch sub /height exch def pop
- newpath
-
- % Translate coordinates first so that the origin is at the upper-left
- % corner of the text's bounding box. Remember that x and y for
- % positioning are still on the stack.
-
- translate
- lineLength xoffset mul
- strings length 1 sub spacing mul height add yoffset mul translate
-
- % Now use the baseline and justification information to translate so
- % that the origin is at the baseline and positioning point for the
- % first line of text.
-
- justify lineLength mul baseline neg translate
-
- % Iterate over each of the lines to output it. For each line,
- % compute its width again so it can be properly justified, then
- % display it.
-
- strings {
- dup stringwidth pop
- justify neg mul 0 moveto
- stipple {
-
- % The text is stippled, so turn it into a path and print
- % by calling StippledText, which in turn calls StippleFill.
- % Unfortunately, many Postscript interpreters will get
- % overflow errors if we try to do the whole string at
- % once, so do it a character at a time.
-
- gsave
- /char (X) def
- {
- char 0 3 -1 roll put
- currentpoint
- gsave
- char true charpath clip StippleText
- grestore
- char stringwidth translate
- moveto
- } forall
- grestore
- } {show} ifelse
- 0 spacing neg translate
- } forall
-} bind def
-
-%%EndProlog
-%%BeginSetup
-/CL 2 def
-%%IncludeResource: font Courier-Bold
-%%EndSetup
-
-%%Page: 1 1
-save
-306.0 396.0 translate
-0.846 0.846 scale
--224 -91 translate
--1 182 moveto 449 182 lineto 449 0 lineto -1 0 lineto closepath clip newpath
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-231 103 [
-(50.3695)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-230 105 moveto
-281 105 lineto
-285 101 lineto
-285 88 lineto
-230 88 lineto
-230 105 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-230 89 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-230 105 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-231 125 [
-(set $1)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-230 127 moveto
-278 127 lineto
-274 123 lineto
-274 114 lineto
-278 110 lineto
-230 110 lineto
-230 127 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-230 111 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-230 127 moveto 7 0 rlineto 0 -0.999999999999993 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-16 103 [
-(150)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-15 105 moveto
-38 105 lineto
-42 101 lineto
-42 88 lineto
-15 88 lineto
-15 105 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-15 89 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-15 105 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-16 148 [
-(r frequency)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-15 150 moveto
-94 150 lineto
-94 133 lineto
-15 133 lineto
-15 150 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-15 134 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-16 125 [
-(set $1)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-15 127 moveto
-63 127 lineto
-59 123 lineto
-59 114 lineto
-63 110 lineto
-15 110 lineto
-15 127 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-15 111 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-15 127 moveto 7 0 rlineto 0 -0.999999999999993 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-29 79 [
-(s frequency)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-28 81 moveto
-107 81 lineto
-107 64 lineto
-28 64 lineto
-28 81 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-28 81 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-231 148 [
-(r pitch)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-230 150 moveto
-281 150 lineto
-281 133 lineto
-230 133 lineto
-230 150 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-230 134 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-240 79 [
-(s pitch)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-239 81 moveto
-290 81 lineto
-290 64 lineto
-239 64 lineto
-239 81 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-239 81 moveto 7.00000000000006 0 rlineto 0 -1 rlineto -7.00000000000006 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-231 57 [
-(mtof)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-230 59 moveto
-260 59 lineto
-260 42 lineto
-230 42 lineto
-230 59 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-230 43 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-230 59 moveto 7 0 rlineto 0 -1.00000000000003 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-231 33 [
-(s frequency)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-230 35 moveto
-309 35 lineto
-309 18 lineto
-230 18 lineto
-230 35 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-230 35 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-16 33 [
-(s pitch)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-15 35 moveto
-66 35 lineto
-66 18 lineto
-15 18 lineto
-15 35 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-15 35 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-16 57 [
-(ftom)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-15 59 moveto
-45 59 lineto
-45 42 lineto
-15 42 lineto
-15 59 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-15 43 moveto 7 0 rlineto 0 -1 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-15 59 moveto 7 0 rlineto 0 -1.00000000000003 rlineto -7 0 rlineto closepath
-0 setlinejoin 2 setlinecap
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-77 103 [
-(<-- set frequency)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-291 102 [
-(<-- set MIDI pitch)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-51 56 [
-(<-- convert frequency)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-92 41 [
-(to "MIDI" pitch)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-269 56 [
-(<-- convert "MIDI" pitch)
-] 13 -0 0 0 false DrawText
-grestore
-gsave
-233 88 moveto
-242 81 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-233 88 moveto
-233 59 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-233 110 moveto
-233 105 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-18 88 moveto
-31 81 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-18 88 moveto
-18 59 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-18 133 moveto
-18 127 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-18 110 moveto
-18 105 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-233 133 moveto
-233 127 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-233 42 moveto
-233 35 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-18 42 moveto
-18 35 lineto
-0 setlinecap
-1 setlinejoin
-1 setlinewidth
-[] 0 setdash
-0.000 0.000 0.000 setrgbcolor AdjustColor
-stroke
-grestore
-gsave
-/Courier-Bold findfont 10 scalefont ISOEncode setfont
-0.000 0.000 0.000 setrgbcolor AdjustColor
-351 43 [
-(to frequency)
-] 13 -0 0 0 false DrawText
-grestore
-restore showpage
-
-%%Trailer
-end
-%%EOF
diff --git a/pd/doc/4.fft.examples/04.shifts.pd b/pd/doc/4.fft.examples/04.shifts.pd
index 9a03efbf..faf25118 100644
--- a/pd/doc/4.fft.examples/04.shifts.pd
+++ b/pd/doc/4.fft.examples/04.shifts.pd
@@ -13,8 +13,8 @@
#X text 93 23 This is a test of the "lrshift~" object \, which can be used for calculations that compare neighboring bins of an FFT. The "tabreceive~" picks up the contents of "array1' (consisting of 0 \, 1 \, 0 \, 0 \, ...) and the three print~ objects show the input and the two outputs.;
#X text 155 224 shift left;
#X text 182 260 shift right;
-#X obj 128 240 ../../extra/lrshift~ 1;
-#X obj 149 276 ../../extra/lrshift~ -1;
+#X obj 128 240 lrshift~ 1;
+#X obj 149 276 lrshift~ -1;
#X msg 49 131 \; pd dsp 1 \; array1 1 1;
#X text 223 5 SAMPLE SHIFTS;
#X connect 0 0 1 0;
diff --git a/pd/doc/4.fft.examples/10.phaselockedvoc.pd b/pd/doc/4.fft.examples/10.phaselockedvoc.pd
index 7eea2f57..a3592330 100644
--- a/pd/doc/4.fft.examples/10.phaselockedvoc.pd
+++ b/pd/doc/4.fft.examples/10.phaselockedvoc.pd
@@ -91,10 +91,10 @@
#X obj 516 515 tabread4~ sample;
#X obj 145 422 -~;
#X obj 249 385 r lock;
-#X obj 162 291 ../../extra/lrshift~ 1;
-#X obj 154 315 ../../extra/lrshift~ -1;
-#X obj 227 339 ../../extra/lrshift~ 1;
-#X obj 219 363 ../../extra/lrshift~ -1;
+#X obj 162 291 lrshift~ 1;
+#X obj 154 315 lrshift~ -1;
+#X obj 227 339 lrshift~ 1;
+#X obj 219 363 lrshift~ -1;
#X obj 210 432 -~;
#X obj 161 397 *~ 0;
#X obj 226 408 *~ 0;
diff --git a/pd/doc/4.fft.examples/11.pianorev.pd b/pd/doc/4.fft.examples/11.pianorev.pd
index ad7f8e7f..fd2f0c04 100644
--- a/pd/doc/4.fft.examples/11.pianorev.pd
+++ b/pd/doc/4.fft.examples/11.pianorev.pd
@@ -92,13 +92,13 @@
#X text 138 147 stronger than;
#X text 140 159 old one;
#X obj 245 130 -~;
-#X obj 259 105 ../../extra/lrshift~ 1;
+#X obj 259 105 lrshift~ 1;
#X obj 245 178 clip~ 0 1;
#X obj 245 156 *~ 1e+20;
#X obj 421 130 -~;
#X obj 421 178 clip~ 0 1;
#X obj 421 156 *~ 1e+20;
-#X obj 435 105 ../../extra/lrshift~ -1;
+#X obj 435 105 lrshift~ -1;
#X obj 64 214 *~;
#X obj 64 243 *~;
#X connect 0 0 2 0;
diff --git a/pd/doc/4.fft.examples/12.sinedecomposer.pd b/pd/doc/4.fft.examples/12.sinedecomposer.pd
index 52fb5eb9..3623af28 100644
--- a/pd/doc/4.fft.examples/12.sinedecomposer.pd
+++ b/pd/doc/4.fft.examples/12.sinedecomposer.pd
@@ -1,6 +1,6 @@
#N struct peak-template float x float y float amp float ampreal float
ampimag;
-#N canvas 251 262 858 492 12;
+#N canvas 82 391 858 492 12;
#X msg 501 258 bang;
#X obj 30 360 pack 0 100;
#X obj 30 384 line~;
@@ -31,7 +31,7 @@ ampimag;
#X obj 30 408 *~;
#X obj 29 435 dac~;
#X obj 476 231 adc~;
-#N canvas 204 36 521 368 analysis 0;
+#N canvas 204 36 521 368 analysis 1;
#X obj 206 37 inlet;
#X msg 207 68 bang;
#X obj 275 52 r snapshot;
@@ -43,7 +43,7 @@ ampimag;
#X obj 220 219 s found-peak;
#X obj 154 194 r loud;
#X obj 128 226 spigot;
-#X obj 220 193 ../../extra/pique;
+#X obj 220 193 pique;
#X connect 0 0 1 0;
#X connect 1 0 5 0;
#X connect 2 0 1 0;
@@ -58,20 +58,20 @@ ampimag;
#X restore 613 295 pd analysis;
#X obj 30 313 r loop-amp;
#X msg 613 271 snapshot;
-#X text 10 215 click here first;
+#X text 23 167 click here first;
#X text 613 247 analysis;
#N canvas 36 255 884 389 peak-saver 0;
-#X floatatom 710 310 0 0 0;
-#X floatatom 633 309 0 0 0;
-#X floatatom 560 305 0 0 0;
-#X floatatom 484 303 0 0 0;
+#X floatatom 710 310 0 0 0 0 - - -;
+#X floatatom 633 309 0 0 0 0 - - -;
+#X floatatom 560 305 0 0 0 0 - - -;
+#X floatatom 484 303 0 0 0 0 - - -;
#X obj 406 251 pointer;
#X obj 354 150 pointer;
#X msg 374 60 bang;
#X obj 142 243 rmstodb;
#X obj 10 244 * 0.1;
#X obj 141 268 * -3;
-#X floatatom 416 300 0 0 0;
+#X floatatom 416 300 0 0 0 0 - - -;
#X obj 353 36 r start-analysis;
#X obj 354 89 t b b;
#X msg 29 89 50 60 70;
@@ -118,65 +118,62 @@ ampimag;
float ampimag;
#X restore 339 402 pd peak-template;
#N canvas 0 0 600 382 peak-list 1;
-#X scalar peak-template 6.54702 330 -153.451 -0.00206937 -0.00295808
+#X scalar peak-template 58.2195 330 -122.487 0.000825282 -0.000727483
\;;
-#X scalar peak-template 13.0873 330 -226.384 0.0527068 -0.0271798 \;
-;
-#X scalar peak-template 26.0747 330 -193.145 -0.004041 0.0160602 \;
-;
-#X scalar peak-template 35.3241 330 -136.068 -0.00162406 0.000891527
-\;;
-#X scalar peak-template 39.3259 330 -172.59 0.00700493 0.00274829 \;
-;
-#X scalar peak-template 50.8632 330 -126.917 0.000847277 0.000991251
-\;;
-#X scalar peak-template 58.0851 330 -130.284 -0.00125865 -0.000785961
-\;;
-#X scalar peak-template 61.7223 330 -118.759 -0.000665894 -0.000682444
-\;;
-#X scalar peak-template 64.533 330 -123.671 -1.31387e-05 0.00115121
-\;;
-#X scalar peak-template 70.7855 330 -192.911 -0.0156921 0.00481118
-\;;
-#X scalar peak-template 83.2529 330 -128.585 0.00138656 -0.000101125
+#X scalar peak-template 113.041 330 -92.8753 -0.000338659 0.00010002
\;;
-#X scalar peak-template 87.7921 330 -102.858 -0.00011618 -0.000504767
+#X scalar peak-template 118.46 330 -94.8943 0.00031586 -0.000214072
\;;
-#X scalar peak-template 94.7598 330 -96.8563 -6.587e-06 -0.000411354
-\;;
-#X scalar peak-template 238.251 330 -157.634 -0.00175515 0.00385829
+#X scalar peak-template 138.93 330 -0 3.25541e-06 -5.9315e-06 \;;
+#X scalar peak-template 142.074 330 -0 7.21258e-06 6.84986e-07 \;;
+#X scalar peak-template 146.444 330 -0 -7.88035e-06 8.62137e-07 \;
+;
+#X scalar peak-template 172.29 330 -79.5955 0.000108583 0.000182228
\;;
-#X scalar peak-template 120.177 330 -149.995 -0.000220136 -0.00315404
+#X scalar peak-template 177.651 330 -85.3731 -0.000234655 0.00012266
\;;
-#X scalar peak-template 127.613 330 -115.813 0.000761733 0.000380684
+#X scalar peak-template 195.809 330 -0 2.79175e-06 -8.34867e-06 \;
+;
+#X scalar peak-template 203.103 330 -0 5.14234e-06 -6.78858e-06 \;
+;
+#X scalar peak-template 211.356 330 -0 -5.54349e-06 -6.98329e-06 \;
+;
+#X scalar peak-template 221.688 330 -42.6342 -5.09215e-05 6.6466e-06
\;;
-#X scalar peak-template 133.372 330 -93.2528 -7.56087e-05 -0.000350204
+#X scalar peak-template 226.081 330 -43.02 5.18789e-05 5.00157e-06
\;;
-#X scalar peak-template 140.63 330 -114.426 0.000604011 0.000535798
+#X scalar peak-template 229.339 330 -43.3736 -1.05481e-05 -5.17679e-05
\;;
-#X scalar peak-template 147.903 330 -101.806 -0.000357742 0.000345682
+#X scalar peak-template 274.262 330 -12.1351 -2.70512e-06 1.57e-05
\;;
-#X scalar peak-template 151.501 330 -102.007 0.000501161 -1.29982e-05
+#X scalar peak-template 277.663 330 -12.8808 -1.61933e-05 2.5564e-06
\;;
-#X scalar peak-template 156.14 330 -133.049 -0.00152793 -0.00062287
+#X scalar peak-template 290.641 330 -0 2.56841e-06 6.25735e-06 \;;
+#X scalar peak-template 303.545 330 -0 -5.80611e-06 4.01017e-06 \;
+;
+#X scalar peak-template 306.665 330 -0 6.64873e-06 2.12955e-06 \;;
+#X scalar peak-template 332.606 330 -31.28 -2.93873e-05 1.54798e-05
\;;
-#X scalar peak-template 168.988 330 -98.4353 1.06068e-05 0.000436979
+#X scalar peak-template 342.348 330 -39.2289 4.48755e-05 4.09977e-06
\;;
-#X scalar peak-template 176.71 330 -80.3132 7.61609e-05 -0.000204315
+#X scalar peak-template 349.861 330 -42.7285 -4.16831e-05 -3.03127e-05
\;;
-#X scalar peak-template 189.731 330 -124.879 -0.00119891 -0.000129939
+#X scalar peak-template 358.384 330 -16.8763 8.55105e-06 -1.70906e-05
\;;
-#X scalar peak-template 202.531 330 -84.7508 -0.000188934 0.000176472
+#X scalar peak-template 364.267 330 -0 -8.11825e-06 3.74108e-06 \;
+;
+#X scalar peak-template 381.317 330 -0 1.65706e-07 -7.33649e-06 \;
+;
+#X scalar peak-template 390.885 330 -0.231076 9.93783e-06 1.7404e-06
\;;
-#X scalar peak-template 210.532 330 -103.669 -0.000493027 -0.000206012
+#X scalar peak-template 401.603 330 -2.38845 -3.17752e-06 -1.04892e-05
\;;
-#X scalar peak-template 224.973 330 -86.5866 -0.000200658 -0.000191542
+#X scalar peak-template 408.086 330 -0.241569 2.517e-06 -9.77426e-06
\;;
#X restore 339 426 pd peak-list;
-#X msg 37 235 \; pd dsp 1;
-#X floatatom 720 273 0 0 0;
+#X msg 38 192 \; pd dsp 1;
#X obj 720 296 s loud;
-#X floatatom 557 77 0 0 0;
+#X floatatom 557 77 0 0 0 0 - - -;
#N canvas 194 37 730 728 output 0;
#X obj 77 218 t b;
#X obj 77 154 f;
@@ -219,8 +216,8 @@ sinusoidal peaks that were found at that instant in the sound. You
can also ask for the peak lists to be printed out.;
#N canvas 132 255 634 331 insample 0;
#N canvas 0 0 450 300 graph1 0;
-#X array sample 155948 float 0;
-#X coords 0 1 155947 -1 400 150 1;
+#X array sample 39075 float 0;
+#X coords 0 1 39074 -1 400 150 1;
#X restore 199 18 graph;
#X obj 19 70 r read-sample;
#X obj 19 95 unpack s f;
@@ -235,7 +232,7 @@ can also ask for the peak lists to be printed out.;
#X connect 4 0 6 0;
#X connect 5 0 4 0;
#X restore 336 350 pd insample;
-#X floatatom 134 363 0 0 0;
+#X floatatom 134 363 0 0 0 0 - - -;
#N canvas 190 43 405 461 test-signal 0;
#X obj 135 296 tabread4~ sample;
#X obj 135 271 line~;
@@ -255,7 +252,7 @@ can also ask for the peak lists to be printed out.;
#X text 242 13 sample playback;
#X msg 33 25 1;
#X obj 33 69 metro 1000;
-#X floatatom 33 48 0 0 0;
+#X floatatom 33 48 0 0 0 0 - - -;
#X obj 255 75 t b b f;
#X obj 161 84 t b f;
#X connect 0 0 4 0;
@@ -284,25 +281,28 @@ can also ask for the peak lists to be printed out.;
#X connect 20 1 2 1;
#X restore 134 386 pd test-signal;
#X text 135 341 amplitude;
-#X text 204 212 read a sample;
-#X msg 128 231 \; read-sample ../sound/bell.aiff 44100;
+#X text 212 174 read a sample;
+#X msg 136 193 \; read-sample ../sound/bell.aiff 44100;
#X text 12 97 The active ingredient is "pique" in the "analysis" subwindow
\, which is in the "extras" directory in the Pd release.;
-#X msg 124 275 \; read-sample ../sound/voice.wav 32000;
+#X msg 136 230 \; read-sample ../sound/voice.wav 32000;
#X obj 458 295 tabwrite~ sample;
-#X connect 0 0 37 0;
+#X obj 720 274 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
+1;
+#X msg 136 268 \; read-sample ../sound/voice2.wav;
+#X connect 0 0 36 0;
#X connect 1 0 2 0;
#X connect 2 0 5 0;
#X connect 3 0 1 0;
#X connect 5 0 6 0;
#X connect 5 0 6 1;
-#X connect 7 0 37 0;
+#X connect 7 0 36 0;
#X connect 9 0 3 0;
#X connect 10 0 8 0;
-#X connect 17 0 18 0;
-#X connect 19 0 21 0;
-#X connect 20 0 19 0;
-#X connect 22 0 20 0;
-#X connect 30 0 31 0;
-#X connect 31 0 4 0;
-#X connect 31 0 5 1;
+#X connect 18 0 20 0;
+#X connect 19 0 18 0;
+#X connect 21 0 19 0;
+#X connect 29 0 30 0;
+#X connect 30 0 4 0;
+#X connect 30 0 5 1;
+#X connect 37 0 17 0;
diff --git a/pd/doc/4.fft.examples/x.wav b/pd/doc/4.fft.examples/x.wav
index 3a2fd446..bccdad63 100644
--- a/pd/doc/4.fft.examples/x.wav
+++ b/pd/doc/4.fft.examples/x.wav
Binary files differ
diff --git a/pd/doc/5.reference/acoustics.pd b/pd/doc/5.reference/acoustics.pd
deleted file mode 100644
index 2a46f589..00000000
--- a/pd/doc/5.reference/acoustics.pd
+++ /dev/null
@@ -1,40 +0,0 @@
-#N canvas 163 25 582 408 12;
-#X obj 15 269 ftom;
-#X obj 8 10 mtof;
-#X obj 15 217 mtof;
-#X floatatom 15 189 0 0 0;
-#X floatatom 15 244 0 0 0;
-#X obj 64 10 ftom;
-#X floatatom 15 293 0 0 0;
-#X obj 120 11 dbtorms;
-#X obj 196 11 rmstodb;
-#X obj 275 11 dbtopow;
-#X obj 352 11 powtodb;
-#X text 21 53 The mtof object transposes a midi value into a frequency
-in Hertz \, so that "69" goes to "440". You can specify microtonal
-pitches as in "69.5" (a quarter tone higher than 69). Ftom does the
-reverse.;
-#X floatatom 147 185 0 0 0;
-#X floatatom 147 240 0 0 0;
-#X floatatom 147 289 0 0 0;
-#X obj 147 213 dbtorms;
-#X obj 147 265 rmstodb;
-#X floatatom 261 186 0 0 0;
-#X floatatom 261 241 0 0 0;
-#X floatatom 261 290 0 0 0;
-#X obj 261 214 dbtopow;
-#X obj 261 266 powtodb;
-#X text 27 336 Overflows and underflows are clipped.;
-#X text 300 376 updated for pd version 0.33;
-#X connect 0 0 6 0;
-#X connect 2 0 4 0;
-#X connect 3 0 2 0;
-#X connect 4 0 0 0;
-#X connect 12 0 15 0;
-#X connect 13 0 16 0;
-#X connect 15 0 13 0;
-#X connect 16 0 14 0;
-#X connect 17 0 20 0;
-#X connect 18 0 21 0;
-#X connect 20 0 18 0;
-#X connect 21 0 19 0;
diff --git a/pd/doc/5.reference/acoustics~.pd b/pd/doc/5.reference/acoustics~.pd
deleted file mode 100644
index f7515339..00000000
--- a/pd/doc/5.reference/acoustics~.pd
+++ /dev/null
@@ -1,81 +0,0 @@
-#N canvas 35 42 813 458 12;
-#X obj 158 118 mtof~;
-#X obj 158 174 snapshot~;
-#X obj 698 132 metro 100;
-#X floatatom 158 205 0 0 0;
-#X obj 49 174 snapshot~;
-#X floatatom 49 55 0 0 0;
-#X floatatom 49 205 0 0 0;
-#X obj 49 118 ftom~;
-#X obj 264 174 snapshot~;
-#X floatatom 264 205 0 0 0;
-#X obj 264 118 dbtorms~;
-#X obj 697 58 loadbang;
-#X msg 709 88 \; pd dsp 1;
-#X obj 49 86 sig~;
-#X floatatom 158 55 0 0 0;
-#X obj 158 86 sig~;
-#X floatatom 264 54 0 0 0;
-#X obj 264 86 sig~;
-#X obj 492 172 snapshot~;
-#X floatatom 492 203 0 0 0;
-#X obj 383 172 snapshot~;
-#X floatatom 383 53 0 0 0;
-#X floatatom 383 203 0 0 0;
-#X obj 607 172 snapshot~;
-#X floatatom 607 203 0 0 0;
-#X obj 383 84 sig~;
-#X floatatom 492 53 0 0 0;
-#X obj 492 84 sig~;
-#X floatatom 607 53 0 0 0;
-#X obj 607 84 sig~;
-#X obj 383 115 rmstodb~;
-#X obj 492 115 dbtopow~;
-#X obj 607 115 powtodb~;
-#X obj 17 10 mtof~;
-#X text 70 11 (etc) - conversions for audio signals;
-#X text 60 400 see also:;
-#X obj 145 400 mtof;
-#X text 192 400 (etc.);
-#X text 547 416 updated for Pd version 0.33;
-#X text 43 241 These objects convert MIDI pitch to frequency and back
-\, and dB to and from RMS and power. THey take audio signals as input
-and output (and work sample by sample.) Since they call library math
-functions \, they may be much more expensive than other workaday tilde
-objects such as *~ and osc~ \, depending on your hardware and math
-library.;
-#X text 41 343 Boundary conditions are handled "reasonably". 100 db
-is assigned an RMS of 1 \, and dbtorms~ and dbtopow~ output true zero
-for 0 dB and less.;
-#X connect 0 0 1 0;
-#X connect 1 0 3 0;
-#X connect 2 0 1 0;
-#X connect 2 0 8 0;
-#X connect 2 0 4 0;
-#X connect 2 0 20 0;
-#X connect 2 0 18 0;
-#X connect 2 0 23 0;
-#X connect 4 0 6 0;
-#X connect 5 0 13 0;
-#X connect 7 0 4 0;
-#X connect 8 0 9 0;
-#X connect 10 0 8 0;
-#X connect 11 0 2 0;
-#X connect 11 0 12 0;
-#X connect 13 0 7 0;
-#X connect 14 0 15 0;
-#X connect 15 0 0 0;
-#X connect 16 0 17 0;
-#X connect 17 0 10 0;
-#X connect 18 0 19 0;
-#X connect 20 0 22 0;
-#X connect 21 0 25 0;
-#X connect 23 0 24 0;
-#X connect 25 0 30 0;
-#X connect 26 0 27 0;
-#X connect 27 0 31 0;
-#X connect 28 0 29 0;
-#X connect 29 0 32 0;
-#X connect 30 0 20 0;
-#X connect 31 0 18 0;
-#X connect 32 0 23 0;
diff --git a/pd/doc/5.reference/adc~_dac~.pd b/pd/doc/5.reference/adc~_dac~.pd
deleted file mode 100644
index e97429b6..00000000
--- a/pd/doc/5.reference/adc~_dac~.pd
+++ /dev/null
@@ -1,11 +0,0 @@
-#N canvas 195 155 575 293 12;
-#X obj 8 11 adc~;
-#X obj 72 11 dac~;
-#X obj 63 121 adc~ 5;
-#X text 143 121 (input from channel 5 only);
-#X obj 61 145 dac~ 1 2 5 23;
-#X text 184 145 (output to channels 1 \, 2 \, 5 \, and 23);
-#X text 16 173 The actual number of channels Pd inputs and outputs are set on Pd's command line. You can open patches that want to use more channels \, and channel numbers out of rance will be dropped (dac~) or appear as zero (adc~).;
-#X text 308 254 updated for Pd version 0.33;
-#X text 122 9 - audio I/O;
-#X text 8 46 Adc~ and dac~ rovide real-time audio input and output for Pd \, respectively \, whether analog or digital. By default they are stereo but you can specify channel numbers as in:;
diff --git a/pd/doc/5.reference/append.pd b/pd/doc/5.reference/append.pd
deleted file mode 100644
index 7cacefe4..00000000
--- a/pd/doc/5.reference/append.pd
+++ /dev/null
@@ -1,44 +0,0 @@
-#N canvas 330 8 595 450 12;
-#X text 15 344 see also:;
-#N canvas 164 72 425 146 help-append-template1 0;
-#X obj 60 21 template float x float y float z;
-#X obj 18 81 filledpolygon z z 0 0 0 20 0 20 30 0 30;
-#X restore 357 373 pd help-append-template1;
-#X obj 141 393 template;
-#X obj 16 368 get;
-#X obj 48 368 set;
-#X obj 148 368 getsize;
-#X obj 215 368 setsize;
-#X obj 218 393 element;
-#X obj 15 394 sublist;
-#X obj 83 393 scalar;
-#N canvas 0 0 276 163 help-append-data 1;
-#X restore 357 351 pd help-append-data;
-#X obj 212 255 pointer;
-#X obj 21 10 append;
-#X text 75 9 -- add item to a list;
-#X msg 212 231 traverse pd-help-append-data \, bang;
-#X obj 34 295 append help-append-template1 x y z;
-#X floatatom 34 246 5 0 0;
-#X obj 34 266 t f f;
-#X msg 356 311 \; pd-help-append-data clear;
-#X text 27 28 "append" maintains a pointer to a scalar \, or else an
-empty pointer to the head of a list. You may set the pointer using
-the leftmost inlet. The creation arguments specify the template of
-a new scalar to append \, and the names of the fields (there should
-be at least one) you will wish to initialize. To append an object \,
-send a number to the leftmost inlet. "Append"'s pointer is updated
-to point to the new scalar \, and the new pointer is also output.;
-#X text 28 149 To insert to the beginning of a list \, you can append
-to the "head" of the list. You may append objects of different templates
-using different "append" objects.;
-#X obj 81 368 pointer;
-#X text 341 408 updated for Pd version 0.35;
-#X text 34 226 click this first->;
-#X text 230 210 go to (and output) "head" of the list;
-#X connect 11 0 15 3;
-#X connect 14 0 11 0;
-#X connect 16 0 17 0;
-#X connect 17 0 15 0;
-#X connect 17 1 15 1;
-#X connect 17 1 15 2;
diff --git a/pd/doc/5.reference/bag.pd b/pd/doc/5.reference/bag.pd
deleted file mode 100644
index cdd5bfff..00000000
--- a/pd/doc/5.reference/bag.pd
+++ /dev/null
@@ -1,27 +0,0 @@
-#N canvas 118 56 577 366 12;
-#X text 18 337 see also:;
-#X obj 148 337 makenote;
-#X msg 76 151 60 64;
-#X msg 127 151 60 0;
-#X msg 171 151 62 64;
-#X msg 218 151 62 0;
-#X obj 76 278 print;
-#X text 121 279 Output is in the printout window.;
-#X msg 218 197 clear;
-#X obj 66 15 bag;
-#X text 101 14 - COLLECTION OF NUMBERS;
-#X text 12 42 The bag object takes (value \, flag) pairs. If the flag is true (nonzero) \, the value is added to the collection \; if false \, it's removed. The collection may have many copies of the same value. You can output the collection (and empty it) with a "flush" message \, or just empty it with "clear." You can use this to mimic a sustain pedal \, for example.;
-#X msg 217 174 flush;
-#X obj 104 337 poly;
-#X obj 76 248 bag;
-#X text 267 151 <-- add or delete elements;
-#X text 271 174 <-- output them;
-#X text 273 198 <-- start over;
-#X text 328 337 updated for Pd version 0.33;
-#X connect 2 0 14 0;
-#X connect 3 0 14 0;
-#X connect 4 0 14 0;
-#X connect 5 0 14 0;
-#X connect 8 0 14 0;
-#X connect 12 0 14 0;
-#X connect 14 0 6 0;
diff --git a/pd/doc/5.reference/bang.pd b/pd/doc/5.reference/bang.pd
deleted file mode 100644
index 1f522268..00000000
--- a/pd/doc/5.reference/bang.pd
+++ /dev/null
@@ -1,13 +0,0 @@
-#N canvas 118 56 581 250 12;
-#X obj 49 182 print;
-#X text 107 183 Output is in the printout window.;
-#X obj 66 15 bang;
-#X text 112 14 - SEND "BANG" MSSESSAGE;
-#X msg 61 105 walk the cat;
-#X msg 49 79 45;
-#X obj 49 152 bang;
-#X text 336 233 updated for Pd version 0.27;
-#X text 23 42 Outputs a "bang" message whatever it receives.;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 0 0;
diff --git a/pd/doc/5.reference/bang~.pd b/pd/doc/5.reference/bang~.pd
deleted file mode 100644
index debade2f..00000000
--- a/pd/doc/5.reference/bang~.pd
+++ /dev/null
@@ -1,18 +0,0 @@
-#N canvas 0 0 529 299 12;
-#X obj 112 128 bang~;
-#X obj 112 159 print;
-#X msg 210 223 \; pd dsp 1;
-#X msg 297 216 \; pd dsp 0;
-#X msg 210 144 bang;
-#X obj 19 20 bang~;
-#X obj 306 193 loadbang;
-#X obj 297 169 delay 100;
-#X text 211 122 click to test;
-#X text 71 21 - output bang after each DSP cycle;
-#X text 5 59 Bang~ outputs a bang after each DSP cycle (at the same logical time as the DSP cycle.) This is primarily useful for sampling the outputs of analysis algorithms.;
-#X text 251 266 updated for Pd version 0.33;
-#X connect 0 0 1 0;
-#X connect 4 0 2 0;
-#X connect 4 0 7 0;
-#X connect 6 0 3 0;
-#X connect 7 0 3 0;
diff --git a/pd/doc/5.reference/biquad~.pd b/pd/doc/5.reference/biquad~.pd
deleted file mode 100644
index 81a31960..00000000
--- a/pd/doc/5.reference/biquad~.pd
+++ /dev/null
@@ -1,35 +0,0 @@
-#N canvas 185 22 655 349 12;
-#X obj 27 14 biquad~;
-#X msg 448 11 \; pd dsp 1;
-#X msg 448 55 \; pd dsp 0;
-#X obj 84 248 env~;
-#X floatatom 84 275;
-#X floatatom 15 110;
-#X obj 15 246 env~;
-#X floatatom 15 274;
-#X text 13 297 Compare the value of the straight signal on the left with the value of the filtered signal on the right.;
-#X obj 84 215 biquad~ 1.41407 -0.9998 1 -1.41421 1;
-#X msg 101 121 1.41407 -0.9998 1 -1.41421 1;
-#X text 76 31 calculates the following difference equation:;
-#X text 77 44 y(n) = ff1 * w(n) + ff2 * w(n-1) + ff3 * w(n-2);
-#X text 76 58 w(n) = x(n) + fb1 * w(n-1) + fb2 * w(n-2);
-#X text 18 76 Syntax: biquad~ fb1 fb2 ff1 ff2 ff3;
-#X text 341 213 this biquad~ is a notch filter for fn = Pi/4;
-#X text 390 226 (= SR/8 = 5512.5 Hz @44.1k);
-#X text 91 14 2-pole-2-zero-filter;
-#X text 113 99 list sets filter parameters;
-#X msg 119 161 set 0 0;
-#X msg 120 186 clear;
-#X obj 15 170 osc~ 5512.5;
-#X text 422 337 updated for Pd version-0.30;
-#X text 189 163 set internal state;
-#X text 187 185 ... or just clear it;
-#X connect 3 0 4 0;
-#X connect 5 0 21 0;
-#X connect 6 0 7 0;
-#X connect 9 0 3 0;
-#X connect 10 0 9 0;
-#X connect 19 0 9 0;
-#X connect 20 0 9 0;
-#X connect 21 0 6 0;
-#X connect 21 0 9 0;
diff --git a/pd/doc/5.reference/block~-help.pd b/pd/doc/5.reference/block~-help.pd
new file mode 100644
index 00000000..69abe2e2
--- /dev/null
+++ b/pd/doc/5.reference/block~-help.pd
@@ -0,0 +1,75 @@
+#N canvas 322 48 653 647 12;
+#X text 411 630 updated for Pd version 0.37;
+#X obj 48 10 block~;
+#X text 112 11 (and switch~) - block size and on/off control for DSP
+;
+#X text 44 40 The block~ and switch~ objects set the block size \,
+overlap \, and up/down-sampling ratio for the window. (The overlap
+and resampling ratio are relative to the super-patch.);
+#X text 137 332 INTERACTIONS WITH OTHER OBJECTS:;
+#X text 45 230 You may have at most one block~/switch~ object in any
+window.;
+#X text 45 176 A switch~ with no arguments does not reblock audio computation
+-- in other words \, block size and sample rate are as in the parent
+patch.;
+#X text 46 353 Dac~ and adc~ don't work correctly if reblocked \, nor
+if a parent window is reblocked \, even if the window containing the
+dac~ or adc~ is reblocked back to the default block size and sample
+rate.;
+#X text 48 573 see also:;
+#X obj 136 573 fft~;
+#X text 47 599 ... and the control.blocksize and up.downsampling audio
+example patches.;
+#X text 180 295 <--- example usage in subpatch;
+#N canvas 351 51 695 365 /SUBPATCH/ 1;
+#X obj 258 238 bang~;
+#X obj 258 264 t b b;
+#X obj 258 290 timer;
+#X floatatom 258 319 5 0 0 0 - - -;
+#X obj 54 30 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
+;
+#X msg 78 53 set 4096 1 1;
+#X msg 78 108 set 4096 2 1;
+#X msg 78 79 set 8192 1 1;
+#X msg 81 138 set 4096 1 0.5;
+#X msg 81 165 set 4096 1 2;
+#X obj 52 192 switch~ 4096 1 1;
+#X obj 258 347 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X text 94 25 <--- switch this subpatch on and off;
+#X text 209 53 <--- block size 4096 \, no overlap \, no resampling
+;
+#X text 206 81 <--- bigger block size;
+#X text 208 109 <--- double overlap;
+#X text 219 142 <--- downsampled by factor of 2;
+#X text 218 167 <--- upsampled by factor of 2;
+#X text 206 194 <--- creation arguments (if any) initialize blocking
+;
+#X text 317 317 <--- measured time (msec) between blocks;
+#X text 245 209 (args are blocksize \, overlap \, up/downsampling)
+;
+#X connect 0 0 1 0;
+#X connect 1 0 2 0;
+#X connect 1 1 2 1;
+#X connect 2 0 3 0;
+#X connect 3 0 11 0;
+#X connect 4 0 10 0;
+#X connect 5 0 10 0;
+#X connect 6 0 10 0;
+#X connect 7 0 10 0;
+#X connect 8 0 10 0;
+#X connect 9 0 10 0;
+#X restore 140 295 pd;
+#X text 47 501 Patches using send~/receive~ or throw~/catch~ to intercommunicate
+must have the same blocking -- and if their parents are blocked bigger
+than they are \, there might be wierdness.;
+#X text 45 420 If using send~ or delwrite~ from a switched-off patch
+\, the output of corresponding receive~ and delread~ objects in other
+\, running patches will cycle old input (and sound like garbage). Throw~
+may be switched with impunity \, but not catch~.;
+#X text 43 92 Switch~ \, in addition \, allows you to switch DSP on
+and off for the window. All subwindows are also switched. (If a subwindow
+of a switched window is also switched \, both switches must be on for
+the subwindow's audio DSP to run. Pd's global DSP must also be on.)
+;
+#X text 44 269 Pd's default block size is 64 samples.;
diff --git a/pd/doc/5.reference/bng.pd b/pd/doc/5.reference/bng.pd
deleted file mode 100644
index d48d560a..00000000
--- a/pd/doc/5.reference/bng.pd
+++ /dev/null
@@ -1,265 +0,0 @@
-#N canvas 11 201 538 357 10;
-#X obj 1 1 cnv 8 100 60 empty empty bng 20 20 1 18 -262144 -1109 0
-;
-#X text 10 288 (c) musil@iem.kug.ac.at;
-#X text 52 301 IEM KUG;
-#X text 118 61 click properties to;
-#X text 106 72 modify geometry \, colors \, etc.;
-#X obj 64 257 print;
-#N canvas 598 330 290 225 once 0;
-#X msg 38 73 1;
-#X obj 38 47 t b b;
-#X obj 68 124 sel 0;
-#X obj 68 103 f 0;
-#X obj 38 24 inlet;
-#X obj 68 154 outlet;
-#X connect 0 0 3 1;
-#X connect 1 0 0 0;
-#X connect 1 1 3 0;
-#X connect 2 0 5 0;
-#X connect 3 0 2 0;
-#X connect 4 0 1 0;
-#X restore 64 234 pd once;
-#X obj 36 258 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 3 130 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 36 173 bng 50 950 50 1 foo5_snd foo5_rcv big-bang 63 2 192 12
--262131 -260818 -143491;
-#X msg 36 53 33;
-#X msg 50 75 -3.14;
-#X msg 73 117 11 22 33.33;
-#X msg 63 95 open xxx;
-#X msg 96 142 funny;
-#X text 101 11 gui-bang:;
-#X obj 202 135 s foo5_rcv;
-#X obj 202 155 r foo5_snd;
-#X obj 202 115 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144
--1 -1;
-#X obj 202 175 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144
--1 -1;
-#X msg 4 53 0;
-#X text 125 205 UP- \, DOWN- \, LEFT- or RIGHT-key;
-#X text 124 216 for moving selected gui-objects;
-#N canvas 425 170 699 530 edit 0;
-#X obj 39 197 f;
-#X msg 17 176 bang;
-#X floatatom 55 175 3 63 88;
-#X floatatom 90 197 3 0 37;
-#X obj 39 220 pack 0 0;
-#X text 117 197 y-label;
-#X text 83 175 x-label;
-#X floatatom 259 143 3 8 75;
-#X text 286 143 size;
-#X obj 279 236 f;
-#X msg 257 215 bang;
-#X floatatom 295 214 3 -10 10;
-#X floatatom 330 236 3 -10 10;
-#X obj 279 259 pack 0 0;
-#X obj 304 348 f;
-#X msg 282 327 bang;
-#X floatatom 320 326 3 20 90;
-#X floatatom 355 348 3 150 200;
-#X obj 304 371 pack 0 0;
-#X text 323 214 x-delta;
-#X text 357 236 y-delta;
-#X text 348 326 x-position;
-#X text 382 348 y-position;
-#X obj 59 312 f;
-#X msg 37 291 bang;
-#X floatatom 75 290 3 0 2;
-#X floatatom 110 312 3 4 36;
-#X obj 59 335 pack 0 0;
-#X text 103 290 font;
-#X text 139 312 height;
-#X msg 36 399 \; foo5_rcv label blabla;
-#X msg 59 360 \; foo5_rcv label_font \$1 \$2;
-#X msg 39 245 \; foo5_rcv label_pos \$1 \$2;
-#X msg 47 135 \; foo5_rcv color \$1 \$2 \$3;
-#X msg 259 172 \; foo5_rcv size \$1;
-#X msg 279 284 \; foo5_rcv delta \$1 \$2;
-#X msg 304 396 \; foo5_rcv pos \$1 \$2;
-#X msg 483 133 \; foo5_rcv receive foo5a_rcv;
-#X msg 482 171 \; foo5a_rcv receive foo5_rcv;
-#X msg 483 50 \; foo5_rcv send foo5a_snd;
-#X msg 483 88 \; foo5_rcv send foo5_snd;
-#X text 526 349 no init;
-#X msg 505 368 \; foo5_rcv init 0;
-#X msg 512 435 \; foo5_rcv init 1;
-#X obj 493 260 f;
-#X msg 471 239 bang;
-#X floatatom 509 238 4 10 100;
-#X floatatom 544 261 5 100 3000;
-#X obj 493 283 pack 0 0;
-#X msg 493 308 \; foo5_rcv flashtime \$1 \$2;
-#X text 548 237 interrupt-time;
-#X text 585 262 hold-time;
-#X msg 36 435 \; foo5_rcv label big-bang;
-#X text 502 417 init bang on loadbang;
-#X text 519 221 flash-time:;
-#X obj 47 114 pack 0 0 0;
-#X obj 47 86 f;
-#X msg 24 38 bang;
-#X floatatom 63 36 3 0 29;
-#X floatatom 79 56 3 0 29;
-#X floatatom 112 72 3 0 29;
-#X text 91 36 background;
-#X text 106 56 front-color;
-#X text 140 73 label-color;
-#X msg 285 35 back;
-#X msg 285 55 front;
-#X msg 285 75 label;
-#X msg 247 35 bang;
-#N canvas 15 207 606 448 RGB_____________ 0;
-#X obj 97 56 inlet;
-#X obj 262 53 inlet;
-#X obj 339 55 inlet;
-#X obj 405 56 inlet;
-#X obj 97 270 bang;
-#X msg 77 295 0;
-#X msg 104 295 1;
-#X obj 146 268 bang;
-#X msg 132 295 0;
-#X msg 160 295 1;
-#X obj 196 269 bang;
-#X msg 187 295 0;
-#X msg 214 295 1;
-#X obj 265 313 spigot;
-#X obj 312 313 spigot;
-#X obj 359 313 spigot;
-#X obj 249 385 outlet;
-#X text 93 33 select;
-#X text 267 28 red;
-#X text 337 30 green;
-#X text 409 30 blue;
-#X obj 405 102 t b f;
-#X obj 339 160 +;
-#X obj 339 185 t b f;
-#X obj 339 216 +;
-#X obj 296 385 outlet;
-#X obj 343 385 outlet;
-#X obj 28 180 loadbang;
-#X obj 97 135 route back front label bang;
-#X obj 343 362 f;
-#X obj 296 361 f;
-#X obj 249 361 f;
-#X obj 262 79 * -65536;
-#X obj 339 80 * -256;
-#X obj 405 80 * -1;
-#X obj 339 247 - 1;
-#X obj 235 168 t b b b b;
-#X connect 0 0 28 0;
-#X connect 1 0 32 0;
-#X connect 2 0 33 0;
-#X connect 3 0 34 0;
-#X connect 4 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 14 1;
-#X connect 5 0 15 1;
-#X connect 6 0 13 1;
-#X connect 7 0 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 13 1;
-#X connect 8 0 15 1;
-#X connect 9 0 14 1;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 11 0 13 1;
-#X connect 11 0 14 1;
-#X connect 12 0 15 1;
-#X connect 13 0 31 1;
-#X connect 14 0 30 1;
-#X connect 15 0 29 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 35 0;
-#X connect 27 0 6 0;
-#X connect 28 0 4 0;
-#X connect 28 1 7 0;
-#X connect 28 2 10 0;
-#X connect 28 3 36 0;
-#X connect 29 0 26 0;
-#X connect 30 0 25 0;
-#X connect 31 0 16 0;
-#X connect 32 0 24 0;
-#X connect 33 0 22 0;
-#X connect 34 0 21 0;
-#X connect 35 0 15 0;
-#X connect 35 0 14 0;
-#X connect 35 0 13 0;
-#X connect 36 0 31 0;
-#X connect 36 1 30 0;
-#X connect 36 2 29 0;
-#X connect 36 3 35 0;
-#X restore 285 96 pd RGB_____________;
-#X floatatom 327 65 3 0 255;
-#X floatatom 370 65 3 0 255;
-#X floatatom 413 66 3 0 255;
-#X text 34 10 preset-colors;
-#X text 296 7 RGB-colors;
-#X text 327 47 red;
-#X text 363 46 green;
-#X text 411 46 blue;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 1;
-#X connect 3 0 4 1;
-#X connect 4 0 32 0;
-#X connect 7 0 34 0;
-#X connect 9 0 13 0;
-#X connect 10 0 9 0;
-#X connect 11 0 9 1;
-#X connect 12 0 13 1;
-#X connect 13 0 35 0;
-#X connect 14 0 18 0;
-#X connect 15 0 14 0;
-#X connect 16 0 14 1;
-#X connect 17 0 18 1;
-#X connect 18 0 36 0;
-#X connect 23 0 27 0;
-#X connect 24 0 23 0;
-#X connect 25 0 23 1;
-#X connect 26 0 27 1;
-#X connect 27 0 31 0;
-#X connect 44 0 48 0;
-#X connect 45 0 44 0;
-#X connect 46 0 44 1;
-#X connect 47 0 48 1;
-#X connect 48 0 49 0;
-#X connect 55 0 33 0;
-#X connect 56 0 55 0;
-#X connect 57 0 56 0;
-#X connect 58 0 56 1;
-#X connect 59 0 55 1;
-#X connect 60 0 55 2;
-#X connect 64 0 68 0;
-#X connect 65 0 68 0;
-#X connect 66 0 68 0;
-#X connect 67 0 68 0;
-#X connect 68 0 55 0;
-#X connect 68 1 55 1;
-#X connect 68 2 55 2;
-#X connect 69 0 68 1;
-#X connect 70 0 68 2;
-#X connect 71 0 68 3;
-#X restore 297 144 pd edit;
-#X obj 248 34 bng 15 250 50 0 aaa aaa empty 20 8 192 8 -262144 -1 -1
-;
-#X text 185 312 updated for Pd version 0.35;
-#X text 27 313 graz \, austria 2002;
-#X obj 180 11 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii;
-#X connect 6 0 5 0;
-#X connect 8 0 9 0;
-#X connect 9 0 7 0;
-#X connect 9 0 6 0;
-#X connect 10 0 9 0;
-#X connect 11 0 9 0;
-#X connect 12 0 9 0;
-#X connect 13 0 9 0;
-#X connect 14 0 9 0;
-#X connect 17 0 19 0;
-#X connect 18 0 16 0;
-#X connect 20 0 9 0;
diff --git a/pd/doc/5.reference/bp~.pd b/pd/doc/5.reference/bp~.pd
deleted file mode 100644
index 8bcd86b4..00000000
--- a/pd/doc/5.reference/bp~.pd
+++ /dev/null
@@ -1,40 +0,0 @@
-#N canvas 533 67 651 393 12;
-#X obj 124 11 bp~;
-#X text 159 11 - BANDPASS FILTER;
-#X obj 70 263 env~;
-#X floatatom 70 283 0 0 0;
-#X floatatom 104 193 0 0 0;
-#X obj 12 261 env~;
-#X floatatom 12 282 0 0 0;
-#X text 119 264 env~ gives the amplitude of the signal envelop in dB.
-;
-#X floatatom 12 123 0 0 0;
-#X msg 544 67 \; pd dsp 0;
-#X obj 12 146 osc~ 100;
-#X text 57 121 <-- scroll to change input frequency;
-#X msg 72 170 clear;
-#X text 122 169 <-- reinitialize internal state;
-#X text 398 361 updated for Pd version-0.30;
-#X msg 544 28 \; pd dsp 1;
-#X text 13 73 The left inlet is the incoming audio signal \, the middle
-control input sets center frequency and the rigth input sets "Q".;
-#X text 136 194 <-- center frequency;
-#X obj 72 241 bp~ 100 10;
-#X text 169 242 Arguments initialize center frequency and Q.;
-#X text 12 301 Compare the amplitude of the original signal on the
-left with the amplitude of the filtered signal on the right.;
-#X floatatom 153 215 0 0 0;
-#X text 185 216 <-- Q;
-#X text 16 35 bp~ passes a sinusoid at the center frequency at unit
-gain (approximately). Other frequencies are attenuated.;
-#X text 21 357 see also:;
-#X obj 110 356 vcf~;
-#X connect 2 0 3 0;
-#X connect 4 0 18 1;
-#X connect 5 0 6 0;
-#X connect 8 0 10 0;
-#X connect 10 0 5 0;
-#X connect 10 0 18 0;
-#X connect 12 0 18 0;
-#X connect 18 0 2 0;
-#X connect 21 0 18 2;
diff --git a/pd/doc/5.reference/canvas.pd b/pd/doc/5.reference/canvas.pd
deleted file mode 100644
index a6e33be5..00000000
--- a/pd/doc/5.reference/canvas.pd
+++ /dev/null
@@ -1,19 +0,0 @@
-#N canvas 210 82 579 437 12;
-#X obj 66 15 table;
-#X text 123 16 - Array of numbers;
-#X obj 34 199 table help-tab1 25;
-#X text 10 43 "Table" builds a subpatch with a graphical array inside.
-The creation arguments specify the name and an optional size in points.
-;
-#X msg 70 265 \; help-tab1 read table.txt;
-#X msg 70 309 \; help-tab1 write /tmp/table.txt;
-#X text 70 243 You can also send messages to the array by name:;
-#X text 216 200 <- optional creation args: name \, size;
-#X text 17 355 Unfortunately there's no way to set vertical range \,
-etc.;
-#X text 9 101 Note that the data (and other properties) of the array
-aren't saved with the patch. You can resize \, save to and/or read
-from an external file as you would with "array" objects. See "arrays"
-in the 2.control examples under the "pure documentation" help menu
-item.;
-#X text 325 391 updated for Pd version 0.35;
diff --git a/pd/doc/5.reference/change.pd b/pd/doc/5.reference/change.pd
deleted file mode 100644
index 74e16f6a..00000000
--- a/pd/doc/5.reference/change.pd
+++ /dev/null
@@ -1,23 +0,0 @@
-#N canvas 376 130 540 355 12;
-#X msg 67 124 bang;
-#X floatatom 67 266 0 0 0;
-#X floatatom 79 154 0 0 0;
-#X floatatom 104 182 0 0 0;
-#X text 284 309 updated for Pd version 0.27;
-#X text 173 239 creation argument initializes first value;
-#X obj 66 15 change;
-#X text 114 16 - ELIMINATE REDUNDANCY IN A NUMBER STEAM;
-#X text 12 42 The change object outputs its input only when it changes.
-You can "set" the current value \, or bang to force output.;
-#X obj 67 240 change 6.5;
-#X msg 105 211 set \$1;
-#X text 136 183 set the value;
-#X text 112 123 output current value;
-#X text 110 154 if different from current value \, output and set;
-#X obj 67 293 print;
-#X connect 0 0 9 0;
-#X connect 1 0 14 0;
-#X connect 2 0 9 0;
-#X connect 3 0 10 0;
-#X connect 9 0 1 0;
-#X connect 10 0 9 0;
diff --git a/pd/doc/5.reference/clip~.pd b/pd/doc/5.reference/clip~.pd
deleted file mode 100644
index 61c222fa..00000000
--- a/pd/doc/5.reference/clip~.pd
+++ /dev/null
@@ -1,30 +0,0 @@
-#N canvas 182 132 778 399 12;
-#X obj 75 164 clip~ -0.5 0.5;
-#X obj 75 104 osc~ 1000;
-#X graph graph1 0 1 100 -1 78 280 278 380;
-#X array array99 100 float 0;
-#X pop;
-#X obj 91 213 metro 500;
-#X obj 91 188 r metro;
-#X text 239 235 <-- graph the output;
-#X obj 75 237 tabwrite~ array99;
-#X msg 519 69 \; metro 0;
-#X msg 515 12 \; pd dsp 1 \; metro 1;
-#X text 604 26 <-- Click to start;
-#X text 589 73 <-- Click to stop;
-#X obj 42 19 clip~;
-#X text 88 18 - restrict a signal to lie between two limits;
-#X text 243 136 inlets to reset clip range;
-#X floatatom 135 136 4 0 0;
-#X floatatom 196 137 4 0 0;
-#X text 210 164 creation arguments initialize clip range;
-#X text 4 55 The clip~ object passes its signal input to its output
-\, clipping it to lie between two limits.;
-#X text 470 371 updated for Pd version 0.33;
-#X connect 0 0 6 0;
-#X connect 1 0 0 0;
-#X connect 3 0 6 0;
-#X connect 4 0 3 0;
-#X connect 4 0 3 0;
-#X connect 14 0 0 1;
-#X connect 15 0 0 2;
diff --git a/pd/doc/5.reference/cos~.pd b/pd/doc/5.reference/cos~.pd
deleted file mode 100644
index ba6f918e..00000000
--- a/pd/doc/5.reference/cos~.pd
+++ /dev/null
@@ -1,32 +0,0 @@
-#N canvas 134 143 768 332 12;
-#X obj 112 12 cos~;
-#X obj 23 200 cos~;
-#X obj 23 249 snapshot~;
-#X obj 23 152 sig~;
-#X floatatom 23 275 0 0 0;
-#X obj 23 125 * 0.01;
-#X floatatom 23 98 0 0 0;
-#X obj 90 215 metro 500;
-#X obj 90 189 r metro;
-#X msg 540 93 \; metro 0;
-#X msg 521 39 \; pd dsp 1 \; metro 1;
-#X text 159 13 - COSINE WAVESHAPER;
-#X text 86 125 Divide by 100;
-#X text 71 153 convert to audio;
-#X text 78 100 <-- Scroll to set input value;
-#X text 64 276 <-- output of the cos~ object;
-#X text 291 195 see also:;
-#X obj 379 197 osc~;
-#X obj 423 197 tabread4~;
-#X text 494 293 updated for Pd version 0.33;
-#X text 608 54 <-Click to start;
-#X text 609 99 <-Click to stop;
-#X text 9 45 The cos~ object outputs the cosine of its signal input.;
-#X connect 1 0 2 0;
-#X connect 2 0 4 0;
-#X connect 2 0 4 0;
-#X connect 3 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 5 0;
-#X connect 7 0 2 0;
-#X connect 8 0 7 0;
diff --git a/pd/doc/5.reference/cputime.pd b/pd/doc/5.reference/cputime.pd
deleted file mode 100644
index c0a0f43a..00000000
--- a/pd/doc/5.reference/cputime.pd
+++ /dev/null
@@ -1,15 +0,0 @@
-#N canvas 302 232 550 286 12;
-#X msg 74 144 bang;
-#X msg 30 115 bang;
-#X floatatom 30 206 0 0 0;
-#X text 71 113 Click here to reset;
-#X text 27 232 Output is in milliseconds;
-#X obj 30 175 cputime;
-#X text 124 144 Click here to get elapsed CPU time;
-#X text 6 51 The cputime object measures elapsed CPU time \, as measured by your operating system. This appears to work on NT \, IRIX \, and Linux \, but not on W98.;
-#X obj 66 15 cputime;
-#X text 123 16 - measure CPU usage;
-#X text 297 261 updated for Pd version 0.33;
-#X connect 0 0 5 1;
-#X connect 1 0 5 0;
-#X connect 5 0 2 0;
diff --git a/pd/doc/5.reference/delay.pd b/pd/doc/5.reference/delay.pd
deleted file mode 100644
index 5f90cd4b..00000000
--- a/pd/doc/5.reference/delay.pd
+++ /dev/null
@@ -1,30 +0,0 @@
-#N canvas 3 0 513 348 12;
-#X obj 66 15 delay;
-#X obj 13 229 50;
-#X msg 13 98 bang;
-#X floatatom 13 255;
-#X floatatom 116 182;
-#X obj 51 230 0;
-#X text 111 16 - CALLBACK AFTER TIME DELAY;
-#X text 130 205 <-- creation argument initializes delay time;
-#X text 6 41 The delay object sends a bang to its outlet after a delay in milliseconds specified by its right inlet or its creation argument.;
-#X obj 51 204 delay 1000;
-#X text 58 86 Click here to test the delay object by initializing the number box below to 50 and then clearing it after the specified delay.;
-#X text 94 132 Click here to CANCEL delay's action;
-#X msg 51 133 stop;
-#X text 43 324 see also:;
-#X obj 155 323 timer;
-#X obj 111 323 metro;
-#X msg 62 155 2000;
-#X text 102 154 Number in right inlet sets time and schedules the action.;
-#X text 316 320 updated for Pd version 0.3;
-#X text 145 183 <-- scroll to change delay time in milliseconds;
-#X text 14 280 Note: sending a bang to a delay which is already set will reschedule its output \, cancelling the old one.;
-#X connect 1 0 3 0;
-#X connect 2 0 1 0;
-#X connect 2 0 9 0;
-#X connect 4 0 9 1;
-#X connect 5 0 3 0;
-#X connect 9 0 5 0;
-#X connect 12 0 9 0;
-#X connect 16 0 9 0;
diff --git a/pd/doc/5.reference/delread~.pd b/pd/doc/5.reference/delread~.pd
deleted file mode 100644
index 682f6e98..00000000
--- a/pd/doc/5.reference/delread~.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 24 20 796 472 12;
-#X text 351 276 1st argument: name of delay line;
-#X floatatom 116 253 0 0 0;
-#X text 151 255 float input (delay time in ms);
-#X text 127 310 signal output (delayed signal);
-#X text 21 52 You can use more than one delread~ objects for the same delay line.;
-#X text 20 81 If the specified delay time is longer than the size of the delay line or less than zero it is clipped to the length of the delay line.;
-#X obj 383 226 delwrite~ del_example 1000;
-#X floatatom 383 177 0 0 0;
-#X obj 116 375 snapshot~;
-#X floatatom 116 399 0 0 0;
-#X obj 24 246 loadbang;
-#X obj 24 313 metro 200;
-#X msg 32 273 \; pd dsp 1;
-#X obj 116 286 delread~ del_example 1000;
-#X obj 24 16 delread~;
-#X text 424 176 input to delay line;
-#X obj 383 201 sig~;
-#X text 433 443 updated for Pd version 0.33;
-#X text 89 16 - read a signal from a delay line;
-#X text 21 133 Note: if the delaywrite~ runs after the delread~ the minimum delay is actually one DSP period \, not zero.;
-#X text 351 292 2nd argument: (initial) delay time in ms;
-#X obj 126 444 delwrite~;
-#X obj 217 444 vd~;
-#X text 36 443 see also:;
-#X connect 1 0 13 0;
-#X connect 7 0 16 0;
-#X connect 8 0 9 0;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 11 0 8 0;
-#X connect 13 0 8 0;
-#X connect 16 0 6 0;
diff --git a/pd/doc/5.reference/delwrite~.pd b/pd/doc/5.reference/delwrite~.pd
deleted file mode 100644
index 50ca3f63..00000000
--- a/pd/doc/5.reference/delwrite~.pd
+++ /dev/null
@@ -1,15 +0,0 @@
-#N canvas 12 24 663 281 12;
-#X obj 24 16 delwrite~;
-#X obj 24 158 delwrite~ del_line_xxx 500;
-#X text 88 123 signal input;
-#X text 116 16 writes a signal in a delay line;
-#X text 271 156 1st argument: name of delay line;
-#X text 411 243 updated for Pd version 0.33;
-#X obj 24 124 sig~ 0;
-#X text 19 50 Delwrite~ allocates memory for a delay line and writes an audio signal into it. Delread~ objects by hte same name read from the delay line.;
-#X text 294 186 (= max. delay time);
-#X text 271 172 2nd argument: length of delay line in msec;
-#X text 24 203 see also:;
-#X obj 112 205 delread~;
-#X obj 193 205 vd~;
-#X connect 6 0 1 0;
diff --git a/pd/doc/5.reference/drawnumber.pd b/pd/doc/5.reference/drawnumber.pd
deleted file mode 100644
index a62a8103..00000000
--- a/pd/doc/5.reference/drawnumber.pd
+++ /dev/null
@@ -1,35 +0,0 @@
-#N struct help-drawnumber-template float x float y float cat float
-dog;
-#N canvas 369 6 538 189 12;
-#X text 15 103 see also:;
-#X obj 18 7 drawnumber;
-#X obj 204 132 plot;
-#X obj 100 131 drawpolygon;
-#X obj 22 130 template;
-#X text 114 7 -- draw numeric fields from data structures;
-#N canvas 14 10 297 129 help-drawnumber-data 1;
-#X scalar help-drawnumber-template 50 100 23 43 \;;
-#X scalar help-drawnumber-template 150 50 3.14 -1.618 \;;
-#X restore 273 71 pd help-drawnumber-data;
-#N canvas 57 283 580 439 help-drawnumber-template 1;
-#X text 24 316 This object defines the fields for this template. Their
-values are initialized in the "works" subwindow. You can see them by
-right-clicking on the object in the "data" window and selecting "properties."
-;
-#X text 44 104 - RGB color (0=black \, 999=white \, 900=red \, 90=green
-\, 9=blue \, 555=grey \, etc.);
-#X obj 11 294 template float x float y float cat float dog;
-#X text 22 166 Any of these can be numbers or field names \, like "dog"
-and "cat" here.;
-#X text 22 202 When not in "edit" mode \, you can click and drag vertically
-on the numbers to change their values. (In edit mode you can move \,
-cut \, copy \, and paste the objects.);
-#X text 24 251 Keyboard entry isn't supported yet.;
-#X obj 24 15 drawnumber cat 0 0 0 cat=;
-#X obj 259 16 drawnumber dog 0 -15 900 dog=;
-#X text 44 136 - an optional label ("cat=" for instance);
-#X text 26 44 drawnumber takes arguments specifying:;
-#X text 44 84 - an (x \, y) pair giving relative coordinates \;;
-#X text 44 64 - the number to draw;
-#X restore 273 45 pd help-drawnumber-template;
-#X text 275 159 updated for Pd version 0.35;
diff --git a/pd/doc/5.reference/drawpolygon.pd b/pd/doc/5.reference/drawpolygon.pd
deleted file mode 100644
index fc422af4..00000000
--- a/pd/doc/5.reference/drawpolygon.pd
+++ /dev/null
@@ -1,41 +0,0 @@
-#N struct help-drawpolygon-template float x float y float cat float
-dog float weasel;
-#N canvas 411 8 565 187 12;
-#X text 13 130 see also:;
-#X obj 111 149 drawnumber;
-#X obj 207 149 plot;
-#X obj 21 10 drawpolygon;
-#X obj 21 33 drawcurve;
-#X obj 126 11 filledpolygon;
-#X obj 127 33 filledcurve;
-#X text 225 10 -- draw shapes for data structures;
-#N canvas 30 290 587 435 help-drawpolygon-template 1;
-#X obj 14 335 template float x float y float cat float dog float weasel
-;
-#X obj 19 24 drawpolygon 0 2 0 0 0 weasel;
-#X text 26 44 drawpolygon and drawcurve take arguments specifying:
-;
-#X text 29 137 Any of these can be numbers or field names \, like "weasel"
-here. The example above draws a vertical black line of height "weasel".
-;
-#X obj 19 194 filledpolygon 900 dog 3 10 0 20 cat 30 0;
-#X text 31 216 filledpolyconn and filledcurve take the same arguments
-\, except that a new first argument is added to specify interior color.
-Here the interior color is red (900) \, the outline color is controlled
-by the "dog" field \, and the three points describe a triangle of altitude
-"cat". The fields x and y automatically govern the placement of the
-object as a whole.;
-#X text 45 62 - RGB color (0=black \, 999=white \, 900=red \, 90=green
-\, 9=blue \, 555=grey \, etc.);
-#X text 46 95 - line width;
-#X text 46 116 - two or more (x \, y) pairs giving coordinates.;
-#X text 24 357 This object defines the fields for this template. You
-can see teh fields' values by right-clicking on the object in the "data"
-window and selecting "properties.";
-#X restore 274 93 pd help-drawpolygon-template;
-#X obj 34 149 template;
-#N canvas 10 18 384 178 help-drawpolygon-data 1;
-#X scalar help-drawpolygon-template 50 40 30 9 80 \;;
-#X scalar help-drawpolygon-template 150 40 -20 90 50 \;;
-#X restore 274 119 pd help-drawpolygon-data;
-#X text 312 168 updated for Pd version 0.35;
diff --git a/pd/doc/5.reference/element.pd b/pd/doc/5.reference/element.pd
deleted file mode 100644
index a3faeecf..00000000
--- a/pd/doc/5.reference/element.pd
+++ /dev/null
@@ -1,51 +0,0 @@
-#N struct help-element-template float x float y array array1 help-element-array1-template
-;
-#N struct help-element-array1-template float y;
-#N canvas 330 34 668 442 12;
-#X text 24 373 see also:;
-#X obj 21 393 template;
-#N canvas 393 10 491 261 help-element-template 0;
-#X obj 27 76 plot array1 500 1 10 15 20;
-#X obj 27 174 filledpolygon 509 509 0 -10 -10 10 -10 10 10 -10 10;
-#X obj 24 16 template float x float y array array1 help-element-array1-template
-;
-#X restore 414 349 pd help-element-template;
-#N canvas 0 0 288 159 help-element-data 1;
-#X scalar help-element-template 35 24 \; 0 \; 10 \; 0 \; 10 \; 20 \;
-10 \; 20 \; 70 \; 10 \; \;;
-#X restore 450 328 pd help-element-data;
-#N canvas 196 292 365 134 help-element-array1-template 0;
-#X obj 30 71 filledpolygon 0 0 0 -5 0 0 5 5 0 0 -5;
-#X obj 32 27 template float y;
-#X restore 354 371 pd help-element-array1-template;
-#X obj 22 11 element;
-#X text 91 10 -- get pointer to an element of an array;
-#X obj 98 393 pointer;
-#X obj 166 393 getsize;
-#X obj 234 393 setsize;
-#X text 24 44 "element" takes a pointer at right and a number at left.
-It looks up a field from the pointer \, which should be an array \,
-and outputs the element of the array specified by the number. There
-are no pointers to arrays themselves \, just to individual elements.
-The template and field mane are specified as creation arguments.;
-#X obj 150 228 pointer;
-#X msg 150 204 traverse pd-help-element-data \, next;
-#X floatatom 38 230 5 0 0;
-#X obj 38 256 element help-element-template array1;
-#X obj 38 303 get help-element-array1-template y;
-#X floatatom 38 330 5 0 0;
-#X text 370 256 arguments: template \, field name;
-#X text 247 230 pointer inlet;
-#X text 36 209 index;
-#X text 43 277 outlet is pointer to single element;
-#X text 89 328 here we just get the value of y.;
-#X text 24 143 Indices range from 0 to the number of elements minus
-one \; indices out of range are quietly replaced by the nearest endpoint.
-;
-#X text 152 184 click here first;
-#X text 407 416 updated for Pd version 0.35;
-#X connect 11 0 14 1;
-#X connect 12 0 11 0;
-#X connect 13 0 14 0;
-#X connect 14 0 15 0;
-#X connect 15 0 16 0;
diff --git a/pd/doc/5.reference/env~.pd b/pd/doc/5.reference/env~.pd
deleted file mode 100644
index 64a245ae..00000000
--- a/pd/doc/5.reference/env~.pd
+++ /dev/null
@@ -1,28 +0,0 @@
-#N canvas 40 55 711 401 12;
-#X floatatom 103 303 0 0 0;
-#X obj 74 14 env~;
-#X text 120 16 - envelope follower;
-#X obj 103 275 env~ 16384;
-#X obj 103 214 osc~ 400;
-#X obj 103 241 *~;
-#X floatatom 217 220 3 -99 300;
-#X obj 217 244 dbtorms;
-#X text 9 46 The env~ object takes a signal and outputs its RMS amplitude
-in dB (with 1 normalized to 100 dB.) Output is bounded below by zero.
-;
-#X text 8 105 The analysis is Hanning windowed.;
-#X text 9 131 The optional creation argument is the analysis window
-size in samples \, and should be a power of two. The analysis windows
-overlap by two \, so that the period of output is half the window size.
-;
-#X text 206 274 <- creation argument sets window size;
-#X text 265 221 <- set peak-to-peak amplitude here in dB.;
-#X text 185 305 <- the output is RMS amplitude which is about 3 dB
-below peak-to-peak amplitude.;
-#X text 459 375 updated for Pd version 0.35;
-#X connect 3 0 0 0;
-#X connect 3 0 0 0;
-#X connect 4 0 5 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 7 0 5 1;
diff --git a/pd/doc/5.reference/fft~-help.pd b/pd/doc/5.reference/fft~-help.pd
index 149a6634..e2209620 100644
--- a/pd/doc/5.reference/fft~-help.pd
+++ b/pd/doc/5.reference/fft~-help.pd
@@ -1,8 +1,8 @@
#N canvas 22 7 886 436 12;
#X text 85 158 frequency;
-#X floatatom 16 173 0 0 0;
+#X floatatom 16 173 0 0 0 0 - - -;
#X obj 16 120 * 44100;
-#X floatatom 16 94 0 0 0;
+#X floatatom 16 94 0 0 0 0 - - -;
#X text 88 92 frequency;
#X text 91 111 in bins;
#X text 85 175 in Hz.;
@@ -35,16 +35,16 @@
by an IFFT has a gain of N.;
#X text 346 343 See the FFT examples to see how to use these in practice.
;
-#X text 346 112 The FFT objects do Fourier analyses and resyntheses
-of incoming real or complex signals. Complex signals are handled as
-pairs of signals (real and imaginary part.) The analysis size is one
-block (you can use the block~ or switch~ obejcts to control block size).
-;
#X text 347 205 The real FFT outputs N/2+1 real parts and N/2-1 imaginary
parts. The other outputs are zero. At DC and at the Nyquist there is
no imaginary part \, but the second through Nth output is as a real
and imaginary pair \, which can be thought of as the cosine and sin
component strengths.;
+#X text 346 112 The FFT objects do Fourier analyses and resyntheses
+of incoming real or complex signals. Complex signals are handled as
+pairs of signals (real and imaginary part.) The analysis size is one
+block (you can use the block~ or switch~ objects to control block size).
+;
#X connect 1 0 7 0;
#X connect 2 0 15 0;
#X connect 3 0 2 0;
diff --git a/pd/doc/5.reference/fft~.pd b/pd/doc/5.reference/fft~.pd
deleted file mode 100644
index 149a6634..00000000
--- a/pd/doc/5.reference/fft~.pd
+++ /dev/null
@@ -1,64 +0,0 @@
-#N canvas 22 7 886 436 12;
-#X text 85 158 frequency;
-#X floatatom 16 173 0 0 0;
-#X obj 16 120 * 44100;
-#X floatatom 16 94 0 0 0;
-#X text 88 92 frequency;
-#X text 91 111 in bins;
-#X text 85 175 in Hz.;
-#X obj 16 229 osc~;
-#X obj 36 16 fft~;
-#X obj 86 17 ifft~;
-#X text 146 15 - forward and inverse complex FFT;
-#X obj 36 42 rfft~;
-#X obj 86 43 rifft~;
-#X text 146 41 - forward and inverse real FFT;
-#X obj 16 254 rfft~;
-#X obj 16 148 / 64;
-#X obj 574 21 loadbang;
-#X msg 574 47 \; pd dsp 1;
-#X text 636 403 updated for Pd version 0.33;
-#X obj 16 322 rifft~;
-#X obj 102 310 print~ real;
-#X obj 115 285 print~ imaginary;
-#X obj 16 352 /~ 64;
-#X obj 16 407 print~ resynthesized;
-#X msg 30 380 bang;
-#X msg 101 248 bang;
-#X msg 100 199 0.25;
-#X msg 152 199 0;
-#X text 195 200 <-- bash phase;
-#X text 152 249 <-- print analysis;
-#X text 79 380 <-- print resynthesis;
-#X text 76 352 <-- renormalize;
-#X text 347 294 There is no normalization \, so that an FFT followed
-by an IFFT has a gain of N.;
-#X text 346 343 See the FFT examples to see how to use these in practice.
-;
-#X text 346 112 The FFT objects do Fourier analyses and resyntheses
-of incoming real or complex signals. Complex signals are handled as
-pairs of signals (real and imaginary part.) The analysis size is one
-block (you can use the block~ or switch~ obejcts to control block size).
-;
-#X text 347 205 The real FFT outputs N/2+1 real parts and N/2-1 imaginary
-parts. The other outputs are zero. At DC and at the Nyquist there is
-no imaginary part \, but the second through Nth output is as a real
-and imaginary pair \, which can be thought of as the cosine and sin
-component strengths.;
-#X connect 1 0 7 0;
-#X connect 2 0 15 0;
-#X connect 3 0 2 0;
-#X connect 7 0 14 0;
-#X connect 14 0 20 0;
-#X connect 14 0 19 0;
-#X connect 14 1 21 0;
-#X connect 14 1 19 1;
-#X connect 15 0 1 0;
-#X connect 16 0 17 0;
-#X connect 19 0 22 0;
-#X connect 22 0 23 0;
-#X connect 24 0 23 0;
-#X connect 25 0 20 0;
-#X connect 25 0 21 0;
-#X connect 26 0 7 1;
-#X connect 27 0 7 1;
diff --git a/pd/doc/5.reference/float.pd b/pd/doc/5.reference/float.pd
deleted file mode 100644
index efc5235a..00000000
--- a/pd/doc/5.reference/float.pd
+++ /dev/null
@@ -1,18 +0,0 @@
-#N canvas 23 20 429 272 12;
-#X msg 30 107 bang;
-#X obj 30 183 float 6.5;
-#X floatatom 30 209;
-#X floatatom 42 129;
-#X floatatom 88 153;
-#X obj 55 12 float;
-#X text 97 11 - STORE A (FLOATING POINT) NUMBER;
-#X text 12 36 The float object stores a number \, initialized by its creation argument \, which may be reset using its inlet and output by sending it the "bang" message. Sending a number sets a new value and outputs it.;
-#X text 77 103 outputs the value;
-#X text 74 130 sets and outputs the value;
-#X text 123 155 sets the value;
-#X text 108 184 creation argument initializes the value;
-#X text 223 242 updated for Pd version 0.3;
-#X connect 0 0 1 0;
-#X connect 1 0 2 0;
-#X connect 3 0 1 0;
-#X connect 4 0 1 1;
diff --git a/pd/doc/5.reference/framp~.pd b/pd/doc/5.reference/framp~.pd
deleted file mode 100644
index cbf3f047..00000000
--- a/pd/doc/5.reference/framp~.pd
+++ /dev/null
@@ -1,40 +0,0 @@
-#N canvas 22 7 857 377 12;
-#X text 85 158 frequency;
-#X floatatom 16 173 0 0 0;
-#X obj 16 120 * 44100;
-#X floatatom 16 94 0 0 0;
-#X text 88 92 frequency;
-#X text 91 111 in bins;
-#X text 85 175 in Hz.;
-#X obj 17 238 rfft~;
-#X obj 16 148 / 64;
-#X obj 653 14 loadbang;
-#X msg 653 40 \; pd dsp 1;
-#X text 599 339 updated for Pd version 0.33;
-#X msg 103 260 bang;
-#X text 154 261 <-- print analysis;
-#X obj 36 16 framp~;
-#X text 119 15 - estimate frequency and amplitude of FFT components
-;
-#X obj 16 270 framp~;
-#X obj 103 322 print~ frequency;
-#X obj 118 297 print~ amplitude;
-#X obj 16 204 osc~;
-#X text 324 98 Framp~ takes as input a rectangular-windowed FFT and
-outputs \, for each FFT channel \, the estimated amplitude and frequency
-of any component feedinf that channel. A sinusoidal component should
-appear in four components (or three in the special case of a sinusoid
-exactly tuned to a bin.) Frequency output is in bins \, i.e. \, units
-of SR/N.;
-#X connect 1 0 19 0;
-#X connect 2 0 8 0;
-#X connect 3 0 2 0;
-#X connect 7 0 16 0;
-#X connect 7 1 16 1;
-#X connect 8 0 1 0;
-#X connect 9 0 10 0;
-#X connect 12 0 17 0;
-#X connect 12 0 18 0;
-#X connect 16 0 17 0;
-#X connect 16 1 18 0;
-#X connect 19 0 7 0;
diff --git a/pd/doc/5.reference/gatom.pd b/pd/doc/5.reference/gatom.pd
deleted file mode 100644
index 2dd7ce61..00000000
--- a/pd/doc/5.reference/gatom.pd
+++ /dev/null
@@ -1,32 +0,0 @@
-#N canvas 138 65 675 508 12;
-#X floatatom 107 9 0 0 0;
-#X text 155 10 atoms (number boxes);
-#X floatatom 38 85 0 0 0;
-#X floatatom 38 125 0 0 0;
-#X msg 51 260 set 45;
-#X floatatom 51 288 0 0 0;
-#X floatatom 51 317 0 0 0;
-#X text 84 40 Number boxes allow you to display numbers or to enter
-numbers using the mouse and keyboard. When a number arrives at the
-number box's inlet \, it is displayed and sent to the outlet. You can
-click on a number box and drag upward or downward to change the value
-continuously.;
-#X text 88 130 You can shift-click and drag to change the number by
-hundredths instead of units. Alt clicking toggles the value between
-0 and the last nonzero value.;
-#X text 83 184 You can also type in values by clicking and typing a
-number followed by "enter.";
-#X text 30 220 the "set" message sets the number box's value but does
-not send it to the outlet.;
-#X text 423 482 updated for Pd version 0.34;
-#X text 39 339 You can set the width of the box by right-clicking and
-choosing "properties." By default the width is 5 characters. If you
-select a width of 0 \, the number box will grow as needed to hold the
-number--BUT BEWARE \, THIS IS EXPENSIVE IN CPU TIME. In a production
-patch \, you'll want to set a specific width.;
-#X floatatom 547 439 1 0 0;
-#X text 41 438 A width of one gives a clickable toggle switch ala Max:
-;
-#X connect 2 0 3 0;
-#X connect 4 0 5 0;
-#X connect 5 0 6 0;
diff --git a/pd/doc/5.reference/get.pd b/pd/doc/5.reference/get.pd
deleted file mode 100644
index 6784a6ce..00000000
--- a/pd/doc/5.reference/get.pd
+++ /dev/null
@@ -1,46 +0,0 @@
-#N struct help-get-template1 float x float y;
-#N canvas 293 5 629 429 12;
-#X text 13 325 see also:;
-#X obj 143 370 template;
-#X obj 84 345 set;
-#X obj 116 345 append;
-#X obj 175 345 getsize;
-#X obj 243 345 setsize;
-#X obj 311 345 element;
-#X obj 16 370 sublist;
-#X obj 84 370 scalar;
-#X msg 60 130 next;
-#N canvas 164 72 425 146 help-get-template1 0;
-#X obj 41 87 filledpolygon 9 0 1 0 0 20 0 20 30 0 30;
-#X obj 60 21 template float x float y;
-#X restore 376 234 pd help-get-template1;
-#N canvas 0 0 276 156 help-get-data 1;
-#X scalar help-get-template1 46 23 \;;
-#X scalar help-get-template1 106 73 \;;
-#X restore 376 212 pd help-get-data;
-#X obj 21 10 get;
-#X text 86 10 -- get values from a scalar;
-#X msg 45 102 traverse pd-help-get-data \, next;
-#X floatatom 45 214 5 0 0;
-#X floatatom 222 210 5 0 0;
-#X obj 45 157 pointer;
-#X text 337 101 output first scalar in list;
-#X text 103 129 output next item;
-#X text 21 277 If you have data whose template varies (from a heterogeneous
-list \, for example) you can use "pointer" to select according to template
-before sending to "get".;
-#X obj 45 185 get help-get-template1 x y;
-#X text 31 37 "Get" \, when sent a pointer to a scalar \, retrieves
-fields from it by name. The fields can be float or symbol. In the future
-this will also allow access to sublists of scalars.;
-#X text 293 167 First argument selects template.;
-#X text 294 182 Remaining args are names of fields.;
-#X text 41 233 x output;
-#X text 220 232 y output;
-#X obj 16 345 pointer;
-#X text 373 399 updated for Pd version 0.35;
-#X connect 9 0 17 0;
-#X connect 14 0 17 0;
-#X connect 17 0 21 0;
-#X connect 21 0 15 0;
-#X connect 21 1 16 0;
diff --git a/pd/doc/5.reference/getsize.pd b/pd/doc/5.reference/getsize.pd
deleted file mode 100644
index f2b17e2f..00000000
--- a/pd/doc/5.reference/getsize.pd
+++ /dev/null
@@ -1,41 +0,0 @@
-#N struct help-getsize-template float x float y array array1 help-getsize-array1-template
-;
-#N struct help-getsize-array1-template float y;
-#N canvas 340 20 655 398 12;
-#X text 28 319 see also:;
-#X obj 25 339 template;
-#N canvas 393 10 491 261 help-getsize-template 0;
-#X obj 27 76 plot array1 500 1 10 15 20;
-#X obj 27 174 filledpolygon 509 509 0 -10 -10 10 -10 10 10 -10 10;
-#X obj 24 16 template float x float y array array1 help-getsize-array1-template
-;
-#X restore 338 311 pd help-getsize-template;
-#N canvas 0 0 301 193 help-getsize-data 1;
-#X scalar help-getsize-template 43 37 \; 0 \; 10 \; 0 \; 10 \; 20 \;
-10 \; 20 \; 70 \; 10 \; \;;
-#X restore 337 290 pd help-getsize-data;
-#N canvas 196 292 365 134 help-getsize-array1-template 0;
-#X obj 30 71 filledpolygon 0 0 0 -5 0 0 5 5 0 0 -5;
-#X obj 32 27 template float y;
-#X restore 337 334 pd help-getsize-array1-template;
-#X obj 102 339 pointer;
-#X obj 236 338 setsize;
-#X obj 25 166 pointer;
-#X msg 25 142 traverse pd-help-getsize-data \, next;
-#X floatatom 25 242 5 0 0;
-#X text 360 214 arguments: template \, field name;
-#X text 76 240 here we just get the value of y.;
-#X obj 25 213 getsize help-getsize-template array1;
-#X text 34 192 inlet for pointer;
-#X obj 35 21 getsize;
-#X text 98 22 -- get number of elements of an array;
-#X text 24 44 When sent a pointer \, "element" looks up a field \,
-which should be an array \, and outputs the number of elements of the
-array. The template and field name are specified as creation arguments.
-;
-#X text 23 110 The smallest possible size is one.;
-#X obj 169 339 element;
-#X text 397 374 updated for Pd version 0.35;
-#X connect 7 0 12 0;
-#X connect 8 0 7 0;
-#X connect 12 0 9 0;
diff --git a/pd/doc/5.reference/graph.pd b/pd/doc/5.reference/graph.pd
deleted file mode 100644
index 1badaee3..00000000
--- a/pd/doc/5.reference/graph.pd
+++ /dev/null
@@ -1,13 +0,0 @@
-#N canvas 28 3 693 300 12;
-#X graph graph1 0 -1 99 1 188 290 338 190;
-#X array array99 100 float;
-#X pop;
-#X text 174 19 GRAPHS;
-#X text 20 42 A graph in Pd is a rectangular subregion of the window in
-which you can store numeric arrays.;
-#X text 19 140 You can change the array values by redrawing it in the graph.
-See also "11.arrays" and passim in the "control examples".;
-#X text 406 266 last updated for release 0.33;
-#X text 18 85 If you create a new array Pd will usually make a new graph
-to put it in (you can change this using the "array" dialog that pops up.)
-;
diff --git a/pd/doc/5.reference/hdial.pd b/pd/doc/5.reference/hdial.pd
deleted file mode 100644
index 006c0f8b..00000000
--- a/pd/doc/5.reference/hdial.pd
+++ /dev/null
@@ -1,282 +0,0 @@
-#N canvas 106 314 612 281 10;
-#X obj 1 1 cnv 8 100 60 empty empty hdial=hdl 20 20 1 18 -262144 -1109
-0;
-#X text 16 213 (c) musil@iem.kug.ac.at;
-#X text 58 226 IEM KUG;
-#X text 289 52 click properties to;
-#X text 277 63 modify geometry \, colors \, etc.;
-#X obj 356 172 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144
--1 -1;
-#X obj 21 54 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 355 124 s foo8_rcv;
-#X obj 356 150 r foo8_snd;
-#X obj 44 100 hdl 25 1 1 10 foo8_snd foo8_rcv hdial_0_9 156 -8 192
-10 -99865 -262144 -260818 2;
-#X msg 44 142 \$1;
-#X floatatom 44 164 4 0 0;
-#X obj 44 186 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 89 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 89 140 route 0 1 2 3 4 5 6 7 8 9;
-#X msg 176 64 set \$1;
-#X floatatom 176 43 4 0 9;
-#X floatatom 44 54 4 0 9;
-#X msg 91 41 7 0 -5.44;
-#X msg 95 63 3 3 4.55;
-#X obj 106 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 123 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 1
-1;
-#X obj 140 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 157 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 174 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 191 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 208 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 225 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 242 161 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 82 178 print;
-#X floatatom 380 198 4 0 0;
-#X msg 380 172 \$1;
-#X msg 355 103 set \$1;
-#X floatatom 355 82 4 0 9;
-#X text 128 178 UP- \, DOWN- \, LEFT- or RIGHT-key;
-#X text 127 189 for moving selected gui-objects;
-#N canvas 226 227 699 530 edit 0;
-#X obj 42 198 f;
-#X msg 20 177 bang;
-#X floatatom 58 176 3 63 156;
-#X floatatom 93 198 3 -20 37;
-#X obj 42 221 pack 0 0;
-#X text 120 198 y-label;
-#X text 86 176 x-label;
-#X floatatom 270 187 3 8 50;
-#X text 297 187 size;
-#X obj 286 293 f;
-#X msg 264 272 bang;
-#X floatatom 302 271 3 -10 10;
-#X floatatom 337 293 3 -10 10;
-#X obj 286 316 pack 0 0;
-#X obj 300 412 f;
-#X msg 278 391 bang;
-#X floatatom 316 390 3 20 60;
-#X floatatom 351 412 3 100 200;
-#X obj 300 435 pack 0 0;
-#X text 330 271 x-delta;
-#X text 364 293 y-delta;
-#X text 344 390 x-position;
-#X text 378 412 y-position;
-#X obj 62 313 f;
-#X msg 40 292 bang;
-#X floatatom 78 291 3 0 2;
-#X floatatom 113 313 3 4 36;
-#X obj 62 336 pack 0 0;
-#X text 106 291 font;
-#X text 142 313 height;
-#X text 504 293 no init;
-#X text 475 348 init value on loadbang;
-#X floatatom 482 228 5 2 20;
-#X msg 47 125 \; foo8_rcv color \$1 \$2 \$3;
-#X msg 42 246 \; foo8_rcv label_pos \$1 \$2;
-#X msg 62 361 \; foo8_rcv label_font \$1 \$2;
-#X msg 34 423 \; foo8_rcv label blabla;
-#X msg 300 460 \; foo8_rcv pos \$1 \$2;
-#X msg 286 341 \; foo8_rcv delta \$1 \$2;
-#X msg 270 216 \; foo8_rcv size \$1;
-#X msg 482 171 \; foo8a_rcv receive foo8_rcv;
-#X msg 483 133 \; foo8_rcv receive foo8a_rcv;
-#X msg 483 88 \; foo8_rcv send foo8_snd;
-#X msg 483 50 \; foo8_rcv send foo8a_snd;
-#X msg 483 312 \; foo8_rcv init 0;
-#X msg 485 366 \; foo8_rcv init 1;
-#X msg 490 436 \; foo8_rcv single_change;
-#X msg 490 470 \; foo8_rcv double_change;
-#X text 491 417 changing-behavior;
-#X msg 482 254 \; foo8_rcv number \$1;
-#X text 526 228 number of buttons;
-#X obj 47 104 pack 0 0 0;
-#X obj 47 76 f;
-#X msg 24 28 bang;
-#X floatatom 63 26 3 0 29;
-#X floatatom 79 46 3 0 29;
-#X floatatom 112 62 3 0 29;
-#X text 91 26 background;
-#X text 106 46 front-color;
-#X text 140 63 label-color;
-#X msg 285 25 back;
-#X msg 285 45 front;
-#X msg 285 65 label;
-#X msg 247 25 bang;
-#N canvas 15 207 606 448 RGB_____________ 0;
-#X obj 97 56 inlet;
-#X obj 262 53 inlet;
-#X obj 339 55 inlet;
-#X obj 405 56 inlet;
-#X obj 97 270 bang;
-#X msg 77 295 0;
-#X msg 104 295 1;
-#X obj 146 268 bang;
-#X msg 132 295 0;
-#X msg 160 295 1;
-#X obj 196 269 bang;
-#X msg 187 295 0;
-#X msg 214 295 1;
-#X obj 265 313 spigot;
-#X obj 312 313 spigot;
-#X obj 359 313 spigot;
-#X obj 249 385 outlet;
-#X text 93 33 select;
-#X text 267 28 red;
-#X text 337 30 green;
-#X text 409 30 blue;
-#X obj 405 102 t b f;
-#X obj 339 160 +;
-#X obj 339 185 t b f;
-#X obj 339 216 +;
-#X obj 296 385 outlet;
-#X obj 343 385 outlet;
-#X obj 28 180 loadbang;
-#X obj 97 135 route back front label bang;
-#X obj 343 362 f;
-#X obj 296 361 f;
-#X obj 249 361 f;
-#X obj 262 79 * -65536;
-#X obj 339 80 * -256;
-#X obj 405 80 * -1;
-#X obj 339 247 - 1;
-#X obj 235 168 t b b b b;
-#X connect 0 0 28 0;
-#X connect 1 0 32 0;
-#X connect 2 0 33 0;
-#X connect 3 0 34 0;
-#X connect 4 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 14 1;
-#X connect 5 0 15 1;
-#X connect 6 0 13 1;
-#X connect 7 0 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 13 1;
-#X connect 8 0 15 1;
-#X connect 9 0 14 1;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 11 0 13 1;
-#X connect 11 0 14 1;
-#X connect 12 0 15 1;
-#X connect 13 0 31 1;
-#X connect 14 0 30 1;
-#X connect 15 0 29 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 35 0;
-#X connect 27 0 6 0;
-#X connect 28 0 4 0;
-#X connect 28 1 7 0;
-#X connect 28 2 10 0;
-#X connect 28 3 36 0;
-#X connect 29 0 26 0;
-#X connect 30 0 25 0;
-#X connect 31 0 16 0;
-#X connect 32 0 24 0;
-#X connect 33 0 22 0;
-#X connect 34 0 21 0;
-#X connect 35 0 15 0;
-#X connect 35 0 14 0;
-#X connect 35 0 13 0;
-#X connect 36 0 31 0;
-#X connect 36 1 30 0;
-#X connect 36 2 29 0;
-#X connect 36 3 35 0;
-#X restore 285 86 pd RGB_____________;
-#X floatatom 327 55 3 0 255;
-#X floatatom 370 55 3 0 255;
-#X floatatom 413 56 3 0 255;
-#X text 34 0 preset-colors;
-#X text 296 -3 RGB-colors;
-#X text 327 37 red;
-#X text 363 36 green;
-#X text 411 36 blue;
-#X msg 34 459 \; foo8_rcv label hdial_0_9;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 1;
-#X connect 3 0 4 1;
-#X connect 4 0 34 0;
-#X connect 7 0 39 0;
-#X connect 9 0 13 0;
-#X connect 10 0 9 0;
-#X connect 11 0 9 1;
-#X connect 12 0 13 1;
-#X connect 13 0 38 0;
-#X connect 14 0 18 0;
-#X connect 15 0 14 0;
-#X connect 16 0 14 1;
-#X connect 17 0 18 1;
-#X connect 18 0 37 0;
-#X connect 23 0 27 0;
-#X connect 24 0 23 0;
-#X connect 25 0 23 1;
-#X connect 26 0 27 1;
-#X connect 27 0 35 0;
-#X connect 32 0 49 0;
-#X connect 51 0 33 0;
-#X connect 52 0 51 0;
-#X connect 53 0 52 0;
-#X connect 54 0 52 1;
-#X connect 55 0 51 1;
-#X connect 56 0 51 2;
-#X connect 60 0 64 0;
-#X connect 61 0 64 0;
-#X connect 62 0 64 0;
-#X connect 63 0 64 0;
-#X connect 64 0 51 0;
-#X connect 64 1 51 1;
-#X connect 64 2 51 2;
-#X connect 65 0 64 1;
-#X connect 66 0 64 2;
-#X connect 67 0 64 3;
-#X restore 469 108 pd edit;
-#X obj 346 35 hdl 15 1 0 8 eee eee empty 20 8 192 8 -262144 -1 -1 0
-;
-#X obj 260 11 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii;
-#X text 183 11 gui-hdial:;
-#X text 33 238 graz \, austria 2002;
-#X text 251 232 updated for Pd version 0.35;
-#X connect 6 0 9 0;
-#X connect 8 0 5 0;
-#X connect 8 0 31 0;
-#X connect 9 0 10 0;
-#X connect 9 0 14 0;
-#X connect 9 0 29 0;
-#X connect 10 0 11 0;
-#X connect 11 0 12 0;
-#X connect 14 0 13 0;
-#X connect 14 1 20 0;
-#X connect 14 2 21 0;
-#X connect 14 3 22 0;
-#X connect 14 4 23 0;
-#X connect 14 5 24 0;
-#X connect 14 6 25 0;
-#X connect 14 7 26 0;
-#X connect 14 8 27 0;
-#X connect 14 9 28 0;
-#X connect 15 0 9 0;
-#X connect 16 0 15 0;
-#X connect 17 0 9 0;
-#X connect 18 0 9 0;
-#X connect 19 0 9 0;
-#X connect 31 0 30 0;
-#X connect 32 0 7 0;
-#X connect 33 0 32 0;
diff --git a/pd/doc/5.reference/help-metro.pd b/pd/doc/5.reference/help-metro.pd
deleted file mode 100644
index f848e582..00000000
--- a/pd/doc/5.reference/help-metro.pd
+++ /dev/null
@@ -1,29 +0,0 @@
-#N canvas 39 7 634 372 12;
-#X text 19 36 The metro object sends a series of bangs at a constant rate. The right inlet takes the value in milliseconds between each bang. The left inlet takes a 1 or 0 \, turning the metronome on or off.;
-#X obj 67 285 + 1;
-#X obj 32 284 int;
-#X floatatom 32 317 4 0 0;
-#X obj 32 243 metro 500;
-#X obj 5 6 metro;
-#X floatatom 81 220 4 0 0;
-#X text 104 282 These objects work together as a counter. For each bang sent by metro \, the output adds 1;
-#X obj 32 103 loadbang;
-#X msg 32 125 1;
-#X text 92 135 nonzero number or "bang" to start;
-#X msg 49 172 0;
-#X msg 38 148 bang;
-#X msg 49 194 stop;
-#X text 99 181 zero or "stop" to stop.;
-#X text 351 332 Updated for Pd version 0.33;
-#X text 130 220 right inlet sets the rate in msec per tick.;
-#X text 127 243 creation argument initializes rate in msec;
-#X connect 1 0 2 1;
-#X connect 2 0 3 0;
-#X connect 2 0 1 0;
-#X connect 4 0 2 0;
-#X connect 6 0 4 1;
-#X connect 8 0 9 0;
-#X connect 9 0 4 0;
-#X connect 11 0 4 0;
-#X connect 12 0 4 0;
-#X connect 13 0 4 0;
diff --git a/pd/doc/5.reference/hip~-help.pd b/pd/doc/5.reference/hip~-help.pd
index bc8c408d..ea0923f7 100644
--- a/pd/doc/5.reference/hip~-help.pd
+++ b/pd/doc/5.reference/hip~-help.pd
@@ -1,31 +1,33 @@
-#N canvas 21 5 556 324 12;
-#X obj 70 228 env~;
-#X floatatom 70 248;
-#X floatatom 107 178;
+#N canvas 21 5 694 319 12;
+#X obj 70 233 env~;
+#X floatatom 70 256 0 0 0 0 - - -;
+#X floatatom 119 178 0 0 0 0 - - -;
#X obj 70 206 hip~ 5;
-#X text 119 201 The high pass filter is initialized to cutoff frequencies below 5 Hz.;
-#X obj 12 226 env~;
-#X floatatom 12 245;
-#X text 108 227 env~ gives the amplitude of the signal envelop in dB.;
-#X floatatom 12 107;
-#X msg 452 24 \; pd dsp 1;
-#X msg 452 58 \; pd dsp 0;
-#X obj 83 6 lop~;
-#X text 9 68 The left inlet is the incoming audio signal. The right inlet is the cutoff frequency in Hz.;
+#X obj 12 233 env~;
+#X floatatom 12 255 0 0 0 0 - - -;
+#X text 115 235 env~ gives the amplitude of the signal envelop in dB.
+;
+#X floatatom 12 107 0 0 0 0 - - -;
+#X msg 567 51 \; pd dsp 1;
+#X msg 565 10 \; pd dsp 0;
+#X text 13 68 The left inlet is the incoming audio signal. The right
+inlet is the cutoff frequency in Hz.;
#X obj 12 130 osc~ 100;
#X text 57 105 <-- scroll to change input frequency;
-#X text 12 266 Compare the value of the original signal on the left with the value of the filtered signal on the right.;
-#X text 8 35 lop~ is a one-pole low pass filter with a specified rolloff frequency.;
-#X text 114 7 - one-pole low pass filter;
#X msg 70 154 clear;
-#X text 114 153 <-- reinitialize internal state;
-#X text 139 179 <-- set cutoff frequency;
-#X text 361 306 updated for Pd version-0.30;
+#X text 122 153 <-- reinitialize internal state;
+#X text 151 179 <-- set cutoff frequency;
+#X obj 83 6 hip~;
+#X text 128 5 - one-pole high pass filter;
+#X text 435 287 updated for Pd version 0.37;
+#X text 12 31 hip~ is a one-pole high pass filter with a specified
+rolloff frequency.;
+#X text 135 208 Creation argument initializes rolloff frequency.;
#X connect 0 0 1 0;
#X connect 2 0 3 1;
#X connect 3 0 0 0;
-#X connect 5 0 6 0;
-#X connect 8 0 13 0;
-#X connect 13 0 5 0;
+#X connect 4 0 5 0;
+#X connect 7 0 11 0;
+#X connect 11 0 4 0;
+#X connect 11 0 3 0;
#X connect 13 0 3 0;
-#X connect 18 0 3 0;
diff --git a/pd/doc/5.reference/hip~.pd b/pd/doc/5.reference/hip~.pd
deleted file mode 100644
index bc8c408d..00000000
--- a/pd/doc/5.reference/hip~.pd
+++ /dev/null
@@ -1,31 +0,0 @@
-#N canvas 21 5 556 324 12;
-#X obj 70 228 env~;
-#X floatatom 70 248;
-#X floatatom 107 178;
-#X obj 70 206 hip~ 5;
-#X text 119 201 The high pass filter is initialized to cutoff frequencies below 5 Hz.;
-#X obj 12 226 env~;
-#X floatatom 12 245;
-#X text 108 227 env~ gives the amplitude of the signal envelop in dB.;
-#X floatatom 12 107;
-#X msg 452 24 \; pd dsp 1;
-#X msg 452 58 \; pd dsp 0;
-#X obj 83 6 lop~;
-#X text 9 68 The left inlet is the incoming audio signal. The right inlet is the cutoff frequency in Hz.;
-#X obj 12 130 osc~ 100;
-#X text 57 105 <-- scroll to change input frequency;
-#X text 12 266 Compare the value of the original signal on the left with the value of the filtered signal on the right.;
-#X text 8 35 lop~ is a one-pole low pass filter with a specified rolloff frequency.;
-#X text 114 7 - one-pole low pass filter;
-#X msg 70 154 clear;
-#X text 114 153 <-- reinitialize internal state;
-#X text 139 179 <-- set cutoff frequency;
-#X text 361 306 updated for Pd version-0.30;
-#X connect 0 0 1 0;
-#X connect 2 0 3 1;
-#X connect 3 0 0 0;
-#X connect 5 0 6 0;
-#X connect 8 0 13 0;
-#X connect 13 0 5 0;
-#X connect 13 0 3 0;
-#X connect 18 0 3 0;
diff --git a/pd/doc/5.reference/hslider.pd b/pd/doc/5.reference/hslider.pd
deleted file mode 100644
index 80bd83a5..00000000
--- a/pd/doc/5.reference/hslider.pd
+++ /dev/null
@@ -1,303 +0,0 @@
-#N canvas 243 228 551 413 10;
-#X obj 1 1 cnv 8 100 60 empty empty hslider=hsl 20 20 1 18 -262144
--1109 0;
-#X floatatom 38 127 9 0 0;
-#X msg 47 84 set \$1;
-#X floatatom 38 41 7 0 0;
-#X text 13 355 (c) musil@iem.kug.ac.at;
-#X text 55 368 IEM KUG;
-#X obj 38 149 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 18 41 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 41 107 hsl 101 15 25 75 0 1 foo1_snd foo1_rcv empty 8 -8 192
-10 -225280 -1109 -1 6200 1;
-#X text 174 11 gui-horicontal-slider:;
-#X floatatom 47 62 7 0 0;
-#X floatatom 116 150 9 0 0;
-#X obj 110 308 r goo2_snd;
-#X obj 145 248 s goo2_rcv;
-#X floatatom 105 40 7 0 0;
-#X floatatom 145 206 7 0 0;
-#X obj 60 170 print;
-#N canvas 276 200 290 224 once 0;
-#X obj 38 47 t b b f;
-#X msg 56 85 1;
-#X obj 31 108 f 0;
-#X obj 31 131 pack 0 0;
-#X obj 31 156 route 0;
-#X obj 38 24 inlet;
-#X obj 31 180 outlet;
-#X connect 0 0 1 0;
-#X connect 0 1 2 0;
-#X connect 0 2 3 1;
-#X connect 1 0 2 1;
-#X connect 2 0 3 0;
-#X connect 3 0 4 0;
-#X connect 4 0 6 0;
-#X connect 5 0 0 0;
-#X restore 60 147 pd once;
-#X obj 40 265 hsl 73 15 55 3520 1 1 goo2_snd goo2_rcv log.freq. 8 -8
-192 10 -42246 -260818 -90133 1600 1;
-#X obj 37 308 ftom;
-#X floatatom 37 330 9 0 0;
-#X floatatom 64 287 9 0 0;
-#X floatatom 110 329 9 0 0;
-#X text 175 176 click properties to;
-#X floatatom 37 203 8 0 0;
-#X obj 37 226 mtof;
-#X text 12 184 --------------------;
-#X text 163 187 modify geometry \, colors \, etc.;
-#X obj 105 82 s foo1_rcv;
-#X obj 116 130 r foo1_snd;
-#X msg 105 61 set \$1;
-#X msg 145 227 set \$1;
-#X text 197 120 (0.01 pixels);
-#X text 183 99 shift-click & drag;
-#X text 189 109 for fine-tuning;
-#X text 148 270 UP- \, DOWN- \, LEFT- or RIGHT-key;
-#X text 147 281 for moving selected gui-objects;
-#N canvas 207 113 716 530 edit 0;
-#X obj 32 220 f;
-#X msg 10 199 bang;
-#X floatatom 48 198 3 63 88;
-#X floatatom 83 220 3 0 37;
-#X obj 32 243 pack 0 0;
-#X text 110 220 y-label;
-#X text 76 198 x-label;
-#X obj 279 246 f;
-#X msg 257 225 bang;
-#X floatatom 295 224 3 -10 10;
-#X floatatom 330 246 3 -10 10;
-#X obj 279 269 pack 0 0;
-#X obj 292 358 f;
-#X msg 270 337 bang;
-#X floatatom 308 336 3 20 60;
-#X floatatom 343 358 3 150 200;
-#X obj 292 381 pack 0 0;
-#X text 323 224 x-delta;
-#X text 357 246 y-delta;
-#X text 336 336 x-position;
-#X text 370 358 y-position;
-#X obj 52 335 f;
-#X msg 30 314 bang;
-#X floatatom 68 313 3 0 2;
-#X floatatom 103 335 3 4 36;
-#X obj 52 358 pack 0 0;
-#X text 96 313 font;
-#X text 132 335 height;
-#X floatatom 476 188 1 0 1;
-#X text 523 401 no init;
-#X text 493 453 init value on loadbang;
-#X msg 47 154 \; goo2_rcv color \$1 \$2 \$3;
-#X msg 32 268 \; goo2_rcv label_pos \$1 \$2;
-#X msg 52 383 \; goo2_rcv label_font \$1 \$2;
-#X msg 34 427 \; goo2_rcv label blabla;
-#X msg 292 406 \; goo2_rcv pos \$1 \$2;
-#X msg 279 294 \; goo2_rcv delta \$1 \$2;
-#X msg 475 21 \; goo2_rcv send goo2a_snd;
-#X msg 475 59 \; goo2_rcv send goo2_snd;
-#X msg 476 105 \; goo2_rcv receive goo2a_rcv;
-#X msg 476 143 \; goo2a_rcv receive goo2_rcv;
-#X msg 502 420 \; goo2_rcv init 0;
-#X msg 503 471 \; goo2_rcv init 1;
-#X text 520 188 steady;
-#X obj 486 291 f;
-#X msg 464 270 bang;
-#X floatatom 502 269 3 55 440;
-#X floatatom 537 291 6 440 3520;
-#X obj 486 314 pack 0 0;
-#X text 530 269 left-range-bound;
-#X text 586 291 right-range-bound;
-#X msg 486 339 \; goo2_rcv range \$1 \$2;
-#X msg 363 465 \; goo2_rcv log;
-#X msg 269 466 \; goo2_rcv lin;
-#X text 269 448 linear / logarithmical;
-#X obj 275 133 f;
-#X msg 250 112 bang;
-#X floatatom 291 111 3 15 73;
-#X floatatom 326 133 3 8 50;
-#X obj 275 156 pack 0 0;
-#X text 319 111 width;
-#X text 357 134 height;
-#X msg 275 181 \; goo2_rcv size \$1 \$2;
-#X msg 34 463 \; goo2_rcv label log.freq.;
-#X msg 476 212 \; goo2_rcv steady \$1;
-#X obj 47 100 pack 0 0 0;
-#X obj 47 72 f;
-#X msg 24 24 bang;
-#X floatatom 63 22 3 0 29;
-#X floatatom 79 42 3 0 29;
-#X floatatom 112 58 3 0 29;
-#X text 91 22 background;
-#X text 106 42 front-color;
-#X text 140 59 label-color;
-#X msg 277 22 back;
-#X msg 277 42 front;
-#X msg 277 62 label;
-#X msg 239 22 bang;
-#N canvas 15 207 606 448 RGB_____________ 0;
-#X obj 97 56 inlet;
-#X obj 262 53 inlet;
-#X obj 339 55 inlet;
-#X obj 405 56 inlet;
-#X obj 97 270 bang;
-#X msg 77 295 0;
-#X msg 104 295 1;
-#X obj 146 268 bang;
-#X msg 132 295 0;
-#X msg 160 295 1;
-#X obj 196 269 bang;
-#X msg 187 295 0;
-#X msg 214 295 1;
-#X obj 265 313 spigot;
-#X obj 312 313 spigot;
-#X obj 359 313 spigot;
-#X obj 249 385 outlet;
-#X text 93 33 select;
-#X text 267 28 red;
-#X text 337 30 green;
-#X text 409 30 blue;
-#X obj 405 102 t b f;
-#X obj 339 160 +;
-#X obj 339 185 t b f;
-#X obj 339 216 +;
-#X obj 296 385 outlet;
-#X obj 343 385 outlet;
-#X obj 28 180 loadbang;
-#X obj 97 135 route back front label bang;
-#X obj 343 362 f;
-#X obj 296 361 f;
-#X obj 249 361 f;
-#X obj 262 79 * -65536;
-#X obj 339 80 * -256;
-#X obj 405 80 * -1;
-#X obj 339 247 - 1;
-#X obj 235 168 t b b b b;
-#X connect 0 0 28 0;
-#X connect 1 0 32 0;
-#X connect 2 0 33 0;
-#X connect 3 0 34 0;
-#X connect 4 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 14 1;
-#X connect 5 0 15 1;
-#X connect 6 0 13 1;
-#X connect 7 0 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 13 1;
-#X connect 8 0 15 1;
-#X connect 9 0 14 1;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 11 0 13 1;
-#X connect 11 0 14 1;
-#X connect 12 0 15 1;
-#X connect 13 0 31 1;
-#X connect 14 0 30 1;
-#X connect 15 0 29 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 35 0;
-#X connect 27 0 6 0;
-#X connect 28 0 4 0;
-#X connect 28 1 7 0;
-#X connect 28 2 10 0;
-#X connect 28 3 36 0;
-#X connect 29 0 26 0;
-#X connect 30 0 25 0;
-#X connect 31 0 16 0;
-#X connect 32 0 24 0;
-#X connect 33 0 22 0;
-#X connect 34 0 21 0;
-#X connect 35 0 15 0;
-#X connect 35 0 14 0;
-#X connect 35 0 13 0;
-#X connect 36 0 31 0;
-#X connect 36 1 30 0;
-#X connect 36 2 29 0;
-#X connect 36 3 35 0;
-#X restore 277 82 pd RGB_____________;
-#X floatatom 319 52 3 0 255;
-#X floatatom 362 52 3 0 255;
-#X floatatom 405 53 3 0 255;
-#X text 34 -1 preset-colors;
-#X text 290 1 RGB-colors;
-#X text 319 34 red;
-#X text 355 33 green;
-#X text 403 33 blue;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 1;
-#X connect 3 0 4 1;
-#X connect 4 0 32 0;
-#X connect 7 0 11 0;
-#X connect 8 0 7 0;
-#X connect 9 0 7 1;
-#X connect 10 0 11 1;
-#X connect 11 0 36 0;
-#X connect 12 0 16 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 1;
-#X connect 15 0 16 1;
-#X connect 16 0 35 0;
-#X connect 21 0 25 0;
-#X connect 22 0 21 0;
-#X connect 23 0 21 1;
-#X connect 24 0 25 1;
-#X connect 25 0 33 0;
-#X connect 28 0 64 0;
-#X connect 44 0 48 0;
-#X connect 45 0 44 0;
-#X connect 46 0 44 1;
-#X connect 47 0 48 1;
-#X connect 48 0 51 0;
-#X connect 55 0 59 0;
-#X connect 56 0 55 0;
-#X connect 57 0 55 1;
-#X connect 58 0 59 1;
-#X connect 59 0 62 0;
-#X connect 65 0 31 0;
-#X connect 66 0 65 0;
-#X connect 67 0 66 0;
-#X connect 68 0 66 1;
-#X connect 69 0 65 1;
-#X connect 70 0 65 2;
-#X connect 74 0 78 0;
-#X connect 75 0 78 0;
-#X connect 76 0 78 0;
-#X connect 77 0 78 0;
-#X connect 78 0 65 0;
-#X connect 78 1 65 1;
-#X connect 78 2 65 2;
-#X connect 79 0 78 1;
-#X connect 80 0 78 2;
-#X connect 81 0 78 3;
-#X restore 314 245 pd edit;
-#X obj 221 61 hsl 128 15 0 127 0 0 ddd ddd empty 20 8 192 8 -262144
--1 -1 10600 1;
-#X text 187 379 updated for Pd version 0.35;
-#X text 30 380 graz \, austria 2002;
-#X obj 168 34 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii;
-#X connect 1 0 6 0;
-#X connect 2 0 8 0;
-#X connect 3 0 8 0;
-#X connect 7 0 8 0;
-#X connect 8 0 1 0;
-#X connect 8 0 17 0;
-#X connect 10 0 2 0;
-#X connect 12 0 22 0;
-#X connect 14 0 30 0;
-#X connect 15 0 31 0;
-#X connect 17 0 16 0;
-#X connect 18 0 21 0;
-#X connect 18 0 19 0;
-#X connect 19 0 20 0;
-#X connect 24 0 25 0;
-#X connect 25 0 18 0;
-#X connect 29 0 11 0;
-#X connect 30 0 28 0;
-#X connect 31 0 13 0;
diff --git a/pd/doc/5.reference/int.pd b/pd/doc/5.reference/int.pd
deleted file mode 100644
index 6b6de2f6..00000000
--- a/pd/doc/5.reference/int.pd
+++ /dev/null
@@ -1,24 +0,0 @@
-#N canvas 4 30 605 319 12;
-#X msg 61 101 bang;
-#X floatatom 61 248 0 0 0;
-#X floatatom 73 125 0 0 0;
-#X floatatom 102 198 0 0 0;
-#X text 108 97 outputs the value;
-#X text 110 126 sets and outputs the value;
-#X text 113 220 creation argument initializes the value;
-#X obj 61 222 int 6;
-#X msg 73 148 9.6;
-#X text 106 148 non-integers get truncated;
-#X msg 71 173 -9.6;
-#X text 113 173 toward zero;
-#X text 136 200 set the value but no output;
-#X obj 60 11 int;
-#X text 108 12 - STORE AN INTEGER;
-#X text 37 33 The int object stores a number \, initialized by its creation argument \, which may be reset using its inlet and output by sending it the "bang" message. The output is truncated to an integer ala Max.;
-#X text 315 270 updated for Pd version 0.33;
-#X connect 0 0 7 0;
-#X connect 2 0 7 0;
-#X connect 3 0 7 1;
-#X connect 7 0 1 0;
-#X connect 8 0 7 0;
-#X connect 10 0 7 0;
diff --git a/pd/doc/5.reference/key.pd b/pd/doc/5.reference/key.pd
deleted file mode 100644
index 1ab0337c..00000000
--- a/pd/doc/5.reference/key.pd
+++ /dev/null
@@ -1,24 +0,0 @@
-#N canvas 146 45 546 288 12;
-#X obj 21 10 key;
-#X obj 54 9 keyup;
-#X obj 105 9 keyname;
-#X text 173 8 -- grab keyboard;
-#X obj 38 67 key;
-#X floatatom 38 95 3 0 0 0 - - -;
-#X floatatom 77 93 3 0 0 0 - - -;
-#X obj 77 67 keyup;
-#X floatatom 128 93 3 0 0 0 - - -;
-#X obj 128 67 keyname;
-#X symbolatom 172 94 10 0 0 0 - - -;
-#X text 280 262 updated for Pd version 0.32.;
-#X text 26 133 Key and keyup report the (system dependent) numbers
-of "printing" keys of the keyboard. Keyname gives the symbolic name
-of the key \, with a 1 or 0 if it's up or down \, and works with non-printing
-keys like shift or "F1".;
-#X text 18 200 Caveat -- this only works if Pd actually gets the key
-events which can depend on the stacking order of windows and/or the
-pointer location \, depending on the system.;
-#X connect 4 0 5 0;
-#X connect 7 0 6 0;
-#X connect 9 0 8 0;
-#X connect 9 1 10 0;
diff --git a/pd/doc/5.reference/line.pd b/pd/doc/5.reference/line.pd
deleted file mode 100644
index 31392b86..00000000
--- a/pd/doc/5.reference/line.pd
+++ /dev/null
@@ -1,22 +0,0 @@
-#N canvas 31 15 486 368 12;
-#X floatatom 22 323;
-#X msg 31 216 0 1000;
-#X msg 46 238 39;
-#X obj 66 15 line;
-#X text 106 14 - ramp generator;
-#X obj 22 297 line 100;
-#X text 88 292 creation argument sets time increment. In this implementation you can't set this dtnamically.;
-#X msg 22 193 1 1000;
-#X text 18 36 The line object takes (target \, time) pairs and slews to the specified target over the time given \, updating its output at a "grain rate" given by the creation argument. If you dont' specify a time \, line jumps immediately to the target. Note that the inlet does not remember old values (unlike every other inlet in Pd) -- sending a float causes a jump in the output regardless of whatever time value was specified in some previous message. If the line object receives a message specifying some new target before reaching the previous one \, it takes off from its current value.;
-#X text 93 205 send a pair to ramp to a new value;
-#X text 105 235 send a single number to jump;
-#X text 46 347 see also:;
-#X obj 120 347 line~;
-#X msg 57 263 stop;
-#X text 98 262 "stop" message to stop output;
-#X text 273 348 updated for Pd version 0.27;
-#X connect 1 0 5 0;
-#X connect 2 0 5 0;
-#X connect 5 0 0 0;
-#X connect 7 0 5 0;
-#X connect 13 0 5 0;
diff --git a/pd/doc/5.reference/line~-help.pd b/pd/doc/5.reference/line~-help.pd
index 7b470c2d..c7be247d 100644
--- a/pd/doc/5.reference/line~-help.pd
+++ b/pd/doc/5.reference/line~-help.pd
@@ -2,7 +2,7 @@
#X obj 33 301 snapshot~;
#X obj 21 8 line~;
#X obj 33 226 line~;
-#X floatatom 33 324 0 0 0;
+#X floatatom 33 324 0 0 0 0 - - -;
#X obj 43 274 metro 100;
#X obj 43 249 r start;
#X msg 550 21 \; pd dsp 1 \; start bang;
@@ -14,7 +14,10 @@
#X text 104 199 "stop" message freezes line~ at its current value;
#X msg 60 153 0;
#X msg 43 128 0 5000;
-#X text 10 28 The line~ object generates linear ramps whose levels and timing are determined by messages you send it. The messages may be a single target value (causing the output to jump to the target) or a target and a time in milliseconds (to start a new ramp.);
+#X text 10 28 The line~ object generates linear ramps whose levels
+and timing are determined by messages you send it. The messages may
+be a single target value (causing the output to jump to the target)
+or a target and a time in milliseconds (to start a new ramp.);
#X text 644 36 Click to start;
#X text 639 94 Click to stop;
#X text 185 300 see also:;
@@ -22,6 +25,7 @@
#X msg 550 75 \; pd dsp 0 \; start 0;
#X text 75 7 - audio ramp generator;
#X text 576 335 updated for version 0.33;
+#X obj 317 302 vline~;
#X connect 0 0 3 0;
#X connect 2 0 0 0;
#X connect 4 0 0 0;
diff --git a/pd/doc/5.reference/line~.pd b/pd/doc/5.reference/line~.pd
deleted file mode 100644
index 7b470c2d..00000000
--- a/pd/doc/5.reference/line~.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 121 54 813 370 12;
-#X obj 33 301 snapshot~;
-#X obj 21 8 line~;
-#X obj 33 226 line~;
-#X floatatom 33 324 0 0 0;
-#X obj 43 274 metro 100;
-#X obj 43 249 r start;
-#X msg 550 21 \; pd dsp 1 \; start bang;
-#X msg 34 106 1 1000;
-#X text 89 105 a pair of numbers starts a ramp;
-#X msg 60 176 2;
-#X text 91 150 a single number jumps to value;
-#X msg 61 200 stop;
-#X text 104 199 "stop" message freezes line~ at its current value;
-#X msg 60 153 0;
-#X msg 43 128 0 5000;
-#X text 10 28 The line~ object generates linear ramps whose levels and timing are determined by messages you send it. The messages may be a single target value (causing the output to jump to the target) or a target and a time in milliseconds (to start a new ramp.);
-#X text 644 36 Click to start;
-#X text 639 94 Click to stop;
-#X text 185 300 see also:;
-#X obj 271 302 line;
-#X msg 550 75 \; pd dsp 0 \; start 0;
-#X text 75 7 - audio ramp generator;
-#X text 576 335 updated for version 0.33;
-#X connect 0 0 3 0;
-#X connect 2 0 0 0;
-#X connect 4 0 0 0;
-#X connect 5 0 4 0;
-#X connect 7 0 2 0;
-#X connect 9 0 2 0;
-#X connect 11 0 2 0;
-#X connect 13 0 2 0;
-#X connect 14 0 2 0;
diff --git a/pd/doc/5.reference/lop~.pd b/pd/doc/5.reference/lop~.pd
deleted file mode 100644
index 9f3e85f8..00000000
--- a/pd/doc/5.reference/lop~.pd
+++ /dev/null
@@ -1,31 +0,0 @@
-#N canvas 402 99 566 329 12;
-#X obj 70 228 env~;
-#X floatatom 70 248;
-#X floatatom 107 178;
-#X obj 70 206 hip~ 5;
-#X text 119 201 The high pass filter is initialized to cutoff frequencies below 5 Hz.;
-#X obj 12 226 env~;
-#X floatatom 12 245;
-#X text 108 227 env~ gives the amplitude of the signal envelop in dB.;
-#X floatatom 12 107;
-#X msg 452 24 \; pd dsp 1;
-#X msg 452 58 \; pd dsp 0;
-#X obj 83 6 lop~;
-#X text 9 68 The left inlet is the incoming audio signal. The right inlet is the cutoff frequency in Hz.;
-#X obj 12 130 osc~ 100;
-#X text 57 105 <-- scroll to change input frequency;
-#X text 12 266 Compare the value of the original signal on the left with the value of the filtered signal on the right.;
-#X text 8 35 lop~ is a one-pole low pass filter with a specified rolloff frequency.;
-#X text 114 7 - one-pole low pass filter;
-#X msg 70 154 clear;
-#X text 114 153 <-- reinitialize internal state;
-#X text 139 179 <-- set cutoff frequency;
-#X text 364 306 updated for Pd version-0.30;
-#X connect 0 0 1 0;
-#X connect 2 0 3 1;
-#X connect 3 0 0 0;
-#X connect 5 0 6 0;
-#X connect 8 0 13 0;
-#X connect 13 0 5 0;
-#X connect 13 0 3 0;
-#X connect 18 0 3 0;
diff --git a/pd/doc/5.reference/makefilename-help.pd b/pd/doc/5.reference/makefilename-help.pd
index 6850699b..c921fe7f 100644
--- a/pd/doc/5.reference/makefilename-help.pd
+++ b/pd/doc/5.reference/makefilename-help.pd
@@ -1,17 +1,49 @@
-#N canvas 18 58 583 301 12;
-#X floatatom 30 169 0 0 0;
-#X obj 30 223 print;
-#X obj 30 196 makefilename dog%d.aif;
-#X msg 245 166 symbol meat;
-#X msg 355 167 symbol hair;
-#X obj 245 223 print;
-#X obj 245 196 makefilename dog%s.aif;
-#X text 28 49 The Makefilename object generates symbols according to a format string \, for use as a series of filenames \, table names \, or whatnot. You can plug in a variable number or symbol by putting "%d" or "%s" in the string. If you put "%s" in the string be sure to send it a symbol and vice versa... there's no checking.;
-#X text 319 257 updated for Pd version 0.33;
+#N canvas 87 80 611 646 12;
+#X floatatom 37 179 0 0 0 0 - - -;
+#X obj 37 281 print;
+#X obj 37 254 makefilename dog%d.aif;
+#X msg 34 326 symbol meat;
+#X msg 47 350 symbol hair;
+#X obj 34 405 print;
+#X obj 34 378 makefilename dog%s.aif;
+#X text 26 47 The Makefilename object generates symbols according to
+a format string \, for use as a series of filenames \, table names
+\, or whatnot. You can plug in a variable number or symbol by putting
+"%d" or "%s" in the string. If you put "%s" in the string be sure to
+send it a symbol and vice versa... there's no checking.;
#X obj 49 17 makefilename;
#X text 170 18 - format a "name" with a variable field;
+#X msg 52 205 set cat%d.wav;
+#X msg 52 229 set %d-zebra;
+#X text 359 625 updated for Pd version 0.37;
+#X text 71 179 <- numbers replace "%d" in string;
+#X text 177 207 <- "set" message replaces format;
+#X text 243 256 <- creation argument is format;
+#X text 138 152 SUBSTITUTING A NUMBER;
+#X text 126 301 SUBSTITUTING A SYMBOL;
+#X obj 49 619 print;
+#X obj 48 517 makefilename dog%%d.%s;
+#X msg 48 541 set \$1;
+#X obj 48 595 makefilename not-set-yet;
+#X floatatom 57 566 0 0 0 0 - - -;
+#X msg 48 465 symbol aif;
+#X msg 61 489 symbol wav;
+#X text 44 441 GANG THEM TO DO DOUBLE (OR N-TUPLE) SUBSTITUTION;
+#X text 258 519 "%s" is replaced by the symbol;
+#X text 259 502 here \, "%%" becomes "%" and;
+#X text 114 544 ... so this becomes "set dog%d.aif" \, for example.
+;
+#X text 108 566 ... and then the number fills in "%d".;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 3 0 6 0;
#X connect 4 0 6 0;
#X connect 6 0 5 0;
+#X connect 10 0 2 0;
+#X connect 11 0 2 0;
+#X connect 19 0 20 0;
+#X connect 20 0 21 0;
+#X connect 21 0 18 0;
+#X connect 22 0 21 0;
+#X connect 23 0 19 0;
+#X connect 24 0 19 0;
diff --git a/pd/doc/5.reference/makefilename.pd b/pd/doc/5.reference/makefilename.pd
deleted file mode 100644
index 6850699b..00000000
--- a/pd/doc/5.reference/makefilename.pd
+++ /dev/null
@@ -1,17 +0,0 @@
-#N canvas 18 58 583 301 12;
-#X floatatom 30 169 0 0 0;
-#X obj 30 223 print;
-#X obj 30 196 makefilename dog%d.aif;
-#X msg 245 166 symbol meat;
-#X msg 355 167 symbol hair;
-#X obj 245 223 print;
-#X obj 245 196 makefilename dog%s.aif;
-#X text 28 49 The Makefilename object generates symbols according to a format string \, for use as a series of filenames \, table names \, or whatnot. You can plug in a variable number or symbol by putting "%d" or "%s" in the string. If you put "%s" in the string be sure to send it a symbol and vice versa... there's no checking.;
-#X text 319 257 updated for Pd version 0.33;
-#X obj 49 17 makefilename;
-#X text 170 18 - format a "name" with a variable field;
-#X connect 0 0 2 0;
-#X connect 2 0 1 0;
-#X connect 3 0 6 0;
-#X connect 4 0 6 0;
-#X connect 6 0 5 0;
diff --git a/pd/doc/5.reference/makenote.pd b/pd/doc/5.reference/makenote.pd
deleted file mode 100644
index e3d003fc..00000000
--- a/pd/doc/5.reference/makenote.pd
+++ /dev/null
@@ -1,26 +0,0 @@
-#N canvas 39 28 663 385 12;
-#X floatatom 180 207 0 0 0;
-#X floatatom 110 176 0 0 0;
-#X msg 48 127 60;
-#X obj 41 262 print x1;
-#X obj 180 262 print x2;
-#X floatatom 41 104 0 0 0;
-#X obj 29 14 makenote;
-#X text 113 14 - send note-on messages and schedule note-off for later;
-#X text 19 41 Makenote makes MIDI-style note-on/note-off pairs \, which you can use for MIDI output or to drive note-like processes within Pd.;
-#X msg 48 153 60.5;
-#X text 80 105 numbers at left are "pitches" which may be integers or not.;
-#X text 146 178 "velocity";
-#X text 215 210 duration in milliseconds;
-#X obj 41 235 makenote 3.2 500;
-#X text 193 235 creation arguments initialize velocity and duration;
-#X text 38 316 see also;
-#X obj 117 316 stripnote;
-#X text 389 325 updated for Pd version 0.33;
-#X connect 0 0 13 2;
-#X connect 1 0 13 1;
-#X connect 2 0 13 0;
-#X connect 5 0 13 0;
-#X connect 9 0 13 0;
-#X connect 13 0 3 0;
-#X connect 13 1 4 0;
diff --git a/pd/doc/5.reference/math.pd b/pd/doc/5.reference/math.pd
deleted file mode 100644
index 5464b8aa..00000000
--- a/pd/doc/5.reference/math.pd
+++ /dev/null
@@ -1,60 +0,0 @@
-#N canvas 0 0 554 555 12;
-#X floatatom 283 263 0 0 0;
-#X floatatom 226 349 0 0 0;
-#X floatatom 226 262 0 0 0;
-#X floatatom 281 486 0 0 0;
-#X floatatom 281 425 0 0 0;
-#X floatatom 185 486 0 0 0;
-#X floatatom 185 425 0 0 0;
-#X floatatom 117 486 0 0 0;
-#X floatatom 117 425 0 0 0;
-#X floatatom 117 326 0 0 0;
-#X floatatom 117 265 0 0 0;
-#X floatatom 30 486 0 0 0;
-#X floatatom 30 425 0 0 0;
-#X floatatom 218 186 0 0 0;
-#X floatatom 135 182 0 0 0;
-#X obj 66 146 sin;
-#X floatatom 66 53 0 0 0;
-#X floatatom 66 180 0 0 0;
-#X obj 66 113 * 6.28319;
-#X obj 66 83 / 360;
-#X obj 135 148 cos;
-#X obj 218 152 tan;
-#X obj 30 456 sqrt;
-#X obj 117 296 atan;
-#X obj 117 456 log;
-#X obj 185 456 exp;
-#X obj 281 456 abs;
-#X obj 226 290 float;
-#X obj 283 290 t b f;
-#X obj 226 319 atan2;
-#X text 87 17 Higher math in Pd;
-#X text 171 58 trig functions take inputs in radians;
-#X text 24 213 The arc tangent takes two forms. The atan2 version takes an (x \, y) pair and gives you an output between -pi and pi.;
-#X text 23 380 also \, square root \, natural logarithm and exponential \, and absolute value:;
-#X text 292 529 updated for Pd version 0.33;
-#X connect 0 0 28 0;
-#X connect 2 0 27 0;
-#X connect 4 0 26 0;
-#X connect 6 0 25 0;
-#X connect 8 0 24 0;
-#X connect 10 0 23 0;
-#X connect 12 0 22 0;
-#X connect 15 0 17 0;
-#X connect 16 0 19 0;
-#X connect 18 0 15 0;
-#X connect 18 0 20 0;
-#X connect 18 0 21 0;
-#X connect 19 0 18 0;
-#X connect 20 0 14 0;
-#X connect 21 0 13 0;
-#X connect 22 0 11 0;
-#X connect 23 0 9 0;
-#X connect 24 0 7 0;
-#X connect 25 0 5 0;
-#X connect 26 0 3 0;
-#X connect 27 0 29 0;
-#X connect 28 0 27 0;
-#X connect 28 1 29 1;
-#X connect 29 0 1 0;
diff --git a/pd/doc/5.reference/message.pd b/pd/doc/5.reference/message.pd
deleted file mode 100644
index 13a74f55..00000000
--- a/pd/doc/5.reference/message.pd
+++ /dev/null
@@ -1,46 +0,0 @@
-#N canvas 0 365 726 512 12;
-#X msg 88 13 message boxes;
-#X text 55 36 Message boxes hold one or more message. Anytime the message
-box receives any message at all \, the messages in the box are all
-sent to their destinations.;
-#X obj 178 301 print;
-#X msg 178 241 60 64;
-#X msg 178 271 pitch \$1 \, velocity \$2;
-#X msg 49 378 123 \; my-receiver-name 858 \; another-receiver -45;
-#X text 55 84 Clicking on a message also sends it \, so you can use
-messsage boxes for push buttins. For instance \, click here while watching
-the printout window:;
-#X msg 164 141 walk the dog;
-#X obj 164 170 print;
-#X text 281 141 <--- message;
-#X text 265 167 <--- object (different border);
-#X text 35 200 You can separate multiple messages by commas. Also \,
-you can use "$1" \, "$2" \, etc. to make variable messages:;
-#X text 14 323 Finally \, if you separate messages by a semicolon instead
-of a comma \, the following message(s) are re-routed to named objects
-such as "receives":;
-#X obj 49 433 print;
-#X obj 253 378 receive my-receiver-name;
-#X floatatom 253 402 0 0 0;
-#X floatatom 252 449 0 0 0;
-#X obj 252 425 receive another-receiver;
-#X msg 559 349 dog bird monkey \; monkey \;;
-#X msg 559 229 set dog;
-#X msg 567 252 set cat;
-#X text 593 189 this is;
-#X text 592 206 arcane:;
-#X msg 576 303 add monkey;
-#X msg 581 327 add2 bird;
-#X msg 573 277 set;
-#X text 415 479 updated for Pd version 0.34;
-#X connect 3 0 4 0;
-#X connect 4 0 2 0;
-#X connect 5 0 13 0;
-#X connect 7 0 8 0;
-#X connect 14 0 15 0;
-#X connect 17 0 16 0;
-#X connect 19 0 18 0;
-#X connect 20 0 18 0;
-#X connect 23 0 18 0;
-#X connect 24 0 18 0;
-#X connect 25 0 18 0;
diff --git a/pd/doc/5.reference/midi.pd b/pd/doc/5.reference/midi.pd
deleted file mode 100644
index 4b731688..00000000
--- a/pd/doc/5.reference/midi.pd
+++ /dev/null
@@ -1,129 +0,0 @@
-#N canvas 68 50 876 553 12;
-#X floatatom 318 379 0 0 0;
-#X floatatom 282 468 0 0 0;
-#X floatatom 200 469 0 0 0;
-#X text 96 330 off;
-#X floatatom 52 383 0 0 0;
-#X floatatom 70 134 0 0 0;
-#X obj 34 108 notein;
-#X floatatom 34 134 0 0 0;
-#X obj 52 488 noteout;
-#X obj 52 462 makenote 64 250;
-#X obj 52 409 metro 500;
-#X msg 52 356 1;
-#X msg 84 356 0;
-#X text 52 333 on;
-#X msg 52 436 60;
-#X obj 200 496 pgmout;
-#X obj 282 494 bendout;
-#X floatatom 416 379 0 0 0;
-#X floatatom 197 136 0 0 0;
-#X floatatom 145 136 0 0 0;
-#X text 41 79 omni;
-#X floatatom 106 134 0 0 0;
-#X obj 145 109 notein 1;
-#X text 145 85 channel 1;
-#X text 194 17 MIDI I/O objects;
-#X text 85 54 notes;
-#X text 334 47 control change;
-#X text 264 69 everything;
-#X floatatom 309 137 0 0 0;
-#X floatatom 271 137 0 0 0;
-#X floatatom 347 136 0 0 0;
-#X obj 271 110 ctlin;
-#X floatatom 440 138 0 0 0;
-#X floatatom 396 138 0 0 0;
-#X obj 396 111 ctlin 7;
-#X text 364 71 specific controller number;
-#X text 410 88 omni;
-#X text 496 89 channel 1;
-#X floatatom 493 140 0 0 0;
-#X obj 493 114 ctlin 7 1;
-#X obj 61 221 pgmin;
-#X floatatom 97 248 0 0 0;
-#X floatatom 61 248 0 0 0;
-#X floatatom 197 250 0 0 0;
-#X floatatom 161 250 0 0 0;
-#X floatatom 307 253 0 0 0;
-#X floatatom 272 253 0 0 0;
-#X floatatom 382 255 0 0 0;
-#X floatatom 343 253 0 0 0;
-#X floatatom 420 256 0 0 0;
-#X obj 161 222 bendin;
-#X obj 272 226 touchin;
-#X obj 343 227 polytouchin;
-#X text 49 167 these can also take an optional channel number as argument but by default are omni:;
-#X text 32 197 program change;
-#X text 155 198 pitch bend;
-#X text 271 203 channel and poly aftertouch;
-#X floatatom 191 380 0 0 0;
-#X floatatom 224 380 0 0 0;
-#X floatatom 260 382 0 0 0;
-#X obj 191 407 ctlout;
-#X obj 318 406 ctlout 7;
-#X text 192 349 control out;
-#X text 314 353 control 7;
-#X text 409 354 control 7 \, channel 4;
-#X obj 416 406 ctlout 7 4;
-#X text 101 277 outputs work similarly. They all take an optional channel as creation argument \, and ctlin takes a control number and a channel. You get inlets to change them in any case. IF you specify no channel \, it's channel 1;
-#X floatatom 355 467 0 0 0;
-#X floatatom 440 466 0 0 0;
-#X obj 355 493 touchout;
-#X obj 440 492 polytouchout;
-#X floatatom 479 467 0 0 0;
-#X floatatom 520 467 0 0 0;
-#X obj 625 218 midiin;
-#X floatatom 625 249 0 0 0;
-#X floatatom 656 249 0 0 0;
-#X floatatom 695 249 0 0 0;
-#X floatatom 726 250 0 0 0;
-#X text 590 155 These two are always omni and;
-#X text 590 174 output the port number instead;
-#X text 594 192 of the channel:;
-#X obj 697 218 sysexin;
-#X obj 623 472 midiout;
-#X text 571 413 use this to output raw MIDI;
-#X text 566 433 (the second inlet is the port;
-#X text 569 451 number.);
-#X text 625 514 updated for Pd release 0.33;
-#X connect 0 0 61 0;
-#X connect 1 0 16 0;
-#X connect 2 0 15 0;
-#X connect 4 0 10 0;
-#X connect 6 0 7 0;
-#X connect 6 1 5 0;
-#X connect 6 2 21 0;
-#X connect 9 0 8 0;
-#X connect 9 1 8 1;
-#X connect 10 0 14 0;
-#X connect 11 0 4 0;
-#X connect 12 0 4 0;
-#X connect 14 0 9 0;
-#X connect 17 0 65 0;
-#X connect 22 0 19 0;
-#X connect 22 1 18 0;
-#X connect 31 0 29 0;
-#X connect 31 1 28 0;
-#X connect 31 2 30 0;
-#X connect 34 0 33 0;
-#X connect 34 1 32 0;
-#X connect 39 0 38 0;
-#X connect 40 0 42 0;
-#X connect 40 1 41 0;
-#X connect 50 0 44 0;
-#X connect 50 1 43 0;
-#X connect 51 0 46 0;
-#X connect 51 1 45 0;
-#X connect 52 0 48 0;
-#X connect 52 1 47 0;
-#X connect 52 2 49 0;
-#X connect 57 0 60 0;
-#X connect 58 0 60 1;
-#X connect 59 0 60 2;
-#X connect 67 0 69 0;
-#X connect 68 0 70 0;
-#X connect 71 0 70 1;
-#X connect 72 0 70 2;
-#X connect 73 0 74 0;
-#X connect 73 1 75 0;
-#X connect 81 0 76 0;
diff --git a/pd/doc/5.reference/moses.pd b/pd/doc/5.reference/moses.pd
deleted file mode 100644
index c1f23c90..00000000
--- a/pd/doc/5.reference/moses.pd
+++ /dev/null
@@ -1,17 +0,0 @@
-#N canvas 0 0 624 300 12;
-#X obj 72 196 moses 10;
-#X floatatom 72 164 4 0 0;
-#X floatatom 139 167 4 0 0;
-#X floatatom 72 229 4 0 0;
-#X floatatom 139 230 4 0 0;
-#X obj 63 24 moses;
-#X text 118 23 - part a stream of numbers;
-#X text 303 235 updated for Pd version 0.33;
-#X text 24 64 Moses takes numbers and outputs them at left if they're
-less than a control value \, and at right if they're greater or equal
-to it. The creation argument initializes the control value (10 in this
-example) and the right inlet changes it.;
-#X connect 0 0 3 0;
-#X connect 0 1 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 1;
diff --git a/pd/doc/5.reference/my_canvas.pd b/pd/doc/5.reference/my_canvas.pd
deleted file mode 100644
index decda628..00000000
--- a/pd/doc/5.reference/my_canvas.pd
+++ /dev/null
@@ -1,243 +0,0 @@
-#N canvas 482 81 568 339 10;
-#X obj 1 1 cnv 15 300 60 foo10_snd foo10_rcv my_canvas=cnv 63 37 192
-17 -257472 -355 0;
-#X text 4 232 (c) musil@iem.kug.ac.at;
-#X text 46 245 IEM KUG;
-#N canvas 219 100 699 530 edit 0;
-#X obj 39 226 f;
-#X msg 17 205 bang;
-#X floatatom 55 204 3 63 88;
-#X floatatom 90 226 3 0 37;
-#X obj 39 249 pack 0 0;
-#X text 117 226 y-label;
-#X text 83 204 x-label;
-#X obj 297 281 f;
-#X msg 275 260 bang;
-#X floatatom 313 259 3 -10 10;
-#X floatatom 348 281 3 -10 10;
-#X obj 297 304 pack 0 0;
-#X obj 309 396 f;
-#X msg 287 375 bang;
-#X floatatom 325 374 3 20 60;
-#X floatatom 360 396 3 150 200;
-#X obj 309 419 pack 0 0;
-#X text 341 259 x-delta;
-#X text 375 281 y-delta;
-#X text 353 374 x-position;
-#X text 387 396 y-position;
-#X obj 59 341 f;
-#X msg 37 320 bang;
-#X floatatom 75 319 3 0 2;
-#X floatatom 110 341 3 4 36;
-#X obj 59 364 pack 0 0;
-#X text 103 319 font;
-#X text 139 341 height;
-#X floatatom 275 183 3 2 20;
-#X msg 52 137 \; foo10_rcv color \$1 \$2;
-#X msg 39 274 \; foo10_rcv label_pos \$1 \$2;
-#X msg 59 390 \; foo10_rcv label_font \$1 \$2;
-#X msg 36 430 \; foo10_rcv label blabla;
-#X msg 36 466 \; foo10_rcv label my_canvas;
-#X msg 309 444 \; foo10_rcv pos \$1 \$2;
-#X msg 297 329 \; foo10_rcv delta \$1 \$2;
-#X obj 505 234 f;
-#X msg 483 213 bang;
-#X floatatom 521 212 5 100 1000;
-#X floatatom 556 234 4 50 500;
-#X obj 505 257 pack 0 0;
-#X text 566 212 width;
-#X text 594 236 height;
-#X msg 505 282 \; foo10_rcv vis_size \$1 \$2;
-#X msg 275 211 \; foo10_rcv size \$1;
-#X text 305 183 selectable size;
-#X msg 483 156 \; foo10a_rcv receive foo10_rcv;
-#X msg 483 119 \; foo10_rcv receive foo10a_rcv;
-#X msg 482 29 \; foo10_rcv send foo10a_snd;
-#X msg 482 67 \; foo10_rcv send foo10_snd;
-#X msg 509 372 \; foo10_rcv get_pos;
-#X obj 510 407 r foo10_snd;
-#X obj 510 428 unpack 0 0;
-#X floatatom 510 453 4 0 0;
-#X floatatom 575 452 4 0 0;
-#X text 490 452 x=;
-#X text 557 452 y=;
-#X obj 52 79 f;
-#X msg 29 31 bang;
-#X floatatom 68 29 3 0 29;
-#X floatatom 103 47 3 0 29;
-#X text 96 29 background;
-#X text 131 48 label-color;
-#X msg 290 25 back;
-#X msg 290 49 label;
-#X msg 252 25 bang;
-#N canvas 15 207 606 448 RGB_____________ 0;
-#X obj 97 56 inlet;
-#X obj 262 53 inlet;
-#X obj 339 55 inlet;
-#X obj 405 56 inlet;
-#X obj 97 270 bang;
-#X msg 77 295 0;
-#X msg 104 295 1;
-#X obj 146 268 bang;
-#X msg 132 295 0;
-#X msg 160 295 1;
-#X obj 265 313 spigot;
-#X obj 312 313 spigot;
-#X obj 249 385 outlet;
-#X text 93 33 select;
-#X text 267 28 red;
-#X text 337 30 green;
-#X text 409 30 blue;
-#X obj 405 102 t b f;
-#X obj 339 160 +;
-#X obj 339 185 t b f;
-#X obj 339 216 +;
-#X obj 296 385 outlet;
-#X obj 28 180 loadbang;
-#X obj 296 361 f;
-#X obj 249 361 f;
-#X obj 262 79 * -65536;
-#X obj 339 80 * -256;
-#X obj 405 80 * -1;
-#X obj 339 247 - 1;
-#X obj 97 135 route back label bang;
-#X obj 235 168 t b b b;
-#X connect 0 0 29 0;
-#X connect 1 0 25 0;
-#X connect 2 0 26 0;
-#X connect 3 0 27 0;
-#X connect 4 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 11 1;
-#X connect 6 0 10 1;
-#X connect 7 0 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 10 1;
-#X connect 9 0 11 1;
-#X connect 10 0 24 1;
-#X connect 11 0 23 1;
-#X connect 17 0 18 0;
-#X connect 17 1 18 1;
-#X connect 18 0 19 0;
-#X connect 19 0 20 0;
-#X connect 19 1 20 1;
-#X connect 20 0 28 0;
-#X connect 22 0 6 0;
-#X connect 23 0 21 0;
-#X connect 24 0 12 0;
-#X connect 25 0 20 0;
-#X connect 26 0 18 0;
-#X connect 27 0 17 0;
-#X connect 28 0 11 0;
-#X connect 28 0 10 0;
-#X connect 29 0 4 0;
-#X connect 29 1 7 0;
-#X connect 29 2 30 0;
-#X connect 30 0 24 0;
-#X connect 30 1 23 0;
-#X connect 30 2 28 0;
-#X restore 290 86 pd RGB_____________;
-#X floatatom 332 55 3 0 255;
-#X floatatom 375 55 3 0 255;
-#X floatatom 418 56 3 0 255;
-#X text 39 3 preset-colors;
-#X text 301 0 RGB-colors;
-#X text 332 37 red;
-#X text 368 36 green;
-#X text 416 36 blue;
-#X obj 52 104 pack 0 0;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 1;
-#X connect 3 0 4 1;
-#X connect 4 0 30 0;
-#X connect 7 0 11 0;
-#X connect 8 0 7 0;
-#X connect 9 0 7 1;
-#X connect 10 0 11 1;
-#X connect 11 0 35 0;
-#X connect 12 0 16 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 1;
-#X connect 15 0 16 1;
-#X connect 16 0 34 0;
-#X connect 21 0 25 0;
-#X connect 22 0 21 0;
-#X connect 23 0 21 1;
-#X connect 24 0 25 1;
-#X connect 25 0 31 0;
-#X connect 28 0 44 0;
-#X connect 36 0 40 0;
-#X connect 37 0 36 0;
-#X connect 38 0 36 1;
-#X connect 39 0 40 1;
-#X connect 40 0 43 0;
-#X connect 51 0 52 0;
-#X connect 52 0 53 0;
-#X connect 52 1 54 0;
-#X connect 57 0 75 0;
-#X connect 58 0 57 0;
-#X connect 59 0 57 1;
-#X connect 60 0 75 1;
-#X connect 63 0 66 0;
-#X connect 64 0 66 0;
-#X connect 65 0 66 0;
-#X connect 66 0 75 0;
-#X connect 66 1 75 1;
-#X connect 67 0 66 1;
-#X connect 68 0 66 2;
-#X connect 69 0 66 3;
-#X connect 75 0 29 0;
-#X restore 305 20 pd edit;
-#X floatatom 110 193 4 0 0;
-#X floatatom 147 193 4 0 0;
-#X text 121 209 x;
-#X text 158 209 y;
-#X obj 7 161 metro 100;
-#X obj 33 141 tgl 15 1 empty empty empty 20 8 0 10 -262144 -1 -1 1
-1;
-#X obj 110 145 r from_K1;
-#X floatatom 188 194 4 0 0;
-#X floatatom 225 194 4 0 0;
-#X text 198 210 x;
-#X text 236 210 y;
-#X obj 188 146 r from_K2;
-#X msg 7 185 \; to_K get_pos;
-#N canvas 0 296 395 395 room 1;
-#X obj 1 1 cnv 1 400 400 empty empty type...ctrl+e 150 140 2 17 -33289
--24198 0;
-#X obj 15 16 cnv 1 1 360 empty empty move_K1_and_K2 115 160 2 17 -166441
--24198 0;
-#X obj 374 15 cnv 1 1 360 empty empty empty 20 12 2 20 -99865 -66577
-0;
-#X obj 15 15 cnv 1 360 1 empty empty empty 20 12 2 20 -166441 -66577
-0;
-#X obj 17 375 cnv 1 358 1 empty empty empty 20 12 2 20 -99865 -66577
-0;
-#X obj 23 22 cnv 25 25 25 from_K1 to_K K1 1 13 194 14 -261681 -123526
-0;
-#X obj 342 342 cnv 25 25 25 from_K2 to_K K2 1 13 194 14 -225280 -1109
-0;
-#X restore 307 147 pd room;
-#X obj 110 169 unpack;
-#X obj 188 170 unpack;
-#X text 51 92 to modify geometry \, colors \, etc.;
-#X obj 2 115 cnv 1 470 1 empty empty empty 20 12 2 20 -261681 -66577
-0;
-#X text 40 78 of the light-blue;
-#X text 166 78 my_canvas-object \,;
-#X text 5 64 click the properties-dialog on the top-left corner;
-#X obj 361 195 r foo10_rcv;
-#X obj 403 215 s ggg;
-#X text 172 257 updated for Pd version 0.35;
-#X text 21 257 graz \, austria 2002;
-#X obj 187 236 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii;
-#X connect 8 0 16 0;
-#X connect 9 0 8 0;
-#X connect 10 0 18 0;
-#X connect 15 0 19 0;
-#X connect 18 0 4 0;
-#X connect 18 1 5 0;
-#X connect 19 0 11 0;
-#X connect 19 1 12 0;
-#X connect 25 0 26 0;
diff --git a/pd/doc/5.reference/namecanvas.pd b/pd/doc/5.reference/namecanvas.pd
deleted file mode 100644
index 4c408bcb..00000000
--- a/pd/doc/5.reference/namecanvas.pd
+++ /dev/null
@@ -1,8 +0,0 @@
-#N canvas 38 53 532 261 12;
-#X obj 66 15 namecanvas;
-#X text 169 15 - ATTACH THIS CANVAS TO A NAME;
-#X obj 204 107 namecanvas bonzo;
-#X msg 205 64 \; bonzo msg 50 50 hi there;
-#X text 252 224 updated for Pd version 0.33;
-#X msg 79 180 \; pd-namecanvas.pd msg 50 70 this is better;
-#X text 44 153 This is obsolete. Instead \, you can just say:;
diff --git a/pd/doc/5.reference/netreceive.pd b/pd/doc/5.reference/netreceive.pd
deleted file mode 100644
index b4bd3f9c..00000000
--- a/pd/doc/5.reference/netreceive.pd
+++ /dev/null
@@ -1,23 +0,0 @@
-#N canvas 50 24 682 520 12;
-#X obj 100 323 netreceive 3000;
-#X floatatom 202 353 0 0 0;
-#X obj 100 414 netreceive 3001 1;
-#X text 33 36 The Netreceive object opens a socket for TCP ("stream") or UDP ("datagram") network reception on a specified port. If using TCP \, an outlet gives you the number of Netsend objects (or other compatible clients) have opened connections here.;
-#X text 31 117 Incoming network messages appear on "receive" objects \; it's up to the sender to select which one. Here \, a "receive foo" fields messages sent from the Netsend help window \, q.v.;
-#X text 108 270 first argument: portnumber = 3000;
-#X text 105 291 second argument: 0 or none for TCP \, nonzero for UDP;
-#X text 238 322 <-- TCP \, port 3000;
-#X text 262 413 <-- UDP \, port 3001;
-#X text 236 354 <--- number of open connections;
-#X text 85 12 Netreceive -- listen for incoming messages from network;
-#X text 26 383 incoming messages;
-#X text 203 488 see also:;
-#X obj 289 490 netsend;
-#X obj 100 353 print tcp;
-#X obj 100 442 print udp;
-#X text 425 484 updated for Pd version 0.33;
-#X text 30 207 SECURITY ALERT: don't publish the port number of your netreceive unless you wouldn't mind other people being able to send you messages.;
-#X text 32 168 There are some possibilities for intercommunication with other programs... see the help for "netsend.";
-#X connect 0 0 14 0;
-#X connect 0 1 1 0;
-#X connect 2 0 15 0;
diff --git a/pd/doc/5.reference/netsend.pd b/pd/doc/5.reference/netsend.pd
deleted file mode 100644
index f2eb9bad..00000000
--- a/pd/doc/5.reference/netsend.pd
+++ /dev/null
@@ -1,55 +0,0 @@
-#N canvas 84 44 866 530 12;
-#X obj 15 425 netsend;
-#X msg 15 263 connect localhost 3000;
-#X msg 24 403 send foo \$1;
-#X floatatom 24 376 0 0 0;
-#X msg 15 344 disconnect;
-#X msg 285 397 send foo \$1;
-#X floatatom 285 370 0 0 0;
-#X msg 268 344 disconnect;
-#X obj 268 422 netsend 1;
-#X msg 268 263 connect localhost 3001;
-#X floatatom 15 452 0 0 0;
-#X floatatom 268 449 0 0 0;
-#X text 359 422 creation argument: 0 or none for TCP \, nonzero for
-UDP;
-#X text 66 242 TCP;
-#X text 343 239 UDP;
-#X text 197 9 Netsend -- send Pd messages over a network;
-#X text 475 261 Connect to "localhost" port 3000/3001;
-#X text 373 345 Close the connection;
-#X text 325 372 Send messages to "foo" on remote machine;
-#X text 10 473 Outlet is nonzero if connection is open \, zero otherwise.
-;
-#X text 87 38 The Netsend object connects to another machine over the
-network for sending TCP ("stream") or UDP ("datagram") messages. An
-outlet reports whether the connection is open or not. A connection
-request should specify the name or IP address of the other host and
-the port number. There should be a "Netreceive" on the remote host
-with a matching port number.;
-#X obj 409 497 netreceive;
-#X text 318 497 see also:;
-#X text 607 498 updated for Pd version 0.33;
-#X text 87 150 Opt@web.fm has made compatible objects for Max so that
-Pd and Max can intercommunicate: see ftp://fals.ch/pub/pdnets/.;
-#X text 87 186 The Linux version of Pd comes with "pdsend" and "pdreceive"
-standalone programs. These haven't been tested in Windows yet (but
-the source is included in the Pd distribution.);
-#X msg 15 290 connect molloy 3000;
-#X msg 268 290 connect molloy 3001;
-#X msg 15 317 connect bug 3000;
-#X msg 268 317 connect bug 3000;
-#X connect 0 0 10 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 0;
-#X connect 3 0 2 0;
-#X connect 4 0 0 0;
-#X connect 5 0 8 0;
-#X connect 6 0 5 0;
-#X connect 7 0 8 0;
-#X connect 8 0 11 0;
-#X connect 9 0 8 0;
-#X connect 26 0 0 0;
-#X connect 27 0 8 0;
-#X connect 28 0 0 0;
-#X connect 29 0 8 0;
diff --git a/pd/doc/5.reference/noise~.pd b/pd/doc/5.reference/noise~.pd
deleted file mode 100644
index cafc15c3..00000000
--- a/pd/doc/5.reference/noise~.pd
+++ /dev/null
@@ -1,18 +0,0 @@
-#N canvas 174 90 458 270 12;
-#X floatatom 77 178 4 0 0;
-#X obj 77 111 noise~;
-#X obj 167 149 print~;
-#X msg 167 123 bang;
-#X obj 282 89 loadbang;
-#X msg 282 114 \; pd dsp 1;
-#X obj 77 150 env~ 4096;
-#X text 67 204 RMS in dB;
-#X text 171 242 updated for Pd version 0.33;
-#X obj 20 11 noise~;
-#X text 84 11 - uniformly distributed white noise;
-#X text 38 49 the output range is -1 to 1...;
-#X connect 1 0 2 0;
-#X connect 1 0 6 0;
-#X connect 3 0 2 0;
-#X connect 4 0 5 0;
-#X connect 6 0 0 0;
diff --git a/pd/doc/5.reference/numbox2.pd b/pd/doc/5.reference/numbox2.pd
deleted file mode 100644
index a26db250..00000000
--- a/pd/doc/5.reference/numbox2.pd
+++ /dev/null
@@ -1,302 +0,0 @@
-#N canvas 290 235 617 416 10;
-#X obj 1 1 cnv 8 100 60 empty empty numbox=nbx 20 20 1 18 -262144 -1109
-0;
-#X floatatom 38 300 9 0 0;
-#X msg 47 84 set \$1;
-#X floatatom 38 43 7 0 0;
-#X text 25 363 (c) musil@iem.kug.ac.at;
-#X text 67 376 IEM KUG;
-#X obj 38 324 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 18 47 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X floatatom 47 63 7 0 0;
-#X floatatom 116 324 9 0 0;
-#X floatatom 106 42 7 0 0;
-#X floatatom 183 113 7 0 0;
-#X obj 111 249 ftom;
-#X floatatom 111 271 9 0 0;
-#X floatatom 147 244 9 0 0;
-#X floatatom 221 266 9 0 0;
-#X text 217 151 click properties to;
-#X floatatom 111 112 9 0 0;
-#X obj 111 134 mtof;
-#X text 202 65 (0.01 pixels);
-#X text 57 99 ------------------------------------------;
-#X text 57 286 --------------------------------------------;
-#X text 205 162 modify geometry \, colors \, etc.;
-#X msg 106 63 set \$1;
-#X text 188 44 shift-click & drag;
-#X text 194 54 for fine-tuning;
-#X text 195 203 UP- \, DOWN- \, LEFT- or RIGHT-key;
-#X text 193 214 for moving selected gui-objects;
-#N canvas 239 379 699 530 edit 0;
-#X obj 37 233 f;
-#X msg 15 212 bang;
-#X floatatom 53 211 3 6 88;
-#X floatatom 88 233 3 -20 37;
-#X obj 37 256 pack 0 0;
-#X text 115 233 y-label;
-#X text 81 211 x-label;
-#X obj 287 271 f;
-#X msg 265 250 bang;
-#X floatatom 303 249 3 -10 10;
-#X floatatom 338 271 3 -10 10;
-#X obj 287 294 pack 0 0;
-#X obj 299 381 f;
-#X msg 277 360 bang;
-#X floatatom 315 359 3 20 90;
-#X floatatom 350 381 3 150 200;
-#X obj 299 404 pack 0 0;
-#X text 331 249 x-delta;
-#X text 365 271 y-delta;
-#X text 343 359 x-position;
-#X text 377 381 y-position;
-#X obj 57 348 f;
-#X msg 35 327 bang;
-#X floatatom 73 326 3 0 2;
-#X floatatom 108 348 3 4 36;
-#X obj 57 371 pack 0 0;
-#X text 101 326 font;
-#X text 137 348 height;
-#X floatatom 476 188 1 0 1;
-#X text 523 401 no init;
-#X text 493 453 init value on loadbang;
-#X text 520 188 steady;
-#X obj 486 291 f;
-#X msg 464 270 bang;
-#X floatatom 502 269 4 55 440;
-#X floatatom 537 291 6 440 3520;
-#X obj 486 314 pack 0 0;
-#X text 269 469 linear / logarithmical;
-#X msg 47 158 \; goo4_rcv color \$1 \$2 \$3;
-#X msg 37 281 \; goo4_rcv label_pos \$1 \$2;
-#X msg 57 396 \; goo4_rcv label_font \$1 \$2;
-#X msg 40 442 \; goo4_rcv label blabla;
-#X msg 269 487 \; goo4_rcv lin;
-#X msg 363 486 \; goo4_rcv log;
-#X msg 299 429 \; goo4_rcv pos \$1 \$2;
-#X msg 287 319 \; goo4_rcv delta \$1 \$2;
-#X msg 475 21 \; goo4_rcv send goo4a_snd;
-#X msg 475 59 \; goo4_rcv send goo4_snd;
-#X msg 476 105 \; goo4_rcv receive goo4a_rcv;
-#X msg 476 143 \; goo4a_rcv receive goo4_rcv;
-#X msg 486 339 \; goo4_rcv range \$1 \$2;
-#X msg 502 420 \; goo4_rcv init 0;
-#X msg 503 471 \; goo4_rcv init 1;
-#X text 539 270 bottom-range-bound;
-#X text 586 292 top-range-bound;
-#X obj 286 160 f;
-#X msg 264 139 bang;
-#X floatatom 302 138 3 4 55;
-#X floatatom 337 160 3 15 73;
-#X obj 286 183 pack 0 0;
-#X msg 286 208 \; goo4_rcv size \$1 \$2;
-#X text 330 138 width;
-#X text 368 161 height;
-#X msg 41 478 \; goo4_rcv label log.freq.;
-#X msg 476 212 \; goo4_rcv steady \$1;
-#X obj 47 116 pack 0 0 0;
-#X obj 47 88 f;
-#X msg 24 40 bang;
-#X floatatom 63 38 3 0 29;
-#X floatatom 79 58 3 0 29;
-#X floatatom 112 74 3 0 29;
-#X text 91 38 background;
-#X text 106 58 front-color;
-#X text 140 75 label-color;
-#X msg 285 37 back;
-#X msg 285 57 front;
-#X msg 285 77 label;
-#X msg 247 37 bang;
-#N canvas 15 207 606 448 RGB_____________ 0;
-#X obj 97 56 inlet;
-#X obj 262 53 inlet;
-#X obj 339 55 inlet;
-#X obj 405 56 inlet;
-#X obj 97 270 bang;
-#X msg 77 295 0;
-#X msg 104 295 1;
-#X obj 146 268 bang;
-#X msg 132 295 0;
-#X msg 160 295 1;
-#X obj 196 269 bang;
-#X msg 187 295 0;
-#X msg 214 295 1;
-#X obj 265 313 spigot;
-#X obj 312 313 spigot;
-#X obj 359 313 spigot;
-#X obj 249 385 outlet;
-#X text 93 33 select;
-#X text 267 28 red;
-#X text 337 30 green;
-#X text 409 30 blue;
-#X obj 405 102 t b f;
-#X obj 339 160 +;
-#X obj 339 185 t b f;
-#X obj 339 216 +;
-#X obj 296 385 outlet;
-#X obj 343 385 outlet;
-#X obj 28 180 loadbang;
-#X obj 97 135 route back front label bang;
-#X obj 343 362 f;
-#X obj 296 361 f;
-#X obj 249 361 f;
-#X obj 262 79 * -65536;
-#X obj 339 80 * -256;
-#X obj 405 80 * -1;
-#X obj 339 247 - 1;
-#X obj 235 168 t b b b b;
-#X connect 0 0 28 0;
-#X connect 1 0 32 0;
-#X connect 2 0 33 0;
-#X connect 3 0 34 0;
-#X connect 4 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 14 1;
-#X connect 5 0 15 1;
-#X connect 6 0 13 1;
-#X connect 7 0 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 13 1;
-#X connect 8 0 15 1;
-#X connect 9 0 14 1;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 11 0 13 1;
-#X connect 11 0 14 1;
-#X connect 12 0 15 1;
-#X connect 13 0 31 1;
-#X connect 14 0 30 1;
-#X connect 15 0 29 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 35 0;
-#X connect 27 0 6 0;
-#X connect 28 0 4 0;
-#X connect 28 1 7 0;
-#X connect 28 2 10 0;
-#X connect 28 3 36 0;
-#X connect 29 0 26 0;
-#X connect 30 0 25 0;
-#X connect 31 0 16 0;
-#X connect 32 0 24 0;
-#X connect 33 0 22 0;
-#X connect 34 0 21 0;
-#X connect 35 0 15 0;
-#X connect 35 0 14 0;
-#X connect 35 0 13 0;
-#X connect 36 0 31 0;
-#X connect 36 1 30 0;
-#X connect 36 2 29 0;
-#X connect 36 3 35 0;
-#X restore 285 98 pd RGB_____________;
-#X floatatom 327 67 3 0 255;
-#X floatatom 370 67 3 0 255;
-#X floatatom 413 68 3 0 255;
-#X text 34 12 preset-colors;
-#X text 296 9 RGB-colors;
-#X text 327 49 red;
-#X text 363 48 green;
-#X text 411 48 blue;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 1;
-#X connect 3 0 4 1;
-#X connect 4 0 39 0;
-#X connect 7 0 11 0;
-#X connect 8 0 7 0;
-#X connect 9 0 7 1;
-#X connect 10 0 11 1;
-#X connect 11 0 45 0;
-#X connect 12 0 16 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 1;
-#X connect 15 0 16 1;
-#X connect 16 0 44 0;
-#X connect 21 0 25 0;
-#X connect 22 0 21 0;
-#X connect 23 0 21 1;
-#X connect 24 0 25 1;
-#X connect 25 0 40 0;
-#X connect 28 0 64 0;
-#X connect 32 0 36 0;
-#X connect 33 0 32 0;
-#X connect 34 0 32 1;
-#X connect 35 0 36 1;
-#X connect 36 0 50 0;
-#X connect 55 0 59 0;
-#X connect 56 0 55 0;
-#X connect 57 0 55 1;
-#X connect 58 0 59 1;
-#X connect 59 0 60 0;
-#X connect 65 0 38 0;
-#X connect 66 0 65 0;
-#X connect 67 0 66 0;
-#X connect 68 0 66 1;
-#X connect 69 0 65 1;
-#X connect 70 0 65 2;
-#X connect 74 0 78 0;
-#X connect 75 0 78 0;
-#X connect 76 0 78 0;
-#X connect 77 0 78 0;
-#X connect 78 0 65 0;
-#X connect 78 1 65 1;
-#X connect 78 2 65 2;
-#X connect 79 0 78 1;
-#X connect 80 0 78 2;
-#X connect 81 0 78 3;
-#X restore 327 48 pd edit;
-#X obj 61 345 print;
-#N canvas 276 200 290 224 once 0;
-#X obj 38 47 t b b f;
-#X msg 56 85 1;
-#X obj 31 108 f 0;
-#X obj 31 131 pack 0 0;
-#X obj 31 156 route 0;
-#X obj 38 24 inlet;
-#X obj 31 180 outlet;
-#X connect 0 0 1 0;
-#X connect 0 1 2 0;
-#X connect 0 2 3 1;
-#X connect 1 0 2 1;
-#X connect 2 0 3 0;
-#X connect 3 0 4 0;
-#X connect 4 0 6 0;
-#X connect 5 0 0 0;
-#X restore 61 322 pd once;
-#X obj 249 87 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii;
-#X text 218 387 updated for Pd version 0.35;
-#X text 42 388 graz \, austria 2002;
-#X text 192 13 gui-number-box:;
-#X obj 106 84 s foo13_rcv;
-#X obj 183 133 s goo14_rcv;
-#X obj 221 244 r goo14_snd;
-#X obj 116 302 r foo13_snd;
-#X obj 47 172 nbx 4 15 100 300 0 0 foo13_snd foo13_rcv empty 45 7 192
-10 -225280 -1109 -1 100 256;
-#X obj 111 200 nbx 5 18 55 3520 1 0 goo14_snd goo14_rcv log.freq. 45
--10 192 14 -261681 -260818 -90881 55 72;
-#X obj 464 114 nbx 5 14 -1e+37 1e+37 0 0 hhh hhh empty 45 7 192 10
--262144 -1 -1 0 256;
-#X connect 1 0 6 0;
-#X connect 2 0 39 0;
-#X connect 3 0 39 0;
-#X connect 7 0 39 0;
-#X connect 8 0 2 0;
-#X connect 10 0 23 0;
-#X connect 11 0 36 0;
-#X connect 12 0 13 0;
-#X connect 17 0 18 0;
-#X connect 18 0 40 0;
-#X connect 23 0 35 0;
-#X connect 30 0 29 0;
-#X connect 37 0 15 0;
-#X connect 38 0 9 0;
-#X connect 39 0 30 0;
-#X connect 39 0 1 0;
-#X connect 40 0 12 0;
-#X connect 40 0 14 0;
diff --git a/pd/doc/5.reference/openpanel.pd b/pd/doc/5.reference/openpanel.pd
deleted file mode 100644
index 15e5d244..00000000
--- a/pd/doc/5.reference/openpanel.pd
+++ /dev/null
@@ -1,11 +0,0 @@
-#N canvas 35 31 585 245 12;
-#X obj 128 136 openpanel;
-#X msg 128 108 bang;
-#X obj 128 161 print;
-#X text 31 11 openpanel -- query you for a filename;
-#X text 48 218 see also:;
-#X obj 136 219 savepanel;
-#X text 272 223 updated for Pd version 0.33;
-#X text 33 59 When Openpanel gets a "bang" an "Open file" browser appears on the screen. If you select a file \, its name appears on the outlet.;
-#X connect 0 0 2 0;
-#X connect 1 0 0 0;
diff --git a/pd/doc/5.reference/operators.pd b/pd/doc/5.reference/operators.pd
deleted file mode 100644
index 64b47e4d..00000000
--- a/pd/doc/5.reference/operators.pd
+++ /dev/null
@@ -1,31 +0,0 @@
-#N canvas 52 109 635 355 12;
-#X obj 29 172 +;
-#X floatatom 41 113 0 0 0;
-#X floatatom 29 197 0 0 0;
-#X floatatom 51 143 0 0 0;
-#X msg 29 82 bang;
-#X obj 44 6 +;
-#X text 27 307 see also:;
-#X obj 186 314 +~;
-#X text 79 5 (etc.) -- ARITHMETIC;
-#X text 72 88 Bang outputs sum;
-#X text 79 112 Numbers in left inlet add and output sum;
-#X text 93 142 Numbers in right inlet only change the inlet's value;
-#X obj 113 314 trigger;
-#X text 348 325 last updated for version 0.33;
-#X text 93 189 You can supply a creation argument to initialize the right inlet:;
-#X text 29 29 The floating point binary operators are + \, - \, * \, / \, pow \, max \, and min. Note that pow only works for nonnegative mantissas.;
-#X floatatom 101 225 0 0 0;
-#X floatatom 101 275 0 0 0;
-#X obj 101 250 pow -1;
-#X floatatom 179 225 0 0 0;
-#X floatatom 179 275 0 0 0;
-#X obj 179 250 min 20;
-#X connect 0 0 2 0;
-#X connect 1 0 0 0;
-#X connect 3 0 0 1;
-#X connect 4 0 0 0;
-#X connect 16 0 18 0;
-#X connect 18 0 17 0;
-#X connect 19 0 21 0;
-#X connect 21 0 20 0;
diff --git a/pd/doc/5.reference/osc~.pd b/pd/doc/5.reference/osc~.pd
deleted file mode 100644
index 2bd5f0df..00000000
--- a/pd/doc/5.reference/osc~.pd
+++ /dev/null
@@ -1,58 +0,0 @@
-#N canvas 85 32 811 508 12;
-#X obj 252 320 dac~ 1;
-#X obj 252 292 *~;
-#X floatatom 156 115 0 0 0;
-#X obj 276 264 line~;
-#X msg 276 208 0.1 100;
-#X msg 295 233 0 100;
-#X text 347 203 on;
-#X text 344 232 off;
-#X text 333 261 envelope;
-#X text 333 274 generator;
-#X text 260 183 amplitude controls:;
-#X text 250 344 audio output;
-#X text 424 426 see also:;
-#X obj 580 428 cos~;
-#X obj 629 428 tabread4~;
-#X obj 68 14 osc~;
-#X text 142 16 - cosine wave oscillator;
-#X obj 126 294 metro 500;
-#X obj 126 269 r metro;
-#X text 88 344 graph the output;
-#X obj 510 427 phasor~;
-#X msg 571 79 \; metro 0;
-#X msg 570 20 \; pd dsp 1 \; metro 1;
-#X floatatom 637 245 0 0 0;
-#X obj 637 275 sig~;
-#X text 522 266 convert to;
-#X text 512 282 audio signal;
-#X text 518 305 oscillator;
-#X text 479 243 frequency control;
-#X obj 637 306 osc~;
-#X text 3 120 change frequency;
-#X text 244 145 <-- creation argument sets initial frequency;
-#X text 231 123 v-- inlet resets phase;
-#X graph graph1 0 -1 100 1 94 388 294 488;
-#X array array99 100 float;
-#X pop;
-#X text 16 39 The osc~ object outputs a cosine wave. If no argument is supplied \, the input is taken to be an audio signal. With a floating-point argument \, osc~ takes floating-point messages to change frequency.;
-#X text 510 336 invoked without argument to;
-#X text 512 360 specify audio signal input;
-#X text 2 105 incoming numbers;
-#X obj 89 322 tabwrite~ array99;
-#X obj 156 144 osc~ 1000;
-#X text 546 480 updated for Pd version 0.33;
-#X text 655 39 <-Click to start;
-#X text 648 88 <-Click to stop;
-#X connect 1 0 0 0;
-#X connect 2 0 39 0;
-#X connect 3 0 1 1;
-#X connect 4 0 3 0;
-#X connect 5 0 3 0;
-#X connect 17 0 38 0;
-#X connect 18 0 17 0;
-#X connect 18 0 17 0;
-#X connect 23 0 24 0;
-#X connect 24 0 29 0;
-#X connect 39 0 1 0;
-#X connect 39 0 38 0;
diff --git a/pd/doc/5.reference/otherbinops.pd b/pd/doc/5.reference/otherbinops.pd
deleted file mode 100644
index 3f310818..00000000
--- a/pd/doc/5.reference/otherbinops.pd
+++ /dev/null
@@ -1,90 +0,0 @@
-#N canvas 20 43 698 447 12;
-#X floatatom 524 338 0 0 0;
-#X floatatom 353 338 0 0 0;
-#X floatatom 298 338 0 0 0;
-#X floatatom 413 338 0 0 0;
-#X floatatom 467 338 0 0 0;
-#X obj 524 311 <;
-#X obj 298 262 r left;
-#X obj 540 267 r right;
-#X floatatom 71 335 0 0 0;
-#X floatatom 19 334 0 0 0;
-#X floatatom 119 335 0 0 0;
-#X floatatom 163 334 0 0 0;
-#X obj 16 45 &;
-#X obj 66 45 |;
-#X obj 118 45 &&;
-#X obj 169 45 ||;
-#X obj 19 307 &;
-#X obj 71 308 |;
-#X obj 119 308 &&;
-#X obj 163 307 ||;
-#X text 13 73 The Logical Operators;
-#X obj 19 266 r left;
-#X obj 218 266 r right;
-#X obj 12 118 >;
-#X obj 61 118 >=;
-#X obj 114 118 ==;
-#X obj 215 119 <=;
-#X obj 262 119 <;
-#X text 11 153 The Relational Operators;
-#X obj 298 312 >;
-#X obj 353 312 >=;
-#X obj 413 312 ==;
-#X obj 467 312 <=;
-#X text 16 190 relational output is logical- and negative numbers BAD
-in bitwise logical operators. These operators as defined by C programming
-language. (inputs and outputs are converted to and from floating point).
-;
-#X floatatom 410 65 0 0 0;
-#X obj 410 92 s left;
-#X floatatom 481 66 0 0 0;
-#X obj 481 94 t b f;
-#X obj 481 122 s left;
-#X obj 541 122 s right;
-#X obj 166 118 !=;
-#X text 377 42 set left and right inputs here;
-#X floatatom 202 335 0 0 0;
-#X floatatom 246 334 0 0 0;
-#X obj 208 46 <<;
-#X obj 259 46 >>;
-#X obj 202 308 <<;
-#X obj 246 307 >>;
-#X text 421 383 last updated for version 0.32;
-#X connect 5 0 0 0;
-#X connect 6 0 29 0;
-#X connect 6 0 30 0;
-#X connect 6 0 31 0;
-#X connect 6 0 32 0;
-#X connect 6 0 5 0;
-#X connect 7 0 29 1;
-#X connect 7 0 30 1;
-#X connect 7 0 31 1;
-#X connect 7 0 32 1;
-#X connect 7 0 5 1;
-#X connect 16 0 9 0;
-#X connect 17 0 8 0;
-#X connect 18 0 10 0;
-#X connect 19 0 11 0;
-#X connect 21 0 16 0;
-#X connect 21 0 17 0;
-#X connect 21 0 18 0;
-#X connect 21 0 19 0;
-#X connect 21 0 46 0;
-#X connect 21 0 47 0;
-#X connect 22 0 19 1;
-#X connect 22 0 18 1;
-#X connect 22 0 17 1;
-#X connect 22 0 16 1;
-#X connect 22 0 47 1;
-#X connect 22 0 46 1;
-#X connect 29 0 2 0;
-#X connect 30 0 1 0;
-#X connect 31 0 3 0;
-#X connect 32 0 4 0;
-#X connect 34 0 35 0;
-#X connect 36 0 37 0;
-#X connect 37 0 38 0;
-#X connect 37 1 39 0;
-#X connect 46 0 42 0;
-#X connect 47 0 43 0;
diff --git a/pd/doc/5.reference/pack.pd b/pd/doc/5.reference/pack.pd
deleted file mode 100644
index c979d480..00000000
--- a/pd/doc/5.reference/pack.pd
+++ /dev/null
@@ -1,37 +0,0 @@
-#N canvas 14 8 809 354 12;
-#X floatatom 19 86 0 0 0;
-#X msg 29 115 bang;
-#X floatatom 49 138 0 0 0;
-#X floatatom 188 138 0 0 0;
-#X obj 19 254 print;
-#X msg 86 138 symbol cat;
-#X obj 82 9 pack;
-#X text 28 319 See also;
-#X obj 106 321 unpack;
-#X text 14 34 The pack object takes a series of inputs and outputs
-a concatenated list. The number of creation arguments determines the
-number of inlets.;
-#X text 60 85 <-- number in first inlet generates output;
-#X text 70 114 <-- bang generates output without resetting first value
-;
-#X text 226 135 <-- numbers and symbols in the corresponding inlets
-change the values without causing output (see "trigger" for a way to
-change this behavior.);
-#X text 250 187 <-- as with any Pd object \, you can send a list whose
-atoms are automatically distributed to the corresponding inlets.;
-#X msg 175 190 1 2 dog;
-#X obj 167 321 trigger;
-#X obj 19 227 pack 100 0 s 0;
-#X text 121 9 - combine several atoms into one message;
-#X text 155 226 <-- creation arguments specify the number of inlets
-and their types: a number make a numeric outlet (and initializes the
-value). A symbol argument can start with "s" \, "f" \, or "p" to specify
-a "symbol" \, "float" (number) \, or pointer outlet.;
-#X text 538 331 updated for Pd version 0.34;
-#X connect 0 0 16 0;
-#X connect 1 0 16 0;
-#X connect 2 0 16 1;
-#X connect 3 0 16 3;
-#X connect 5 0 16 2;
-#X connect 14 0 16 0;
-#X connect 16 0 4 0;
diff --git a/pd/doc/5.reference/pd.pd b/pd/doc/5.reference/pd.pd
deleted file mode 100644
index f7db8f66..00000000
--- a/pd/doc/5.reference/pd.pd
+++ /dev/null
@@ -1,52 +0,0 @@
-#N canvas 32 130 677 385 12;
-#N canvas 0 0 600 400 /SUBPATCH/ 0;
-#X restore 59 10 pd;
-#X text 88 12 - subpatch;
-#X obj 218 10 inlet;
-#X text 263 10 - control inlet;
-#X obj 442 11 inlet~;
-#X text 494 12 - audio inlet;
-#X obj 215 39 outlet;
-#X text 265 39 - control outlet;
-#X obj 435 40 outlet~;
-#X text 494 40 - audio outlet;
-#X text 37 74 Type "pd" into an object box to make a subpatch. When
-in run mode you can click on the object to open the subpatch. You can
-name the subpatch with an argument:;
-#N canvas 0 0 600 396 my-subpatch 0;
-#X restore 133 131 pd my-subpatch;
-#N canvas 0 0 600 392 my-subpatch-with-inlets-and-outlets 0;
-#X obj 68 126 inlet;
-#X text 20 96 control inlet for receiving messages;
-#X floatatom 68 154 0 0 0;
-#X floatatom 71 255 0 0 0;
-#X obj 71 287 outlet;
-#X text 35 225 control outlet for sending message;
-#X obj 403 121 inlet~;
-#X obj 403 172 print~;
-#X msg 418 146 bang;
-#X obj 402 314 outlet~;
-#X obj 402 288 sig~ 34;
-#X connect 0 0 2 0;
-#X connect 3 0 4 0;
-#X connect 6 0 7 0;
-#X connect 8 0 7 0;
-#X connect 10 0 9 0;
-#X restore 86 272 pd my-subpatch-with-inlets-and-outlets;
-#X text 55 174 and you can put inlets and outlets by making "inlet"
-objects \, etc \, in the subpatch (open the patch below to see them.)
-;
-#X obj 423 322 print~;
-#X msg 362 294 bang;
-#X obj 422 243 sig~ 12;
-#X floatatom 86 246 0 0 0;
-#X floatatom 86 298 0 0 0;
-#X text 441 272 (check that audio is on);
-#X text 52 221 messages in and out;
-#X text 392 220 audio in and out;
-#X text 391 351 updated for Pd version 0.26;
-#X connect 12 0 18 0;
-#X connect 12 1 14 0;
-#X connect 15 0 14 0;
-#X connect 16 0 12 1;
-#X connect 17 0 12 0;
diff --git a/pd/doc/5.reference/phasor~.pd b/pd/doc/5.reference/phasor~.pd
deleted file mode 100644
index 2da01cf9..00000000
--- a/pd/doc/5.reference/phasor~.pd
+++ /dev/null
@@ -1,36 +0,0 @@
-#N canvas 5 31 889 373 12;
-#X graph graph1 0 1 100 -1 67 250 267 350;
-#X array array99 100 float;
-#X pop;
-#X obj 29 181 metro 500;
-#X obj 13 126 phasor~;
-#X floatatom 13 76 0 0 0;
-#X obj 57 12 phasor~;
-#X obj 29 156 r metro;
-#X obj 13 100 sig~ 890;
-#X text 78 75 <-- specify frequency;
-#X text 92 98 <-- convert it to audio signal;
-#X msg 409 75 \; metro 0;
-#X msg 405 18 \; pd dsp 1 \; metro 1;
-#X text 494 32 <-- Click to start;
-#X text 479 79 <-- Click to stop;
-#X text 129 14 - sawtooth generator;
-#X text 170 207 <-- graph the output;
-#X text 82 128 <-- right inlet resets phase;
-#X obj 425 227 phasor~ 440;
-#X floatatom 425 203 0 0 0;
-#X text 348 118 The phasor~ object outputs a sawtooth signal \, traditionally used for table lookup via cos~ or tabread4~. If no argument is supplied \, the input is taken to be an audio signal \; with a floating-point argument \, phasor~ takes floating-point messages to change frequency.;
-#X text 294 246 Invoked above with argument for non-signal input. Incoming messages override the initial value.;
-#X text 311 301 see also:;
-#X obj 396 301 osc~;
-#X obj 439 301 cos~;
-#X obj 481 301 tabread4~;
-#X text 627 345 updated for Pd version 0.33;
-#X obj 13 205 tabwrite~ array99;
-#X connect 1 0 25 0;
-#X connect 2 0 25 0;
-#X connect 3 0 6 0;
-#X connect 5 0 1 0;
-#X connect 5 0 1 0;
-#X connect 6 0 2 0;
-#X connect 17 0 16 0;
diff --git a/pd/doc/5.reference/pipe.pd b/pd/doc/5.reference/pipe.pd
deleted file mode 100644
index 272057ed..00000000
--- a/pd/doc/5.reference/pipe.pd
+++ /dev/null
@@ -1,41 +0,0 @@
-#N canvas 99 89 737 480 12;
-#X floatatom 52 127 0 0 0;
-#X floatatom 127 227 0 0 0;
-#X floatatom 52 284 0 0 0;
-#X floatatom 544 281 0 0 0;
-#X floatatom 535 392 0 0 0;
-#X obj 534 364 pipe 5 6 7 1000;
-#X obj 543 307 t f f f;
-#X obj 563 338 + 1;
-#X obj 597 337 + 2;
-#X floatatom 590 390 0 0 0;
-#X floatatom 658 391 0 0 0;
-#X text 32 433 see also:;
-#X text 129 13 pipe -- message "delay line";
-#X obj 52 253 pipe 2000;
-#X text 91 125 numbers to store and output later;
-#X text 117 148 output all stored messages immediately;
-#X msg 63 152 flush;
-#X msg 65 180 clear;
-#X text 113 180 forget all stored messages;
-#X text 91 286 delayed output;
-#X obj 116 435 delay;
-#X obj 167 435 timer;
-#X text 51 42 The Pipe object stores a sequence of messages and outputs them after a specified delay time in miliseconds. You can change the delay time as you wish. The outputs are sorted automatically.;
-#X text 140 254 creation argument initializes delay time;
-#X text 163 228 set delay time;
-#X text 487 449 updated for Pd version 0.33;
-#X text 21 330 You can specify compound messages (lists) by adding arguments which set their type and initial value as in "pack." In this case the delay time comes last and is changed by the last inlet. You can also pack symbols and pointers but this feature is UNTESTED.;
-#X connect 0 0 13 0;
-#X connect 1 0 13 1;
-#X connect 3 0 6 0;
-#X connect 5 0 4 0;
-#X connect 5 1 9 0;
-#X connect 5 2 10 0;
-#X connect 6 0 5 0;
-#X connect 6 1 7 0;
-#X connect 6 2 8 0;
-#X connect 7 0 5 1;
-#X connect 8 0 5 2;
-#X connect 13 0 2 0;
-#X connect 16 0 13 0;
diff --git a/pd/doc/5.reference/plot.pd b/pd/doc/5.reference/plot.pd
deleted file mode 100644
index 2070ed69..00000000
--- a/pd/doc/5.reference/plot.pd
+++ /dev/null
@@ -1,58 +0,0 @@
-#N struct help-plot-template float x float y array array1 help-plot-array1-template
-array array2 help-plot-array2-template array array3 help-plot-array3-template
-;
-#N struct help-plot-array1-template float y;
-#N struct help-plot-array2-template float x float y;
-#N struct help-plot-array3-template float y float w;
-#N canvas 398 0 516 229 12;
-#N canvas 173 285 626 539 help-plot-template 1;
-#X text 29 34 creation arguments:;
-#X text 48 71 - RGB color (0=black \, 999=white \, 900=red \, 90=green
-\, 9=blue \, 555=grey \, etc.);
-#X text 47 52 - OPTIONAL word "curve" to specify bezier;
-#X text 46 98 - line width;
-#X text 46 114 - relative x and y location;
-#X text 47 130 - x spacing;
-#X obj 39 217 plot curve array2 70 3 100 0;
-#X obj 30 308 plot curve array3 9 1 120 50 20;
-#X obj 45 12 plot array1 500 1 10 15 20;
-#X text 29 147 This first example plots the red trace (500) \, width
-1 \, at point (10 \, 15) \, with horizontal spacing 20 The black diamonds
-come from the template of the array1 element itself.;
-#X text 62 239 This is the green spiral (color 70 \, line width 3 \,
-location (100 \, 0). Since the template for array2 contains an "x"
-cariable \, play ignores x spacing requests and takes x from the data
-itself.;
-#X text 50 328 If a "w" variable is present in the template as for
-array3 \, it is added to the line width.;
-#X obj 27 501 filledpolygon 509 509 0 -10 -10 10 -10 10 10 -10 10;
-#X text 27 454 To see the data itself \, select "properties" for the
-scalar by right clicking on the purple square.;
-#X obj 24 387 struct help-plot-template float x float y array array1
-help-plot-array1-template array array2 help-plot-array2-template array
-array3 help-plot-array3-template;
-#X text 33 366 here's the "struct" for all this:;
-#X restore 243 78 pd help-plot-template;
-#N canvas 196 292 273 120 help-plot-array1-template 0;
-#X obj 30 71 filledpolygon 0 0 0 -5 0 0 5 5 0 0 -5;
-#X obj 32 27 template float y;
-#X restore 242 101 pd help-plot-array1-template;
-#N canvas 161 163 273 120 help-plot-array2-template 0;
-#X obj 32 26 template float x float y;
-#X restore 243 123 pd help-plot-array2-template;
-#N canvas 0 0 411 207 help-plot-data 1;
-#X scalar help-plot-template 39 73 \; 0 \; 20 \; 0 \; 30 \; 0 \; \;
-0 0 \; 0 10 \; 20 0 \; 0 -30 \; -40 0 \; 0 50 \; 60 0 \; \; 0 0 \;
-10 10 \; 0 10 \; 0 1 \; 20 1 \; 20 10 \; 20 1 \; \;;
-#X restore 242 57 pd help-plot-data;
-#X text 23 139 see also:;
-#X obj 30 184 drawnumber;
-#X obj 29 163 template;
-#X obj 35 22 plot;
-#X text 87 21 -- draw array elements of scalars;
-#X obj 29 206 drawpolygon;
-#N canvas 161 163 273 120 help-plot-array3-template 0;
-#X obj 43 32 template float y float w;
-#X restore 242 144 pd help-plot-array3-template;
-#X text 8 79 explanation is in here-->;
-#X text 264 203 updated for Pd version 0.35;
diff --git a/pd/doc/5.reference/pointer.pd b/pd/doc/5.reference/pointer.pd
deleted file mode 100644
index 96a22ff1..00000000
--- a/pd/doc/5.reference/pointer.pd
+++ /dev/null
@@ -1,79 +0,0 @@
-#N struct template2 float x float y;
-#N struct template1 float x float y float z;
-#N canvas 223 0 715 654 12;
-#X text 20 572 see also:;
-#X obj 21 10 pointer;
-#X text 95 10 -- remember the location of a scalar in a list;
-#N canvas 164 72 425 146 help-pointer-template1 0;
-#X obj 18 81 filledpolygon z 0 1 0 0 20 0 20 30 0 30;
-#X obj 60 21 struct template1 float x float y float z;
-#X restore 327 386 pd help-pointer-template1;
-#N canvas 26 456 510 145 help-pointer-template2 0;
-#X obj 52 78 filledcurve 909 0 0 0 0 30 30 60 0 30 -30 0 0;
-#X obj 60 21 struct template2 float x float y;
-#X restore 327 409 pd help-pointer-template2;
-#X obj 23 592 get;
-#X obj 56 592 set;
-#X obj 91 592 append;
-#X obj 152 592 getsize;
-#X obj 220 593 setsize;
-#X obj 290 593 element;
-#X obj 23 617 sublist;
-#N canvas 0 0 312 185 help-pointer-data 1;
-#X scalar template2 20 97 \;;
-#X scalar template1 80 17 90 \;;
-#X scalar template1 120 117 9 \;;
-#X restore 327 364 pd help-pointer-data;
-#X obj 54 360 pointer;
-#X msg 54 231 traverse pd-help-pointer-data;
-#X msg 67 255 bang;
-#X text 109 256 outputs current value;
-#X msg 69 281 next;
-#X obj 54 385 print out1;
-#X obj 167 371 print out2;
-#X text 119 274 moves forward one item and outputs pointer \; if we
-reach the end \, a "bang" goes to out2.;
-#X text 16 426 Optional arguments to pointer allow you to select according
-to the class of the scalar being output:;
-#X msg 74 487 next;
-#X msg 60 464 traverse pd-help-pointer-data;
-#X obj 60 515 pointer help-pointer-template1 help-pointer-template2
-;
-#X obj 60 541 print template1;
-#X obj 198 541 print template2;
-#X obj 338 541 print other;
-#X obj 441 541 print bangout;
-#X text 333 232 sets to the "head" of the list;
-#X text 29 34 "Pointer" is a storage object like "float" \, except
-that the thing stored is the location of a scalar somewhere. You can
-send a pointer a value (perhaps from another "pointer" object). The
-right inlet takes pointers and simply stores them. A bang in the left
-outputs the pointer \, and a pointer in the left both sets and outputs
-the value.;
-#X text 29 132 The value of a pointer can either indicate a real scalar
-\, or else the "head" (before the first element) of the list. This
-allows you to point to an empty list \, and also \, to "append" a scalar
-to the beginning of the list.;
-#X text 29 191 Pointers are "safe": if you delete a scalar pointers
-to it are marked invalid.;
-#X text 166 391 bang at end;
-#X text 167 407 of list;
-#X text 53 405 output;
-#X text 445 617 updated for Pd version 0.35;
-#X obj 92 616 struct;
-#X msg 71 307 vnext 1;
-#X text 149 308 "vnext" gets the next object (if arg is 0) or the next
-selected object (if arg is 1 -- but the window must be visible for
-the "selection" to make sense).;
-#X connect 13 0 18 0;
-#X connect 13 1 19 0;
-#X connect 14 0 13 0;
-#X connect 15 0 13 0;
-#X connect 17 0 13 0;
-#X connect 22 0 24 0;
-#X connect 23 0 24 0;
-#X connect 24 0 25 0;
-#X connect 24 1 26 0;
-#X connect 24 2 27 0;
-#X connect 24 3 28 0;
-#X connect 38 0 13 0;
diff --git a/pd/doc/5.reference/poly.pd b/pd/doc/5.reference/poly.pd
deleted file mode 100644
index 0b34f99e..00000000
--- a/pd/doc/5.reference/poly.pd
+++ /dev/null
@@ -1,30 +0,0 @@
-#N canvas 0 0 600 496 12;
-#X text 155 228 <-- scroll to change the value of delay in milliseconds.;
-#X text 406 383 updated for Pd version 0.25;
-#X text 42 383 see also:;
-#X obj 66 15 poly;
-#X text 101 14 - MIDI-STYLE POLYPHONIC VOICE ALLOCATOR;
-#X text 12 42 The poly object takes a stream of pitch/velocity pairs and outputs triples containing voice number \, pitch and velocity. You can pack the output and use the route object to route messages among a bank of voices depending on the first outlet. Poly can be configured to do voice stealing or not (the default.);
-#X obj 110 384 route;
-#X obj 154 384 makenote;
-#X obj 52 254 poly 4 1;
-#X text 134 253 <-- first argument \, number of voices \; second argument selects voice stealing;
-#X msg 52 168 60 64;
-#X msg 103 168 60 0;
-#X msg 147 168 62 64;
-#X msg 194 168 62 0;
-#X obj 52 280 pack 0 0 0;
-#X obj 52 306 print;
-#X text 97 305 Output is in the printout window.;
-#X msg 254 177 stop;
-#X msg 296 177 clear;
-#X connect 8 0 14 0;
-#X connect 8 1 14 1;
-#X connect 8 2 14 2;
-#X connect 10 0 8 0;
-#X connect 11 0 8 0;
-#X connect 12 0 8 0;
-#X connect 13 0 8 0;
-#X connect 14 0 15 0;
-#X connect 17 0 8 0;
-#X connect 18 0 8 0;
diff --git a/pd/doc/5.reference/print.pd b/pd/doc/5.reference/print.pd
deleted file mode 100644
index 50af069a..00000000
--- a/pd/doc/5.reference/print.pd
+++ /dev/null
@@ -1,13 +0,0 @@
-#N canvas 349 65 615 247 12;
-#X msg 102 52 walk the dog;
-#X msg 29 51 bang;
-#X msg 70 51 234;
-#X obj 29 96 print x1;
-#X obj 21 10 print;
-#X text 37 134 Print prints out the messages it receives on the "terminal
-window" that Pd is run from.;
-#X text 249 200 updated for Pd version 0.31.;
-#X text 73 10 -- print messages to terminal window;
-#X connect 0 0 3 0;
-#X connect 1 0 3 0;
-#X connect 2 0 3 0;
diff --git a/pd/doc/5.reference/print~.pd b/pd/doc/5.reference/print~.pd
deleted file mode 100644
index b3a9c429..00000000
--- a/pd/doc/5.reference/print~.pd
+++ /dev/null
@@ -1,18 +0,0 @@
-#N canvas 118 333 531 212 10;
-#X msg 74 143 2;
-#X msg 455 77 \; pd dsp 0;
-#X msg 454 40 \; pd dsp 1;
-#X obj 62 177 print~;
-#X msg 74 118 bang;
-#X obj 62 92 phasor~ 1000;
-#X text 122 119 bang prints one vector;
-#X obj 454 18 loadbang;
-#X text 109 142 print two or more successive vectors;
-#X obj 32 12 print~;
-#X text 85 12 - print out raw values of a signal;
-#X text 301 171 Updated for Pd version 0.33;
-#X text 19 44 The print~ object takes a signal input and prints one or more vectors out when you send it a bang or a number. By default a vector is 64 samples.;
-#X connect 0 0 3 0;
-#X connect 4 0 3 0;
-#X connect 5 0 3 0;
-#X connect 7 0 2 0;
diff --git a/pd/doc/5.reference/qlist.pd b/pd/doc/5.reference/qlist.pd
deleted file mode 100644
index a5b2a574..00000000
--- a/pd/doc/5.reference/qlist.pd
+++ /dev/null
@@ -1,76 +0,0 @@
-#N canvas 7 31 1178 587 12;
-#X obj 546 328 qlist;
-#X msg 592 110 rewind;
-#X msg 591 135 next;
-#X floatatom 546 382 0 0 0;
-#X msg 593 54 bang;
-#X obj 441 515 r this;
-#X obj 544 515 r that;
-#X obj 441 544 print this;
-#X obj 544 544 print that;
-#X obj 560 356 print done;
-#X msg 593 80 tempo 1;
-#X text 18 51 The qlist object reads text files containing time-tagged
-Pd messages. You can have them sequenced automatically (by sending
-a "bang" message \, possibly changing speed via "tempo" messages) or
-manually via the "rewind" and "next" messages.;
-#X text 15 136 To run the qlist automatically \, send it a "read" message
-(the filename is relative to the directory the patch is in) and later
-a "bang." Messages in the file are separated by semicolons. Optional
-leading numbers are delay times in milliseconds. If the tempo is diffrerent
-from 1 the messages are sent faster or slower accordingly. Messages
-should start with a symbol giving the destination object. In the file
-"qlist.q" used here \, the messages go to objects "this" and "that"
-which are receives below.;
-#X text 17 281 To run it manually \, send "rewind" followed by "next".
-All messages not preceeded by numbers are sent. As soon as a message
-starting with one or more numbers is encountered \, the numbers are
-output as a list. There are many ways you could design a sequencer
-around this.;
-#X text 668 48 sequence automatically;
-#X text 670 79 set relative tempo;
-#X text 668 105 go to beginning (and stop);
-#X text 668 132 single-step forward;
-#X text 713 273 read a file;
-#X text 777 300 write one;
-#X text 552 404 This outlet gets a list of leading numbers for the
-next message \, for you to use in designing your own sequencer.;
-#X msg 586 274 read qlist.txt;
-#X msg 586 300 write /tmp/qlist.txt;
-#X text 21 493 see also:;
-#X obj 97 493 textfile;
-#X text 22 362 You can also record textual messages and save them to
-a file. Send "clear" to empty the qlist and "add" to add messages (terminated
-with semicolons.) The message \, "add2" adds a list of atoms without
-finishing with a semicolon in case you want to make variable-length
-messages.;
-#X msg 589 190 clear;
-#X msg 589 216 add 500 this is another message;
-#X msg 590 242 add2 that;
-#X text 666 187 empty the qlist;
-#X text 882 217 add a message to a qlist;
-#X text 683 240 add a message to a qlist but don't terminate it;
-#X text 653 341 This outlet gets a bang when you hit the end of the
-sequence. In the file "qlist.txt" the end is delayed 1000 milliseconds
-after the last message.;
-#X text 379 470 These receives are invoked in the file "qlist.txt"
-in this directory.;
-#X obj 71 13 qlist;
-#X text 132 15 - text-based sequencer;
-#X text 668 158 single-step forward SUPRESSING MESSAGE-SENDING;
-#X msg 591 161 next 1;
-#X text 921 558 updated for Pd version 0.35;
-#X connect 0 0 3 0;
-#X connect 0 1 9 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 0;
-#X connect 4 0 0 0;
-#X connect 5 0 7 0;
-#X connect 6 0 8 0;
-#X connect 10 0 0 0;
-#X connect 21 0 0 0;
-#X connect 22 0 0 0;
-#X connect 26 0 0 0;
-#X connect 27 0 0 0;
-#X connect 28 0 0 0;
-#X connect 37 0 0 0;
diff --git a/pd/doc/5.reference/random.pd b/pd/doc/5.reference/random.pd
deleted file mode 100644
index b792325c..00000000
--- a/pd/doc/5.reference/random.pd
+++ /dev/null
@@ -1,19 +0,0 @@
-#N canvas 0 0 630 421 12;
-#X msg 40 212 bang;
-#X obj 40 287 random 5;
-#X floatatom 83 261 0 0 0;
-#X floatatom 40 312 0 0 0;
-#X msg 50 236 seed 123;
-#X text 92 210 bang for output;
-#X text 132 236 message to set the seed;
-#X text 116 259 inlet to reset the range;
-#X text 119 286 argument to initialize the range;
-#X text 378 337 updated for Pd version 0.33;
-#X text 11 46 Random outputs pseudorandom integers from 0 to N-1 where N is the creation argument (5 in the example below.) You can specify a seed if you wish. Seeds are kept locally so that if two Randoms are seeded the same they will have the same output (or indeed you can seed the same one twice to repeat the output.);
-#X text 12 139 On the other hand \, if you don't supply a seed each instance of random gets its own seed. WARNING: nothing is known about the quality of teh pseudorandom number generator. It isn't any standard one!;
-#X obj 20 11 random;
-#X text 84 11 - pseudorandom integers;
-#X connect 0 0 1 0;
-#X connect 1 0 3 0;
-#X connect 2 0 1 1;
-#X connect 4 0 1 0;
diff --git a/pd/doc/5.reference/readsf~.pd b/pd/doc/5.reference/readsf~.pd
deleted file mode 100644
index 115f9db6..00000000
--- a/pd/doc/5.reference/readsf~.pd
+++ /dev/null
@@ -1,48 +0,0 @@
-#N canvas 38 26 630 390 10;
-#X msg 458 10 \; pd dsp 1;
-#X msg 47 186 1;
-#X msg 47 205 0;
-#X obj 403 305 print didit;
-#X obj 126 305 env~ 16384;
-#X floatatom 126 324;
-#X msg 48 227 print;
-#X obj 44 330 dac~;
-#X obj 191 305 env~ 16384;
-#X floatatom 191 324;
-#X obj 38 252 readsf~ 4 1e+06;
-#X obj 256 305 env~ 16384;
-#X floatatom 256 324;
-#X obj 323 306 env~ 16384;
-#X floatatom 323 325;
-#X msg 45 167 open ../sound/bell.aiff 0 200 4 2 b;
-#X obj 82 306 *~ 0.1;
-#X obj 40 306 *~ 0.1;
-#X text 40 7 READSF~ - read a soundfile;
-#X msg 45 146 open ../sound/bell.aiff;
-#X text 146 240 optional arguments: number of channels \; buffer size per channnel in bytes.;
-#X text 404 286 when the soundfile is done.;
-#X text 403 272 last outlet gives a "bang";
-#X text 471 369 Updated for version 0.29;
-#X text 271 146 Open takes a filename \, an onset in sample frames \, and \, as an override \, you may also supply a header size to skip \, a number of channels \, bytes per channel \, and endianness.;
-#X text 36 93 The wave \, aiff \, and nextstep formats are parsed automatically \, although only 2- 3- and 4- byte samples are accepted (4 bytes implies floating point and is only available in the nextstep format.);
-#X text 37 27 The readsf~ object reads a soundfile into its signal outputs. You must open the soundfile in advance (a couple of seconds before you'll need it) using the "open" message. The object immediately starts reading from the file \, but output will only appear after you send a "1" to start playback. A "0" stops it.;
-#X connect 1 0 10 0;
-#X connect 2 0 10 0;
-#X connect 4 0 5 0;
-#X connect 6 0 10 0;
-#X connect 8 0 9 0;
-#X connect 10 0 4 0;
-#X connect 10 0 17 0;
-#X connect 10 1 8 0;
-#X connect 10 1 16 0;
-#X connect 10 2 11 0;
-#X connect 10 2 16 0;
-#X connect 10 3 13 0;
-#X connect 10 3 17 0;
-#X connect 10 4 3 0;
-#X connect 11 0 12 0;
-#X connect 13 0 14 0;
-#X connect 15 0 10 0;
-#X connect 16 0 7 1;
-#X connect 17 0 7 0;
-#X connect 19 0 10 0;
diff --git a/pd/doc/5.reference/realtime.pd b/pd/doc/5.reference/realtime.pd
deleted file mode 100644
index 60fcffaa..00000000
--- a/pd/doc/5.reference/realtime.pd
+++ /dev/null
@@ -1,15 +0,0 @@
-#N canvas 156 202 565 269 12;
-#X msg 73 146 bang;
-#X msg 30 115 bang;
-#X floatatom 30 206 0 0 0;
-#X text 71 113 Click here to reset;
-#X text 27 232 Output is in milliseconds;
-#X text 114 147 Click here to get elapsed CPU time;
-#X obj 66 15 realtime;
-#X text 12 47 The realtime object measures elapsed real time \, as measured by your operating system.;
-#X obj 30 176 realtime;
-#X text 134 15 - ask OS for elapsed real time;
-#X text 302 244 updated for Pd version 0.33;
-#X connect 0 0 8 1;
-#X connect 1 0 8 0;
-#X connect 8 0 2 0;
diff --git a/pd/doc/5.reference/receive.pd b/pd/doc/5.reference/receive.pd
deleted file mode 100644
index 17bb08cb..00000000
--- a/pd/doc/5.reference/receive.pd
+++ /dev/null
@@ -1,26 +0,0 @@
-#N canvas 257 45 511 351 12;
-#X text 278 321 updated for Pd version 0.32;
-#X floatatom 36 55 5 0 0;
-#X floatatom 152 58 5 0 0;
-#X floatatom 272 57 5 0 0;
-#X floatatom 38 134 5 0 0;
-#X floatatom 171 136 5 0 0;
-#X floatatom 305 134 5 0 0;
-#X text 62 321 abbreviation:;
-#X obj 36 80 send help-rcv1;
-#X obj 152 81 send help-rcv1;
-#X obj 271 81 send help-rcv2;
-#X obj 38 110 receive help-rcv1;
-#X obj 171 110 receive help-rcv2;
-#X obj 305 110 receive help-rcv2;
-#X text 31 161 "Receive" outputs messages sent via "send." Sends and receives are named to tell them whom to connect to. They work across windows too. Also \, you can use message boxes as shown:;
-#X msg 84 233 \; help-rcv1 34 \; help-rcv2 67;
-#X obj 161 320 r;
-#X obj 21 10 receive;
-#X text 79 10 -- receive messages without patch cords;
-#X connect 1 0 8 0;
-#X connect 2 0 9 0;
-#X connect 3 0 10 0;
-#X connect 11 0 4 0;
-#X connect 12 0 5 0;
-#X connect 13 0 6 0;
diff --git a/pd/doc/5.reference/route.pd b/pd/doc/5.reference/route.pd
deleted file mode 100644
index 224fb0ea..00000000
--- a/pd/doc/5.reference/route.pd
+++ /dev/null
@@ -1,80 +0,0 @@
-#N canvas 0 0 815 537 12;
-#X obj 183 213 print x1;
-#X obj 261 213 print x2;
-#X obj 339 213 print x3;
-#X obj 422 213 print x4;
-#X obj 183 185 route 23 54 1;
-#X msg 183 155 234 345 456;
-#X msg 308 155 23 34 45;
-#X msg 414 155 54 43;
-#X msg 485 155 1 foo bar;
-#X msg 254 247 impeach ringo starr;
-#X obj 191 275 route big apple;
-#X msg 435 248 apple pie;
-#X msg 191 247 1 2 3;
-#X msg 523 248 big apple pie;
-#X msg 578 155 walk the dog;
-#X text 45 33 Route checks the first element of a message against each
-of its arguments \, which may be numbers or symbols (but not a mixture
-of the two.);
-#X text 44 85 If a match is found \, the rest of the message appears
-on the corresponding outlet. If no match \, the message is repeated
-to the last "rejection" outlet. The number of outlets is the number
-of arguments plus one.;
-#X text 19 185 numeric arguments:;
-#X text 17 275 symbolic arguments:;
-#X obj 157 489 print z1;
-#X obj 233 489 print z2;
-#X msg 124 424 bang;
-#X msg 170 424 list;
-#X msg 213 424 5;
-#X msg 251 424 float 5;
-#X msg 320 424 list 5;
-#X msg 385 424 symbol pie;
-#X msg 560 424 pie;
-#X msg 483 424 list pie;
-#X msg 70 424 1 2 3;
-#X obj 157 461 route list float symbol bang;
-#X obj 310 489 print z3;
-#X obj 387 489 print z4;
-#X obj 461 489 print z5;
-#X obj 191 305 print y1;
-#X obj 269 305 print y2;
-#X obj 347 305 print y3;
-#X text 76 344 To avoid confusion between \, say \, the number 5 and
-the list contining only the number 5 \, both messages match "float"
-\, and ditto for symbols. An empty list matches "bang". In Pd these
-are all considered special cases of lists.;
-#X text 545 506 updated for Pd version 0.35;
-#X text 97 9 - route messages according to their first element;
-#X obj 43 8 route;
-#X connect 4 0 0 0;
-#X connect 4 1 1 0;
-#X connect 4 2 2 0;
-#X connect 4 3 3 0;
-#X connect 5 0 4 0;
-#X connect 6 0 4 0;
-#X connect 7 0 4 0;
-#X connect 8 0 4 0;
-#X connect 9 0 10 0;
-#X connect 10 0 34 0;
-#X connect 10 1 35 0;
-#X connect 10 2 36 0;
-#X connect 11 0 10 0;
-#X connect 12 0 10 0;
-#X connect 13 0 10 0;
-#X connect 14 0 4 0;
-#X connect 21 0 30 0;
-#X connect 22 0 30 0;
-#X connect 23 0 30 0;
-#X connect 24 0 30 0;
-#X connect 25 0 30 0;
-#X connect 26 0 30 0;
-#X connect 27 0 30 0;
-#X connect 28 0 30 0;
-#X connect 29 0 30 0;
-#X connect 30 0 19 0;
-#X connect 30 1 20 0;
-#X connect 30 2 31 0;
-#X connect 30 3 32 0;
-#X connect 30 4 33 0;
diff --git a/pd/doc/5.reference/rsqrt~.pd b/pd/doc/5.reference/rsqrt~.pd
deleted file mode 100644
index fb0bc350..00000000
--- a/pd/doc/5.reference/rsqrt~.pd
+++ /dev/null
@@ -1,32 +0,0 @@
-#N canvas 183 264 685 375 12;
-#X obj 68 211 metro 500;
-#X obj 68 186 r metro;
-#X msg 575 106 \; metro 0;
-#X msg 574 48 \; pd dsp 1 \; metro 1;
-#X floatatom 52 112 0 0 0;
-#X floatatom 52 268 0 0 0;
-#X text 419 349 updated for Pd version 0.33;
-#X obj 574 21 loadbang;
-#X obj 52 235 snapshot~;
-#X floatatom 51 351 9 0 0;
-#X obj 51 295 t f f;
-#X obj 51 322 *;
-#X obj 52 138 sig~;
-#X obj 36 16 rsqrt~;
-#X text 105 14 - signal reciprocal square root;
-#X text 18 45 rsqrt~ takes the approximate reciprocal square root of
-the incoming signal \, using a fast \, approximate algorithm which
-is probably accurate to about 120 dB (20 bits).;
-#X obj 52 162 rsqrt~;
-#X connect 0 0 8 0;
-#X connect 1 0 0 0;
-#X connect 1 0 0 0;
-#X connect 4 0 12 0;
-#X connect 5 0 10 0;
-#X connect 7 0 3 0;
-#X connect 8 0 5 0;
-#X connect 10 0 11 0;
-#X connect 10 1 11 1;
-#X connect 11 0 9 0;
-#X connect 12 0 16 0;
-#X connect 16 0 8 0;
diff --git a/pd/doc/5.reference/samphold~.pd b/pd/doc/5.reference/samphold~.pd
deleted file mode 100644
index 1a58bd02..00000000
--- a/pd/doc/5.reference/samphold~.pd
+++ /dev/null
@@ -1,34 +0,0 @@
-#N canvas 121 54 554 287 10;
-#X obj 32 238 snapshot~;
-#X floatatom 32 257;
-#X obj 41 219 metro 100;
-#X obj 41 197 r start;
-#X msg 387 21 \; pd dsp 1 \; start bang;
-#X text 392 270 updated for version 0.29;
-#X text 454 30 Click to start;
-#X text 447 78 Click to stop;
-#X msg 388 65 \; pd dsp 0 \; start 0;
-#X obj 19 7 samphold~;
-#X text 96 6 - sample and hold unit;
-#X obj 32 170 samphold~;
-#X text 10 26 The samphold~ object samples its left input whenever its right input decreases in value (as a phasor~ does each period \, for example.) Both inputs are audio signals.;
-#X obj 67 129 sig~;
-#X obj 101 148 sig~;
-#X floatatom 67 109;
-#X floatatom 101 127;
-#X msg 32 66 set 34;
-#X msg 38 87 reset;
-#X text 81 65 set output to a number;
-#X text 81 86 force the next sample;
-#X text 97 109 sample signal;
-#X text 135 127 control signal;
-#X connect 0 0 1 0;
-#X connect 2 0 0 0;
-#X connect 3 0 2 0;
-#X connect 11 0 0 0;
-#X connect 13 0 11 0;
-#X connect 14 0 11 1;
-#X connect 15 0 13 0;
-#X connect 16 0 14 0;
-#X connect 17 0 11 0;
-#X connect 18 0 11 0;
diff --git a/pd/doc/5.reference/savepanel.pd b/pd/doc/5.reference/savepanel.pd
deleted file mode 100644
index b5d7e7a6..00000000
--- a/pd/doc/5.reference/savepanel.pd
+++ /dev/null
@@ -1,12 +0,0 @@
-#N canvas 9 118 567 234 12;
-#X msg 102 92 bang;
-#X obj 102 145 print;
-#X text 295 199 updated for Pd version 0.24;
-#X text 28 192 see also:;
-#X text 16 35 When Savepanel gets a "bang" a "Save As" file browser appears on the screen \, If you choose a filename \, it appears on the outlet.;
-#X obj 102 120 savepanel;
-#X obj 115 191 openpanel;
-#X obj 19 7 savepanel;
-#X text 104 6 - query you for the name of a file to create;
-#X connect 0 0 5 0;
-#X connect 5 0 1 0;
diff --git a/pd/doc/5.reference/select.pd b/pd/doc/5.reference/select.pd
deleted file mode 100644
index 6bc17ad7..00000000
--- a/pd/doc/5.reference/select.pd
+++ /dev/null
@@ -1,73 +0,0 @@
-#N canvas 47 29 618 662 12;
-#X floatatom 22 332 0 0 0;
-#X msg 156 120 6;
-#X msg 119 120 234;
-#X floatatom 119 150 0 0 0;
-#X msg 121 301 1;
-#X msg 89 301 54;
-#X obj 22 392 print x1;
-#X obj 100 391 print x2;
-#X msg 58 301 23;
-#X msg 22 302 234;
-#X msg 65 120 6;
-#X obj 28 180 select 6;
-#X msg 28 120 234;
-#X obj 28 210 print x1;
-#X obj 107 211 print x2;
-#X obj 177 391 print x3;
-#X obj 255 392 print x4;
-#X floatatom 28 150 0 0 0;
-#X obj 22 362 select 23 54 1;
-#X text 45 609 abbreviation:;
-#X obj 169 610 sel;
-#X text 20 37 In its simplest form shown below \, Select checks its input agains the constant "6". If they match \, the first outlet gives "bang" and otherwise the input is copied to the second outlet. If Select is used with a single argument \, a second inlet allows you to change the test value.;
-#X text 22 239 You can give several arguments. You get an outlet for each test value and finally an outlet for values which match none of them. In this case you don't get inlets to change the test values:;
-#X obj 32 566 print x1;
-#X obj 114 567 print x2;
-#X msg 34 451 symbol cort;
-#X msg 46 476 symbol zack;
-#X msg 178 476 symbol cort;
-#X msg 184 501 symbol zack;
-#X obj 34 539 select cort;
-#X msg 308 462 symbol cort;
-#X msg 415 462 symbol zack;
-#X obj 308 551 print x1;
-#X obj 385 551 print x2;
-#X obj 308 521 select cort zack;
-#X obj 462 551 print x3;
-#X msg 413 487 symbol bill;
-#X text 24 426 Select can also be used to sort symbols:;
-#X text 83 637 see also:;
-#X obj 175 639 route;
-#X obj 32 10 select;
-#X text 92 10 - compare numbers or symbols;
-#X text 370 629 updated for Pd version 0.33;
-#X connect 0 0 18 0;
-#X connect 1 0 3 0;
-#X connect 2 0 3 0;
-#X connect 3 0 11 1;
-#X connect 4 0 0 0;
-#X connect 5 0 0 0;
-#X connect 8 0 0 0;
-#X connect 9 0 0 0;
-#X connect 10 0 17 0;
-#X connect 11 0 13 0;
-#X connect 11 1 14 0;
-#X connect 12 0 17 0;
-#X connect 17 0 11 0;
-#X connect 18 0 6 0;
-#X connect 18 1 7 0;
-#X connect 18 2 15 0;
-#X connect 18 3 16 0;
-#X connect 25 0 29 0;
-#X connect 26 0 29 0;
-#X connect 27 0 29 1;
-#X connect 28 0 29 1;
-#X connect 29 0 23 0;
-#X connect 29 1 24 0;
-#X connect 30 0 34 0;
-#X connect 31 0 34 0;
-#X connect 34 0 32 0;
-#X connect 34 1 33 0;
-#X connect 34 2 35 0;
-#X connect 36 0 34 0;
diff --git a/pd/doc/5.reference/send.pd b/pd/doc/5.reference/send.pd
deleted file mode 100644
index f8d44a85..00000000
--- a/pd/doc/5.reference/send.pd
+++ /dev/null
@@ -1,26 +0,0 @@
-#N canvas 257 45 511 351 12;
-#X text 278 321 updated for Pd version 0.32;
-#X obj 21 10 send;
-#X text 60 11 -- send messages without patch cords;
-#X obj 36 80 send help-send1;
-#X obj 152 81 send help-send1;
-#X obj 271 81 send help-send2;
-#X obj 38 110 receive help-send1;
-#X obj 171 110 receive help-send2;
-#X obj 305 110 receive help-send2;
-#X floatatom 36 55 5 0 0;
-#X floatatom 152 58 5 0 0;
-#X floatatom 272 57 5 0 0;
-#X floatatom 38 134 5 0 0;
-#X floatatom 171 136 5 0 0;
-#X floatatom 305 134 5 0 0;
-#X obj 161 320 s;
-#X text 62 321 abbreviation:;
-#X text 31 161 "Send" sends messages to "receive" objects. Sends and receives are named to tell them whom to connect to. They work across windows too. Also \, you can use message boxes as shown:;
-#X msg 84 233 \; help-send1 34 \; help-send2 67;
-#X connect 6 0 12 0;
-#X connect 7 0 13 0;
-#X connect 8 0 14 0;
-#X connect 9 0 3 0;
-#X connect 10 0 4 0;
-#X connect 11 0 5 0;
diff --git a/pd/doc/5.reference/send~.pd b/pd/doc/5.reference/send~.pd
deleted file mode 100644
index 5c9db395..00000000
--- a/pd/doc/5.reference/send~.pd
+++ /dev/null
@@ -1,32 +0,0 @@
-#N canvas 31 28 678 406 12;
-#X floatatom 344 238 0 0 0;
-#X obj 344 189 receive~ signal1;
-#X obj 17 215 send~ signal1;
-#X obj 17 192 sig~ 50;
-#X obj 344 213 snapshot~;
-#X obj 42 22 send~;
-#X obj 94 23 receive~;
-#X text 178 23 - one-to-many nonlocal signal connections;
-#X obj 507 133 loadbang;
-#X obj 507 194 metro 200;
-#X msg 517 155 \; pd dsp 1;
-#X floatatom 18 168 4 0 0;
-#X text 48 51 A send~ object copies its input to a local buffer which all receive~ objects of the same name read from. They may be in different windows or even different patches. Any number of receives may be associated with one send~ but it is an error to have two send~s of the same name.;
-#X obj 179 344 tabreceive~;
-#X text 405 368 updated for Pd version 0.33.;
-#X obj 148 187 sig~ 25;
-#X obj 148 215 send~ signal2;
-#X msg 355 139 set signal2;
-#X msg 356 161 set signal1;
-#X text 34 287 Send~/Receive~ only work for the default block size (64) \; for FFT applications see also:;
-#X text 35 262 Receive~ takes "set" messages to switch between send~s.;
-#X connect 1 0 4 0;
-#X connect 3 0 2 0;
-#X connect 4 0 0 0;
-#X connect 8 0 9 0;
-#X connect 8 0 10 0;
-#X connect 9 0 4 0;
-#X connect 11 0 3 0;
-#X connect 15 0 16 0;
-#X connect 17 0 1 0;
-#X connect 18 0 1 0;
diff --git a/pd/doc/5.reference/set.pd b/pd/doc/5.reference/set.pd
deleted file mode 100644
index 227b29b4..00000000
--- a/pd/doc/5.reference/set.pd
+++ /dev/null
@@ -1,45 +0,0 @@
-#N struct help-set-template1 float x float y;
-#N canvas 300 3 583 365 12;
-#X text 19 263 see also:;
-#X obj 137 308 template;
-#X obj 112 284 append;
-#X obj 170 284 getsize;
-#X obj 237 284 setsize;
-#X obj 215 308 element;
-#X obj 11 308 sublist;
-#X obj 78 308 scalar;
-#X msg 210 155 next;
-#X obj 21 10 get;
-#X floatatom 19 173 5 0 0;
-#X floatatom 108 181 5 0 0;
-#X obj 196 180 pointer;
-#X text 273 113 output first scalar in list;
-#X text 256 155 output next item;
-#X text 262 204 First argument selects template.;
-#X text 263 219 Remaining args are names of fields.;
-#X obj 11 283 pointer;
-#X msg 196 131 traverse pd-help-set-data \, next;
-#N canvas 0 0 276 122 help-set-data 1;
-#X scalar help-set-template1 39 23 \;;
-#X scalar help-set-template1 99 73 \;;
-#X restore 377 244 pd help-set-data;
-#N canvas 164 72 425 146 help-set-template1 0;
-#X obj 41 87 filledpolygon 9 0 1 0 0 20 0 20 30 0 30;
-#X obj 60 21 template float x float y;
-#X restore 377 266 pd help-set-template1;
-#X text 86 10 -- set values in a scalar;
-#X obj 19 204 set help-set-template1 x y;
-#X text 18 155 x value;
-#X text 106 162 y value;
-#X obj 79 283 get;
-#X text 19 32 "Set" takes a pointer to a scalar in its rightmost inlet
-\; the remaining inlets set numeric values of fields. Only the leftmost
-inlet is "hot". You can't "set" arrays or sublists. Instead \, you
-can get pointers into them using "element" and "sublist" (probably
-not working yet) and set individual items.;
-#X text 336 342 updated for Pd version 0.35;
-#X connect 8 0 12 0;
-#X connect 10 0 22 0;
-#X connect 11 0 22 1;
-#X connect 12 0 22 2;
-#X connect 18 0 12 0;
diff --git a/pd/doc/5.reference/setsize.pd b/pd/doc/5.reference/setsize.pd
deleted file mode 100644
index ce68f5fc..00000000
--- a/pd/doc/5.reference/setsize.pd
+++ /dev/null
@@ -1,54 +0,0 @@
-#N struct help-setsize-template float x float y array array1 help-setsize-array1-template
-;
-#N struct help-setsize-array1-template float y;
-#N canvas 331 45 678 459 12;
-#X text 31 359 see also:;
-#X obj 28 379 template;
-#N canvas 393 10 491 261 help-setsize-template 0;
-#X obj 27 174 filledpolygon 509 509 0 -10 -10 10 -10 10 10 -10 10;
-#X obj 24 16 template float x float y array array1 help-setsize-array1-template
-;
-#X obj 27 76 plot array1 500 1 10 15 10;
-#X restore 364 261 pd help-setsize-template;
-#N canvas 0 0 295 165 help-setsize-data 1;
-#X scalar help-setsize-template 31 23 \; 0 \; 10 \; 0 \; 10 \; 20 \;
-10 \; 20 \; 70 \; 10 \; \;;
-#X restore 363 240 pd help-setsize-data;
-#N canvas 196 292 365 134 help-setsize-array1-template 0;
-#X obj 30 71 filledpolygon 0 0 0 -5 0 0 5 5 0 0 -5;
-#X obj 32 27 template float y;
-#X restore 363 284 pd help-setsize-array1-template;
-#X obj 107 379 pointer;
-#X obj 242 379 setsize;
-#X obj 272 186 pointer;
-#X msg 272 162 traverse pd-help-setsize-data \, next;
-#X floatatom 25 189 5 0 0;
-#X text 359 210 arguments: template \, field name;
-#X obj 25 213 setsize help-setsize-template array1;
-#X text 115 183 inlet for pointer;
-#X obj 36 11 setsize;
-#X obj 174 379 element;
-#X text 31 156 number sets;
-#X text 30 170 size;
-#X text 99 12 -- resize an array;
-#X text 25 34 "setsize" takes a pointer to a scalar at left and a number
-at right. Its creation arguments specify the template of the pointer
-and the name of an array field. Sending a number then sets the number
-of elements of the array.;
-#X text 24 93 The smallest possible size is one. If the array is resized
-downward the extra data are lost. If resized upward \, the new elements
-are initialized to default values.;
-#X msg 566 335 bang;
-#X text 297 333 click to reload from file -->;
-#X text 274 143 click here first;
-#N canvas 460 63 435 172 readit 1;
-#X msg 66 65 \; pd-help-setsize-data read setsize.txt;
-#X obj 107 18 inlet;
-#X msg 62 123 \; pd-help-setsize-data write setsize.txt;
-#X connect 1 0 0 0;
-#X restore 566 361 pd readit;
-#X text 416 395 updated for Pd version 0.35;
-#X connect 7 0 11 1;
-#X connect 8 0 7 0;
-#X connect 9 0 11 0;
-#X connect 20 0 23 0;
diff --git a/pd/doc/5.reference/sigbinops.pd b/pd/doc/5.reference/sigbinops.pd
deleted file mode 100644
index b461c846..00000000
--- a/pd/doc/5.reference/sigbinops.pd
+++ /dev/null
@@ -1,60 +0,0 @@
-#N canvas 18 67 1086 595 10;
-#X obj 8 251 +~;
-#X obj 115 249 -~;
-#X obj 222 249 *~;
-#X obj 327 251 /~;
-#X obj 38 17 +~;
-#X obj 73 17 -~;
-#X obj 106 16 *~;
-#X obj 140 16 /~;
-#X graph graph1 0 -1 100 1 678 446 1078 146;
-#X array array1 100 float;
-#X pop;
-#X obj 327 293 tabwrite~ array1;
-#X obj 8 293 tabwrite~ array1;
-#X obj 115 293 tabwrite~ array1;
-#X obj 222 293 tabwrite~ array1;
-#X text 266 14 -- operators on audio signals;
-#X obj 8 160 osc~ 440;
-#X obj 480 157 osc~ 675;
-#X msg 17 271 bang;
-#X obj 173 15 max~;
-#X obj 207 15 min~;
-#X text 487 458 modified for Pd version 0.27;
-#X obj 536 293 tabwrite~ array1;
-#X obj 431 293 tabwrite~ array1;
-#X obj 431 249 max~;
-#X obj 536 251 min~;
-#X msg 127 272 bang;
-#X msg 233 271 bang;
-#X msg 343 272 bang;
-#X msg 443 271 bang;
-#X msg 553 272 bang;
-#X text 52 332 The binary signal operators can be configured to combine two signals as above \, or \, if you give a numeric argument \, audio signals are combined with scalars:;
-#X obj 204 377 +~ 5;
-#X text 60 406 The right inlet takes audio signals or numbers depending on whether the argument is present or not.;
-#X msg 68 71 \; pd dsp 1;
-#X connect 0 0 10 0;
-#X connect 1 0 11 0;
-#X connect 2 0 12 0;
-#X connect 3 0 9 0;
-#X connect 14 0 0 0;
-#X connect 14 0 1 0;
-#X connect 14 0 3 0;
-#X connect 14 0 2 0;
-#X connect 14 0 22 0;
-#X connect 14 0 23 0;
-#X connect 15 0 3 1;
-#X connect 15 0 2 1;
-#X connect 15 0 1 1;
-#X connect 15 0 0 1;
-#X connect 15 0 22 1;
-#X connect 15 0 23 1;
-#X connect 16 0 10 0;
-#X connect 22 0 21 0;
-#X connect 23 0 20 0;
-#X connect 24 0 11 0;
-#X connect 25 0 12 0;
-#X connect 26 0 9 0;
-#X connect 27 0 21 0;
-#X connect 28 0 20 0;
diff --git a/pd/doc/5.reference/sig~.pd b/pd/doc/5.reference/sig~.pd
deleted file mode 100644
index 72781487..00000000
--- a/pd/doc/5.reference/sig~.pd
+++ /dev/null
@@ -1,20 +0,0 @@
-#N canvas 132 175 547 284 12;
-#X obj 109 221 snapshot~;
-#X floatatom 110 246 0 0 0;
-#X obj 78 12 sig~;
-#X obj 24 133 sig~;
-#X floatatom 24 108 0 0 0;
-#X text 114 14 - convert numbers to audio signal;
-#X text 11 53 In this example \, the sig~ object converts numbers to an audio signal \, which the snapshot~ converts back again.;
-#X text 64 108 <-- Scroll to set value;
-#X obj 109 131 loadbang;
-#X msg 118 155 \; pd dsp 1;
-#X obj 109 195 metro 200;
-#X text 291 249 updated for Pd version 0.33;
-#X connect 0 0 1 0;
-#X connect 0 0 1 0;
-#X connect 3 0 0 0;
-#X connect 4 0 3 0;
-#X connect 8 0 9 0;
-#X connect 8 0 10 0;
-#X connect 10 0 0 0;
diff --git a/pd/doc/5.reference/snapshot~.pd b/pd/doc/5.reference/snapshot~.pd
deleted file mode 100644
index 244a2a7c..00000000
--- a/pd/doc/5.reference/snapshot~.pd
+++ /dev/null
@@ -1,28 +0,0 @@
-#N canvas 40 55 704 399 12;
-#X obj 205 266 snapshot~;
-#X floatatom 205 292 0 0 0;
-#X obj 105 274 snapshot~;
-#X floatatom 105 318 0 0 0;
-#X obj 74 14 snapshot~;
-#X msg 205 236 bang;
-#X text 201 313 This output updates each time bang is clicked above.;
-#X text 154 14 - convert a signal to a number on demand;
-#X text 9 46 The snapshot~ object takes a signal and converts it to a control value whenever it receives a bang in its left outlet. This object is particularly useful for monitoring outputs.;
-#X text 459 375 updated for Pd version 0.33;
-#X msg 19 212 \; pd dsp 1;
-#X obj 12 187 loadbang;
-#X obj 12 251 metro 200;
-#X text 104 334 This output updates every 200 milliseconds.;
-#X obj 105 214 osc~ 0.1;
-#X text 110 196 0.1 Hz cosine;
-#X text 7 111 In the example below \, the first snapshot~ object prints out the values of a low frequency cosine wave every 200 milliseconds. The second snapshot~ object prints the output value when the bang button above it is clicked.;
-#X connect 0 0 1 0;
-#X connect 0 0 1 0;
-#X connect 2 0 3 0;
-#X connect 2 0 3 0;
-#X connect 5 0 0 0;
-#X connect 11 0 10 0;
-#X connect 11 0 12 0;
-#X connect 12 0 2 0;
-#X connect 14 0 2 0;
-#X connect 14 0 0 0;
diff --git a/pd/doc/5.reference/soundfiler-help.pd b/pd/doc/5.reference/soundfiler-help.pd
index 515f102b..5561bf18 100644
--- a/pd/doc/5.reference/soundfiler-help.pd
+++ b/pd/doc/5.reference/soundfiler-help.pd
@@ -29,15 +29,14 @@ prefers.;
#X text 575 124 -maxsize <maximum number of samples we can resize to>
;
#X text 560 226 Flags for writing:;
-#X text 575 247 -wave \, -nextstep \, -aiff;
-#X text 576 266 -big \, -little (nextstep only!);
-#X text 575 288 -skip <number of sample frames to skip in array>;
-#X text 576 310 -nframes <maximum number to write>;
-#X text 577 354 -normalize;
-#X text 576 332 -bytes <2 \, 3 \, or 4>;
+#X text 578 247 -wave \, -nextstep \, -aiff;
+#X text 579 266 -big \, -little (nextstep only!);
+#X text 578 288 -skip <number of sample frames to skip in array>;
+#X text 579 310 -nframes <maximum number to write>;
+#X text 580 354 -normalize;
+#X text 579 332 -bytes <2 \, 3 \, or 4>;
#X floatatom 11 337 0 0 0 0 - - -;
#X msg 15 175 read -resize ../sound/bell.aiff array2;
-#X text 751 539 updated for Pd version 0.29;
#X msg 17 288 write -nextstep -bytes 4 /tmp/foo3 array1 array2;
#X msg 16 265 write -wave -nframes 10000 /tmp/foo2 array2;
#X text 287 150 read a file;
@@ -45,7 +44,7 @@ prefers.;
#X text 225 217 ...or even overriding everything;
#X text 283 240 write a file;
#X text 352 309 write stereo;
-#X text 560 385 The number of channels is limited to 64;
+#X text 557 398 The number of channels is limited to 64;
#X text 612 433 see also:;
#X obj 606 456 tabwrite~;
#X obj 607 480 tabread4~;
@@ -58,10 +57,12 @@ or 4 byte floating point samples in wave \, aiff \, or next formats
(no floating point aiff \, though.). The number of channels of the
soundfile need not match the number of arrays given (extras are dropped
and unsupplied channels are zeroed out.);
+#X text 579 374 -rate <sample rate>;
+#X text 751 539 updated for Pd version 0.37;
#X connect 2 0 22 0;
#X connect 3 0 2 0;
#X connect 4 0 2 0;
#X connect 5 0 2 0;
#X connect 23 0 2 0;
+#X connect 24 0 2 0;
#X connect 25 0 2 0;
-#X connect 26 0 2 0;
diff --git a/pd/doc/5.reference/soundfiler.pd b/pd/doc/5.reference/soundfiler.pd
deleted file mode 100644
index c6384664..00000000
--- a/pd/doc/5.reference/soundfiler.pd
+++ /dev/null
@@ -1,66 +0,0 @@
-#N canvas 82 31 926 613 10;
-#X graph graph1 0 -1 77971 1 71 453 371 353;
-#X array array1 77971 float 0;
-#X pop;
-#X graph graph1 0 -1 77971 1 71 575 371 475;
-#X array array2 77971 float 0;
-#X pop;
-#X obj 12 293 soundfiler;
-#X msg 532 476 \; array1 resize 1000 \; array2 resize 1000 \;;
-#X msg 18 221 write -aiff /tmp/foo1 array2;
-#X msg 19 132 read ../sound/bell.aiff array2;
-#X msg 18 179 read -raw 128 2 2 b ../sound/bell.aiff array1 array2
-;
-#X msg 532 522 \; array1 resize 160000 \; array2 resize 160000;
-#X msg 530 431 \; array1 const 0 \; array2 const 0;
-#X text 26 10 SOUNDFILER - read and write soundfiles to arrays;
-#X text 18 31 The soundfiler object reads and writes floating point
-arrays to binary soundfiles which may contain 2 or 3 byte fixed point
-or 4 byte floating point samples in wave \, aiff \, or next formats
-(only next supports floating point \, though.). The number of channels
-of the soundfile need not match the number of arrays given (extras
-are dropped and unsupplied channels are zeroed out.);
-#X text 475 9 When reading you can leave soundfiler to figure out which
-of the three known soundfile formats the file belongs to or override
-all header information using the "-raw" flag.;
-#X text 479 51 Flags for reading:;
-#X text 498 73 -skip <sample frames to skip in file>;
-#X text 498 90 -nframes <maximum number of sample frames to read>;
-#X text 499 148 -raw <headersize> <channels> <bytespersample> <endianness>
-;
-#X text 518 166 This causes all header information to be ignored. Endianness
-is "l" ("little") for Intel machines or "b" ("big") for Macintoshes
-and SGIs. You can give "n" (natural) to take the byte order your machine
-prefers.;
-#X text 499 111 -resize;
-#X text 499 127 -maxsize <maximum number of samples we can resize to>
-;
-#X text 488 225 Flags for writing:;
-#X text 503 246 -wave \, -nextstep \, -aiff;
-#X text 504 265 -big \, -little (nextstep only!);
-#X text 503 287 -skip <number of sample frames to skip in array>;
-#X text 504 309 -nframes <maximum number to write>;
-#X text 505 353 -normalize;
-#X text 504 331 -bytes <2 \, 3 \, or 4>;
-#X floatatom 12 317 0 0 0;
-#X msg 16 155 read -resize ../sound/bell.aiff array2;
-#X text 707 581 updated for Pd version 0.29;
-#X msg 18 268 write -nextstep -bytes 4 /tmp/foo3 array1 array2;
-#X msg 17 245 write -wave -nframes 10000 /tmp/foo2 array2;
-#X text 257 130 read a file;
-#X text 302 155 ...optionally resize;
-#X text 230 196 ...or even overriding everything;
-#X text 235 221 write a file;
-#X text 376 270 write stereo;
-#X text 488 384 The number of channels is limited to 64;
-#X text 790 429 see also:;
-#X obj 784 452 tabwrite~;
-#X obj 785 476 tabread4~;
-#X obj 784 503 tabplay~;
-#X connect 2 0 26 0;
-#X connect 4 0 2 0;
-#X connect 5 0 2 0;
-#X connect 6 0 2 0;
-#X connect 27 0 2 0;
-#X connect 29 0 2 0;
-#X connect 30 0 2 0;
diff --git a/pd/doc/5.reference/spigot.pd b/pd/doc/5.reference/spigot.pd
deleted file mode 100644
index 3daf9157..00000000
--- a/pd/doc/5.reference/spigot.pd
+++ /dev/null
@@ -1,21 +0,0 @@
-#N canvas 349 223 586 335 12;
-#X msg 25 157 0.5 1000;
-#X floatatom 74 242 1 0 0;
-#X obj 25 267 spigot;
-#X obj 25 300 print;
-#X msg 38 210 walk the cat;
-#X msg 31 182 bang;
-#X obj 35 11 spigot;
-#X text 100 12 - pass or block messages;
-#X text 99 242 control: nonzero to pass messages \, zero to stop them
-;
-#X text 333 303 updated for Pd version 0.33;
-#X text 35 63 Spigot passes messages from its left inlet to its outlet
-\, as long as a nonzero number is sent to its right inlet. When its
-right inlet gets zero \, incoming messages are "blocked \, " i.e. \,
-ignored.;
-#X connect 0 0 2 0;
-#X connect 1 0 2 1;
-#X connect 2 0 3 0;
-#X connect 4 0 2 0;
-#X connect 5 0 2 0;
diff --git a/pd/doc/5.reference/sqrt~.pd b/pd/doc/5.reference/sqrt~.pd
deleted file mode 100644
index b7b8e1a4..00000000
--- a/pd/doc/5.reference/sqrt~.pd
+++ /dev/null
@@ -1,32 +0,0 @@
-#N canvas 182 132 778 399 12;
-#X obj 71 201 metro 500;
-#X obj 71 176 r metro;
-#X msg 575 106 \; metro 0;
-#X msg 574 48 \; pd dsp 1 \; metro 1;
-#X floatatom 55 102 0 0 0;
-#X floatatom 55 258 0 0 0;
-#X text 470 371 updated for Pd version 0.33;
-#X obj 574 21 loadbang;
-#X obj 36 16 sqrt~;
-#X text 88 18 - signal square root;
-#X obj 55 152 sqrt~;
-#X obj 55 225 snapshot~;
-#X floatatom 54 341 9 0 0;
-#X obj 54 285 t f f;
-#X obj 54 312 *;
-#X obj 55 128 sig~;
-#X text 18 45 sqrt~ takes the approximate square root of the incoming
-signal \, using a fast \, approximate algorithm which is probably accurate
-to about 120 dB (20 bits).;
-#X connect 0 0 11 0;
-#X connect 1 0 0 0;
-#X connect 1 0 0 0;
-#X connect 4 0 15 0;
-#X connect 5 0 13 0;
-#X connect 7 0 3 0;
-#X connect 10 0 11 0;
-#X connect 11 0 5 0;
-#X connect 13 0 14 0;
-#X connect 13 1 14 1;
-#X connect 14 0 12 0;
-#X connect 15 0 10 0;
diff --git a/pd/doc/5.reference/stripnote.pd b/pd/doc/5.reference/stripnote.pd
deleted file mode 100644
index 80a8cecb..00000000
--- a/pd/doc/5.reference/stripnote.pd
+++ /dev/null
@@ -1,16 +0,0 @@
-#N canvas 53 36 458 251 10;
-#X msg 39 100 23 0;
-#X obj 39 175 print x1;
-#X obj 96 175 print x2;
-#X obj 39 139 stripnote;
-#X msg 79 100 34.5 67.8;
-#X obj 65 214 makenote;
-#X text 83 12 - send note-on messages and schedule note-off for later;
-#X text 283 220 updated for Pd version 0.28;
-#X text 10 214 see also;
-#X obj 23 10 stripnote;
-#X text 17 44 Stripnote takes note-off (zero-velocity) messages out of a stream of MIDI-style note message and passes the others through unchanged.;
-#X connect 0 0 3 0;
-#X connect 3 0 1 0;
-#X connect 3 1 2 0;
-#X connect 4 0 3 0;
diff --git a/pd/doc/5.reference/struct.pd b/pd/doc/5.reference/struct.pd
deleted file mode 100644
index a18fa6e9..00000000
--- a/pd/doc/5.reference/struct.pd
+++ /dev/null
@@ -1,26 +0,0 @@
-#N canvas 343 45 557 321 12;
-#X text 88 11 -- declare the fields in a data structure.;
-#N canvas 345 476 638 171 help-template1 0;
-#X obj 60 21 struct struct-1 float x float y symbol dog array weasel
-struct-2;
-#X text 40 76 In this example \, the "struct-1" structure is defined
-in which "x" and "y" are "floats" \, i.e. \, numbers \, but "dog" is
-a symbol and "weasel" is an array of objects of structure "struct-2".
-;
-#X restore 324 156 pd help-template1;
-#N canvas 10 274 588 157 help-template2 0;
-#X text 28 95 Here is one which specifies only the floating point "y"
-\; it's used for the elements of the array shown in the other template.
-;
-#X obj 60 21 struct struct-2 float y;
-#X restore 324 183 pd help-template2;
-#X obj 36 215 drawpolygon;
-#X text 36 195 see also:;
-#X obj 141 215 drawnumber;
-#X obj 236 216 plot;
-#X text 281 290 updated for Pd version 0.35;
-#X obj 21 10 struct;
-#X text 16 49 There should be one "struct" object in each Pd window
-you are using as a data structure template. The arguments specify the
-types and names of the fields \; and for array fields \, a third argument
-specifies the template that the array elements should belong to.;
diff --git a/pd/doc/5.reference/sublist.pd b/pd/doc/5.reference/sublist.pd
deleted file mode 100644
index a3067d5a..00000000
--- a/pd/doc/5.reference/sublist.pd
+++ /dev/null
@@ -1,10 +0,0 @@
-#N canvas 252 0 559 226 12;
-#X text 311 181 updated for Pd version 0.32;
-#X obj 21 10 sublist;
-#X text 86 10 -- get a list from a field of a scalar;
-#X text 31 37 Don't try this yet -- it's untested.;
-#X text 36 89 "sublist" will take as creation arguments a template
-name and a field name \; its one input takes a pointer. If you send
-a pointer (which should agree with the template name) \, "sublist"
-will output the field (which should be of type "list".) The output
-is in fact a pointer to the head of the sublist.;
diff --git a/pd/doc/5.reference/swap.pd b/pd/doc/5.reference/swap.pd
deleted file mode 100644
index 987a5844..00000000
--- a/pd/doc/5.reference/swap.pd
+++ /dev/null
@@ -1,20 +0,0 @@
-#N canvas 376 130 488 326 12;
-#X msg 67 124 bang;
-#X floatatom 67 252;
-#X floatatom 79 154;
-#X floatatom 118 194;
-#X obj 66 15 swap;
-#X text 114 16 - SWAP TWO NUMBERS \, RESPECTING RIGHT-TO-LEFT ORDER;
-#X text 284 309 updated for Pd version 0.27;
-#X text 12 42 The swap object stores numbers from its left inlet to output on its right inlet -- after repeating its right hand input out the left.;
-#X text 112 123 outputs 2 stored values;
-#X obj 67 226 swap 6.5;
-#X text 110 154 sets second value and outputs both;
-#X text 150 195 sets first value;
-#X text 142 226 creation argument initializes first value;
-#X floatatom 118 254;
-#X connect 0 0 9 0;
-#X connect 2 0 9 0;
-#X connect 3 0 9 1;
-#X connect 9 0 1 0;
-#X connect 9 1 13 0;
diff --git a/pd/doc/5.reference/switch~.pd b/pd/doc/5.reference/switch~.pd
deleted file mode 100644
index c3ab8797..00000000
--- a/pd/doc/5.reference/switch~.pd
+++ /dev/null
@@ -1,45 +0,0 @@
-#N canvas 218 166 619 368 12;
-#X msg 382 133 \; metro 0;
-#X text 462 92 <-Click to start;
-#X text 455 137 <-Click to stop;
-#X text 47 13 switch and block - turn DSP on and off for subpatches
-and control block size;
-#N canvas 15 32 598 301 switched 1;
-#X obj 265 148 switch~;
-#X floatatom 265 121 1 0 0;
-#X floatatom 75 168 4 0 0;
-#X obj 75 104 noise~;
-#X obj 75 136 env~ 512;
-#X text 25 26 DSP in this subwindow is turned on and off by the switch~
-object. Any subwindows of this window can also be switched off here.
-If a patch and a superpatch both have switches \, both must be "on"
-for DSP to run in the patch.;
-#X text 32 203 switch~ takes optional arguments the same as block~.
-If you supply arguments to switch \, the patch will be switched AND
-reblocked.;
-#X text 31 258 Only one switch~ or block~ may appear in any window.
-;
-#X connect 1 0 0 0;
-#X connect 3 0 4 0;
-#X connect 4 0 2 0;
-#X restore 139 124 pd switched;
-#N canvas 13 421 564 200 blocked 1;
-#X obj 184 35 block~ 1024 4;
-#X text 14 76 This object specified that DSP in this subwindow is to
-be computed at a block size of 1024 \, and an overlap of 4 \, i.e.
-\, every 256 samples. You may not (yet) specify a block size smaller
-than your superpatch. This is useful for writing FFT based patches
-(see the "fft examples" tutorial series.);
-#X restore 141 158 pd blocked;
-#X msg 382 87 \; pd dsp 1;
-#X obj 382 61 loadbang;
-#X text 38 82 see the subpatches for explanation:;
-#X text 362 334 updated for Pd version 0.34;
-#X text 34 195 BUG! -- dac~ and adc~ work only with a blocksize of
-64 If you want to reblock audio computation \, do so in a sub-patch
-and keep the adc~ and dac~ objects in a super-patch. Also \, you can't
-send~ or receive~ between windows with different block sizes or overlapping.
-Only the inlet~ and outlet~ objects know how to reblock signals. In
-this example \, you could put a dac~ in this \, outer window \, or
-in the switched subwindow \, but not the blocked one.;
-#X connect 7 0 6 0;
diff --git a/pd/doc/5.reference/tabosc4~.pd b/pd/doc/5.reference/tabosc4~.pd
deleted file mode 100644
index ada694e1..00000000
--- a/pd/doc/5.reference/tabosc4~.pd
+++ /dev/null
@@ -1,86 +0,0 @@
-#N canvas 307 35 742 511 12;
-#X floatatom 66 450 0 0 0;
-#N canvas 159 26 495 270 output 0;
-#X obj 414 196 t b;
-#X obj 414 134 f;
-#X obj 414 73 inlet;
-#X text 421 36 mute;
-#X obj 414 227 f;
-#X msg 521 218 0;
-#X msg 414 104 bang;
-#X obj 414 166 moses 1;
-#X obj 521 187 t b f;
-#X obj 486 143 moses 1;
-#X obj 102 181 dbtorms;
-#X obj 486 113 r master-lvl;
-#X obj 102 52 r master-lvl;
-#X obj 414 257 s master-lvl;
-#X obj 26 222 inlet~;
-#X obj 244 50 inlet;
-#X text 244 22 level;
-#X obj 244 122 s master-lvl;
-#X msg 118 80 set \$1;
-#X obj 118 109 outlet;
-#X msg 262 78 \; pd dsp 1;
-#X obj 102 238 line~;
-#X obj 26 259 *~;
-#X obj 26 295 dac~;
-#X obj 102 210 pack 0 50;
-#X text 24 195 audio;
-#X text 114 135 show level;
-#X connect 0 0 4 0;
-#X connect 1 0 7 0;
-#X connect 2 0 6 0;
-#X connect 4 0 13 0;
-#X connect 5 0 13 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 7 1 8 0;
-#X connect 8 0 5 0;
-#X connect 9 1 4 1;
-#X connect 10 0 24 0;
-#X connect 11 0 1 1;
-#X connect 11 0 9 0;
-#X connect 12 0 10 0;
-#X connect 12 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 15 0 20 0;
-#X connect 18 0 19 0;
-#X connect 21 0 22 1;
-#X connect 22 0 23 0;
-#X connect 22 0 23 1;
-#X connect 24 0 21 0;
-#X restore 32 476 pd output;
-#X msg 102 450 MUTE;
-#X text 148 449 <--- volume in dB;
-#X floatatom 32 296 4 0 0;
-#X obj 32 326 sig~ 100;
-#X obj 547 52 table table1;
-#X obj 547 80 table table2;
-#X msg 372 287 \; table1 sinesum 512 0.5 0.5 0.5 0.5 \; table2 cosinesum 512 0 1;
-#X text 433 474 Updated for Pd version 0.33;
-#X obj 20 11 tabosc4~;
-#X text 110 12 4-point interpolating oscillator;
-#X msg 52 372 set table1;
-#X obj 32 413 tabosc4~ table1;
-#X msg 156 372 set table2;
-#X text 372 343 click above \, start DSP \, and turn output;
-#X text 372 361 volume up to hear this;
-#X text 14 40 tabosc4~ is a traditional computer music style wavetable lookup oscillator using 4-point polynomial interpolation. The table should have a poiwer of two points plus three "guard points" \, one at the beginning and two at the end \, which should be wraparound copies of the last point and the first two points \, respectively. The "sinesum" and "cosinesum" methods for arrays do this automatically for you if you just want to specify partial strengths.;
-#X text 14 178 For good results use 512 points for up to about 15 partials \, or 32*npartials (rounded up to a power of 2) for more than 15;
-#X floatatom 275 391 4 0 0;
-#X text 12 233 Don't send new "sinesum" messages to tables while you're running -- instead \, use "set" messages to switch between tables.;
-#X text 80 298 signal input for frequency (Hz.);
-#X text 46 349 message to switch tables;
-#X text 325 391 inlet to reset phase;
-#X text 166 414 creation argument initializes table;
-#X connect 0 0 1 1;
-#X connect 1 0 0 0;
-#X connect 2 0 1 2;
-#X connect 4 0 5 0;
-#X connect 5 0 13 0;
-#X connect 12 0 13 0;
-#X connect 13 0 1 0;
-#X connect 14 0 13 0;
-#X connect 19 0 13 1;
diff --git a/pd/doc/5.reference/tabplay~.pd b/pd/doc/5.reference/tabplay~.pd
deleted file mode 100644
index 92cdb81e..00000000
--- a/pd/doc/5.reference/tabplay~.pd
+++ /dev/null
@@ -1,66 +0,0 @@
-#N canvas 28 13 707 471 10;
-#X msg 639 93 \; pd dsp 0;
-#X graph graph1 0 -1 155948 1 428 369 678 169;
-#X array array99 155948 float 0;
-#X pop;
-#X floatatom 11 342 0 0 0;
-#X msg 11 109 set array99;
-#X text 93 109 "set" message permits you to switch between arrays;
-#X text 128 228 creation argument initializes array name;
-#X text 5 392 see also the "array" tutorial in section 2 of the Pd
-documentation \, and these objects:;
-#X obj 6 438 tabwrite~;
-#X obj 140 439 tabread;
-#X obj 194 439 tabwrite;
-#X obj 254 439 tabsend~;
-#X obj 315 439 tabreceive~;
-#X obj 41 13 tabplay~;
-#X text 108 14 play a table as a sample (non-transposing);
-#X obj 11 228 tabplay~ array99;
-#X obj 452 82 soundfiler;
-#X msg 452 48 read -resize ../sound/bell.aiff array99 \; pd dsp 1 \;
-;
-#X floatatom 452 104 0 0 0;
-#X obj 11 316 env~ 16384;
-#X obj 396 439 soundfiler;
-#X obj 73 439 tabread4~;
-#X obj 87 360 dac~ 1;
-#X obj 87 323 *~;
-#X obj 100 304 line~;
-#X msg 100 263 0.1 100;
-#X msg 116 284 0 100;
-#X text 162 264 on;
-#X text 157 283 off;
-#X text 148 301 envelope;
-#X text 148 312 generator;
-#X text 101 248 amplitude controls:;
-#X text 131 362 audio output;
-#X obj 87 342 hip~ 5;
-#X msg 26 179 0 44100;
-#X msg 27 158 44100;
-#X msg 26 138 bang;
-#X text 475 449 updated for Pd version 0.29;
-#X text 29 43 The tabplay~ object plays a sample \, or part of one
-\, with no transposition or interpolation. It is cheaper than tabread4~
-and there are none of tabread4~'s interpolation artifacts.;
-#X text 509 25 click here to load table;
-#X text 80 136 "bang" or 0 plays whole sample;
-#X text 82 157 play starting at 44100th sample;
-#X text 93 177 play starting at beginning for 44100 samples;
-#X msg 25 199 44100 1000;
-#X text 103 198 play from 44100 through 45099 (1000 samples);
-#X connect 3 0 14 0;
-#X connect 14 0 18 0;
-#X connect 14 0 22 0;
-#X connect 15 0 17 0;
-#X connect 16 0 15 0;
-#X connect 18 0 2 0;
-#X connect 22 0 32 0;
-#X connect 23 0 22 1;
-#X connect 24 0 23 0;
-#X connect 25 0 23 0;
-#X connect 32 0 21 0;
-#X connect 33 0 14 0;
-#X connect 34 0 14 0;
-#X connect 35 0 14 0;
-#X connect 42 0 14 0;
diff --git a/pd/doc/5.reference/tabread.pd b/pd/doc/5.reference/tabread.pd
deleted file mode 100644
index fa671a21..00000000
--- a/pd/doc/5.reference/tabread.pd
+++ /dev/null
@@ -1,21 +0,0 @@
-#N canvas 44 26 703 454 12;
-#X text 52 181 index;
-#X obj 36 9 tabread;
-#X obj 15 244 tabread array99;
-#X floatatom 15 182 0 0 0;
-#X floatatom 15 278 0 0 0;
-#X graph graph1 0 0 10 10 362 379 612 179;
-#X array array99 10 float;
-#X pop;
-#X msg 31 56 \; readout 1 \; array99 resize 10 \; array99 bounds 0 0 10 10 \; array99 xlabel -0.5 0 1 2 3 4 5 6 7 8 9 10 \; array99 ylabel -1 0 1 2 3 4 5 6 7 8 9 10 \; array99 0 1 4 2 8 5 6 1 4 2 8;
-#X text 60 276 output = array99[index];
-#X text 141 33 click here to initialize;
-#X text 159 236 creation argument;
-#X text 155 254 gives array name;
-#X msg 25 204 set array99;
-#X text 137 204 change array name;
-#X text 422 407 updated for Pd version 0.33;
-#X text 110 8 - read numbers from a table;
-#X connect 2 0 4 0;
-#X connect 3 0 2 0;
-#X connect 11 0 2 0;
diff --git a/pd/doc/5.reference/tabread4~.pd b/pd/doc/5.reference/tabread4~.pd
deleted file mode 100644
index c28f580a..00000000
--- a/pd/doc/5.reference/tabread4~.pd
+++ /dev/null
@@ -1,43 +0,0 @@
-#N canvas 59 33 814 475 10;
-#X obj 11 228 tabread4~ array99;
-#X text 21 207 signal input x(n);
-#X msg 727 51 \; pd dsp 0;
-#X graph graph1 0 -1 9 1 514 373 764 173;
-#X array array99 10 float 0;
-#X pop;
-#X text 127 21 4-point-interpolating table lookup;
-#X obj 11 316 snapshot~;
-#X obj 30 290 metro 200;
-#X obj 11 124 sig~;
-#X floatatom 11 98 0 0 0;
-#X obj 30 264 r readout;
-#X floatatom 11 342 0 0 0;
-#X msg 452 50 \; readout 1 \; array99 resize 10 \; array99 0 -0.5 -0.5
--0.5 0.5 0.5 0.5 \; pd dsp 1 \;;
-#X text 49 94 incoming signal is index. Indices should range from 1
-to (size-2) so that the 4-point interpolation is meaningful. You can
-shift-drag the number box to see the effect of interpolation.;
-#X msg 34 158 set array99;
-#X text 116 158 "set" message permits you to switch between arrays
-;
-#X text 139 228 creation argument initializes array name;
-#X text 5 392 see also the "array" tutorial in section 2 of the Pd
-documentation \, and these objects:;
-#X obj 47 21 tabread4~;
-#X text 509 27 click here to test;
-#X obj 12 442 tabwrite~;
-#X obj 157 442 tabread;
-#X obj 216 442 tabwrite;
-#X obj 281 442 tabsend~;
-#X obj 346 442 tabreceive~;
-#X text 7 58 Tabread4~ is used to build samplers and other table lookup
-algorithms. The interpolation scheme is 4-point polynomial.;
-#X text 616 460 updated for Pd version 0.29;
-#X obj 83 442 tabplay~;
-#X connect 0 0 5 0;
-#X connect 5 0 10 0;
-#X connect 6 0 5 0;
-#X connect 7 0 0 0;
-#X connect 8 0 7 0;
-#X connect 9 0 6 0;
-#X connect 13 0 0 0;
diff --git a/pd/doc/5.reference/tabreceive~.pd b/pd/doc/5.reference/tabreceive~.pd
deleted file mode 100644
index 7de98346..00000000
--- a/pd/doc/5.reference/tabreceive~.pd
+++ /dev/null
@@ -1,6 +0,0 @@
-#N canvas 109 83 646 239 12;
-#X obj 21 18 tabreceive~;
-#X text 17 53 creation argument: name of array;
-#X text 16 83 By default a block is 64 samples \; this can be reset using the block~ object.;
-#X text 380 201 updated for Pd version 0.33;
-#X text 129 18 - read a block of a signal from an array continuously;
diff --git a/pd/doc/5.reference/tabsend~.pd b/pd/doc/5.reference/tabsend~.pd
deleted file mode 100644
index 85a4183f..00000000
--- a/pd/doc/5.reference/tabsend~.pd
+++ /dev/null
@@ -1,6 +0,0 @@
-#N canvas 151 91 596 222 12;
-#X obj 31 27 tabsend~;
-#X text 113 26 writes one block of a signal continuously to an array;
-#X text 41 60 creation argument: name of array;
-#X text 29 96 By default a block is 64 samples \; this can be reset using the block~ object.;
-#X text 318 186 updated for Pd version 0.33;
diff --git a/pd/doc/5.reference/tabwrite.pd b/pd/doc/5.reference/tabwrite.pd
deleted file mode 100644
index 60b31513..00000000
--- a/pd/doc/5.reference/tabwrite.pd
+++ /dev/null
@@ -1,21 +0,0 @@
-#N canvas 44 17 653 456 12;
-#X obj 31 27 tabwrite;
-#X floatatom 9 176 0 0 0;
-#X obj 9 282 tabwrite array99;
-#X text 113 28 write numbers to a table;
-#X graph graph1 0 0 10 10 355 389 605 189;
-#X array array99 10 float;
-#X pop;
-#X msg 9 53 \; readout 1 \; array99 resize 10 \; array99 bounds 0 0 10 10 \; array99 xlabel -0.5 0 1 2 3 4 5 6 7 8 9 10 \; array99 ylabel -1 0 1 2 3 4 5 6 7 8 9 10 \; array99 0 1 4 2 8 5 6 1 4 2 8;
-#X text 406 94 click here to initialize;
-#X floatatom 146 257 0 0 0;
-#X text 158 279 creation argument;
-#X text 160 297 is array name;
-#X text 46 174 set y value;
-#X text 44 239 right inlet selects x value;
-#X msg 25 204 set array99;
-#X text 133 203 change array name;
-#X text 389 423 updated for Pd version 0.33;
-#X connect 1 0 2 0;
-#X connect 7 0 2 1;
-#X connect 12 0 2 0;
diff --git a/pd/doc/5.reference/tabwrite~.pd b/pd/doc/5.reference/tabwrite~.pd
deleted file mode 100644
index 606f4f30..00000000
--- a/pd/doc/5.reference/tabwrite~.pd
+++ /dev/null
@@ -1,30 +0,0 @@
-#N canvas 119 134 697 332 10;
-#X obj 31 27 tabwrite~;
-#X text 110 27 object to write a signal in an array;
-#X msg 43 131 bang;
-#X obj 23 211 tabwrite~ array99;
-#X graph graph1 0 -1 100 1 460 235 610 135;
-#X array array99 100 float;
-#X pop;
-#X obj 23 82 sig~ 3000;
-#X obj 23 110 phasor~;
-#X text 149 213 creation argument initializes array name;
-#X msg 40 181 set array99;
-#X msg 445 35 \; pd dsp 1;
-#X msg 524 37 \; pd dsp 0;
-#X text 85 133 bang to start recording;
-#X text 126 180 set the destination array;
-#X text 18 251 see also the "array" tutorial in section 2 of the Pd documentation \, and these objects:;
-#X obj 90 282 tabread;
-#X obj 149 282 tabwrite;
-#X obj 214 282 tabsend~;
-#X obj 279 282 tabreceive~;
-#X obj 17 282 tabread4~;
-#X msg 43 153 stop;
-#X text 85 154 stop recording;
-#X text 458 288 updated for Pd version 0.29;
-#X connect 2 0 3 0;
-#X connect 5 0 6 0;
-#X connect 6 0 3 0;
-#X connect 8 0 3 0;
-#X connect 19 0 3 0;
diff --git a/pd/doc/5.reference/text.pd b/pd/doc/5.reference/text.pd
deleted file mode 100644
index 96664048..00000000
--- a/pd/doc/5.reference/text.pd
+++ /dev/null
@@ -1,4 +0,0 @@
-#N canvas 74 127 544 214 12;
-#X text 281 174 updated for Pd version 0.26;
-#X text 107 13 comments;
-#X text 38 73 This is Pd's help window for comments \, which don't do anything.;
diff --git a/pd/doc/5.reference/textfile.pd b/pd/doc/5.reference/textfile.pd
deleted file mode 100644
index 8da1dde6..00000000
--- a/pd/doc/5.reference/textfile.pd
+++ /dev/null
@@ -1,59 +0,0 @@
-#N canvas 12 43 1181 529 12;
-#X msg 582 27 rewind;
-#X obj 577 416 print done;
-#X text 745 185 read a file;
-#X text 801 214 write one;
-#X text 97 472 see also:;
-#X obj 521 365 textfile;
-#X msg 584 188 read textfile.txt;
-#X obj 176 473 qlist;
-#X obj 145 20 textfile;
-#X text 236 20 read and write text files;
-#X text 34 92 The textfile object reads and writes text files to and
-from memory. You can read a file and output sequential lines as lists
-\, or collect lines and write them out. You can use this object to
-generate "models" for Gem \, for instance.;
-#X text 665 28 go to beginning;
-#X msg 582 54 bang;
-#X text 665 53 output one line as a list;
-#X msg 584 216 write /tmp/textfile.txt;
-#X msg 584 243 write /tmp/textfile2.txt cr;
-#X text 593 264 write a file \, terminating lines only with carriage
-return (omitting semicolons.) You can read files this way too \, in
-which case carriage returns are mapped to semicolons.;
-#X obj 521 438 print list;
-#X msg 583 312 read textfile.txt cr;
-#X msg 582 82 clear;
-#X text 737 83 empty the object;
-#X text 737 111 add a message;
-#X text 521 464 this outlet gets the lines in sequence.;
-#X text 35 246 You can also use this object simply for storing heterogeneous
-sequences of lists.;
-#X text 608 385 This outlet gets a bang when you hit the end of the
-sequence.;
-#X msg 582 162 set 2 4 6 8;
-#X text 740 163 clear and then add one message;
-#X msg 582 109 add cis boom bah;
-#X msg 582 136 add2 bang;
-#X text 734 136 add an unterminated message;
-#X text 31 160 To record textual messages and save them to a file \,
-first send "clear" to empty the qlist and "add" to add messages (terminated
-with semicolons.) The message \, "add2" adds a list of atoms without
-finishing with a semicolon in case you want to make variable-length
-messages.;
-#X msg 582 339 print;
-#X text 636 342 debugging printout;
-#X text 901 500 updated for Pd version 0.33;
-#X connect 0 0 5 0;
-#X connect 5 0 17 0;
-#X connect 5 1 1 0;
-#X connect 6 0 5 0;
-#X connect 12 0 5 0;
-#X connect 14 0 5 0;
-#X connect 15 0 5 0;
-#X connect 18 0 5 0;
-#X connect 19 0 5 0;
-#X connect 25 0 5 0;
-#X connect 27 0 5 0;
-#X connect 28 0 5 0;
-#X connect 31 0 5 0;
diff --git a/pd/doc/5.reference/threshold~.pd b/pd/doc/5.reference/threshold~.pd
deleted file mode 100644
index 5922d15b..00000000
--- a/pd/doc/5.reference/threshold~.pd
+++ /dev/null
@@ -1,31 +0,0 @@
-#N canvas 114 43 685 360 12;
-#X msg 452 58 \; pd dsp 0;
-#X msg 452 24 \; pd dsp 1;
-#X obj 124 11 threshold~;
-#X text 200 12 - TRIGGER FROM AUDIO SIGNAL;
-#X obj 49 183 sig~;
-#X obj 49 261 threshold~ 10 100 0 100;
-#X text 303 255 Arguments:;
-#X text 384 255 1 trigger threshold;
-#X floatatom 49 156 5 0 0;
-#X obj 49 289 print trigger;
-#X obj 205 287 print rest;
-#X text 385 271 2 trigger debounce time;
-#X text 385 288 3 rest threshold;
-#X text 384 303 4 rest debounce time;
-#X text 486 342 updated for Pd version 0.32;
-#X msg 205 209 1;
-#X msg 235 210 0;
-#X text 12 39 threshold~ monitors its input signal and outputs bangs when the signal exceeds a specified "trigger" value \, and also when the signal recedes below a "rest" value. You can specify debounce times in milliseconds \, for the threshold~ to wait after the two event types before triggering again.;
-#X msg 131 151 set 0 2000 1 2000;
-#X msg 131 174 set 10 100 0 100;
-#X text 262 150 "set" to change the parameters;
-#X text 268 210 zero or nonszero in inlet to set the state to "high" or "low". There is no debounce period after this.;
-#X connect 4 0 5 0;
-#X connect 5 0 9 0;
-#X connect 5 1 10 0;
-#X connect 8 0 4 0;
-#X connect 15 0 5 1;
-#X connect 16 0 5 1;
-#X connect 18 0 5 0;
-#X connect 19 0 5 0;
diff --git a/pd/doc/5.reference/throw~.pd b/pd/doc/5.reference/throw~.pd
deleted file mode 100644
index c9a1ce9d..00000000
--- a/pd/doc/5.reference/throw~.pd
+++ /dev/null
@@ -1,34 +0,0 @@
-#N canvas 80 120 664 313 12;
-#X obj 97 159 throw~ signal1;
-#X floatatom 268 211 0 0 0;
-#X obj 90 193 sig~ 50;
-#X obj 268 181 snapshot~;
-#X obj 90 221 throw~ signal1;
-#X obj 97 88 sig~ 25;
-#X obj 268 135 catch~ signal1;
-#X obj 35 17 throw~;
-#X obj 97 17 catch~;
-#X text 163 16 - summing signal bus and non-local connection;
-#X obj 551 88 loadbang;
-#X msg 561 110 \; pd dsp 1;
-#X obj 551 151 metro 200;
-#X text 33 48 Any number of throw~ objects can add into one catch~ object (but two catch~ objects cannot share the same name.);
-#X floatatom 401 206 0 0 0;
-#X obj 402 182 snapshot~;
-#X obj 402 134 catch~ signal2;
-#X msg 113 111 set signal2;
-#X msg 114 135 set signal1;
-#X text 75 252 You can redirect throw~ via a "set" message.;
-#X text 410 283 updated for Pd version 0.33;
-#X connect 2 0 4 0;
-#X connect 3 0 1 0;
-#X connect 5 0 0 0;
-#X connect 6 0 3 0;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 12 0 3 0;
-#X connect 12 0 15 0;
-#X connect 15 0 14 0;
-#X connect 16 0 15 0;
-#X connect 17 0 0 0;
-#X connect 18 0 0 0;
diff --git a/pd/doc/5.reference/timer.pd b/pd/doc/5.reference/timer.pd
deleted file mode 100644
index 0f7b3829..00000000
--- a/pd/doc/5.reference/timer.pd
+++ /dev/null
@@ -1,15 +0,0 @@
-#N canvas 440 273 514 280 10;
-#X msg 60 146 bang;
-#X msg 30 115 bang;
-#X obj 30 175 timer;
-#X obj 66 15 timer;
-#X text 111 16 - measure logical time;
-#X floatatom 30 206;
-#X text 71 113 Click here to reset;
-#X text 98 147 Click here to get elapsed logical time;
-#X text 27 232 Output is in milliseconds;
-#X text 6 51 The timer object measures elapsed logical time. Logical time moves forward as if all computation were instantaneous and as if all "delay" and "metro" objects were exact.;
-#X text 319 260 updated for Pd version 0.25;
-#X connect 0 0 2 1;
-#X connect 1 0 2 0;
-#X connect 2 0 5 0;
diff --git a/pd/doc/5.reference/toggle.pd b/pd/doc/5.reference/toggle.pd
deleted file mode 100644
index 5cb9ae75..00000000
--- a/pd/doc/5.reference/toggle.pd
+++ /dev/null
@@ -1,273 +0,0 @@
-#N canvas 205 140 489 376 10;
-#X obj 1 1 cnv 8 100 60 empty empty toggle=tgl 20 20 1 18 -262144 -1109
-0;
-#X text 21 296 (c) musil@iem.kug.ac.at;
-#X text 63 309 IEM KUG;
-#X text 115 41 click properties to;
-#X text 103 52 modify geometry \, colors \, etc.;
-#X obj 168 113 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144
--1 -1;
-#X obj 168 179 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144
--1 -1;
-#X obj 168 133 s foo6_rcv;
-#X obj 168 159 r foo6_snd;
-#X text 153 14 gui-toggle:;
-#X obj 26 270 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 10 117 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X msg 26 39 33;
-#X obj 26 180 tgl 60 1 foo6_snd foo6_rcv big_toggle 63 20 194 13 -228992
--4033 -34 1 1;
-#X msg 42 79 1;
-#X msg 49 99 0;
-#X floatatom 26 249 4 0 0;
-#X msg 33 59 -0.001;
-#X msg 103 135 set 1;
-#X msg 108 157 set 0;
-#X obj 3 155 tgl 15 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0 1
-;
-#X obj 65 249 tgl 15 0 empty empty empty 8 -8 0 10 -262144 -1 -1 1
-1;
-#X msg 95 114 set -0.23;
-#X obj 189 93 tgl 15 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 188 179 tgl 15 0 empty empty empty 8 -8 0 10 -262144 -1 -1 1
-1;
-#X msg 93 93 0 3 4.55;
-#X msg 85 73 0.22 0 -5.44;
-#X msg 189 113 set \$1;
-#X text 96 222 UP- \, DOWN- \, LEFT- or RIGHT-key;
-#X text 95 233 for moving selected gui-objects;
-#N canvas 440 175 699 530 edit 0;
-#X msg 47 151 \; foo6_rcv color \$1 \$2 \$3;
-#X obj 47 126 pack 0 0 0;
-#X obj 47 98 f;
-#X msg 24 50 bang;
-#X floatatom 63 48 3 0 29;
-#X floatatom 79 68 3 0 29;
-#X floatatom 112 84 3 0 29;
-#X text 91 48 background;
-#X text 106 68 front-color;
-#X text 140 85 label-color;
-#X obj 49 223 f;
-#X msg 27 202 bang;
-#X floatatom 65 201 3 63 88;
-#X floatatom 100 223 3 0 37;
-#X obj 49 246 pack 0 0;
-#X text 127 223 y-label;
-#X text 93 201 x-label;
-#X msg 49 271 \; foo6_rcv label_pos \$1 \$2;
-#X floatatom 505 55 3 8 75;
-#X text 532 55 size;
-#X msg 505 76 \; foo6_rcv size \$1;
-#X obj 282 182 f;
-#X msg 260 161 bang;
-#X floatatom 298 160 3 -10 10;
-#X floatatom 333 182 3 -10 10;
-#X obj 282 205 pack 0 0;
-#X msg 282 230 \; foo6_rcv delta \$1 \$2;
-#X obj 296 301 f;
-#X msg 274 280 bang;
-#X floatatom 312 279 3 20 60;
-#X floatatom 347 301 3 150 200;
-#X obj 296 324 pack 0 0;
-#X msg 296 349 \; foo6_rcv pos \$1 \$2;
-#X text 326 160 x-delta;
-#X text 360 182 y-delta;
-#X text 340 279 x-position;
-#X text 374 301 y-position;
-#X obj 305 423 f;
-#X msg 283 402 bang;
-#X floatatom 321 401 3 -10 10;
-#X floatatom 356 423 3 -10 10;
-#X obj 305 446 pack 0 0;
-#X text 383 423 y-label;
-#X text 349 401 x-label;
-#X msg 305 471 \; foo6_rcv delta \$1 \$2;
-#X msg 499 140 \; foo6_rcv send foo6a_snd;
-#X msg 499 178 \; foo6_rcv send foo6_snd;
-#X msg 494 216 \; foo6_rcv receive foo6a_rcv;
-#X msg 494 254 \; foo6a_rcv receive foo6_rcv;
-#X msg 41 448 \; foo6_rcv label blabla;
-#X msg 41 484 \; foo6_rcv label big_toggle;
-#X obj 69 338 f;
-#X msg 47 317 bang;
-#X floatatom 85 316 3 0 2;
-#X floatatom 120 338 3 4 36;
-#X obj 69 361 pack 0 0;
-#X msg 69 386 \; foo6_rcv label_font \$1 \$2;
-#X text 113 316 font;
-#X text 149 338 height;
-#X floatatom 498 307 5 -200 200;
-#X text 542 307 nonzero-value;
-#X msg 498 331 \; foo6_rcv nonzero \$1;
-#X msg 503 412 \; foo6_rcv init 0;
-#X msg 510 479 \; foo6_rcv init 1;
-#X text 524 393 no init;
-#X text 500 461 init value on loadbang;
-#X msg 285 47 back;
-#X msg 285 67 front;
-#X msg 285 87 label;
-#X msg 247 47 bang;
-#N canvas 15 207 606 448 RGB_____________ 0;
-#X obj 97 56 inlet;
-#X obj 262 53 inlet;
-#X obj 339 55 inlet;
-#X obj 405 56 inlet;
-#X obj 97 270 bang;
-#X msg 77 295 0;
-#X msg 104 295 1;
-#X obj 146 268 bang;
-#X msg 132 295 0;
-#X msg 160 295 1;
-#X obj 196 269 bang;
-#X msg 187 295 0;
-#X msg 214 295 1;
-#X obj 265 313 spigot;
-#X obj 312 313 spigot;
-#X obj 359 313 spigot;
-#X obj 249 385 outlet;
-#X text 93 33 select;
-#X text 267 28 red;
-#X text 337 30 green;
-#X text 409 30 blue;
-#X obj 405 102 t b f;
-#X obj 339 160 +;
-#X obj 339 185 t b f;
-#X obj 339 216 +;
-#X obj 296 385 outlet;
-#X obj 343 385 outlet;
-#X obj 28 180 loadbang;
-#X obj 97 135 route back front label bang;
-#X obj 343 362 f;
-#X obj 296 361 f;
-#X obj 249 361 f;
-#X obj 262 79 * -65536;
-#X obj 339 80 * -256;
-#X obj 405 80 * -1;
-#X obj 339 247 - 1;
-#X obj 235 168 t b b b b;
-#X connect 0 0 28 0;
-#X connect 1 0 32 0;
-#X connect 2 0 33 0;
-#X connect 3 0 34 0;
-#X connect 4 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 14 1;
-#X connect 5 0 15 1;
-#X connect 6 0 13 1;
-#X connect 7 0 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 13 1;
-#X connect 8 0 15 1;
-#X connect 9 0 14 1;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 11 0 13 1;
-#X connect 11 0 14 1;
-#X connect 12 0 15 1;
-#X connect 13 0 31 1;
-#X connect 14 0 30 1;
-#X connect 15 0 29 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 35 0;
-#X connect 27 0 6 0;
-#X connect 28 0 4 0;
-#X connect 28 1 7 0;
-#X connect 28 2 10 0;
-#X connect 28 3 36 0;
-#X connect 29 0 26 0;
-#X connect 30 0 25 0;
-#X connect 31 0 16 0;
-#X connect 32 0 24 0;
-#X connect 33 0 22 0;
-#X connect 34 0 21 0;
-#X connect 35 0 15 0;
-#X connect 35 0 14 0;
-#X connect 35 0 13 0;
-#X connect 36 0 31 0;
-#X connect 36 1 30 0;
-#X connect 36 2 29 0;
-#X connect 36 3 35 0;
-#X restore 285 108 pd RGB_____________;
-#X floatatom 327 77 3 0 255;
-#X floatatom 370 77 3 0 255;
-#X floatatom 413 78 3 0 255;
-#X text 34 22 preset-colors;
-#X text 296 19 RGB-colors;
-#X text 327 59 red;
-#X text 363 58 green;
-#X text 411 58 blue;
-#X connect 1 0 0 0;
-#X connect 2 0 1 0;
-#X connect 3 0 2 0;
-#X connect 4 0 2 1;
-#X connect 5 0 1 1;
-#X connect 6 0 1 2;
-#X connect 10 0 14 0;
-#X connect 11 0 10 0;
-#X connect 12 0 10 1;
-#X connect 13 0 14 1;
-#X connect 14 0 17 0;
-#X connect 18 0 20 0;
-#X connect 21 0 25 0;
-#X connect 22 0 21 0;
-#X connect 23 0 21 1;
-#X connect 24 0 25 1;
-#X connect 25 0 26 0;
-#X connect 27 0 31 0;
-#X connect 28 0 27 0;
-#X connect 29 0 27 1;
-#X connect 30 0 31 1;
-#X connect 31 0 32 0;
-#X connect 37 0 41 0;
-#X connect 38 0 37 0;
-#X connect 39 0 37 1;
-#X connect 40 0 41 1;
-#X connect 41 0 44 0;
-#X connect 51 0 55 0;
-#X connect 52 0 51 0;
-#X connect 53 0 51 1;
-#X connect 54 0 55 1;
-#X connect 55 0 56 0;
-#X connect 59 0 61 0;
-#X connect 66 0 70 0;
-#X connect 67 0 70 0;
-#X connect 68 0 70 0;
-#X connect 69 0 70 0;
-#X connect 70 0 1 0;
-#X connect 70 1 1 1;
-#X connect 70 2 1 2;
-#X connect 71 0 70 1;
-#X connect 72 0 70 2;
-#X connect 73 0 70 3;
-#X restore 278 136 pd edit;
-#X obj 222 276 tgl 15 0 bbb bbb empty 20 8 192 8 -262144 -1 -1 1 1
-;
-#X text 191 320 updated for Pd version 0.35;
-#X text 38 321 graz \, austria 2002;
-#X obj 127 255 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii;
-#X connect 5 0 7 0;
-#X connect 8 0 6 0;
-#X connect 8 0 24 0;
-#X connect 11 0 13 0;
-#X connect 12 0 13 0;
-#X connect 13 0 16 0;
-#X connect 13 0 21 0;
-#X connect 14 0 13 0;
-#X connect 15 0 13 0;
-#X connect 16 0 10 0;
-#X connect 17 0 13 0;
-#X connect 18 0 13 0;
-#X connect 19 0 13 0;
-#X connect 20 0 13 0;
-#X connect 22 0 13 0;
-#X connect 23 0 27 0;
-#X connect 25 0 13 0;
-#X connect 26 0 13 0;
-#X connect 27 0 7 0;
diff --git a/pd/doc/5.reference/trigger.pd b/pd/doc/5.reference/trigger.pd
deleted file mode 100644
index a32d5def..00000000
--- a/pd/doc/5.reference/trigger.pd
+++ /dev/null
@@ -1,37 +0,0 @@
-#N canvas 58 142 685 355 12;
-#X msg 28 149 2.5;
-#X msg 126 151 bang;
-#X msg 68 150 23 64;
-#X obj 28 242 print x1;
-#X obj 112 242 print x2;
-#X obj 196 240 print x3;
-#X obj 43 26 trigger;
-#X obj 286 241 print x4;
-#X text 114 27 - sequence messages in right-to-left order;
-#X text 417 331 updated for Pd version 0.33;
-#X text 81 290 the above can be abbreviated as:;
-#X msg 172 152 symbol dog;
-#X text 39 59 The trigger object outputs its input from right to left
-\, converting to the types indicated by its creation arguments. There
-is also a "pointer" argument type (see the pointer object.);
-#X obj 381 293 t f b l s a;
-#X msg 466 167 dog my cats;
-#X obj 466 199 trigger bang anything;
-#X obj 374 242 print x5;
-#X obj 466 240 print y1;
-#X obj 552 242 print y2;
-#X obj 28 202 trigger float bang symbol list anything;
-#X text 464 122 "anythings" can only;
-#X text 461 142 be converted to bang:;
-#X connect 0 0 19 0;
-#X connect 1 0 19 0;
-#X connect 2 0 19 0;
-#X connect 11 0 19 0;
-#X connect 14 0 15 0;
-#X connect 15 0 17 0;
-#X connect 15 1 18 0;
-#X connect 19 0 3 0;
-#X connect 19 1 4 0;
-#X connect 19 2 5 0;
-#X connect 19 3 7 0;
-#X connect 19 4 16 0;
diff --git a/pd/doc/5.reference/unpack.pd b/pd/doc/5.reference/unpack.pd
deleted file mode 100644
index 5f1a4120..00000000
--- a/pd/doc/5.reference/unpack.pd
+++ /dev/null
@@ -1,28 +0,0 @@
-#N canvas 234 84 730 277 12;
-#X floatatom 80 180 0 0 0;
-#X floatatom 205 180 0 0 0;
-#X floatatom 243 180 0 0 0;
-#X floatatom 46 180 0 0 0;
-#X obj 117 180 print foo;
-#X obj 133 243 pack;
-#X text 51 242 See also;
-#X obj 101 9 unpack;
-#X text 164 8 - split a message to atoms;
-#X text 196 139 <-- creation arguments specify the types of atoms expected
-;
-#X msg 46 102 1 2;
-#X msg 85 102 3 4 shut;
-#X msg 164 102 5 6 pick 7 8;
-#X text 368 239 updated for Pd version 0.33;
-#X obj 46 139 unpack 0 0 s 0 0;
-#X text 25 36 unpack takes lists of atoms and distributes them to its
-outlets. The creation arguments specify float (any number or the symbol
-'f') \, pointer (symbol 'p') or symbol (symbol 's').;
-#X connect 10 0 14 0;
-#X connect 11 0 14 0;
-#X connect 12 0 14 0;
-#X connect 14 0 3 0;
-#X connect 14 1 0 0;
-#X connect 14 2 4 0;
-#X connect 14 3 1 0;
-#X connect 14 4 2 0;
diff --git a/pd/doc/5.reference/until.pd b/pd/doc/5.reference/until.pd
deleted file mode 100644
index 9da7a9ce..00000000
--- a/pd/doc/5.reference/until.pd
+++ /dev/null
@@ -1,25 +0,0 @@
-#N canvas 142 97 410 273 10;
-#X msg 65 116 bang;
-#X obj 66 15 until;
-#X text 114 16 - LOOP;
-#X text 24 36 The until object's left inlet starts a loop in which it outputs "bang" until its right inlet gets a bang which stops it. If you start "until" with a number \, it iterates at most that number of times \, as in the Max "uzi" object.;
-#X text 24 85 WARNING: if you bang an "until" which doesn't have a stopping mechanism \, Pd goes into an infinite loop!;
-#X obj 65 168 until;
-#X text 110 115 start;
-#X msg 73 137 3;
-#X text 109 138 start limited to 3 iterations;
-#X obj 65 196 f;
-#X obj 96 198 + 1;
-#X obj 140 198 sel 0;
-#X obj 65 240 print;
-#X obj 96 219 mod 10;
-#X text 225 247 updated for Pd version 0.28;
-#X connect 0 0 5 0;
-#X connect 5 0 9 0;
-#X connect 7 0 5 0;
-#X connect 9 0 10 0;
-#X connect 9 0 12 0;
-#X connect 10 0 13 0;
-#X connect 11 0 5 1;
-#X connect 13 0 9 1;
-#X connect 13 0 11 0;
diff --git a/pd/doc/5.reference/value.pd b/pd/doc/5.reference/value.pd
deleted file mode 100644
index 66c457a3..00000000
--- a/pd/doc/5.reference/value.pd
+++ /dev/null
@@ -1,30 +0,0 @@
-#N canvas 257 45 500 281 12;
-#X text 290 257 updated for Pd version 0.32;
-#X floatatom 36 55 5 0 0;
-#X text 50 249 abbreviation:;
-#X text 79 10 -- nonlocal shared value (named variable);
-#X floatatom 36 130 5 0 0;
-#X msg 46 78 bang;
-#X obj 21 10 value;
-#X obj 36 105 value help-value1;
-#X obj 149 248 v;
-#X floatatom 163 55 5 0 0;
-#X floatatom 163 130 5 0 0;
-#X msg 173 78 bang;
-#X obj 163 105 value help-value1;
-#X floatatom 291 55 5 0 0;
-#X floatatom 291 130 5 0 0;
-#X msg 301 78 bang;
-#X obj 291 105 value help-value2;
-#X text 31 171 "Value" stores a numeric value which is shared between all values with the same name (which need not be in the same Pd window.);
-#X text 345 54 numbers set the value;
-#X text 349 77 bang retrieves it;
-#X connect 1 0 7 0;
-#X connect 5 0 7 0;
-#X connect 7 0 4 0;
-#X connect 9 0 12 0;
-#X connect 11 0 12 0;
-#X connect 12 0 10 0;
-#X connect 13 0 16 0;
-#X connect 15 0 16 0;
-#X connect 16 0 14 0;
diff --git a/pd/doc/5.reference/vcf~.pd b/pd/doc/5.reference/vcf~.pd
deleted file mode 100644
index 45dde1d8..00000000
--- a/pd/doc/5.reference/vcf~.pd
+++ /dev/null
@@ -1,35 +0,0 @@
-#N canvas 0 0 644 422 12;
-#X obj 257 200 sig~;
-#X text 14 193 test signal;
-#X text 100 341 amp in (db);
-#X text 92 144 test frequency;
-#X text 224 340 amp out (db);
-#X obj 220 264 vcf~;
-#X text 246 144 center frequency;
-#X text 374 184 q;
-#X floatatom 122 168 5 0 0;
-#X floatatom 257 171 5 0 0;
-#X obj 122 193 osc~;
-#X floatatom 353 203 5 0 0;
-#X obj 122 291 env~ 8192;
-#X obj 220 290 env~ 8192;
-#X floatatom 121 318 5 0 0;
-#X floatatom 220 319 5 0 0;
-#X obj 80 13 vcf~;
-#X text 135 13 -- voltage-controlled bandpass filter;
-#X text 26 395 see also:;
-#X obj 115 394 bp~;
-#X text 302 394 updated for Pd version 0.35;
-#X text 12 45 vcf~ is like bp~ except that it takes an audio signal
-to set center frequency \, which may thus change continuously in time.
-The "Q" or filter sharpness is still only set by messages. More expensive
-than bp~ in CPU time but more powerful too.;
-#X connect 0 0 5 1;
-#X connect 5 0 13 0;
-#X connect 8 0 10 0;
-#X connect 9 0 0 0;
-#X connect 10 0 5 0;
-#X connect 10 0 12 0;
-#X connect 11 0 5 2;
-#X connect 12 0 14 0;
-#X connect 13 0 15 0;
diff --git a/pd/doc/5.reference/vdial.pd b/pd/doc/5.reference/vdial.pd
deleted file mode 100644
index 048c4c2b..00000000
--- a/pd/doc/5.reference/vdial.pd
+++ /dev/null
@@ -1,282 +0,0 @@
-#N canvas 106 314 558 455 10;
-#X obj 1 1 cnv 8 100 60 empty empty vdial=vdl 20 20 1 18 -262144 -1109
-0;
-#X text 13 390 (c) musil@iem.kug.ac.at;
-#X text 55 403 IEM KUG;
-#X text 132 122 click properties to;
-#X text 120 133 modify geometry \, colors \, etc.;
-#X obj 159 261 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144
--1 -1;
-#X obj 21 54 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X msg 41 319 \$1;
-#X floatatom 41 341 4 0 0;
-#X obj 41 363 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 86 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 86 317 route 0 1 2 3 4 5 6 7 8 9;
-#X msg 194 92 set \$1;
-#X floatatom 194 71 4 0 9;
-#X floatatom 44 54 4 0 9;
-#X msg 91 41 7 0 -5.44;
-#X msg 95 63 3 3 4.55;
-#X obj 103 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 120 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 1
-1;
-#X obj 137 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 154 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 171 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 188 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 205 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 222 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 239 338 tgl 12 0 empty empty empty 8 -8 0 10 -262144 -1 -1 0
-1;
-#X obj 79 355 print;
-#X floatatom 183 287 4 0 0;
-#X msg 183 261 \$1;
-#X msg 158 192 set \$1;
-#X floatatom 158 171 4 0 9;
-#X text 125 355 UP- \, DOWN- \, LEFT- or RIGHT-key;
-#X text 124 366 for moving selected gui-objects;
-#N canvas 230 247 699 530 edit 0;
-#X obj 42 198 f;
-#X msg 20 177 bang;
-#X floatatom 58 176 3 63 156;
-#X floatatom 93 198 3 -20 37;
-#X obj 42 221 pack 0 0;
-#X text 120 198 y-label;
-#X text 86 176 x-label;
-#X floatatom 270 187 3 8 50;
-#X text 297 187 size;
-#X obj 286 293 f;
-#X msg 264 272 bang;
-#X floatatom 302 271 3 -10 10;
-#X floatatom 337 293 3 -10 10;
-#X obj 286 316 pack 0 0;
-#X obj 300 412 f;
-#X msg 278 391 bang;
-#X floatatom 316 390 3 20 60;
-#X floatatom 351 412 3 100 200;
-#X obj 300 435 pack 0 0;
-#X text 330 271 x-delta;
-#X text 364 293 y-delta;
-#X text 344 390 x-position;
-#X text 378 412 y-position;
-#X obj 62 313 f;
-#X msg 40 292 bang;
-#X floatatom 78 291 3 0 2;
-#X floatatom 113 313 3 4 36;
-#X obj 62 336 pack 0 0;
-#X text 106 291 font;
-#X text 142 313 height;
-#X text 504 293 no init;
-#X text 475 348 init value on loadbang;
-#X floatatom 482 228 5 2 20;
-#X text 491 417 changing-behavior;
-#X text 526 228 number of buttons;
-#X obj 47 104 pack 0 0 0;
-#X obj 47 76 f;
-#X msg 24 28 bang;
-#X floatatom 63 26 3 0 29;
-#X floatatom 79 46 3 0 29;
-#X floatatom 112 62 3 0 29;
-#X text 91 26 background;
-#X text 106 46 front-color;
-#X text 140 63 label-color;
-#X msg 285 25 back;
-#X msg 285 45 front;
-#X msg 285 65 label;
-#X msg 247 25 bang;
-#N canvas 15 207 606 448 RGB_____________ 0;
-#X obj 97 56 inlet;
-#X obj 262 53 inlet;
-#X obj 339 55 inlet;
-#X obj 405 56 inlet;
-#X obj 97 270 bang;
-#X msg 77 295 0;
-#X msg 104 295 1;
-#X obj 146 268 bang;
-#X msg 132 295 0;
-#X msg 160 295 1;
-#X obj 196 269 bang;
-#X msg 187 295 0;
-#X msg 214 295 1;
-#X obj 265 313 spigot;
-#X obj 312 313 spigot;
-#X obj 359 313 spigot;
-#X obj 249 385 outlet;
-#X text 93 33 select;
-#X text 267 28 red;
-#X text 337 30 green;
-#X text 409 30 blue;
-#X obj 405 102 t b f;
-#X obj 339 160 +;
-#X obj 339 185 t b f;
-#X obj 339 216 +;
-#X obj 296 385 outlet;
-#X obj 343 385 outlet;
-#X obj 28 180 loadbang;
-#X obj 97 135 route back front label bang;
-#X obj 343 362 f;
-#X obj 296 361 f;
-#X obj 249 361 f;
-#X obj 262 79 * -65536;
-#X obj 339 80 * -256;
-#X obj 405 80 * -1;
-#X obj 339 247 - 1;
-#X obj 235 168 t b b b b;
-#X connect 0 0 28 0;
-#X connect 1 0 32 0;
-#X connect 2 0 33 0;
-#X connect 3 0 34 0;
-#X connect 4 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 14 1;
-#X connect 5 0 15 1;
-#X connect 6 0 13 1;
-#X connect 7 0 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 13 1;
-#X connect 8 0 15 1;
-#X connect 9 0 14 1;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 11 0 13 1;
-#X connect 11 0 14 1;
-#X connect 12 0 15 1;
-#X connect 13 0 31 1;
-#X connect 14 0 30 1;
-#X connect 15 0 29 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 35 0;
-#X connect 27 0 6 0;
-#X connect 28 0 4 0;
-#X connect 28 1 7 0;
-#X connect 28 2 10 0;
-#X connect 28 3 36 0;
-#X connect 29 0 26 0;
-#X connect 30 0 25 0;
-#X connect 31 0 16 0;
-#X connect 32 0 24 0;
-#X connect 33 0 22 0;
-#X connect 34 0 21 0;
-#X connect 35 0 15 0;
-#X connect 35 0 14 0;
-#X connect 35 0 13 0;
-#X connect 36 0 31 0;
-#X connect 36 1 30 0;
-#X connect 36 2 29 0;
-#X connect 36 3 35 0;
-#X restore 285 86 pd RGB_____________;
-#X floatatom 327 55 3 0 255;
-#X floatatom 370 55 3 0 255;
-#X floatatom 413 56 3 0 255;
-#X text 34 0 preset-colors;
-#X text 296 -3 RGB-colors;
-#X text 327 37 red;
-#X text 363 36 green;
-#X text 411 36 blue;
-#X msg 47 125 \; foo12_rcv color \$1 \$2 \$3;
-#X msg 42 246 \; foo12_rcv label_pos \$1 \$2;
-#X msg 62 361 \; foo12_rcv label_font \$1 \$2;
-#X msg 34 423 \; foo12_rcv label blabla;
-#X msg 34 459 \; foo12_rcv label vdial_0_9;
-#X msg 300 460 \; foo12_rcv pos \$1 \$2;
-#X msg 286 341 \; foo12_rcv delta \$1 \$2;
-#X msg 270 216 \; foo12_rcv size \$1;
-#X msg 483 50 \; foo12_rcv send foo12a_snd;
-#X msg 483 88 \; foo12_rcv send foo12_snd;
-#X msg 482 171 \; foo12a_rcv receive foo12_rcv;
-#X msg 483 133 \; foo12_rcv receive foo12a_rcv;
-#X msg 482 254 \; foo12_rcv number \$1;
-#X msg 483 312 \; foo12_rcv init 0;
-#X msg 485 366 \; foo12_rcv init 1;
-#X msg 490 436 \; foo12_rcv single_change;
-#X msg 490 470 \; foo12_rcv double_change;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 1;
-#X connect 3 0 4 1;
-#X connect 4 0 58 0;
-#X connect 7 0 64 0;
-#X connect 9 0 13 0;
-#X connect 10 0 9 0;
-#X connect 11 0 9 1;
-#X connect 12 0 13 1;
-#X connect 13 0 63 0;
-#X connect 14 0 18 0;
-#X connect 15 0 14 0;
-#X connect 16 0 14 1;
-#X connect 17 0 18 1;
-#X connect 18 0 62 0;
-#X connect 23 0 27 0;
-#X connect 24 0 23 0;
-#X connect 25 0 23 1;
-#X connect 26 0 27 1;
-#X connect 27 0 59 0;
-#X connect 32 0 69 0;
-#X connect 35 0 57 0;
-#X connect 36 0 35 0;
-#X connect 37 0 36 0;
-#X connect 38 0 36 1;
-#X connect 39 0 35 1;
-#X connect 40 0 35 2;
-#X connect 44 0 48 0;
-#X connect 45 0 48 0;
-#X connect 46 0 48 0;
-#X connect 47 0 48 0;
-#X connect 48 0 35 0;
-#X connect 48 1 35 1;
-#X connect 48 2 35 2;
-#X connect 49 0 48 1;
-#X connect 50 0 48 2;
-#X connect 51 0 48 3;
-#X restore 267 222 pd edit;
-#X obj 221 11 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii;
-#X text 30 415 graz \, austria 2002;
-#X text 223 401 updated for Pd version 0.35;
-#X text 144 11 gui-vdial:;
-#X obj 79 110 vdl 25 1 0 8 foo12_snd foo12_rcv vdial_0_9 20 -8 192
-10 -99865 -262144 -260818 0;
-#X obj 352 36 vdl 15 1 0 8 iii iii empty 20 8 192 8 -262144 -1 -1 0
-;
-#X obj 158 213 s foo12_rcv;
-#X obj 159 239 r foo12_snd;
-#X connect 6 0 38 0;
-#X connect 7 0 8 0;
-#X connect 8 0 9 0;
-#X connect 11 0 10 0;
-#X connect 11 1 17 0;
-#X connect 11 2 18 0;
-#X connect 11 3 19 0;
-#X connect 11 4 20 0;
-#X connect 11 5 21 0;
-#X connect 11 6 22 0;
-#X connect 11 7 23 0;
-#X connect 11 8 24 0;
-#X connect 11 9 25 0;
-#X connect 12 0 38 0;
-#X connect 13 0 12 0;
-#X connect 14 0 38 0;
-#X connect 15 0 38 0;
-#X connect 16 0 38 0;
-#X connect 28 0 27 0;
-#X connect 29 0 40 0;
-#X connect 30 0 29 0;
-#X connect 38 0 11 0;
-#X connect 38 0 26 0;
-#X connect 38 0 7 0;
-#X connect 41 0 5 0;
-#X connect 41 0 28 0;
diff --git a/pd/doc/5.reference/vd~.pd b/pd/doc/5.reference/vd~.pd
deleted file mode 100644
index 5a36ff73..00000000
--- a/pd/doc/5.reference/vd~.pd
+++ /dev/null
@@ -1,19 +0,0 @@
-#N canvas 109 10 654 410 12;
-#X floatatom 50 194 0 0 0;
-#X obj 50 287 outlet~;
-#X text 130 286 signal output (delayed signal);
-#X obj 24 16 vd~;
-#X text 60 9 reads a signal from a delay line at a variable delay time (4-point-interpolation);
-#X obj 50 222 sig~;
-#X text 99 219 signal input (delay time in ms);
-#X obj 50 254 vd~ del_example;
-#X text 193 252 creation argument: name of delay line;
-#X text 31 51 vd~ implements a 4-point interpolating delay tap from a corresponding delwrite~ object. The delay in milliseconds of the tap is specified by the incoming signal.;
-#X text 35 340 see also:;
-#X obj 123 343 delwrite~;
-#X obj 212 342 delread~;
-#X text 354 373 updated for Pd version 0.33;
-#X text 28 103 The delay time is always at least one sample and at most the length of the delay line (specified by hte delwrite~). In addition \, in case the delwrite~ runs later in the DSP loop than the vd~ \, the delay is constrained below by one vector length (64 samples.);
-#X connect 0 0 5 0;
-#X connect 5 0 7 0;
-#X connect 7 0 1 0;
diff --git a/pd/doc/5.reference/vline~-help.pd b/pd/doc/5.reference/vline~-help.pd
new file mode 100644
index 00000000..4e4fc880
--- /dev/null
+++ b/pd/doc/5.reference/vline~-help.pd
@@ -0,0 +1,46 @@
+#N canvas 273 80 815 504 12;
+#X obj 55 458 snapshot~;
+#X floatatom 55 481 5 0 0 0 - - -;
+#X obj 65 431 metro 100;
+#X obj 65 406 r start;
+#X msg 550 21 \; pd dsp 1 \; start bang;
+#X msg 55 241 1 1000;
+#X msg 83 357 stop;
+#X msg 72 288 0;
+#X text 644 36 Click to start;
+#X text 639 94 Click to stop;
+#X text 207 457 see also:;
+#X obj 293 459 line;
+#X msg 550 75 \; pd dsp 0 \; start 0;
+#X text 561 465 updated for version 0.33;
+#X obj 339 459 line~;
+#X obj 21 7 vline~;
+#X text 85 7 - high-precision audio ramp generator;
+#X obj 55 383 vline~;
+#X text 15 44 The vline~ object \, like line~ \, generates linear ramps
+whose levels and timing are determined by messages you send it. The
+messages consist of a target value \, a time interval (zero if not
+supplied) \, and an initial delay (also zero if not supplied.) Ramps
+may start and stop between audio samples \, in which case the output
+is interpolated accordingly.;
+#X text 15 155 Any number of future ramps may be scheduled and vline~
+will remember them and execute them in order. They must be specified
+in increasing order of initial delay however \, since a segment cancels
+all planned segments at any future time.;
+#X text 120 238 ramp up;
+#X msg 64 263 0 1000;
+#X text 127 266 ramp down;
+#X text 84 308 ramp up \, jump down \, ramp up again;
+#X msg 78 329 1 1000 \, 0 0 1000 \, 1 1000 1000;
+#X text 110 287 jump down;
+#X text 126 356 "stop" message freezes vline~ at its current value
+;
+#X connect 0 0 1 0;
+#X connect 2 0 0 0;
+#X connect 3 0 2 0;
+#X connect 5 0 17 0;
+#X connect 6 0 17 0;
+#X connect 7 0 17 0;
+#X connect 17 0 0 0;
+#X connect 21 0 17 0;
+#X connect 24 0 17 0;
diff --git a/pd/doc/5.reference/vslider.pd b/pd/doc/5.reference/vslider.pd
deleted file mode 100644
index 69452ad6..00000000
--- a/pd/doc/5.reference/vslider.pd
+++ /dev/null
@@ -1,302 +0,0 @@
-#N canvas 147 201 617 416 10;
-#X obj 1 1 cnv 8 100 60 empty empty vslider=vsl 20 20 1 18 -262144
--1109 0;
-#X floatatom 38 300 9 0 0;
-#X msg 47 84 set \$1;
-#X floatatom 38 43 7 0 0;
-#X text 25 363 (c) musil@iem.kug.ac.at;
-#X text 67 376 IEM KUG;
-#X obj 38 324 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X obj 18 47 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
--1;
-#X floatatom 47 63 7 0 0;
-#X floatatom 116 324 9 0 0;
-#X floatatom 106 42 7 0 0;
-#X floatatom 147 113 7 0 0;
-#X obj 75 249 ftom;
-#X floatatom 75 271 9 0 0;
-#X floatatom 111 244 9 0 0;
-#X floatatom 185 266 9 0 0;
-#X text 181 151 click properties to;
-#X floatatom 75 112 9 0 0;
-#X obj 75 134 mtof;
-#X text 166 12 gui-vertical-slider:;
-#X obj 38 162 vsl 15 101 100 300 0 1 foo3_snd foo3_rcv empty 8 -8 192
-10 -225280 -1109 -1 2500 1;
-#X obj 75 168 vsl 15 73 55 3520 1 1 goo4_snd goo4_rcv log.freq. 11
--6 192 10 -261681 -260818 -90881 0 1;
-#X obj 185 244 r goo4_snd;
-#X obj 147 133 s goo4_rcv;
-#X text 202 65 (0.01 pixels);
-#X text 57 99 ------------------------------------------;
-#X text 57 286 --------------------------------------------;
-#X text 169 162 modify geometry \, colors \, etc.;
-#X obj 106 84 s foo3_rcv;
-#X obj 116 302 r foo3_snd;
-#X msg 106 63 set \$1;
-#X text 188 44 shift-click & drag;
-#X text 194 54 for fine-tuning;
-#X text 119 192 UP- \, DOWN- \, LEFT- or RIGHT-key;
-#X text 118 203 for moving selected gui-objects;
-#N canvas 239 379 699 530 edit 0;
-#X obj 37 233 f;
-#X msg 15 212 bang;
-#X floatatom 53 211 3 6 88;
-#X floatatom 88 233 3 -20 37;
-#X obj 37 256 pack 0 0;
-#X text 115 233 y-label;
-#X text 81 211 x-label;
-#X obj 287 271 f;
-#X msg 265 250 bang;
-#X floatatom 303 249 3 -10 10;
-#X floatatom 338 271 3 -10 10;
-#X obj 287 294 pack 0 0;
-#X obj 299 381 f;
-#X msg 277 360 bang;
-#X floatatom 315 359 3 20 90;
-#X floatatom 350 381 3 150 200;
-#X obj 299 404 pack 0 0;
-#X text 331 249 x-delta;
-#X text 365 271 y-delta;
-#X text 343 359 x-position;
-#X text 377 381 y-position;
-#X obj 57 348 f;
-#X msg 35 327 bang;
-#X floatatom 73 326 3 0 2;
-#X floatatom 108 348 3 4 36;
-#X obj 57 371 pack 0 0;
-#X text 101 326 font;
-#X text 137 348 height;
-#X floatatom 476 188 1 0 1;
-#X text 523 401 no init;
-#X text 493 453 init value on loadbang;
-#X text 520 188 steady;
-#X obj 486 291 f;
-#X msg 464 270 bang;
-#X floatatom 502 269 4 55 440;
-#X floatatom 537 291 6 440 3520;
-#X obj 486 314 pack 0 0;
-#X text 269 469 linear / logarithmical;
-#X msg 47 158 \; goo4_rcv color \$1 \$2 \$3;
-#X msg 37 281 \; goo4_rcv label_pos \$1 \$2;
-#X msg 57 396 \; goo4_rcv label_font \$1 \$2;
-#X msg 40 442 \; goo4_rcv label blabla;
-#X msg 269 487 \; goo4_rcv lin;
-#X msg 363 486 \; goo4_rcv log;
-#X msg 299 429 \; goo4_rcv pos \$1 \$2;
-#X msg 287 319 \; goo4_rcv delta \$1 \$2;
-#X msg 475 21 \; goo4_rcv send goo4a_snd;
-#X msg 475 59 \; goo4_rcv send goo4_snd;
-#X msg 476 105 \; goo4_rcv receive goo4a_rcv;
-#X msg 476 143 \; goo4a_rcv receive goo4_rcv;
-#X msg 486 339 \; goo4_rcv range \$1 \$2;
-#X msg 502 420 \; goo4_rcv init 0;
-#X msg 503 471 \; goo4_rcv init 1;
-#X text 539 270 bottom-range-bound;
-#X text 586 292 top-range-bound;
-#X obj 286 160 f;
-#X msg 264 139 bang;
-#X floatatom 302 138 3 4 55;
-#X floatatom 337 160 3 15 73;
-#X obj 286 183 pack 0 0;
-#X msg 286 208 \; goo4_rcv size \$1 \$2;
-#X text 330 138 width;
-#X text 368 161 height;
-#X msg 41 478 \; goo4_rcv label log.freq.;
-#X msg 476 212 \; goo4_rcv steady \$1;
-#X obj 47 116 pack 0 0 0;
-#X obj 47 88 f;
-#X msg 24 40 bang;
-#X floatatom 63 38 3 0 29;
-#X floatatom 79 58 3 0 29;
-#X floatatom 112 74 3 0 29;
-#X text 91 38 background;
-#X text 106 58 front-color;
-#X text 140 75 label-color;
-#X msg 285 37 back;
-#X msg 285 57 front;
-#X msg 285 77 label;
-#X msg 247 37 bang;
-#N canvas 15 207 606 448 RGB_____________ 0;
-#X obj 97 56 inlet;
-#X obj 262 53 inlet;
-#X obj 339 55 inlet;
-#X obj 405 56 inlet;
-#X obj 97 270 bang;
-#X msg 77 295 0;
-#X msg 104 295 1;
-#X obj 146 268 bang;
-#X msg 132 295 0;
-#X msg 160 295 1;
-#X obj 196 269 bang;
-#X msg 187 295 0;
-#X msg 214 295 1;
-#X obj 265 313 spigot;
-#X obj 312 313 spigot;
-#X obj 359 313 spigot;
-#X obj 249 385 outlet;
-#X text 93 33 select;
-#X text 267 28 red;
-#X text 337 30 green;
-#X text 409 30 blue;
-#X obj 405 102 t b f;
-#X obj 339 160 +;
-#X obj 339 185 t b f;
-#X obj 339 216 +;
-#X obj 296 385 outlet;
-#X obj 343 385 outlet;
-#X obj 28 180 loadbang;
-#X obj 97 135 route back front label bang;
-#X obj 343 362 f;
-#X obj 296 361 f;
-#X obj 249 361 f;
-#X obj 262 79 * -65536;
-#X obj 339 80 * -256;
-#X obj 405 80 * -1;
-#X obj 339 247 - 1;
-#X obj 235 168 t b b b b;
-#X connect 0 0 28 0;
-#X connect 1 0 32 0;
-#X connect 2 0 33 0;
-#X connect 3 0 34 0;
-#X connect 4 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 14 1;
-#X connect 5 0 15 1;
-#X connect 6 0 13 1;
-#X connect 7 0 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 13 1;
-#X connect 8 0 15 1;
-#X connect 9 0 14 1;
-#X connect 10 0 11 0;
-#X connect 10 0 12 0;
-#X connect 11 0 13 1;
-#X connect 11 0 14 1;
-#X connect 12 0 15 1;
-#X connect 13 0 31 1;
-#X connect 14 0 30 1;
-#X connect 15 0 29 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 35 0;
-#X connect 27 0 6 0;
-#X connect 28 0 4 0;
-#X connect 28 1 7 0;
-#X connect 28 2 10 0;
-#X connect 28 3 36 0;
-#X connect 29 0 26 0;
-#X connect 30 0 25 0;
-#X connect 31 0 16 0;
-#X connect 32 0 24 0;
-#X connect 33 0 22 0;
-#X connect 34 0 21 0;
-#X connect 35 0 15 0;
-#X connect 35 0 14 0;
-#X connect 35 0 13 0;
-#X connect 36 0 31 0;
-#X connect 36 1 30 0;
-#X connect 36 2 29 0;
-#X connect 36 3 35 0;
-#X restore 285 98 pd RGB_____________;
-#X floatatom 327 67 3 0 255;
-#X floatatom 370 67 3 0 255;
-#X floatatom 413 68 3 0 255;
-#X text 34 12 preset-colors;
-#X text 296 9 RGB-colors;
-#X text 327 49 red;
-#X text 363 48 green;
-#X text 411 48 blue;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 1;
-#X connect 3 0 4 1;
-#X connect 4 0 39 0;
-#X connect 7 0 11 0;
-#X connect 8 0 7 0;
-#X connect 9 0 7 1;
-#X connect 10 0 11 1;
-#X connect 11 0 45 0;
-#X connect 12 0 16 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 1;
-#X connect 15 0 16 1;
-#X connect 16 0 44 0;
-#X connect 21 0 25 0;
-#X connect 22 0 21 0;
-#X connect 23 0 21 1;
-#X connect 24 0 25 1;
-#X connect 25 0 40 0;
-#X connect 28 0 64 0;
-#X connect 32 0 36 0;
-#X connect 33 0 32 0;
-#X connect 34 0 32 1;
-#X connect 35 0 36 1;
-#X connect 36 0 50 0;
-#X connect 55 0 59 0;
-#X connect 56 0 55 0;
-#X connect 57 0 55 1;
-#X connect 58 0 59 1;
-#X connect 59 0 60 0;
-#X connect 65 0 38 0;
-#X connect 66 0 65 0;
-#X connect 67 0 66 0;
-#X connect 68 0 66 1;
-#X connect 69 0 65 1;
-#X connect 70 0 65 2;
-#X connect 74 0 78 0;
-#X connect 75 0 78 0;
-#X connect 76 0 78 0;
-#X connect 77 0 78 0;
-#X connect 78 0 65 0;
-#X connect 78 1 65 1;
-#X connect 78 2 65 2;
-#X connect 79 0 78 1;
-#X connect 80 0 78 2;
-#X connect 81 0 78 3;
-#X restore 327 48 pd edit;
-#X obj 61 345 print;
-#N canvas 276 200 290 224 once 0;
-#X obj 38 47 t b b f;
-#X msg 56 85 1;
-#X obj 31 108 f 0;
-#X obj 31 131 pack 0 0;
-#X obj 31 156 route 0;
-#X obj 38 24 inlet;
-#X obj 31 180 outlet;
-#X connect 0 0 1 0;
-#X connect 0 1 2 0;
-#X connect 0 2 3 1;
-#X connect 1 0 2 1;
-#X connect 2 0 3 0;
-#X connect 3 0 4 0;
-#X connect 4 0 6 0;
-#X connect 5 0 0 0;
-#X restore 61 322 pd once;
-#X obj 377 110 vsl 15 128 0 127 0 0 ccc ccc empty 20 8 192 8 -262144
--1 -1 4200 1;
-#X obj 249 87 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii;
-#X text 218 387 updated for Pd version 0.35;
-#X text 42 388 graz \, austria 2002;
-#X connect 1 0 6 0;
-#X connect 2 0 20 0;
-#X connect 3 0 20 0;
-#X connect 7 0 20 0;
-#X connect 8 0 2 0;
-#X connect 10 0 30 0;
-#X connect 11 0 23 0;
-#X connect 12 0 13 0;
-#X connect 17 0 18 0;
-#X connect 18 0 21 0;
-#X connect 20 0 1 0;
-#X connect 20 0 37 0;
-#X connect 21 0 14 0;
-#X connect 21 0 12 0;
-#X connect 22 0 15 0;
-#X connect 29 0 9 0;
-#X connect 30 0 28 0;
-#X connect 37 0 36 0;
diff --git a/pd/doc/5.reference/vu.pd b/pd/doc/5.reference/vu.pd
deleted file mode 100644
index 3c94ba52..00000000
--- a/pd/doc/5.reference/vu.pd
+++ /dev/null
@@ -1,247 +0,0 @@
-#N canvas 171 210 549 418 10;
-#X obj 1 1 cnv 8 100 60 empty empty vu 20 20 1 18 -262144 -1109 0;
-#X text 19 363 (c) musil@iem.kug.ac.at;
-#X text 61 376 IEM KUG;
-#X floatatom 177 129 7 -110 20;
-#X text 202 41 click properties to;
-#X text 190 52 modify geometry \, colors \, etc.;
-#X text 49 13 gui-vu-meter-display:;
-#X obj 99 39 tgl 15 1 empty empty empty 8 -8 0 10 -262144 -1 -1 1 1
-;
-#X obj 12 179 vu 16 120 foo7_rcv vu-meter 60 0 64 10 -1 -355 1 0;
-#X floatatom 11 332 6 0 0;
-#X floatatom 22 310 6 0 0;
-#X text 75 309 dB;
-#X text 63 333 dB;
-#X text 71 128 dB;
-#X text 80 148 dB;
-#X text 103 146 peak-level;
-#X text 101 125 rms-level;
-#X text 96 308 peak-level;
-#X text 83 332 rms-level;
-#X text 108 99 <list> of rms \, peak;
-#X obj 177 231 s foo7_rcv;
-#X obj 177 211 pack 0 0;
-#X floatatom 195 150 7 -110 20;
-#X obj 195 191 t b f;
-#X text 236 129 dB;
-#X text 255 151 dB;
-#X text 71 258 UP- \, DOWN- \, LEFT- or RIGHT-key;
-#X text 70 269 for moving selected gui-objects;
-#X floatatom 11 128 7 -110 20;
-#X floatatom 22 149 7 -110 20;
-#N canvas 236 62 699 530 edit 0;
-#X obj 37 222 f;
-#X msg 15 201 bang;
-#X floatatom 53 200 3 50 88;
-#X floatatom 88 222 3 0 37;
-#X obj 37 245 pack 0 0;
-#X text 115 222 y-label;
-#X text 81 200 x-label;
-#X obj 292 313 f;
-#X msg 270 292 bang;
-#X floatatom 308 291 3 -10 10;
-#X floatatom 343 313 3 -10 10;
-#X obj 292 336 pack 0 0;
-#X obj 304 435 f;
-#X msg 282 414 bang;
-#X floatatom 320 413 3 20 140;
-#X floatatom 355 435 3 150 200;
-#X obj 304 458 pack 0 0;
-#X text 336 291 x-delta;
-#X text 370 313 y-delta;
-#X text 348 413 x-position;
-#X text 382 435 y-position;
-#X obj 57 337 f;
-#X msg 35 316 bang;
-#X floatatom 73 315 3 0 2;
-#X floatatom 108 337 3 8 36;
-#X obj 57 360 pack 0 0;
-#X text 101 315 font;
-#X text 137 337 height;
-#X floatatom 471 106 1 0 1;
-#X msg 52 131 \; foo7_rcv color \$1 \$2;
-#X msg 37 270 \; foo7_rcv label_pos \$1 \$2;
-#X msg 57 386 \; foo7_rcv label_font \$1 \$2;
-#X msg 37 427 \; foo7_rcv label blabla;
-#X msg 292 361 \; foo7_rcv delta \$1 \$2;
-#X msg 304 483 \; foo7_rcv pos \$1 \$2;
-#X msg 469 23 \; foo7_rcv receive foo7a_rcv;
-#X msg 469 60 \; foo7a_rcv receive foo7_rcv;
-#X text 492 106 display scale;
-#X msg 471 132 \; foo7_rcv scale \$1;
-#X obj 279 193 f;
-#X msg 257 172 bang;
-#X floatatom 295 171 3 8 50;
-#X floatatom 330 193 3 110 200;
-#X obj 279 216 pack 0 0;
-#X text 323 171 width;
-#X text 357 193 height;
-#X msg 279 241 \; foo7_rcv size \$1 \$2;
-#X msg 37 463 \; foo7_rcv label vu-meter;
-#X obj 52 79 f;
-#X msg 29 31 bang;
-#X floatatom 68 29 3 0 29;
-#X floatatom 103 47 3 0 29;
-#X text 96 29 background;
-#X text 131 48 label-color;
-#X msg 290 25 back;
-#X msg 290 49 label;
-#X msg 252 25 bang;
-#N canvas 15 207 606 448 RGB_____________ 0;
-#X obj 97 56 inlet;
-#X obj 262 53 inlet;
-#X obj 339 55 inlet;
-#X obj 405 56 inlet;
-#X obj 97 270 bang;
-#X msg 77 295 0;
-#X msg 104 295 1;
-#X obj 146 268 bang;
-#X msg 132 295 0;
-#X msg 160 295 1;
-#X obj 265 313 spigot;
-#X obj 312 313 spigot;
-#X obj 249 385 outlet;
-#X text 93 33 select;
-#X text 267 28 red;
-#X text 337 30 green;
-#X text 409 30 blue;
-#X obj 405 102 t b f;
-#X obj 339 160 +;
-#X obj 339 185 t b f;
-#X obj 339 216 +;
-#X obj 296 385 outlet;
-#X obj 28 180 loadbang;
-#X obj 296 361 f;
-#X obj 249 361 f;
-#X obj 262 79 * -65536;
-#X obj 339 80 * -256;
-#X obj 405 80 * -1;
-#X obj 339 247 - 1;
-#X obj 97 135 route back label bang;
-#X obj 235 168 t b b b;
-#X connect 0 0 29 0;
-#X connect 1 0 25 0;
-#X connect 2 0 26 0;
-#X connect 3 0 27 0;
-#X connect 4 0 5 0;
-#X connect 4 0 6 0;
-#X connect 5 0 11 1;
-#X connect 6 0 10 1;
-#X connect 7 0 8 0;
-#X connect 7 0 9 0;
-#X connect 8 0 10 1;
-#X connect 9 0 11 1;
-#X connect 10 0 24 1;
-#X connect 11 0 23 1;
-#X connect 17 0 18 0;
-#X connect 17 1 18 1;
-#X connect 18 0 19 0;
-#X connect 19 0 20 0;
-#X connect 19 1 20 1;
-#X connect 20 0 28 0;
-#X connect 22 0 6 0;
-#X connect 23 0 21 0;
-#X connect 24 0 12 0;
-#X connect 25 0 20 0;
-#X connect 26 0 18 0;
-#X connect 27 0 17 0;
-#X connect 28 0 11 0;
-#X connect 28 0 10 0;
-#X connect 29 0 4 0;
-#X connect 29 1 7 0;
-#X connect 29 2 30 0;
-#X connect 30 0 24 0;
-#X connect 30 1 23 0;
-#X connect 30 2 28 0;
-#X restore 290 86 pd RGB_____________;
-#X floatatom 332 55 3 0 255;
-#X floatatom 375 55 3 0 255;
-#X floatatom 418 56 3 0 255;
-#X text 39 3 preset-colors;
-#X text 301 0 RGB-colors;
-#X text 332 37 red;
-#X text 368 36 green;
-#X text 416 36 blue;
-#X obj 52 104 pack 0 0;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 1;
-#X connect 3 0 4 1;
-#X connect 4 0 30 0;
-#X connect 7 0 11 0;
-#X connect 8 0 7 0;
-#X connect 9 0 7 1;
-#X connect 10 0 11 1;
-#X connect 11 0 33 0;
-#X connect 12 0 16 0;
-#X connect 13 0 12 0;
-#X connect 14 0 12 1;
-#X connect 15 0 16 1;
-#X connect 16 0 34 0;
-#X connect 21 0 25 0;
-#X connect 22 0 21 0;
-#X connect 23 0 21 1;
-#X connect 24 0 25 1;
-#X connect 25 0 31 0;
-#X connect 28 0 38 0;
-#X connect 39 0 43 0;
-#X connect 40 0 39 0;
-#X connect 41 0 39 1;
-#X connect 42 0 43 1;
-#X connect 43 0 46 0;
-#X connect 48 0 66 0;
-#X connect 49 0 48 0;
-#X connect 50 0 48 1;
-#X connect 51 0 66 1;
-#X connect 54 0 57 0;
-#X connect 55 0 57 0;
-#X connect 56 0 57 0;
-#X connect 57 0 66 0;
-#X connect 57 1 66 1;
-#X connect 58 0 57 1;
-#X connect 59 0 57 2;
-#X connect 60 0 57 3;
-#X connect 66 0 29 0;
-#X restore 313 188 pd edit;
-#N canvas 147 336 290 278 source 0;
-#X obj 40 95 random 102;
-#X obj 40 171 - 101;
-#X obj 40 205 pack 0 0;
-#X obj 40 45 metro 300;
-#X obj 40 69 t b b;
-#X obj 133 95 random 20;
-#X obj 40 117 t f f;
-#X obj 91 147 +;
-#X obj 91 172 - 101;
-#X obj 40 21 inlet;
-#X obj 40 230 outlet;
-#X connect 0 0 6 0;
-#X connect 1 0 2 0;
-#X connect 2 0 10 0;
-#X connect 3 0 4 0;
-#X connect 4 0 0 0;
-#X connect 4 1 5 0;
-#X connect 5 0 7 1;
-#X connect 6 0 1 0;
-#X connect 6 1 7 0;
-#X connect 7 0 8 0;
-#X connect 8 0 2 1;
-#X connect 9 0 3 0;
-#X restore 99 62 pd source;
-#X obj 263 94 s fff;
-#X obj 186 302 x_all_guis aaa bbb ccc ddd eee fff ggg hhh iii;
-#X text 210 386 updated for Pd version 0.35;
-#X text 36 388 graz \, austria 2002;
-#X connect 3 0 21 0;
-#X connect 7 0 31 0;
-#X connect 8 0 9 0;
-#X connect 8 1 10 0;
-#X connect 21 0 20 0;
-#X connect 22 0 23 0;
-#X connect 23 0 21 0;
-#X connect 23 1 21 1;
-#X connect 28 0 8 0;
-#X connect 29 0 8 1;
-#X connect 31 0 8 0;
-#X connect 31 0 32 0;
diff --git a/pd/doc/5.reference/wrap~.pd b/pd/doc/5.reference/wrap~.pd
deleted file mode 100644
index 81681f30..00000000
--- a/pd/doc/5.reference/wrap~.pd
+++ /dev/null
@@ -1,26 +0,0 @@
-#N canvas 182 132 703 319 12;
-#X obj 58 220 metro 500;
-#X obj 58 195 r metro;
-#X msg 575 106 \; metro 0;
-#X msg 574 48 \; pd dsp 1 \; metro 1;
-#X floatatom 42 121 0 0 0;
-#X floatatom 42 277 0 0 0;
-#X text 443 271 updated for Pd version 0.33;
-#X obj 574 21 loadbang;
-#X obj 42 244 snapshot~;
-#X obj 42 147 sig~;
-#X obj 36 16 wrap~;
-#X text 93 16 - remainder modulo 1;
-#X text 18 45 wrap~ gives the difference between the input and the
-largest integer not exceeding it (for positive numbers this is the
-fractional part).;
-#X obj 42 171 wrap~;
-#X text 127 123 <-- shift-drag here to get non-integers to try;
-#X connect 0 0 8 0;
-#X connect 1 0 0 0;
-#X connect 1 0 0 0;
-#X connect 4 0 9 0;
-#X connect 7 0 3 0;
-#X connect 8 0 5 0;
-#X connect 9 0 13 0;
-#X connect 13 0 8 0;
diff --git a/pd/doc/5.reference/writesf~-help.pd b/pd/doc/5.reference/writesf~-help.pd
index 7cbb915b..03ea0b73 100644
--- a/pd/doc/5.reference/writesf~-help.pd
+++ b/pd/doc/5.reference/writesf~-help.pd
@@ -1,4 +1,4 @@
-#N canvas 279 74 734 440 12;
+#N canvas 146 65 733 567 12;
#X msg 592 11 \; pd dsp 1;
#X msg 141 163 print;
#X msg 53 83 bang;
@@ -12,9 +12,9 @@
#X text 188 141 stop streaming audio;
#X obj 131 207 writesf~ 2;
#X msg 131 31 open /tmp/foo.wav;
-#X obj 115 408 soundfiler;
-#X text 454 407 updated for Pd version 0.37;
-#X text 23 408 see also:;
+#X obj 131 538 soundfiler;
+#X text 485 540 updated for Pd version 0.37;
+#X text 36 539 see also:;
#X obj 145 185 osc~ 440;
#X text 34 257 writesf~ creates a subthread whose task is to write
audio streams to disk. You need not provide any disk access time between
@@ -25,10 +25,18 @@ give the object time to flush all the output to disk.;
#X text 377 59 create 24-bit soundfile;
#X text 376 86 create 32-bit floating-point soundfile;
#X msg 131 59 open -bytes 3 /tmp/foo.wav;
-#X text 32 338 The soundfile is 2- or 3-byte fixed point ("pcm") or
+#X text 33 339 The soundfile is 2- or 3-byte fixed point ("pcm") or
4-byte floating-point. The soundfile format is determined by the file
extent ("foo.wav" \, "foo.aiff" \, or "foo.snd").;
-#X obj 217 410 readsf~;
+#X obj 233 540 readsf~;
+#X text 66 413 -wave \, -nextstep \, -aiff;
+#X text 67 434 -big \, -little (nextstep only!);
+#X text 67 455 -bytes <2 \, 3 \, or 4>;
+#X text 67 477 -rate <sample rate>;
+#X text 32 395 The "open" message may take flag-style arguments as
+follows:;
+#X text 27 498 (setting sample rate will affect the soundfile header
+but the file will _not_ be resampled.);
#X connect 1 0 11 0;
#X connect 2 0 3 0;
#X connect 2 0 5 0;
diff --git a/pd/doc/5.reference/writesf~.pd b/pd/doc/5.reference/writesf~.pd
deleted file mode 100644
index 053e0dee..00000000
--- a/pd/doc/5.reference/writesf~.pd
+++ /dev/null
@@ -1,27 +0,0 @@
-#N canvas 388 177 450 290 10;
-#X msg 365 19 \; pd dsp 1;
-#X msg 141 133 print;
-#X msg 56 50 bang;
-#X msg 140 85 start;
-#X msg 142 111 stop;
-#X obj 189 133 osc~ 441;
-#X obj 56 81 del 1000;
-#X text 41 9 writesf~ -- write audio signals to a soundfile;
-#X text 269 276 updated for Pd version 0.32.;
-#X text 205 158 creation argument is number of channels;
-#X text 206 169 (1 to 64).;
-#X text 250 58 create a new soundfile;
-#X text 181 85 start streaming audio;
-#X text 176 111 stop streaming audio;
-#X text 27 186 writesf~ creates a subthread whose task is to write audio streams to disk. You need not provide any access time between "open" and "start" \, but between "stop" and the next "open" you must give the object time to flush all the output to disk.;
-#X text 27 240 writesf~ works best with pd in "realtime" mode (pd -rt). Available for linux only at the moment...;
-#X obj 132 158 writesf~ 2;
-#X msg 136 60 open /tmp/foo.wav;
-#X connect 1 0 16 0;
-#X connect 2 0 3 0;
-#X connect 2 0 6 0;
-#X connect 3 0 16 0;
-#X connect 4 0 16 0;
-#X connect 5 0 16 0;
-#X connect 6 0 4 0;
-#X connect 17 0 16 0;
diff --git a/pd/doc/5.reference/x_all_guis.pd b/pd/doc/5.reference/x_all_guis.pd
deleted file mode 100644
index 3c18031b..00000000
--- a/pd/doc/5.reference/x_all_guis.pd
+++ /dev/null
@@ -1,20 +0,0 @@
-#N canvas 209 342 290 271 10;
-#X obj 23 31 bng 15 250 50 532480 \$1 \$1 empty 20 8 192 8 -262144
--1 -1;
-#X obj 23 63 tgl 15 1.06496e+06 \$2 \$2 empty 20 8 192 8 -262144 -1
--1 0 1;
-#X obj 22 95 vsl 15 128 0 127 0 1.59744e+06 \$3 \$3 empty 20 8 192
-8 -262144 -1 -1 0 1;
-#X obj 65 30 hsl 128 15 0 127 0 2.12992e+06 \$4 \$4 empty 20 8 192
-8 -262144 -1 -1 0 1;
-#X obj 63 63 hdl 15 1 2.6624e+06 8 \$5 \$5 empty 20 8 192 8 -262144
--1 -1 0;
-#X obj 62 99 vu 15 120 \$6 empty 35 8 64 8 -66577 -1 1 49152;
-#X obj 115 99 cnv 15 100 60 \$7 \$7 \$7 20 12 917696 14 -233017 -66577
-3.72736e+06;
-#X obj 41 308 inlet;
-#X obj 41 334 outlet;
-#X obj 227 30 vdl 15 1 4.79232e+06 8 \$9 \$9 empty 20 8 192 8 -262144
--1 -1 0;
-#X obj 116 176 nbx 5 14 -1e+37 1e+37 0 4.25984e+06 \$8 \$8 empty 45
-7 192 10 -262144 -1 -1 0;
diff --git a/pd/doc/6.externs/foo1.c b/pd/doc/6.externs/foo1.c
deleted file mode 100644
index 48d0d344..00000000
--- a/pd/doc/6.externs/foo1.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* code for foo1 pd class */
-
-#include "m_pd.h"
-
-typedef struct foo1
-{
- t_object t_ob;
-} t_foo1;
-
-void foo1_float(t_foo1 *x, t_floatarg f)
-{
- post("foo1: %f", f);
-}
-
-void foo1_rats(t_foo1 *x)
-{
- post("foo1: rats");
-}
-
-t_class *foo1_class;
-
-void *foo1_new(void)
-{
- t_foo1 *x = (t_foo1 *)pd_new(foo1_class);
- post("foo1_new");
- return (void *)x;
-}
-
-void foo1_setup(void)
-{
- post("foo1_setup");
- foo1_class = class_new(gensym("foo1"), (t_newmethod)foo1_new, 0,
- sizeof(t_foo1), 0, 0);
- class_addmethod(foo1_class, (t_method)foo1_rats, gensym("rats"), 0);
- class_addfloat(foo1_class, foo1_float);
-}
-
diff --git a/pd/doc/6.externs/foo2.c b/pd/doc/6.externs/foo2.c
deleted file mode 100644
index e68ed996..00000000
--- a/pd/doc/6.externs/foo2.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* code for foo2 pd class */
-
-#include "m_pd.h"
-
-typedef struct foo2
-{
- t_object t_ob;
-} t_foo2;
-
-void foo2_float(t_foo2 *x, t_floatarg f)
-{
- post("foo2: %f", f);
-}
-
-void foo2_rats(t_foo2 *x)
-{
- post("foo2: rats");
-}
-
-void foo2_ft1(t_foo2 *x, t_floatarg g)
-{
- post("ft1: %f", g);
-}
-
-void foo2_free(void)
-{
- post("foo2_free");
-}
-
-t_class *foo2_class;
-
-void *foo2_new(void)
-{
- t_foo2 *x = (t_foo2 *)pd_new(foo2_class);
- inlet_new(&x->t_ob, &x->t_ob.ob_pd, gensym("float"), gensym("ft1"));
- post("foo2_new");
- return (void *)x;
-}
-
-void foo2_setup(void)
-{
- post("foo2_setup");
- foo2_class = class_new(gensym("foo2"), (t_newmethod)foo2_new,
- (t_method)foo2_free, sizeof(t_foo2), 0, 0);
- class_addmethod(foo2_class, (t_method)foo2_rats, gensym("rats"), 0);
- class_addmethod(foo2_class, (t_method)foo2_ft1, gensym("ft1"), A_FLOAT, 0);
- class_addfloat(foo2_class, foo2_float);
-}
-
diff --git a/pd/doc/6.externs/test-foo1.pd b/pd/doc/6.externs/test-foo1.pd
deleted file mode 100644
index 280be821..00000000
--- a/pd/doc/6.externs/test-foo1.pd
+++ /dev/null
@@ -1,6 +0,0 @@
-#N canvas 68 38 269 168 10;
-#X obj 68 90 foo1;
-#X msg 68 52 5;
-#X msg 100 52 rats;
-#X connect 1 0 0 0;
-#X connect 2 0 0 0;
diff --git a/pd/doc/6.externs/test-foo2.pd b/pd/doc/6.externs/test-foo2.pd
deleted file mode 100644
index be62e140..00000000
--- a/pd/doc/6.externs/test-foo2.pd
+++ /dev/null
@@ -1,8 +0,0 @@
-#N canvas 171 53 269 164 10;
-#X msg 100 52 rats;
-#X obj 68 90 foo2;
-#X msg 155 55 7;
-#X msg 68 52 4;
-#X connect 0 0 1 0;
-#X connect 2 0 1 1;
-#X connect 3 0 1 0;
diff --git a/pd/doc/7.stuff/data-structures/1.scalars.pd b/pd/doc/7.stuff/data-structures/1.scalars.pd
index c2c465bf..ec5794cb 100644
--- a/pd/doc/7.stuff/data-structures/1.scalars.pd
+++ b/pd/doc/7.stuff/data-structures/1.scalars.pd
@@ -1,20 +1,23 @@
+#N struct template1 float x float y float z float q;
#N canvas 363 11 579 461 12;
#N canvas 13 22 297 180 data 1;
+#X scalar template1 50 100 30 9 \;;
+#X scalar template1 150 100 -20 900 \;;
#X restore 60 347 pd data;
#N canvas 10 274 550 324 template1 1;
#X obj 60 46 filledpolygon 244 q 5 0 0 20 z 40 0;
-#X obj 60 21 template float x float y float z float q;
-#X text 3 67 This subpatch acts as a template which describes the data
-structure. The "template" specifies four floating point values named
-x \, y \, z \, and q. The "filledpolygon" is a drawing instruction.
-Templates should have only one template object but may have any number
-of drawing instructions.;
#X text 4 164 The filledpolygon's arguments are interior color \, border
color \, border width \, and then the points of the polygon. Arguments
which are symbols ("q" and "z" in this case) mean to take the values
from the data structure. Other values are constant. The position of
the object is automatically controlled by fields named "x" and "y".
;
+#X obj 60 21 struct template1 float x float y float z float q;
+#X text 3 67 This subpatch acts as a template which describes the data
+structure. The "struct" specifies four floating point values named
+x \, y \, z \, and q. The "filledpolygon" is a drawing instruction.
+Templates should have only one template object but may have any number
+of drawing instructions.;
#X restore 60 371 pd template1;
#N canvas 0 0 440 292 stuff 0;
#X obj 235 185 pointer;
diff --git a/pd/doc/7.stuff/data-structures/2.getting.data.pd b/pd/doc/7.stuff/data-structures/2.getting.data.pd
index bebd7371..123b869f 100644
--- a/pd/doc/7.stuff/data-structures/2.getting.data.pd
+++ b/pd/doc/7.stuff/data-structures/2.getting.data.pd
@@ -1,3 +1,4 @@
+#N struct template2 float x float y float z float q;
#N canvas 363 11 630 603 12;
#X text 311 559 updated for Pd version 0.32.;
#N canvas 42 312 598 266 stuff 0;
@@ -25,18 +26,21 @@
#X msg 27 271 next;
#X text 75 301 <- object that outputs pointers to scalars;
#N canvas 13 22 345 271 data2 1;
+#X scalar template2 53 202 30 9 \;;
+#X scalar template2 203 152 -20 900 \;;
+#X scalar template2 103 152 -50 30 \;;
#X restore 506 265 pd data2;
-#N canvas 15 278 427 138 template2 0;
-#X obj 60 46 filledpolygon 244 q 5 0 0 20 z 40 0;
-#X obj 60 21 template float x float y float z float q;
+#N canvas 15 278 554 155 template2 0;
+#X obj 15 46 filledpolygon 244 q 5 0 0 20 z 40 0;
#X text 13 79 The template for the two scalars \, as in the last patch
;
+#X obj 15 21 struct template2 float x float y float z float q;
#X restore 506 288 pd template2;
#X obj 15 355 get template2 x y z q;
-#X floatatom 15 384 5 0 0;
-#X floatatom 76 384 5 0 0;
-#X floatatom 137 384 5 0 0;
-#X floatatom 199 385 5 0 0;
+#X floatatom 15 384 5 0 0 0 - - -;
+#X floatatom 76 384 5 0 0 0 - - -;
+#X floatatom 137 384 5 0 0 0 - - -;
+#X floatatom 199 385 5 0 0 0 - - -;
#X msg 15 246 traverse pd-data2;
#X obj 59 330 print;
#X text 100 330 <- this gets a bang when we reach the end;
diff --git a/pd/doc/7.stuff/data-structures/3.setting.data.pd b/pd/doc/7.stuff/data-structures/3.setting.data.pd
index d951a0a8..1f300ca3 100644
--- a/pd/doc/7.stuff/data-structures/3.setting.data.pd
+++ b/pd/doc/7.stuff/data-structures/3.setting.data.pd
@@ -1,23 +1,49 @@
-#N canvas 401 39 490 472 12;
-#X floatatom 60 371 0 0 0;
-#X floatatom 60 323 0 0 0;
-#X floatatom 60 275 0 0 0;
-#X floatatom 60 227 0 0 0;
-#X floatatom 324 322 0 0 0;
-#X floatatom 283 322 0 0 0;
-#X floatatom 240 322 0 0 0;
+#N struct template3 float x float y float w float h float q;
+#N canvas 401 39 621 469 12;
+#X floatatom 60 371 0 0 0 0 - - -;
+#X floatatom 60 323 0 0 0 0 - - -;
+#X floatatom 60 275 0 0 0 0 - - -;
+#X floatatom 60 227 0 0 0 0 - - -;
+#X floatatom 324 322 0 0 0 0 - - -;
+#X floatatom 283 322 0 0 0 0 - - -;
+#X floatatom 240 322 0 0 0 0 - - -;
#X obj 197 274 pointer;
#X msg 205 249 next;
-#X floatatom 197 322 0 0 0;
+#X floatatom 197 322 0 0 0 0 - - -;
#N canvas 19 29 363 341 data3 1;
+#X scalar template3 18 25 43 18 741 \;;
+#X scalar template3 111 109 75 25 72 \;;
+#X scalar template3 111 32 4 15 163 \;;
+#X scalar template3 59 1 13 34 563 \;;
+#X scalar template3 148 26 37 20 566 \;;
+#X scalar template3 173 221 76 48 763 \;;
+#X scalar template3 250 127 18 36 543 \;;
+#X scalar template3 124 210 78 21 107 \;;
+#X scalar template3 264 183 32 32 178 \;;
+#X scalar template3 26 28 56 60 132 \;;
+#X scalar template3 2 202 66 2 808 \;;
+#X scalar template3 246 33 74 51 642 \;;
+#X scalar template3 214 226 8 43 180 \;;
+#X scalar template3 57 145 51 58 939 \;;
+#X scalar template3 216 102 36 43 505 \;;
+#X scalar template3 166 86 68 9 614 \;;
+#X scalar template3 144 191 56 28 886 \;;
+#X scalar template3 228 2 62 1 758 \;;
+#X scalar template3 168 169 48 22 644 \;;
+#X scalar template3 223 248 73 50 727 \;;
#X restore 269 425 pd data3;
-#N canvas 100 436 466 223 template3 0;
+#N canvas 100 436 466 223 template3 1;
#X obj 25 68 filledpolygon q 0 1 0 0 w 0 w h 0 h;
#X obj 26 163 drawnumber q 0 0 0;
-#X obj 24 19 template float x float y float w float h float q;
#X text 22 39 five numeric ("float") fields;
-#X text 25 88 drawing a rectangle \, interior color q \, border black and one unit thick \, through the points (0 \, 0) \, (w \, 0) \, (w \, h) \, and (0 \, h). Note that the three points containing variables become hot spots for mouse dragging.;
-#X text 26 184 Draw the value of q as an Araboc numeral \, at (0 \, 0) \, in black.;
+#X text 25 88 drawing a rectangle \, interior color q \, border black
+and one unit thick \, through the points (0 \, 0) \, (w \, 0) \, (w
+\, h) \, and (0 \, h). Note that the three points containing variables
+become hot spots for mouse dragging.;
+#X text 26 184 Draw the value of q as an Araboc numeral \, at (0 \,
+0) \, in black.;
+#X obj 24 19 struct template3 float x float y float w float h float
+q;
#X restore 269 446 pd template3;
#N canvas 313 223 587 367 stuff 0;
#X obj 352 180 pointer;
@@ -73,17 +99,27 @@
#X restore 269 404 pd stuff;
#X msg 269 379 remake;
#X obj 197 298 get template3 x y w h q;
-#X floatatom 356 322 0 0 0;
+#X floatatom 356 322 0 0 0 0 - - -;
#X obj 60 251 set template3 x;
#X obj 60 299 set template3 y;
#X obj 60 347 set template3 w;
#X obj 60 394 set template3 h;
-#X floatatom 60 418 0 0 0;
+#X floatatom 60 418 0 0 0 0 - - -;
#X obj 60 441 set template3 q;
#X msg 197 226 traverse pd-data3;
-#X text 46 5 The "set" object allows you to change numeric values. In this example \, the template specifies five fields describing the (x \, y) location \, width \, height \, and color. A new feature is that the color is also getting printed out under the rectangles. This is done using the "drawnumber" object in the template.;
+#X text 46 5 The "set" object allows you to change numeric values.
+In this example \, the template specifies five fields describing the
+(x \, y) location \, width \, height \, and color. A new feature is
+that the color is also getting printed out under the rectangles. This
+is done using the "drawnumber" object in the template.;
#X text 323 378 <- click to randomize;
-#X text 46 87 Getting parameter values is as inthe previous patch \; however \, as you traverse the list with "next" messages the new pointers are also sent to the five "set" objects. These have as arguments the template name and the name of the field they will set. You can drag on the five number boxes (after selecting an object with "traverse" and "next" messages) to change its location \, shape \, and color.;
+#X text 45 99 Getting parameter values is as in the previous patch
+\; however \, as you traverse the list with "next" messages the new
+pointers are also sent to the five "set" objects. These have as arguments
+the template name and the name of the field they will set. You can
+drag on the five number boxes (after selecting an object with "traverse"
+and "next" messages) to change its location \, shape \, and color.
+;
#X connect 0 0 19 0;
#X connect 1 0 18 0;
#X connect 2 0 17 0;
diff --git a/pd/doc/7.stuff/data-structures/4.append.pd b/pd/doc/7.stuff/data-structures/4.append.pd
index 2c1991d9..b5c2492b 100644
--- a/pd/doc/7.stuff/data-structures/4.append.pd
+++ b/pd/doc/7.stuff/data-structures/4.append.pd
@@ -11,13 +11,13 @@ and to output its value ("bang") to the "append" object. This object
is then given numeric values to create three items.;
#X obj 11 336 append template4 x y z q;
#X msg 421 269 \; pd-data4 clear;
-#N canvas 0 0 318 188 data4 1;
+#N canvas 0 0 315 341 data4 1;
#X restore 430 219 pd data4;
-#N canvas 15 278 427 138 template4 0;
-#X obj 60 46 filledpolygon 244 q 5 0 0 20 z 40 0;
-#X obj 60 21 template float x float y float z float q;
+#N canvas 15 278 519 148 template4 0;
+#X obj 17 44 filledpolygon 244 q 5 0 0 20 z 40 0;
#X text 13 79 The template for the two scalars \, as in the last patch
;
+#X obj 17 19 struct template4 float x float y float z float q;
#X restore 428 243 pd template4;
#X msg 421 309 traverse pd-data4 \, bang;
#X text 57 165 The outlet of "append" is a pointer to the newly created
diff --git a/pd/doc/7.stuff/data-structures/5.array.pd b/pd/doc/7.stuff/data-structures/5.array.pd
index 9c1996a7..234d039d 100644
--- a/pd/doc/7.stuff/data-structures/5.array.pd
+++ b/pd/doc/7.stuff/data-structures/5.array.pd
@@ -1,20 +1,26 @@
+#N struct template5 float x float y float z float q array bazoo template5-element
+;
+#N struct template5-element float y;
#N canvas 67 294 709 456 12;
#X obj 235 323 pointer;
-#X floatatom 232 183 0 0 0;
+#X floatatom 232 183 0 0 0 0 - - -;
#X msg 235 300 bang;
-#X floatatom 15 200 0 0 0;
-#X floatatom 17 350 0 0 0;
-#X floatatom 235 369 0 0 0;
-#X floatatom 451 276 0 0 0;
+#X floatatom 15 200 0 0 0 0 - - -;
+#X floatatom 17 350 0 0 0 0 - - -;
+#X floatatom 235 369 0 0 0 0 - - -;
+#X floatatom 451 276 0 0 0 0 - - -;
#X obj 451 229 pointer;
#X obj 318 163 pointer;
#X msg 449 194 bang;
#N canvas 0 0 384 196 data5 1;
+#X scalar template5 50 150 30 9 \; 0 \; 0 \; 0 \; 0 \; 0 \; 3 \; 0
+\; 0 \; 0 \; 7 \; -30 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0
+\; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \;
+0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 0 \; 43 \; 0
+\; 0 \; 0 \; 0 \; \;;
#X restore 508 314 pd data5;
-#N canvas 5 272 431 226 template5 0;
+#N canvas 5 272 646 260 template5 1;
#X obj 8 91 filledpolygon 244 q 3 0 0 20 z 40 0;
-#X obj 6 8 template float x float y float z float q array bazoo template5-element
-;
#X obj 8 113 plot bazoo 700 3 30 10 4;
#X text 6 44 this declares an array named "bazoo" whose elements are
described by "template5-element." Array declarations take three arguments
@@ -24,13 +30,15 @@ while "float" declarations take only two.;
spaced 4 apart.;
#X text 7 186 You can also do (x \, y) plots and/or make the line thickness
variable---see the help window for "plot".;
+#X obj 6 8 struct template5 float x float y float z float q array bazoo
+template5-element;
#X restore 508 337 pd template5;
-#N canvas 65 248 442 101 template5-element 0;
-#X obj 35 11 template float y;
+#N canvas 65 248 568 128 template5-element 0;
#X text 12 36 This says that array elements will have a single floating-point
number named "y". The variable name "y" is automatically assumed to
control screen height \; if you don't have at least that variable you
can't plot the array..;
+#X obj 35 11 struct template5-element float y;
#X restore 508 360 pd template5-element;
#N canvas 515 84 589 429 stuff 0;
#X obj 354 163 pointer;
@@ -45,8 +53,8 @@ can't plot the array..;
#X obj 137 23 loadbang;
#X msg 134 140 50 150 30 9;
#X obj 134 191 t b b p;
-#X floatatom 68 327 0 0 0;
-#X floatatom 14 332 0 0 0;
+#X floatatom 68 327 0 0 0 0 - - -;
+#X floatatom 14 332 0 0 0 0 - - -;
#X obj 14 376 set template5-element y;
#X obj 68 350 element template5 bazoo;
#X obj 20 303 unpack;
diff --git a/pd/doc/7.stuff/data-structures/6.file.pd b/pd/doc/7.stuff/data-structures/6.file.pd
index 1196d1a1..30c902dc 100644
--- a/pd/doc/7.stuff/data-structures/6.file.pd
+++ b/pd/doc/7.stuff/data-structures/6.file.pd
@@ -1,42 +1,43 @@
#N canvas 405 27 291 318 12;
#N canvas 0 0 377 383 data 1;
#X restore 40 153 pd data;
-#N canvas 50 470 523 157 template-toplevel 0;
-#X obj 120 112 plot bazoo 700 3 10 20 20;
-#X obj 120 48 template float x float y float z float q array bazoo template-element;
-#X obj 120 86 drawpolygon q 4 0 0 20 z z -5 10 20;
+#N canvas 50 470 557 157 template-toplevel 0;
+#X obj 21 94 plot bazoo 700 3 10 20 20;
+#X obj 21 68 drawpolygon q 4 0 0 20 z z -5 10 20;
+#X obj 21 30 struct template-toplevel float x float y float z float
+q array bazoo template-element;
#X restore 40 174 pd template-toplevel;
#N canvas 199 231 600 239 template-element 0;
-#X obj 59 48 template float x float y float w;
-#X obj 80 89 drawpolygon 10 2 5 0 0 -5 -5 0 0 5 5 0;
+#X obj 58 83 drawpolygon 10 2 5 0 0 -5 -5 0 0 5 5 0;
+#X obj 59 48 struct template-element float x float y float w;
#X restore 40 197 pd template-element;
#X msg 45 16 \; pd-data clear;
#N canvas 125 240 709 410 traversal 0;
-#X floatatom 212 353 0 0 0;
+#X floatatom 212 353 0 0 0 0 - - -;
#X obj 212 376 set template-toplevel q;
-#X floatatom 212 307 0 0 0;
-#X floatatom 210 255 0 0 0;
-#X floatatom 96 62 0 0 0;
-#X floatatom 97 114 0 0 0;
-#X floatatom 23 144 0 0 0;
-#X floatatom 210 209 0 0 0;
-#X floatatom 617 194 0 0 0;
-#X floatatom 550 192 0 0 0;
-#X floatatom 486 191 0 0 0;
+#X floatatom 212 307 0 0 0 0 - - -;
+#X floatatom 210 255 0 0 0 0 - - -;
+#X floatatom 96 62 0 0 0 0 - - -;
+#X floatatom 97 114 0 0 0 0 - - -;
+#X floatatom 23 144 0 0 0 0 - - -;
+#X floatatom 210 209 0 0 0 0 - - -;
+#X floatatom 617 194 0 0 0 0 - - -;
+#X floatatom 550 192 0 0 0 0 - - -;
+#X floatatom 486 191 0 0 0 0 - - -;
#X obj 419 116 pointer;
#X obj 419 168 get template-toplevel x y z q;
#X msg 450 90 next;
-#X floatatom 419 191 0 0 0;
+#X floatatom 419 191 0 0 0 0 - - -;
#X obj 23 169 set template-element y;
#X obj 97 137 element template-toplevel bazoo;
#X obj 96 85 setsize template-toplevel bazoo;
#X obj 210 232 set template-toplevel x;
#X obj 210 278 set template-toplevel y;
#X obj 212 330 set template-toplevel z;
-#X floatatom 22 200 0 0 0;
+#X floatatom 22 200 0 0 0 0 - - -;
#X obj 22 225 set template-element x;
#X msg 419 67 traverse pd-data \, next;
-#X floatatom 26 258 0 0 0;
+#X floatatom 26 258 0 0 0 0 - - -;
#X obj 26 283 set template-element w;
#X connect 0 0 1 0;
#X connect 2 0 20 0;
diff --git a/pd/doc/7.stuff/data-structures/7.sequencer.pd b/pd/doc/7.stuff/data-structures/7.sequencer.pd
index 6b815191..f270b48e 100644
--- a/pd/doc/7.stuff/data-structures/7.sequencer.pd
+++ b/pd/doc/7.stuff/data-structures/7.sequencer.pd
@@ -6,9 +6,9 @@ template-pitch array amp template-amp;
#N canvas 565 104 524 166 template-toplevel 0;
#X obj 25 86 plot pitch voiceno 3 10 0;
#X obj 25 113 plot amp 0 3 10 0;
-#X obj 27 60 filledpolygon 9 9 0 0 -10 0 10 5 10 5 -10;
#X obj 25 21 struct template-toplevel float x float y float voiceno
array pitch template-pitch array amp template-amp;
+#X obj 27 61 filledpolygon 9 9 0 0 -2 0 2 5 2 5 -2;
#X restore 64 197 pd template-toplevel;
#N canvas 0 0 419 102 template-amp 0;
#X obj 15 41 struct template-amp float x float y float w;
@@ -16,7 +16,7 @@ array pitch template-pitch array amp template-amp;
#N canvas 42 221 452 87 template-pitch 0;
#X obj 21 29 struct template-pitch float x float y float w;
#X restore 66 242 pd template-pitch;
-#N canvas 282 38 522 569 synthesis 0;
+#N canvas 323 50 551 562 synthesis 0;
#X msg 125 220 next;
#X msg 108 172 traverse pd-data \, next;
#X obj 108 250 pointer template-toplevel;
@@ -32,14 +32,8 @@ array pitch template-pitch array amp template-amp;
#X obj 108 354 route 0 9 90 900 99 909 990;
#X obj 55 372 voice;
#X obj 55 536 outlet~;
-#X obj 55 395 voice;
-#X obj 55 418 voice;
-#X obj 55 441 voice;
#X msg 298 58 \; reset-stop stop \; time-of-last-evt 0 \; pd-data sort
;
-#X obj 55 465 voice;
-#X obj 55 488 voice;
-#X obj 55 511 voice;
#X obj 372 351 s delay-multiplier;
#X obj 375 276 t b f;
#X msg 372 303 1000;
@@ -47,6 +41,12 @@ array pitch template-pitch array amp template-amp;
#X obj 375 250 r tempo;
#X obj 108 90 t b b b;
#X msg 130 136 \; pd-data sort;
+#X obj 55 395 voice;
+#X obj 55 418 voice;
+#X obj 55 441 voice;
+#X obj 55 465 voice;
+#X obj 55 488 voice;
+#X obj 55 511 voice;
#X connect 0 0 2 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
@@ -55,35 +55,35 @@ array pitch template-pitch array amp template-amp;
#X connect 4 0 5 0;
#X connect 5 0 12 0;
#X connect 6 0 7 0;
-#X connect 7 0 27 0;
+#X connect 7 0 21 0;
#X connect 7 1 8 0;
-#X connect 9 0 18 0;
+#X connect 9 0 15 0;
#X connect 11 0 0 0;
#X connect 12 0 13 1;
-#X connect 12 1 15 1;
-#X connect 12 2 16 1;
-#X connect 12 3 17 1;
-#X connect 12 4 19 1;
-#X connect 12 5 20 1;
-#X connect 12 6 21 1;
-#X connect 13 0 15 0;
-#X connect 15 0 16 0;
-#X connect 16 0 17 0;
-#X connect 17 0 19 0;
-#X connect 19 0 20 0;
-#X connect 20 0 21 0;
-#X connect 21 0 14 0;
+#X connect 12 1 23 1;
+#X connect 12 2 24 1;
+#X connect 12 3 25 1;
+#X connect 12 4 26 1;
+#X connect 12 5 27 1;
+#X connect 12 6 28 1;
+#X connect 13 0 23 0;
+#X connect 17 0 18 0;
+#X connect 17 1 19 1;
+#X connect 18 0 19 0;
+#X connect 19 0 16 0;
+#X connect 20 0 17 0;
+#X connect 21 0 1 0;
+#X connect 21 1 22 0;
+#X connect 21 2 10 0;
#X connect 23 0 24 0;
-#X connect 23 1 25 1;
#X connect 24 0 25 0;
-#X connect 25 0 22 0;
-#X connect 26 0 23 0;
-#X connect 27 0 1 0;
-#X connect 27 1 28 0;
-#X connect 27 2 10 0;
+#X connect 25 0 26 0;
+#X connect 26 0 27 0;
+#X connect 27 0 28 0;
+#X connect 28 0 14 0;
#X restore 64 323 pd synthesis;
-#X floatatom 278 276 0 0 0;
-#X floatatom 92 358 0 0 0;
+#X floatatom 278 276 0 0 0 0 - - -;
+#X floatatom 92 358 0 0 0 0 - - -;
#N canvas 159 26 495 270 output 0;
#X obj 345 163 t b;
#X obj 345 112 f;
@@ -138,25 +138,26 @@ array pitch template-pitch array amp template-amp;
#X restore 64 380 pd output;
#X msg 122 358 MUTE;
#X msg 64 296 start;
-#X msg 111 296 stop;
-#N canvas 22 39 392 386 data 0;
-#X scalar template-toplevel 2 246 900 \; 0 0 50 \; 10 0 50 \; \; 0
-0 0 \; 10 0 10 \; 11 0 0 \; \;;
-#X scalar template-toplevel 13 220 990 \; 0 0 50 \; 10 0 50 \; \; 0
-0 10 \; 10 0 10 \; 11 0 0 \; \;;
-#X scalar template-toplevel 34 73 90 \; 0 250 50 \; 100 50 0 \; 100
-50 50 \; 230 200 0 \; 230 50 10 \; 240 300 1 \; 240 100 50 \; 250 250
-1 \; 250 150 50 \; 260 250 1 \; 285 250 1 \; \; 0 0 2 \; 100 0 5 \;
-200 0 6 \; 225 0 2 \; 230 0 5 \; 260 0 10 \; 261 0 5 \; 265 0 0 \;
-266 0 6 \; 270 0 0 \; 271 0 8 \; 275 0 0 \; 276 0 10 \; 280 0 0 \;
-281 0 12 \; 285 0 0 \; \;;
-#X scalar template-toplevel 67 282 900 \; 0 20 1 \; 60 20 1 \; \; 0
-0 0 \; 30 0 14 \; 60 0 0 \; \;;
-#X scalar template-toplevel 141 322 900 \; 0 0 50 \; 70 -70 50 \; \;
-0 0 0 \; 10 0 10 \; 20 0 0 \; 30 0 0 \; 40 0 10 \; 50 0 0 \; 60 0 10
-\; 70 0 0 \; \;;
-#X scalar template-toplevel 326 192 909 \; 0 0 50 \; 50 0 50 \; \;
-0 0 15 \; 10 0 10 \; 50 0 0 \; \;;
+#X msg 115 296 stop;
+#N canvas 22 39 471 498 data 1;
+#X scalar template-toplevel 3 86 900 \; 0 0 12 \; 10 0 12 \; \; 0 0
+0 \; 10 0 2.5 \; 11 0 0 \; \;;
+#X scalar template-toplevel 14 80 990 \; 0 0 12 \; 10 0 12 \; \; 0
+0 2.5 \; 10 0 2.5 \; 11 0 0 \; \;;
+#X scalar template-toplevel 38 43.25 90 \; 0 65 12 \; 100 10 0 \; 100
+10 12 \; 230 50 0 \; 230 10 3 \; 240 60 0 \; 240 25 10 \; 250 60 0
+\; 250 37 10 \; 260 65 0.5 \; 285 65 0.5 \; \; 1 0 2 \; 103 0 1 \;
+195 0 2 \; 220 0 0.75 \; 225 0 1.25 \; 248 0 2.5 \; 251 0 2.25 \; 255
+0 0 \; 256 0 1.5 \; 260 0 0 \; 261 0 2 \; 265 0 0 \; 266 0 2.5 \; 270
+0 0 \; 271 0 3 \; 275 0 0 \; \;;
+#X scalar template-toplevel 64 80 900 \; 0 5 0.25 \; 60 5 0.25 \; \;
+0 0 0 \; 28 -0.25 3.5 \; 58 -0.25 0 \; \;;
+#X scalar template-toplevel 142 105 900 \; 0 0 12 \; 70 -20 12 \; \;
+0 0 0 \; 10 0 2.5 \; 20 0 0 \; 30 0 0 \; 40 0 2.5 \; 50 0 0 \; 60 0
+2.5 \; 70 0 0 \; \;;
+#X scalar template-toplevel 319 63.5 909 \; 0 0 12 \; 50 0 12 \; \;
+0 0 4 \; 10 0 2.5 \; 50 0 0 \; \;;
+#X coords 0 124.5 1 124.25 0 0 0;
#X restore 64 176 pd data;
#N canvas 82 467 332 145 stuff 0;
#X msg 1 101 \; pd-data write xx.txt;
@@ -180,7 +181,7 @@ over the life of the event.;
can set the tempo lower if that helps you follow the "score" the first
couple of times.;
#X text 311 276 <--- tempo;
-#X text 256 416 Updated for Pd version 0.32;
+#X text 256 416 Updated for Pd version 0.36;
#X connect 3 0 6 0;
#X connect 4 0 14 0;
#X connect 5 0 6 1;
diff --git a/pd/doc/7.stuff/data-structures/voice.pd b/pd/doc/7.stuff/data-structures/voice.pd
index 2d124db7..20f2856d 100644
--- a/pd/doc/7.stuff/data-structures/voice.pd
+++ b/pd/doc/7.stuff/data-structures/voice.pd
@@ -2,7 +2,6 @@
#X obj 180 96 inlet;
#X obj 169 288 pack;
#X obj 169 395 line~;
-#X obj 169 238 sqrt;
#X obj 169 262 sqrt;
#X obj 169 480 *~;
#X obj 169 419 *~;
@@ -10,118 +9,111 @@
#X obj 92 478 inlet~;
#X obj 92 526 outlet~;
#X obj 92 502 +~;
-#X obj 436 411 line~;
-#X obj 436 435 *~;
-#X obj 436 459 *~;
-#X obj 436 283 mtof;
-#X obj 394 187 +;
-#X obj 436 307 sqrt;
-#X obj 436 331 sqrt;
-#X obj 436 387 pack;
-#X obj 169 214 / 6;
+#X obj 434 411 line~;
+#X obj 434 435 *~;
+#X obj 434 459 *~;
+#X obj 434 283 mtof;
+#X obj 405 187 +;
+#X obj 434 307 sqrt;
+#X obj 434 331 sqrt;
+#X obj 434 387 pack;
#X obj 189 343 r reset;
#X msg 189 367 0 20;
#X obj 180 120 data-start template-toplevel;
#X obj 6 150 data-array template-toplevel amp template-amp;
#X obj 433 148 data-array template-toplevel pitch template-pitch;
#X obj 308 437 noise~;
-#X obj 477 259 +;
-#X obj 477 282 mtof;
-#X obj 477 306 sqrt;
-#X obj 477 330 sqrt;
-#X obj 477 411 line~;
-#X obj 477 435 *~;
-#X obj 477 459 *~;
-#X obj 477 387 pack;
-#X obj 394 411 line~;
-#X obj 394 435 *~;
-#X obj 394 459 *~;
-#X obj 394 387 pack;
-#X obj 394 284 mtof;
-#X obj 394 308 sqrt;
-#X obj 394 332 sqrt;
-#X obj 394 262 -;
+#X obj 485 259 +;
+#X obj 485 282 mtof;
+#X obj 485 306 sqrt;
+#X obj 485 330 sqrt;
+#X obj 485 411 line~;
+#X obj 485 435 *~;
+#X obj 485 459 *~;
+#X obj 485 387 pack;
+#X obj 384 411 line~;
+#X obj 384 435 *~;
+#X obj 384 459 *~;
+#X obj 384 387 pack;
+#X obj 384 284 mtof;
+#X obj 384 308 sqrt;
+#X obj 384 332 sqrt;
+#X obj 384 262 -;
#X obj 240 520 vcf~ 10;
#X obj 315 520 vcf~ 10;
#X obj 390 516 vcf~ 10;
#X text 13 7 This is an abstraction used in the sequencer example.
Here we take care of the audio synthesis \, according to timed controls
from the the "data-start" and "data-array" subpatches.;
-#X text 505 458 calculate time-varying center frequencies;
+#X text 521 459 calculate time-varying center frequencies;
#X text 470 512 ... for three VCFs acting on a noise source.;
-#X text 92 394 Amplitude;
-#X text 93 410 envelope;
-#X text 117 508 summing bus;
+#X text 85 394 Amplitude;
+#X text 86 410 envelope;
+#X text 94 549 summing bus;
#X text 346 62 Pitch is in eighth-tones (because 4 pixels per half
tone looks reasonable on the screen.) Hence the * 0.25 objects below.
;
-#X obj 394 209 * 0.25;
-#X obj 493 233 * 0.25;
-#X obj 394 230 + 24;
-#X connect 0 0 22 0;
+#X obj 169 235 / 2;
+#X connect 0 0 20 0;
#X connect 1 0 2 0;
-#X connect 2 0 6 0;
-#X connect 2 0 6 1;
-#X connect 3 0 4 0;
-#X connect 4 0 1 0;
-#X connect 5 0 10 1;
-#X connect 6 0 7 0;
-#X connect 6 0 7 1;
-#X connect 7 0 5 0;
-#X connect 8 0 10 0;
-#X connect 10 0 9 0;
+#X connect 2 0 5 0;
+#X connect 2 0 5 1;
+#X connect 3 0 1 0;
+#X connect 4 0 9 1;
+#X connect 5 0 6 0;
+#X connect 5 0 6 1;
+#X connect 6 0 4 0;
+#X connect 7 0 9 0;
+#X connect 9 0 8 0;
+#X connect 10 0 11 0;
+#X connect 10 0 11 1;
#X connect 11 0 12 0;
#X connect 11 0 12 1;
-#X connect 12 0 13 0;
-#X connect 12 0 13 1;
-#X connect 13 0 43 1;
-#X connect 14 0 16 0;
-#X connect 15 0 52 0;
+#X connect 12 0 41 1;
+#X connect 13 0 15 0;
+#X connect 14 0 39 0;
+#X connect 14 0 13 0;
+#X connect 14 0 24 0;
+#X connect 15 0 16 0;
#X connect 16 0 17 0;
-#X connect 17 0 18 0;
-#X connect 18 0 11 0;
-#X connect 19 0 3 0;
+#X connect 17 0 10 0;
+#X connect 18 0 19 0;
+#X connect 19 0 2 0;
#X connect 20 0 21 0;
-#X connect 21 0 2 0;
-#X connect 22 0 23 0;
-#X connect 22 0 24 0;
-#X connect 22 1 15 1;
-#X connect 23 1 19 0;
-#X connect 23 2 1 1;
-#X connect 24 0 15 0;
-#X connect 24 1 53 0;
-#X connect 24 2 18 1;
-#X connect 24 2 37 1;
-#X connect 24 2 33 1;
-#X connect 25 0 42 0;
-#X connect 25 0 43 0;
-#X connect 25 0 44 0;
+#X connect 20 0 22 0;
+#X connect 20 1 14 1;
+#X connect 21 1 50 0;
+#X connect 21 2 1 1;
+#X connect 22 0 14 0;
+#X connect 22 1 39 1;
+#X connect 22 1 24 1;
+#X connect 22 2 17 1;
+#X connect 22 2 35 1;
+#X connect 22 2 31 1;
+#X connect 23 0 40 0;
+#X connect 23 0 41 0;
+#X connect 23 0 42 0;
+#X connect 24 0 25 0;
+#X connect 25 0 26 0;
#X connect 26 0 27 0;
-#X connect 27 0 28 0;
+#X connect 27 0 31 0;
#X connect 28 0 29 0;
-#X connect 29 0 33 0;
-#X connect 30 0 31 0;
-#X connect 30 0 31 1;
-#X connect 31 0 32 0;
-#X connect 31 0 32 1;
-#X connect 32 0 44 1;
-#X connect 33 0 30 0;
-#X connect 34 0 35 0;
-#X connect 34 0 35 1;
-#X connect 35 0 36 0;
-#X connect 35 0 36 1;
-#X connect 36 0 42 1;
-#X connect 37 0 34 0;
-#X connect 38 0 39 0;
-#X connect 39 0 40 0;
-#X connect 40 0 37 0;
-#X connect 41 0 38 0;
-#X connect 42 0 5 1;
-#X connect 43 0 5 1;
-#X connect 44 0 5 1;
-#X connect 52 0 54 0;
-#X connect 53 0 26 1;
-#X connect 53 0 41 1;
-#X connect 54 0 41 0;
-#X connect 54 0 26 0;
-#X connect 54 0 14 0;
+#X connect 28 0 29 1;
+#X connect 29 0 30 0;
+#X connect 29 0 30 1;
+#X connect 30 0 42 1;
+#X connect 31 0 28 0;
+#X connect 32 0 33 0;
+#X connect 32 0 33 1;
+#X connect 33 0 34 0;
+#X connect 33 0 34 1;
+#X connect 34 0 40 1;
+#X connect 35 0 32 0;
+#X connect 36 0 37 0;
+#X connect 37 0 38 0;
+#X connect 38 0 35 0;
+#X connect 39 0 36 0;
+#X connect 40 0 4 1;
+#X connect 41 0 4 1;
+#X connect 42 0 4 1;
+#X connect 50 0 3 0;
diff --git a/pd/doc/7.stuff/tools/testtone.pd b/pd/doc/7.stuff/tools/testtone.pd
index 965859c7..8ca1eb55 100644
--- a/pd/doc/7.stuff/tools/testtone.pd
+++ b/pd/doc/7.stuff/tools/testtone.pd
@@ -1,29 +1,29 @@
-#N canvas 36 16 581 402 12;
-#X floatatom 83 307 3 0 0;
+#N canvas 137 26 581 402 12;
+#X floatatom 83 307 3 0 0 0 - - -;
#X obj 33 257 notein;
#X obj 33 283 stripnote;
-#X floatatom 32 308 3 0 0;
+#X floatatom 32 308 3 0 0 0 - - -;
#X text 35 5 Welcome to Pd ("Pure Data"). This window can test your
audio and MIDI connections. To see Pd's DOCUMENTATION select "getting
started" in the Help menu.;
#X text 236 258 MIDI OUT;
#X text 33 233 MIDI IN;
-#X floatatom 175 305 3 0 0;
-#X floatatom 136 304 3 0 0;
+#X floatatom 175 305 3 0 0 0 - - -;
+#X floatatom 136 304 3 0 0 0 - - -;
#X obj 136 279 ctlin;
#N canvas 0 0 484 446 midi 0;
#X obj 95 61 inlet;
#X obj 96 262 noteout;
-#X floatatom 96 92 0 0 0;
+#X floatatom 96 92 0 0 0 0 - - -;
#X obj 107 120 outlet;
#X obj 338 113 loadbang;
#X obj 96 184 metro;
#X obj 96 236 makenote;
-#X floatatom 189 166 0 0 0;
+#X floatatom 189 166 0 0 0 0 - - -;
#X obj 96 210 f;
-#X floatatom 145 166 0 0 0;
-#X floatatom 233 166 0 0 0;
-#X floatatom 276 166 0 0 0;
+#X floatatom 145 166 0 0 0 0 - - -;
+#X floatatom 233 166 0 0 0 0 - - -;
+#X floatatom 276 166 0 0 0 0 - - -;
#X msg 338 148 500;
#X msg 370 148 60;
#X msg 399 148 64;
@@ -33,7 +33,7 @@ started" in the Help menu.;
#X text 232 145 vel;
#X text 268 146 length;
#X obj 230 257 ctlout 1;
-#X floatatom 231 228 0 0 0;
+#X floatatom 231 228 0 0 0 0 - - -;
#X connect 0 0 2 0;
#X connect 2 0 3 0;
#X connect 2 0 5 0;
@@ -55,8 +55,8 @@ started" in the Help menu.;
#X connect 15 0 11 0;
#X connect 21 0 20 0;
#X restore 236 308 pd midi;
-#X floatatom 149 183 3 0 0;
-#X floatatom 182 183 3 0 0;
+#X floatatom 149 183 3 0 0 0 - - -;
+#X floatatom 182 183 3 0 0 0 - - -;
#X text 24 341 PD is COPYRIGHT 1997-2002 by Miller Puckette and others
but is free for you to use for any reasonable purpose. See the file
\, LICENSE.txt in the distribution.;
@@ -74,7 +74,7 @@ but is free for you to use for any reasonable purpose. See the file
#X text 62 154 -40;
#X text 62 131 -20;
#N canvas 0 0 536 251 more 0;
-#X floatatom 42 209 0 0 0;
+#X floatatom 42 209 0 0 0 0 - - -;
#X obj 42 183 f;
#X obj 79 183 + 1;
#X obj 42 150 metro 1000;
@@ -106,27 +106,26 @@ but is free for you to use for any reasonable purpose. See the file
-1 -1;
#X obj 304 127 bng 15 250 50 0 tone-none empty NONE 20 8 128 12 -262144
-1 -1;
-#X floatatom 215 183 3 0 0;
-#X floatatom 248 183 3 0 0;
-#X floatatom 281 184 3 0 0;
-#X floatatom 315 184 3 0 0;
+#X floatatom 215 183 3 0 0 0 - - -;
+#X floatatom 248 183 3 0 0 0 - - -;
+#X floatatom 281 184 3 0 0 0 - - -;
+#X floatatom 315 184 3 0 0 0 - - -;
#X text 164 208 AUDIO INPUT (RMS dB);
#X text 41 83 TEST;
#X text 40 103 TONE;
#X text 152 76 test tone channels:;
#N canvas 29 216 908 548 -------audio---- 0;
-#X obj 182 92 hip~ 5;
#X obj 23 351 *~;
#X obj 45 324 line~;
#X obj 190 169 outlet;
#X obj 45 297 pack 0 50;
#X obj 22 134 osc~;
-#X floatatom 45 245 0 0 0;
+#X floatatom 45 245 0 0 0 0 - - -;
#X obj 45 270 dbtorms;
#X obj 190 143 int;
#X obj 22 66 mtof;
-#X floatatom 22 43 0 0 0;
-#X floatatom 22 88 0 0 0;
+#X floatatom 22 43 0 0 0 0 - - -;
+#X floatatom 22 88 0 0 0 0 - - -;
#X obj 22 110 sig~;
#X obj 190 117 env~ 8192;
#X obj 182 39 adc~ 1;
@@ -151,7 +150,6 @@ but is free for you to use for any reasonable purpose. See the file
#X obj 16 461 line~;
#X obj 17 433 pack 0 50;
#X obj 17 407 r tone-monitor;
-#X obj 302 91 hip~ 5;
#X obj 310 168 outlet;
#X obj 310 142 int;
#X obj 310 116 env~ 8192;
@@ -183,7 +181,6 @@ but is free for you to use for any reasonable purpose. See the file
#X connect 2 0 3 0;
#X connect 4 0 5 0;
#X restore 14 516 pd glue+loadbang;
-#X obj 424 93 hip~ 5;
#X obj 432 170 outlet;
#X obj 432 144 int;
#X obj 432 118 env~ 8192;
@@ -195,7 +192,6 @@ but is free for you to use for any reasonable purpose. See the file
#X obj 434 353 *~;
#X obj 424 383 +~;
#X obj 432 66 r tone-hip;
-#X obj 544 92 hip~ 5;
#X obj 552 169 outlet;
#X obj 552 143 int;
#X obj 552 117 env~ 8192;
@@ -207,7 +203,6 @@ but is free for you to use for any reasonable purpose. See the file
#X obj 554 352 *~;
#X obj 544 382 +~;
#X obj 552 65 r tone-hip;
-#X obj 661 92 hip~ 5;
#X obj 669 169 outlet;
#X obj 669 143 int;
#X obj 669 117 env~ 8192;
@@ -219,7 +214,6 @@ but is free for you to use for any reasonable purpose. See the file
#X obj 671 352 *~;
#X obj 661 382 +~;
#X obj 669 65 r tone-hip;
-#X obj 781 91 hip~ 5;
#X obj 789 168 outlet;
#X obj 789 142 int;
#X obj 789 116 env~ 8192;
@@ -243,113 +237,119 @@ but is free for you to use for any reasonable purpose. See the file
#X obj 543 406 dac~ 4;
#X obj 661 407 dac~ 5;
#X obj 781 406 dac~ 6;
-#X connect 0 0 24 0;
-#X connect 0 0 13 0;
-#X connect 1 0 15 0;
-#X connect 2 0 1 1;
-#X connect 4 0 2 0;
-#X connect 5 0 1 0;
-#X connect 6 0 7 0;
-#X connect 7 0 4 0;
-#X connect 8 0 3 0;
-#X connect 9 0 11 0;
-#X connect 10 0 9 0;
-#X connect 11 0 12 0;
-#X connect 12 0 5 0;
-#X connect 13 0 8 0;
-#X connect 14 0 0 0;
-#X connect 16 0 18 0;
-#X connect 17 0 10 0;
-#X connect 18 0 20 0;
-#X connect 18 1 21 0;
-#X connect 18 2 19 0;
-#X connect 19 0 6 0;
-#X connect 20 0 6 0;
-#X connect 21 0 6 0;
-#X connect 22 0 24 1;
-#X connect 23 0 28 1;
-#X connect 24 0 30 0;
-#X connect 25 0 23 0;
-#X connect 26 0 25 0;
-#X connect 27 0 28 0;
-#X connect 28 0 30 1;
-#X connect 30 0 29 0;
-#X connect 31 0 0 1;
+#X obj 182 92 hip~;
+#X obj 302 91 hip~;
+#X obj 424 93 hip~;
+#X obj 544 92 hip~;
+#X obj 661 92 hip~;
+#X obj 781 91 hip~;
+#X connect 0 0 14 0;
+#X connect 1 0 0 1;
+#X connect 3 0 1 0;
+#X connect 4 0 0 0;
+#X connect 5 0 6 0;
+#X connect 6 0 3 0;
+#X connect 7 0 2 0;
+#X connect 8 0 10 0;
+#X connect 9 0 8 0;
+#X connect 10 0 11 0;
+#X connect 11 0 4 0;
+#X connect 12 0 7 0;
+#X connect 13 0 109 0;
+#X connect 15 0 17 0;
+#X connect 16 0 9 0;
+#X connect 17 0 19 0;
+#X connect 17 1 20 0;
+#X connect 17 2 18 0;
+#X connect 18 0 5 0;
+#X connect 19 0 5 0;
+#X connect 20 0 5 0;
+#X connect 21 0 23 1;
+#X connect 22 0 27 1;
+#X connect 23 0 29 0;
+#X connect 24 0 22 0;
+#X connect 25 0 24 0;
+#X connect 26 0 27 0;
+#X connect 27 0 29 1;
+#X connect 29 0 28 0;
+#X connect 30 0 109 1;
+#X connect 32 0 31 0;
#X connect 33 0 32 0;
#X connect 34 0 33 0;
-#X connect 35 0 34 0;
-#X connect 36 0 42 0;
-#X connect 36 0 39 0;
-#X connect 38 0 37 0;
-#X connect 39 0 38 0;
-#X connect 40 0 42 1;
-#X connect 41 0 45 1;
-#X connect 42 0 46 0;
-#X connect 43 0 41 0;
-#X connect 44 0 45 0;
-#X connect 45 0 46 1;
-#X connect 46 0 49 0;
-#X connect 47 0 36 1;
-#X connect 48 0 36 0;
-#X connect 50 0 43 0;
-#X connect 51 0 52 0;
-#X connect 53 0 51 0;
-#X connect 55 0 61 0;
-#X connect 55 0 58 0;
-#X connect 57 0 56 0;
-#X connect 58 0 57 0;
-#X connect 59 0 61 1;
-#X connect 60 0 64 1;
-#X connect 61 0 65 0;
-#X connect 62 0 60 0;
-#X connect 63 0 64 0;
-#X connect 64 0 65 1;
-#X connect 65 0 111 0;
-#X connect 66 0 55 1;
-#X connect 67 0 73 0;
-#X connect 67 0 70 0;
-#X connect 69 0 68 0;
-#X connect 70 0 69 0;
-#X connect 71 0 73 1;
-#X connect 72 0 76 1;
-#X connect 73 0 77 0;
-#X connect 74 0 72 0;
-#X connect 75 0 76 0;
-#X connect 76 0 77 1;
-#X connect 77 0 112 0;
-#X connect 78 0 67 1;
-#X connect 79 0 85 0;
-#X connect 79 0 82 0;
-#X connect 81 0 80 0;
-#X connect 82 0 81 0;
-#X connect 83 0 85 1;
-#X connect 84 0 88 1;
-#X connect 85 0 89 0;
-#X connect 86 0 84 0;
-#X connect 87 0 88 0;
-#X connect 88 0 89 1;
-#X connect 89 0 113 0;
-#X connect 90 0 79 1;
-#X connect 91 0 97 0;
-#X connect 91 0 94 0;
-#X connect 93 0 92 0;
-#X connect 94 0 93 0;
-#X connect 95 0 97 1;
-#X connect 96 0 100 1;
-#X connect 97 0 101 0;
-#X connect 98 0 96 0;
-#X connect 99 0 100 0;
-#X connect 100 0 101 1;
-#X connect 101 0 114 0;
-#X connect 102 0 91 1;
-#X connect 103 0 55 0;
-#X connect 104 0 67 0;
-#X connect 105 0 79 0;
-#X connect 106 0 91 0;
-#X connect 107 0 62 0;
-#X connect 108 0 74 0;
-#X connect 109 0 86 0;
-#X connect 110 0 98 0;
+#X connect 36 0 35 0;
+#X connect 37 0 36 0;
+#X connect 38 0 40 1;
+#X connect 39 0 43 1;
+#X connect 40 0 44 0;
+#X connect 41 0 39 0;
+#X connect 42 0 43 0;
+#X connect 43 0 44 1;
+#X connect 44 0 47 0;
+#X connect 45 0 110 1;
+#X connect 46 0 110 0;
+#X connect 48 0 41 0;
+#X connect 49 0 50 0;
+#X connect 51 0 49 0;
+#X connect 54 0 53 0;
+#X connect 55 0 54 0;
+#X connect 56 0 58 1;
+#X connect 57 0 61 1;
+#X connect 58 0 62 0;
+#X connect 59 0 57 0;
+#X connect 60 0 61 0;
+#X connect 61 0 62 1;
+#X connect 62 0 105 0;
+#X connect 63 0 111 1;
+#X connect 65 0 64 0;
+#X connect 66 0 65 0;
+#X connect 67 0 69 1;
+#X connect 68 0 72 1;
+#X connect 69 0 73 0;
+#X connect 70 0 68 0;
+#X connect 71 0 72 0;
+#X connect 72 0 73 1;
+#X connect 73 0 106 0;
+#X connect 74 0 112 1;
+#X connect 76 0 75 0;
+#X connect 77 0 76 0;
+#X connect 78 0 80 1;
+#X connect 79 0 83 1;
+#X connect 80 0 84 0;
+#X connect 81 0 79 0;
+#X connect 82 0 83 0;
+#X connect 83 0 84 1;
+#X connect 84 0 107 0;
+#X connect 85 0 113 1;
+#X connect 87 0 86 0;
+#X connect 88 0 87 0;
+#X connect 89 0 91 1;
+#X connect 90 0 94 1;
+#X connect 91 0 95 0;
+#X connect 92 0 90 0;
+#X connect 93 0 94 0;
+#X connect 94 0 95 1;
+#X connect 95 0 108 0;
+#X connect 96 0 114 1;
+#X connect 97 0 111 0;
+#X connect 98 0 112 0;
+#X connect 99 0 113 0;
+#X connect 100 0 114 0;
+#X connect 101 0 59 0;
+#X connect 102 0 70 0;
+#X connect 103 0 81 0;
+#X connect 104 0 92 0;
+#X connect 109 0 23 0;
+#X connect 109 0 12 0;
+#X connect 110 0 40 0;
+#X connect 110 0 37 0;
+#X connect 111 0 58 0;
+#X connect 111 0 55 0;
+#X connect 112 0 69 0;
+#X connect 112 0 66 0;
+#X connect 113 0 80 0;
+#X connect 113 0 77 0;
+#X connect 114 0 91 0;
+#X connect 114 0 88 0;
#X restore 149 157 pd -------audio----;
#X connect 1 0 2 0;
#X connect 1 1 2 1;
diff --git a/pd/doc/sound/bell.aiff b/pd/doc/sound/bell.aiff
index 4b2a49ae..374faecb 100644
--- a/pd/doc/sound/bell.aiff
+++ b/pd/doc/sound/bell.aiff
Binary files differ
diff --git a/pd/doc/sound/voice.wav b/pd/doc/sound/voice.wav
index 8b7f1acc..d0c1a570 100644
--- a/pd/doc/sound/voice.wav
+++ b/pd/doc/sound/voice.wav
Binary files differ
diff --git a/pd/doc/sound/voice2.wav b/pd/doc/sound/voice2.wav
index 9bd9d484..7ceba74b 100644
--- a/pd/doc/sound/voice2.wav
+++ b/pd/doc/sound/voice2.wav
Binary files differ
diff --git a/pd/extra/bonk~/help-bonk~.pd b/pd/extra/bonk~/help-bonk~.pd
deleted file mode 100644
index 5102e860..00000000
--- a/pd/extra/bonk~/help-bonk~.pd
+++ /dev/null
@@ -1,162 +0,0 @@
-#N canvas 107 94 958 626 10;
-#X obj 320 579 print;
-#X floatatom 314 501 0 0 0;
-#X obj 320 549 spigot;
-#X msg 314 471 0;
-#X msg 351 471 1;
-#X msg 442 427 bang;
-#X obj 429 518 bonk~;
-#X msg 442 244 learn 1;
-#X msg 442 304 learn 0;
-#X msg 437 486 print;
-#X obj 390 467 adc~;
-#X text 320 597 cooked;
-#X msg 565 76 \; pd dsp 1;
-#X obj 257 579 print;
-#X floatatom 251 501 0 0 0;
-#X obj 257 549 spigot;
-#X msg 251 471 0;
-#X msg 282 471 1;
-#X text 257 597 raw;
-#N canvas 366 126 600 400 synth 0;
-#X obj 112 24 r bonk-cooked;
-#X obj 112 49 unpack;
-#X obj 112 99 * 12;
-#X obj 112 124 div 7;
-#X obj 112 74 + 1;
-#X obj 112 174 mtof;
-#X obj 112 224 osc~;
-#X obj 112 249 cos~;
-#X obj 112 149 + 47;
-#X obj 209 247 line~;
-#X obj 209 272 *~;
-#X obj 209 297 lop~ 500;
-#X obj 112 274 *~;
-#X obj 103 361 dac~;
-#X obj 253 165 dbtorms;
-#X obj 253 115 * 0.5;
-#X obj 253 140 + 50;
-#X obj 211 189 f;
-#X msg 173 159 bang;
-#X obj 258 83 inlet;
-#X obj 111 307 hip~ 5;
-#X msg 34 24 0 60;
-#X obj 112 199 sig~;
-#X msg 209 222 \$1 \, 0 200;
-#X connect 0 0 1 0;
-#X connect 1 0 4 0;
-#X connect 2 0 3 0;
-#X connect 3 0 8 0;
-#X connect 4 0 2 0;
-#X connect 5 0 18 0;
-#X connect 5 0 22 0;
-#X connect 6 0 7 0;
-#X connect 7 0 12 0;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 9 0 10 1;
-#X connect 10 0 11 0;
-#X connect 11 0 12 1;
-#X connect 12 0 20 0;
-#X connect 14 0 17 1;
-#X connect 15 0 16 0;
-#X connect 16 0 14 0;
-#X connect 17 0 23 0;
-#X connect 18 0 17 0;
-#X connect 19 0 15 0;
-#X connect 20 0 13 1;
-#X connect 20 0 13 0;
-#X connect 21 0 1 0;
-#X connect 22 0 6 0;
-#X connect 23 0 9 0;
-#X restore 804 86 pd synth;
-#X obj 454 549 s bonk-cooked;
-#X floatatom 804 63 0 0 0;
-#X msg 804 33 0;
-#X msg 442 274 learn 10;
-#X msg 442 334 forget;
-#X msg 442 364 write templates.txt;
-#X msg 442 394 read templates.txt;
-#X msg 835 33 90;
-#X msg 442 120 thresh 6 50;
-#X text 8 70 The Bonk object takes an audio signal input and looks
-for "attacks" defined as sharp changes in the spectral envelope of
-the incoming sound. Optionally \, and less reliably \, you can have
-Bonk check the attack against a collection of stored templates to try
-to guess which of two or more instruments was hit. Bonk is described
-theoretically in the 1998 ICMC proceedings \, reprinted on http://man104nfs.ucsd.edu/~mpuckett.
-;
-#X text 470 70 click here;
-#X text 471 83 to start DSP;
-#X text 8 191 Bonk's two outputs are the raw spectrum of the attack
-(provided as a list of 11 numbers giving the signal "loudness" in the
-11 frequency bands used) \, and the "cooked" output which gives only
-an instrument number (counting up from zero) and a "velocity". The
-instrumnent number is significant only if Bonk has a "template set"
-in memory.;
-#X text 8 368 In this patch \, after starting DSP \, you can print
-out the raw or cooked output using the two "spigots" or listen to a
-synthesizer output by raising its volume.;
-#X text 259 448 enable printout;
-#X text 705 32 output volume;
-#X text 719 50 (0-100);
-#X text 533 118 Set low and high thresholds. Signal growth must exceed
-the high one and then fall to the low one to make an attack.;
-#X text 533 151 Minimum velocity to output (quieter notes are ignored.)
-;
-#X msg 442 180 mask 4 0.7;
-#X msg 442 214 debounce 0;
-#X text 8 299 Bonk's analysis is carried out on a 256-point window
-(6 msec at 44.1 kHz) and by default the analysis period is 128 samples.
-The analysis period can be specified as Bonk's creation argument but
-must be a multiple of 64;
-#X text 532 219 Minimum time (msec) between attacks;
-#X text 532 170 Describes how energy in each frequency band masks later
-energy in the band. Here the masking is total for 4 analysis periods
-and then drops by 0.7 each period.;
-#X text 530 244 Forget all templates and start learning new ones. The
-argument gives the number of times you will hit each instrument (10
-recommended.) Turn on the output volume above for audible feedback
-as you train Bonk. "Learn 0" exits learn mode.;
-#X text 530 328 Forget the last template. In Learn mode \, use "forget"
-to erase and record over a template.;
-#X text 595 368 Write templates to a file in text-editable format.
-;
-#X text 596 398 Read templates from a file.;
-#X text 538 493 Print out all settings and templates.;
-#X msg 442 150 minvel 10;
-#X text 538 426 Poll the current spectrum via "raw" outlet \, You can
-set a very high threshold if you don't want attacks mixed in.;
-#X text 218 12 BONK - an attack detector for small percussion instruments
-;
-#X msg 634 517 print;
-#X msg 437 456 debug 0;
-#X text 538 466 turn debugging on or off.;
-#X connect 1 0 2 1;
-#X connect 2 0 0 0;
-#X connect 3 0 1 0;
-#X connect 4 0 1 0;
-#X connect 5 0 6 0;
-#X connect 6 0 15 0;
-#X connect 6 1 2 0;
-#X connect 6 1 20 0;
-#X connect 7 0 6 0;
-#X connect 8 0 6 0;
-#X connect 9 0 6 0;
-#X connect 10 0 6 0;
-#X connect 14 0 15 1;
-#X connect 15 0 13 0;
-#X connect 16 0 14 0;
-#X connect 17 0 14 0;
-#X connect 21 0 19 0;
-#X connect 22 0 21 0;
-#X connect 23 0 6 0;
-#X connect 24 0 6 0;
-#X connect 25 0 6 0;
-#X connect 26 0 6 0;
-#X connect 27 0 21 0;
-#X connect 28 0 6 0;
-#X connect 39 0 6 0;
-#X connect 40 0 6 0;
-#X connect 49 0 6 0;
-#X connect 53 0 6 0;
diff --git a/pd/extra/bonk~/makefile b/pd/extra/bonk~/makefile
index 731e5cb3..2ac53f8c 100644
--- a/pd/extra/bonk~/makefile
+++ b/pd/extra/bonk~/makefile
@@ -12,13 +12,13 @@ pd_nt: $(NAME).dll
PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
VC="C:\Program Files\Microsoft Visual Studio\Vc98"
-PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include
+PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include
PDNTLDIR = $(VC)\lib
PDNTLIB = $(PDNTLDIR)\libc.lib \
$(PDNTLDIR)\oldnames.lib \
$(PDNTLDIR)\kernel32.lib \
- \ftp\pd\bin\pd.lib
+ ..\..\bin\pd.lib
.c.dll:
cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
@@ -37,8 +37,7 @@ SGIINCLUDE = -I../../src
.c.pd_irix5:
cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
- rm -f $*.o ../$*.pd_linux
- ln -s $*.pd_linux ..
+ rm $*.o
# ----------------------- IRIX 6.x -----------------------
@@ -52,7 +51,7 @@ SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
.c.pd_irix6:
cc $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
+ ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
rm $*.o
# ----------------------- LINUX i386 -----------------------
@@ -61,20 +60,17 @@ pd_linux: $(NAME).pd_linux
.SUFFIXES: .pd_linux
-LINUXCFLAGS = -fPIC -DPD -O2 -funroll-loops -fomit-frame-pointer \
+LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \
-Wall -W -Wshadow -Wstrict-prototypes -Werror \
-Wno-unused -Wno-parentheses -Wno-switch
LINUXINCLUDE = -I../../src
-LSTRIP = strip --strip-unneeded -R .note -R .comment
-
.c.pd_linux:
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -Wl,-export_dynamic --shared -o $*.pd_linux $*.o -lm
- $(LSTRIP) $*.pd_linux
- rm -f $*.o ../$*.pd_linux
- ln -s $*/$*.pd_linux ..
+ ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
+ strip --strip-unneeded $*.pd_linux
+ rm -f $*.o
# ----------------------- Mac OSX -----------------------
@@ -87,9 +83,8 @@ DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
.c.pd_darwin:
cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
- rm -f $*.o ../$*.pd_darwin
- ln -s $*/$*.pd_darwin ..
+ cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
+ rm -f $*.o
# ----------------------------------------------------------
diff --git a/pd/extra/choice/help-choice.pd b/pd/extra/choice/help-choice.pd
deleted file mode 100644
index df46ddc0..00000000
--- a/pd/extra/choice/help-choice.pd
+++ /dev/null
@@ -1,41 +0,0 @@
-#N canvas 16 5 488 531 12;
-#X obj 8 186 choice;
-#X msg 41 86 print;
-#X msg 29 63 clear;
-#X msg 8 34 add 1 0 0 \, add 0 1 0 \, add 0 0 1 \, add 1 1 1 \, add 1 1 0;
-#X obj 77 162 pack 0 0 0;
-#X floatatom 182 120;
-#X floatatom 148 120;
-#X floatatom 115 120;
-#X obj 77 142 f;
-#X msg 77 120 bang;
-#X floatatom 8 207;
-#X obj 53 187 choice 1;
-#X floatatom 53 208;
-#X obj 76 4 choice;
-#X text 122 5 - search for a best match to an incoming list;
-#X text 19 234 The choice object holds a list of vectors \, each having up to ten elements. When sent a list of numbers \, it outputs the index of the known vector that matches most closely. The quality of the match is the dot product of the two vectors after normalizing them \, i.e. \, the vector whose direction is closest to that of the input wins.;
-#X text 19 316 If given a nonzero creation argument \, choice tries to avoid repetitious outputs by weighting less recently output vectors preferentially.;
-#X text 18 354 You can use this to choose interactively between a number of behaviors depending on their attributes. For example \, you might have stored a number of melodies \, of which some are syncopated \, some chromatic \, some are more than 100 years old \, some are bugle calls \, and some are Christmas carols. You could then ask to find a syncopated bugle call (1 \, 0 \, 0 \, 1 \, 0) and you'll get the thing most closely matching the request.;
-#X text 17 461 You can use numbers other than 0 and 1 to indicate relative strengths of the attributes \, or even use negative numbers to indicate opposites \, either in the incoming lists or in the stored ones.;
-#X text 273 513 updated for Pd version-0.30;
-#X text 72 63 delete all stored vectors;
-#X text 394 36 add vectors;
-#X text 81 85 debugging printout;
-#X text 69 104 tweak the numbers and hit "bang" to input a list;
-#X text 115 187 creation argument to avoid repeated outout;
-#X text 85 208 output is the index of best match \, counting from zero;
-#X connect 0 0 10 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 0;
-#X connect 2 0 11 0;
-#X connect 3 0 0 0;
-#X connect 3 0 11 0;
-#X connect 4 0 0 0;
-#X connect 4 0 11 0;
-#X connect 5 0 4 2;
-#X connect 6 0 4 1;
-#X connect 7 0 8 1;
-#X connect 8 0 4 0;
-#X connect 9 0 8 0;
-#X connect 11 0 12 0;
diff --git a/pd/extra/complex-mod~.pd b/pd/extra/complex-mod~.pd
index 14f9b955..df78a3bf 100644
--- a/pd/extra/complex-mod~.pd
+++ b/pd/extra/complex-mod~.pd
@@ -1,6 +1,5 @@
#N canvas 206 108 428 341 12;
#X obj 142 87 inlet~;
-#X obj 315 88 inlet;
#X obj 315 166 cos~;
#X obj 351 144 +~ -0.25;
#X obj 351 166 cos~;
@@ -14,17 +13,18 @@
#X text 140 310 positive;
#X text 213 311 negative;
#X obj 315 114 phasor~;
-#X connect 0 0 6 0;
-#X connect 1 0 14 0;
-#X connect 2 0 6 1;
-#X connect 3 0 4 0;
-#X connect 4 0 7 1;
+#X obj 315 88 inlet~;
+#X connect 0 0 5 0;
+#X connect 1 0 5 1;
+#X connect 2 0 3 0;
+#X connect 3 0 6 1;
+#X connect 4 0 6 0;
#X connect 5 0 7 0;
-#X connect 6 0 8 0;
-#X connect 6 0 11 0;
-#X connect 7 0 8 1;
-#X connect 7 0 11 1;
-#X connect 8 0 9 0;
-#X connect 11 0 10 0;
-#X connect 14 0 3 0;
-#X connect 14 0 2 0;
+#X connect 5 0 10 0;
+#X connect 6 0 7 1;
+#X connect 6 0 10 1;
+#X connect 7 0 8 0;
+#X connect 10 0 9 0;
+#X connect 13 0 2 0;
+#X connect 13 0 1 0;
+#X connect 14 0 13 0;
diff --git a/pd/extra/expr~/README b/pd/extra/expr~/README
index 28fccf84..bf84f2ae 100644
--- a/pd/extra/expr~/README
+++ b/pd/extra/expr~/README
@@ -1,9 +1,38 @@
-You can get more inofrmation on the expr object at
+You can get more information on the expr object at
http://www.crca.ucsd.edu/~yadegari/expr.html
-----------
+New if Version 0.4
+
+-access to variables (made by value object)
+-multiple expression separated by ;
+-added the following shorthands:
+ $y or $y1 = $y1[-1] and $y2 = $y2[-1]
+-new functions:
+ if - conditional evaluation
+ cbrt - cube root
+ erf - error function
+ erfc - complementary error function
+ expm1 - exponential minus 1,
+ log1p - logarithm of 1 plus
+ isinf - is the value infinite,
+ finite - is the value finite
+ isnan -- is the resut a nan (Not a number)
+ copysign - copy sign of a number
+ ldexp - multiply floating-point number by integral power of 2
+ imodf - get signed integral value from floating-point number
+ modf - get signed fractional value from floating-point number
+ drem - floating-point remainder function
+
+ Thanks to Orm Finnendahl for adding the following functions:
+ fmod - floating-point remainder function
+ ceil - ceiling function: smallest integral value not less than argument
+ floor - largest integral value not greater than argument
+
+------------
+
New in Version 0.3
-Full function functionality
@@ -57,11 +86,12 @@ $x#[n]: the sample from inlet # indexed by n, where n has to
satisfy 0 => n >= -vector size,
($x# is a shorthand for $x#[0], specifying the current sample)
-$y[n]: the output value indexed by n, where n has to
+$y#[n]: the output value indexed by n, where n has to
satisfy 0 > n >= -vector size,
+ $y[n] is a shorthand for $y1[n]
I'll appreciate hearing about bugs, comments, suggestions, ...
Shahrokh Yadegari (sdy@ucsd.edu)
-1/29/02
+7/10/02
diff --git a/pd/extra/expr~/help-expr.pd b/pd/extra/expr~/help-expr.pd
deleted file mode 100644
index 98ca696f..00000000
--- a/pd/extra/expr~/help-expr.pd
+++ /dev/null
@@ -1,231 +0,0 @@
-#N canvas 0 0 1024 745 10;
-#X obj 75 416 expr 1;
-#X floatatom 239 384 0 0 0;
-#X floatatom 75 446 0 0 0;
-#X msg 75 388 bang;
-#X obj 143 414 expr 2 + 3;
-#X msg 143 387 bang;
-#X floatatom 143 442 0 0 0;
-#X floatatom 238 442 0 0 0;
-#X obj 238 414 expr 2+$f1;
-#X floatatom 76 485 0 0 0;
-#X floatatom 76 542 0 0 0;
-#X obj 76 514 expr $f1 * $f2;
-#X floatatom 155 485 0 0 0;
-#N canvas 0 0 450 300 graph1 0;
-#X coords 0 10 10 0 200 150 1;
-#X array array1 10 float 0;
-#X restore 472 362 graph;
-#X floatatom 77 580 0 0 0;
-#X floatatom 77 636 0 0 0;
-#X floatatom 236 484 0 0 0;
-#X floatatom 236 541 0 0 0;
-#X obj 236 513 expr $s2[$f1];
-#X msg 309 485 symbol array1;
-#X obj 77 608 expr sin(2 * 3.14159 * $f1 / 360);
-#X msg 429 554 \; array1 1 4 2 8 5 6 1 4 2 8 5 6;
-#X text 81 345 expr examples:;
-#X text 66 10 expression evaluation family - expr \, expr~ \, fexpr~
-;
-#X text 66 188 Syntyax:;
-#X text 67 260 $f#: float input variable;
-#X text 68 275 $s#: symbol input variable;
-#X text -37 708 expr~ examples:;
-#X obj 30 911 print~;
-#X msg 67 890 bang;
-#X obj 30 832 sig~ 440;
-#X floatatom 103 849 0 0 0;
-#X floatatom 30 809 0 0 0;
-#X obj 30 872 expr~ $v1*$f2;
-#X obj 139 912 print~;
-#X msg 155 891 bang;
-#X floatatom 139 824 0 0 0;
-#X floatatom 212 826 0 0 0;
-#X floatatom 411 847 0 0 0;
-#X floatatom 298 823 0 0 0;
-#X obj 298 850 osc~;
-#X msg 526 670 \; pd dsp 0;
-#X msg 448 672 \; pd dsp 1;
-#X text 451 649 audio on;
-#X text 534 648 audio off;
-#X text 274 314 comment;
-#X text 9 792 vector times scalar;
-#X text 141 792 vector;
-#X obj 297 910 dac~;
-#X text 295 801 frequency;
-#X text 427 829 amplitude;
-#X text 497 116 Used for expr~ only:;
-#X text 499 139 $v#: signal (vector) input (vector by vector evaluation)
-;
-#X text 494 172 Used for fexpr~ only:;
-#X text 495 242 $y[n]: the output value indexed by n where n has to
-satisfy 0 > n >= -vector size.;
-#X text 489 282 (the vector size can be changed by the "block~" object.)
-;
-#X text 493 191 $x#[n]: the sample from inlet # indexed by n where
-n has to satisfy 0 => n >= -vector size \, ($x# is a shorthand for
-$x#[0] \, specifying the current sample);
-#X floatatom 81 1300 0 0 0;
-#X floatatom 214 1319 0 0 0;
-#X msg 181 1279 -10;
-#X text 8 1099 fexpr~ examples:;
-#X obj 80 1567 print~;
-#X msg 88 1547 bang;
-#X floatatom 80 1471 0 0 0;
-#X obj 80 1500 sig~ 1;
-#X obj 81 1343 fexpr~ ($x1[$f2]+$x1)/2;
-#X obj 80 1528 fexpr~ $x1+$y[-1];
-#X floatatom 590 1362 0 0 0;
-#X floatatom 750 1383 0 0 0;
-#X obj 585 1452 dac~;
-#X obj 587 1403 fexpr~ ($x1[$f2/1000]+$x1)/2;
-#X msg 819 1313 0 10000;
-#X obj 750 1364 line 0;
-#X msg 753 1314 -10000;
-#X obj 75 1385 dac~;
-#X text 51 1223 Simple FIR filter;
-#X text 512 1130 Simple FIR filter using fractional offset;
-#X msg 659 1314 -10000 10000;
-#X obj 590 1383 osc~ 2205;
-#X msg 599 1339 1102.5;
-#X msg 817 1338 0 10000;
-#X msg 751 1339 -20000;
-#X msg 657 1339 -20000 10000;
-#X msg 590 1314 2205;
-#X text 88 1611 end;
-#X msg 503 1308 start;
-#X msg 505 1330 stop;
-#X msg 12 1280 start;
-#X msg 11 1305 stop;
-#X msg 30 1465 start;
-#X msg 29 1490 stop;
-#X obj 446 1331 loadbang;
-#X obj -27 1491 loadbang;
-#X obj -44 1305 loadbang;
-#X text 572 1287 frequency;
-#X text 662 1296 of the simple filter;
-#X msg 248 1278 -20;
-#X obj 81 1321 osc~ 2205;
-#X msg 111 1277 1102.5;
-#X msg 65 1277 2205;
-#X msg 215 1278 0;
-#X text 78 1441 simple accumulator defined as and an IIR filter;
-#X obj 139 871 expr~ $v1*$v2;
-#X text 7 1144 NOTE: fexpr~ could use lots of CPU power \, by default
-fexpr~ is on when it is loaded. In this page we are turning them off
-with loadbang \, so to hear them you have to turn them on explicitly.
-You can use the "start" and "stop" messages to start and stop fexpr~
-and expr~;
-#X text 65 101 expr~ is used for expression evaluaion of signal data
-on the vector by vector basis;
-#X text 66 85 expr is used for expression evaluaion of control data
-;
-#X text 661 1284 index defining the frequency;
-#X text 50 1236 -10 offset will fully filter audio frequency of 2205
-\, and -20 offset will filter audio at frequency of 1102.5;
-#X text 514 1211 Thus \, the offset -10000 will filter audio at frequency
-of 2205 and the offset value -20000 will filter the audio at frequency
-of 1102.5.;
-#X text 513 1157 When fractional offset is used \, fexpr~ determines
-indexed by linear interpolation. In the following example the offset
-value is divided by 1000 \, thus we can continuously change the offset
-without an audible click in the output.;
-#X text 243 1314 If you change this value you;
-#X text 245 1326 hear a click;
-#X text 77 670 make sure you turn on audio for the expr~ and fexpr~
-examples;
-#X text 64 38 For a more detailed documentaion refer to http://www.crca.ucsd.edu/~yadegari/expr.html
-;
-#X text 67 203 The syntax is very close to how expressions are written
-in C. Variables are specified as follows where the '#' stands for the
-inlet number:;
-#X text 68 246 $i#: integer input variable;
-#X text 67 138 fexpr~ is used for expression evaluaion on sample level
-data \; i.e. \, filter design. Warning: fexpr~ is very cpu intensive.
-;
-#X floatatom 792 826 5 0 0;
-#X obj 545 875 tabsend~ a1;
-#N canvas 0 0 450 300 graph4 0;
-#X coords 0 1 63 -1 200 140 1;
-#X array a1 64 float 0;
-#X restore 546 897 graph;
-#X obj 545 852 expr~ max(min($v1 \, $f2/10) \, -$f2/10);
-#X obj 545 828 osc~ 4000;
-#X text 13 730 NOTES: the first inlet of expr~ cannot be a $f1 or $i1
-\, this may change in later releases;
-#X text 535 775 A simple limiter example;
-#X text 718 800 Move the value below between 0 and 10 to change the
-limiter threshold;
-#X obj 410 714 vsl 15 128 0 127 0 0 empty empty empty 20 8 0 8 -262144
--1 -1 0 1;
-#X obj 297 871 expr~ $v1*$f2/128;
-#X text 641 12 updated for Pd 0.35-35 test 8 and expr* 0.3;
-#X connect 0 0 2 0;
-#X connect 1 0 8 0;
-#X connect 3 0 0 0;
-#X connect 4 0 6 0;
-#X connect 5 0 4 0;
-#X connect 8 0 7 0;
-#X connect 9 0 11 0;
-#X connect 11 0 10 0;
-#X connect 12 0 11 1;
-#X connect 14 0 20 0;
-#X connect 16 0 18 0;
-#X connect 18 0 17 0;
-#X connect 19 0 18 1;
-#X connect 20 0 15 0;
-#X connect 29 0 28 0;
-#X connect 30 0 33 0;
-#X connect 31 0 33 1;
-#X connect 32 0 30 0;
-#X connect 33 0 28 0;
-#X connect 35 0 34 0;
-#X connect 36 0 102 0;
-#X connect 37 0 102 1;
-#X connect 38 0 126 1;
-#X connect 39 0 40 0;
-#X connect 40 0 126 0;
-#X connect 57 0 97 0;
-#X connect 58 0 65 1;
-#X connect 59 0 58 0;
-#X connect 62 0 61 0;
-#X connect 63 0 64 0;
-#X connect 64 0 66 0;
-#X connect 65 0 74 0;
-#X connect 65 0 74 1;
-#X connect 66 0 61 0;
-#X connect 67 0 78 0;
-#X connect 68 0 70 1;
-#X connect 70 0 69 0;
-#X connect 70 0 69 1;
-#X connect 71 0 72 0;
-#X connect 72 0 68 0;
-#X connect 73 0 72 0;
-#X connect 77 0 72 0;
-#X connect 78 0 70 0;
-#X connect 79 0 67 0;
-#X connect 80 0 72 0;
-#X connect 81 0 72 0;
-#X connect 82 0 72 0;
-#X connect 83 0 67 0;
-#X connect 85 0 70 0;
-#X connect 86 0 70 0;
-#X connect 87 0 65 0;
-#X connect 88 0 65 0;
-#X connect 89 0 66 0;
-#X connect 90 0 66 0;
-#X connect 91 0 86 0;
-#X connect 92 0 90 0;
-#X connect 93 0 88 0;
-#X connect 96 0 58 0;
-#X connect 97 0 65 0;
-#X connect 98 0 57 0;
-#X connect 99 0 57 0;
-#X connect 100 0 58 0;
-#X connect 102 0 34 0;
-#X connect 117 0 120 1;
-#X connect 120 0 118 0;
-#X connect 121 0 120 0;
-#X connect 125 0 38 0;
-#X connect 126 0 48 0;
-#X connect 126 0 48 1;
diff --git a/pd/extra/expr~/makefile b/pd/extra/expr~/makefile
index d0175a8a..b482f249 100644
--- a/pd/extra/expr~/makefile
+++ b/pd/extra/expr~/makefile
@@ -1,5 +1,6 @@
-current: expr.pd_linux expr~.pd_linux fexpr~.pd_linux
+current: expr.pd_linux expr~.pd_linux fexpr~.pd_linux \
+ ../expr.pd_linux ../expr~.pd_linux ../fexpr~.pd_linux
install: install_linux
@@ -18,20 +19,20 @@ NTOBJ = vexp.obj vexp_fun.obj vexp_if.obj
PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
VC="C:\Program Files\Microsoft Visual Studio\Vc98"
-PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include
+PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include
PDNTLDIR = $(VC)\lib
PDNTLIB = $(PDNTLDIR)\libc.lib \
$(PDNTLDIR)\oldnames.lib \
$(PDNTLDIR)\kernel32.lib \
- \ftp\pd\bin\pd.lib
+ ..\..\bin\pd.lib
.c.obj:
cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
expr.dll: $(NTOBJ)
link /dll /export:expr_setup /export:expr_tilde_setup \
- /export:fexpr_tilde_setup $(NTOBJ) $(PDNTLIB)
+ /export:fexpr_tilde_setup $(NTOBJ) $(PDNTLIB)
ren vexp.dll expr.dll
copy expr.dll ..\expr.dll
copy expr.dll ..\expr~.dll
@@ -90,30 +91,36 @@ LINUXINCLUDE = -I../../src
expr.pd_linux: $(LINUXOBJ)
ld -export_dynamic -shared -o expr.pd_linux $(LINUXOBJ) -lc -lm
strip --strip-unneeded expr.pd_linux
- rm -f ../expr.pd_linux
- ln -s expr~/expr.pd_linux ..
expr~.pd_linux: expr.pd_linux
- ln -s expr.pd_linux expr~.pd_linux
- ln -s expr~/expr~.pd_linux ..
-
+ -ln -s expr.pd_linux expr~.pd_linux
+
fexpr~.pd_linux: expr.pd_linux
- ln -s expr.pd_linux fexpr~.pd_linux
- ln -s expr~/fexpr~.pd_linux ..
+ -ln -s expr.pd_linux fexpr~.pd_linux
+
+../expr.pd_linux: expr.pd_linux
+ -ln -s expr~/expr.pd_linux ../expr.pd_linux
+
+../expr~.pd_linux: expr.pd_linux
+ -ln -s expr~/expr.pd_linux ../expr~.pd_linux
+
+../fexpr~.pd_linux: expr.pd_linux
+ -ln -s expr~/expr.pd_linux ../fexpr~.pd_linux
install_linux:
install expr.pd_linux $(PDEXTERN)
rm -f $(PDEXTERN)/expr~.pd_linux
rm -f $(PDEXTERN)/fexpr~.pd_linux
cd $(PDEXTERN); \
- ln -s expr.pd_linux expr~.pd_linux; \
- ln -s expr.pd_linux fexpr~.pd_linux
+ -ln -s expr.pd_linux expr~.pd_linux
+ -ln -s expr.pd_linux fexpr~.pd_linux
+
linux_clean:
rm -f *.pd_linux_o *.o
linux_clobber: clean
- rm -f expr.pd_linux expr.pd_irix6
+ rm -f expr.pd_linux
# ----------------------- MAC OSX -----------------------
@@ -133,28 +140,29 @@ expr.pd_darwin: $(MACOSXOBJ)
cc -bundle -undefined suppress -flat_namespace \
-o expr.pd_darwin $(MACOSXOBJ) -lm
rm -f ../expr.pd_darwin
- ln -s expr~/expr.pd_darwin ..
+ -ln -s expr~/expr.pd_darwin ..
expr~.pd_darwin: expr.pd_darwin
- ln -s expr.pd_darwin expr~.pd_darwin
+ -ln -s expr.pd_darwin expr~.pd_darwin
rm -f ../expr~.pd_darwin
- ln -s expr~/expr~.pd_darwin ..
+ -ln -s expr~/expr~.pd_darwin ..
fexpr~.pd_darwin: expr.pd_darwin
- ln -s expr.pd_darwin fexpr~.pd_darwin
+ -ln -s expr.pd_darwin fexpr~.pd_darwin
rm -f ../fexpr~.pd_darwin
- ln -s expr~/fexpr~.pd_darwin ..
+ -ln -s expr~/fexpr~.pd_darwin ..
install_darwin:
install expr.pd_darwin $(PDEXTERN)
rm -f $(PDEXTERN)/expr~.pd_darwin
rm -f $(PDEXTERN)/fexpr~.pd_darwin
cd $(PDEXTERN); \
- ln -s expr.pd_darwin expr~.pd_darwin; \
- ln -s expr.pd_darwin fexpr~.pd_darwin
+ -ln -s expr.pd_darwin expr~.pd_darwin; \
+ -ln -s expr.pd_darwin fexpr~.pd_darwin
darwin_clean:
rm -f *.pd_darwin_o *.o
darwin_clobber: clean
- rm -f expr.pd_darwin expr.pd_irix6
+ rm -f expr.pd_darwin
+
diff --git a/pd/extra/expr~/vexp.c b/pd/extra/expr~/vexp.c
index dddf6efa..d75ab539 100644
--- a/pd/extra/expr~/vexp.c
+++ b/pd/extra/expr~/vexp.c
@@ -28,6 +28,19 @@
/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
/*
+ * Feb 2002 - added access to variables
+ * multiple expression support
+ * new short hand forms for fexpr~
+ * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
+ * --sdy
+ *
+ * July 2002
+ * fixed bugs introduced in last changes in store and ET_EQ
+ * --sdy
+ *
+ */
+
+/*
* vexp.c -- a variable expression evaluator
*
* This modules implements an expression evaluator using the
@@ -56,17 +69,13 @@
#include <string.h>
#include <stdlib.h>
+#include <ctype.h>
#include "vexp.h"
-
-#ifndef MSP
-#ifndef MACOSX
-/*
- *stdlib.h produces a redefinition of _alloca()
- * why, I do not know?
- */
-#include "stdlib.h"
-#endif
+#ifdef MSP
+#undef isdigit
+#define isdigit(x) (x >= '0' && x <= '9')
#endif
+
char *atoif(char *s, long int *value, long int *type);
static struct ex_ex *ex_lex(struct expr *exp, long int *n);
@@ -81,6 +90,10 @@ struct ex_ex *eval_func(struct expr *exp,struct ex_ex *eptr,
struct ex_ex *optr, int i);
struct ex_ex *eval_tab(struct expr *exp, struct ex_ex *eptr,
struct ex_ex *optr, int i);
+struct ex_ex *eval_var(struct expr *exp, struct ex_ex *eptr,
+ struct ex_ex *optr, int i);
+struct ex_ex *eval_store(struct expr *exp, struct ex_ex *eptr,
+ struct ex_ex *optr, int i);
struct ex_ex *eval_sigidx(struct expr *exp, struct ex_ex *eptr,
struct ex_ex *optr, int i);
static int cal_sigidx(struct ex_ex *optr, /* The output value */
@@ -192,6 +205,7 @@ expr_donew(struct expr *expr, int ac, t_atom *av)
char *exp_string;
int exp_strlen;
t_binbuf *b;
+ int i;
memset(expr->exp_var, 0, MAX_VARS * sizeof (*expr->exp_var));
#ifdef PD
@@ -200,7 +214,7 @@ expr_donew(struct expr *expr, int ac, t_atom *av)
binbuf_gettext(b, &exp_string, &exp_strlen);
#else /* MSP */
-{
+ {
char *buf = getbytes(0), *newbuf;
int length = 0;
char string[250];
@@ -230,32 +244,45 @@ expr_donew(struct expr *expr, int ac, t_atom *av)
}
exp_string = buf;
exp_strlen = length;
-}
+ }
#endif
exp_string = (char *)t_resizebytes(exp_string, exp_strlen,exp_strlen+1);
exp_string[exp_strlen] = 0;
- set_tokens(exp_string);
- list = ex_lex(expr, &max_node);
- set_tokens((char *)0);
- if (!list) { /* syntax error */
- return (1);
- }
- expr->exp_stack = (struct ex_ex *)fts_malloc(max_node *
- sizeof (struct ex_ex));
- ret = ex_match(list, (long)0);
- if (!ret) /* syntax error */
- goto error;
- ret = ex_parse(expr, list, expr->exp_stack, (long *)0);
- if (ret) {
- *ret = nullex;
- /* print the stack that been built */
- t_freebytes(exp_string, exp_strlen+1);
- return (0);
+ expr->exp_string = exp_string;
+ expr->exp_str = exp_string;
+ expr->exp_nexpr = 0;
+ ret = (struct ex_ex *) 0;
+ /*
+ * if ret == 0 it means that we have no expression
+ * so we let the pass go through to build a single null stack
+ */
+ while (*expr->exp_str || !ret) {
+ list = ex_lex(expr, &max_node);
+ if (!list) { /* syntax error */
+ goto error;
+ }
+ expr->exp_stack[expr->exp_nexpr] =
+ (struct ex_ex *)fts_malloc(max_node * sizeof (struct ex_ex));
+ expr->exp_nexpr++;
+ ret = ex_match(list, (long)0);
+ if (!ret) /* syntax error */
+ goto error;
+ ret = ex_parse(expr,
+ list, expr->exp_stack[expr->exp_nexpr - 1], (long *)0);
+ if (!ret)
+ goto error;
}
+ *ret = nullex;
+ t_freebytes(exp_string, exp_strlen+1);
+ return (0);
error:
- fts_free(expr->exp_stack);
- expr->exp_stack = 0;
- fts_free(list);
+ for (i = 0; i < expr->exp_nexpr; i++) {
+ fts_free(expr->exp_stack[i]);
+ expr->exp_stack[i] = 0;
+ }
+ expr->exp_nexpr = 0;
+ if (list)
+ fts_free(list);
t_freebytes(exp_string, exp_strlen+1);
return (1);
}
@@ -342,7 +369,10 @@ ex_match(struct ex_ex *eptr, long int op)
case ET_VI:
case ET_SYM:
case ET_VSYM:
- case ET_VO:
+ continue;
+ case ET_YO:
+ if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
+ eptr->ex_type = ET_YOM1;
continue;
case ET_XI:
if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
@@ -401,10 +431,6 @@ ex_match(struct ex_ex *eptr, long int op)
}
continue;
case ET_STR:
- if (eptr[1].ex_type != ET_OP) {
- post("expr: syntax error: bad string '%s'\n", eptr->ex_ptr);
- return (exNULL);
- }
if (eptr[1].ex_op == OP_LB) {
char *tmp;
@@ -426,8 +452,20 @@ ex_match(struct ex_ex *eptr, long int op)
eptr->ex_type = ET_FUNC;
eptr->ex_ptr = (char *) fun;
} else {
- post("expr: syntax error: bad string '%s'\n", eptr->ex_ptr);
- return (exNULL);
+ char *tmp;
+
+ if (eptr[1].ex_type && eptr[1].ex_type!=ET_OP){
+ post("expr: syntax error: bad string '%s'\n", eptr->ex_ptr);
+ return (exNULL);
+ }
+ /* it is a variable */
+ eptr->ex_type = ET_VAR;
+ tmp = eptr->ex_ptr;
+ if (ex_getsym(tmp,
+ (t_symbol **)&(eptr->ex_ptr))) {
+ post("expr: variable '%s' not found",tmp);
+ return (exNULL);
+ }
}
continue;
default:
@@ -490,14 +528,16 @@ ex_parse(struct expr *x, struct ex_ex *iptr, struct ex_ex *optr, long int *argc)
case ET_II:
case ET_FI:
case ET_XI0:
+ case ET_YOM1:
case ET_VI:
+ case ET_VAR:
if (!count && !eptr[1].ex_type) {
*optr++ = *eptr;
return (optr);
}
break;
case ET_XI:
- case ET_VO:
+ case ET_YO:
case ET_SI:
case ET_TBL:
if (eptr[1].ex_type != ET_LB) {
@@ -1016,6 +1056,8 @@ abort();
}
return(++eptr);
case ET_XI0:
+ /* short hand for $x?[0] */
+
/* SDY delete the following check */
if (!IS_FEXPR_TILDE(exp) || optr->ex_type==ET_VEC) {
post("%d:exp->exp_flags = %d", __LINE__,exp->exp_flags);
@@ -1024,7 +1066,21 @@ abort();
optr->ex_type = ET_FLT;
optr->ex_flt = exp->exp_var[eptr->ex_int].ex_vec[idx];
return(++eptr);
- case ET_VO:
+ case ET_YOM1:
+ /*
+ * short hand for $y?[-1]
+ * if we are calculating the first sample of the vector
+ * we need to look at the previous results buffer
+ */
+ optr->ex_type = ET_FLT;
+ if (idx == 0)
+ optr->ex_flt =
+ exp->exp_p_res[eptr->ex_int][exp->exp_vsize - 1];
+ else
+ optr->ex_flt=exp->exp_tmpres[eptr->ex_int][idx-1];
+ return(++eptr);
+
+ case ET_YO:
case ET_XI:
/* SDY delete the following */
if (!IS_FEXPR_TILDE(exp) || optr->ex_type==ET_VEC) {
@@ -1038,6 +1094,8 @@ abort();
return (eval_tab(exp, eptr, optr, idx));
case ET_FUNC:
return (eval_func(exp, eptr, optr, idx));
+ case ET_VAR:
+ return (eval_var(exp, eptr, optr, idx));
case ET_OP:
break;
case ET_STR:
@@ -1060,6 +1118,8 @@ abort();
}
switch((eptr++)->ex_op) {
+ case OP_STORE:
+ return (eval_store(exp, eptr, optr, idx));
case OP_NOT:
EVAL_UNARY(!, +);
case OP_NEG:
@@ -1130,12 +1190,6 @@ abort();
}
-/* SDY
-all the returns in the function need to be changed to come here
-to make sure that we are freeing any allocated buffer pointed to
-by left and right vectors
-*/
-
/*
* the left and right nodes could have been transformed to vectors
* down the chain
@@ -1187,8 +1241,70 @@ eval_func(struct expr *exp, struct ex_ex *eptr, struct ex_ex *optr, int idx)
return (eptr);
}
+
/*
- * eval_tab --
+ * eval_store -- evaluate the '=' operator,
+ * make sure the first operator is a legal left operator
+ * and call ex_eval on the right operator
+ */
+struct ex_ex *
+eval_store(struct expr *exp, struct ex_ex *eptr, struct ex_ex *optr, int idx)
+/* the expr object data pointer */
+/* the operation stack */
+/* the result pointer */
+{
+ struct ex_ex arg;
+ int isvalue;
+ char *tbl = (char *) 0;
+ char *var = (char *) 0;
+ int badleft = 0;
+
+post("store called\n");
+ex_print(eptr);
+eptr = ex_eval(exp, ++eptr, optr, idx);
+return (eptr);
+
+#ifdef notdef /* SDY */
+ arg.ex_type = ET_INT;
+ arg.ex_int = 0;
+ if (eptr->ex_type == ET_VAR) {
+ var = (char *) eptr->ex_ptr;
+
+ eptr = ex_eval(exp, ++eptr, &arg, idx);
+ (void)max_ex_var_store(exp, (t_symbol *)var, &arg, optr);
+ if (arg.ex_type == ET_VEC)
+ fts_free(arg.ex_vec);
+ }
+
+
+ if (eptr->ex_type == ET_SI) {
+ eptr++;
+ if (eptr->ex_type =
+ }
+
+ /* the left operator should either be a value or a array member */
+ switch (eptr->ex_type) {
+ case ET_SI:
+ if ((eptr + 1)->ex_type == OP_LB) {
+ }
+ if (!exp->exp_var[eptr->ex_int].ex_ptr) {
+ if (!(exp->exp_error & EE_NOTABLE)) {
+ post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
+ post("expr: No more table errors will be reported");
+ post("expr: till the next reset");
+ exp->exp_error |= EE_NOTABLE;
+ }
+ badleft++;
+ } else
+ tbl = (char *) exp->exp_var[eptr->ex_int].ex_ptr;
+ break;
+ case ET_TBL:
+ }
+#endif /* SDY */
+}
+
+/*
+ * eval_tab -- evaluate a table operation
*/
struct ex_ex *
eval_tab(struct expr *exp, struct ex_ex *eptr, struct ex_ex *optr, int idx)
@@ -1230,10 +1346,55 @@ eval_tab(struct expr *exp, struct ex_ex *eptr, struct ex_ex *optr, int idx)
optr->ex_int = 0;
if (!notable)
(void)max_ex_tab(exp, (t_symbol *)tbl, &arg, optr);
+ if (arg.ex_type == ET_VEC)
+ fts_free(arg.ex_vec);
return (eptr);
}
/*
+ * eval_var -- evaluate a variable
+ */
+struct ex_ex *
+eval_var(struct expr *exp, struct ex_ex *eptr, struct ex_ex *optr, int idx)
+/* the expr object data pointer */
+/* the operation stack */
+/* the result pointer */
+{
+ struct ex_ex arg;
+ char *var = (char *) 0;
+ int novar = 0;
+
+ if (eptr->ex_type == ET_SI) {
+ if (!exp->exp_var[eptr->ex_int].ex_ptr) {
+/* SDY post_error() does not work in MAX/MSP yet
+post_error((fts_object_t *) exp,
+"expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
+*/
+ if (!(exp->exp_error & EE_NOVAR)) {
+ post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
+ post("expr: No more table errors will be reported");
+ post("expr: till the next reset");
+ exp->exp_error |= EE_NOVAR;
+ }
+ novar++;
+ } else
+ var = (char *) exp->exp_var[eptr->ex_int].ex_ptr;
+ } else if (eptr->ex_type == ET_VAR)
+ var = (char *) eptr->ex_ptr;
+ else {
+ post_error((fts_object_t *) exp, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
+ novar++;
+
+ }
+
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ if (!novar)
+ (void)max_ex_var(exp, (t_symbol *)var, optr);
+ return (++eptr);
+}
+
+/*
* eval_sigidx -- evaluate the value of an indexed signal for fexpr~
*/
struct ex_ex *
@@ -1298,7 +1459,7 @@ eval_sigidx(struct expr *exp, struct ex_ex *eptr, struct ex_ex *optr, int idx)
/*
* indexing an output vector
*/
- } else if (eptr->ex_type == ET_VO) {
+ } else if (eptr->ex_type == ET_YO) {
/* for output vectors index of zero is not legal */
if (fi >= 0) {
if (!(exp->exp_error & EE_BI_OUTPUT)) {
@@ -1308,10 +1469,17 @@ eval_sigidx(struct expr *exp, struct ex_ex *eptr, struct ex_ex *optr, int idx)
post("fexpr~: no error report till next reset");
post("fexpr~: index assumed to be = -1");
}
- i = 0;
+ i = -1;
+ }
+ if (eptr->ex_int >= exp->exp_nexpr) {
+ post("fexpr~: $y%d illegal: not that many exprs",
+ eptr->ex_int);
+ optr->ex_flt = 0;
+ return (reteptr);
}
if (cal_sigidx(optr, i, rem_i, idx, exp->exp_vsize,
- exp->exp_tmpres, exp->exp_p_res)) {
+ exp->exp_tmpres[eptr->ex_int],
+ exp->exp_p_res[eptr->ex_int])) {
if (!(exp->exp_error & EE_BI_OUTPUT)) {
exp->exp_error |= EE_BI_OUTPUT;
post("fexpr~: bad output index, (%f)", fi);
@@ -1380,16 +1548,6 @@ cal_sigidx(struct ex_ex *optr, /* The output value */
return (1);
}
-static char *exp_str;
-/*
- * set_tokens -- set a new string for reading tokens
- */
-
-void
-set_tokens(char *s)
-{
- exp_str = s;
-}
/*
* getoken -- return 1 on syntax error otherwise 0
*/
@@ -1399,18 +1557,25 @@ getoken(struct expr *exp, struct ex_ex *eptr)
char *p;
long i;
- if (!exp_str) {
+
+ if (!exp->exp_str) {
post("expr: getoken: expression string not set\n");
return (0);
}
retry:
- if (!*exp_str) {
+ if (!*exp->exp_str) {
+ eptr->ex_type = 0;
+ eptr->ex_int = 0;
+ return (0);
+ }
+ if (*exp->exp_str == ';') {
+ exp->exp_str++;
eptr->ex_type = 0;
eptr->ex_int = 0;
return (0);
}
eptr->ex_type = ET_OP;
- switch (*exp_str++) {
+ switch (*exp->exp_str++) {
case '\\':
case ' ':
case '\t':
@@ -1456,21 +1621,21 @@ retry:
eptr->ex_op = OP_LB;
break;
case '!':
- if (*exp_str == '=') {
+ if (*exp->exp_str == '=') {
eptr->ex_op = OP_NE;
- exp_str++;
+ exp->exp_str++;
} else
eptr->ex_op = OP_NOT;
break;
case '<':
- switch (*exp_str) {
+ switch (*exp->exp_str) {
case '<':
eptr->ex_op = OP_SL;
- exp_str++;
+ exp->exp_str++;
break;
case '=':
eptr->ex_op = OP_LE;
- exp_str++;
+ exp->exp_str++;
break;
default:
eptr->ex_op = OP_LT;
@@ -1478,14 +1643,14 @@ retry:
}
break;
case '>':
- switch (*exp_str) {
+ switch (*exp->exp_str) {
case '>':
eptr->ex_op = OP_SR;
- exp_str++;
+ exp->exp_str++;
break;
case '=':
eptr->ex_op = OP_GE;
- exp_str++;
+ exp->exp_str++;
break;
default:
eptr->ex_op = OP_GT;
@@ -1493,30 +1658,39 @@ retry:
}
break;
case '=':
- if (*exp_str++ != '=') {
+ if (*exp->exp_str++ != '=') {
post("expr: syntax error: =\n");
return (1);
}
eptr->ex_op = OP_EQ;
break;
+/* do not allow the store till the function is fixed
+ if (*exp->exp_str != '=')
+ eptr->ex_op = OP_STORE;
+ else {
+ exp->exp_str++;
+ eptr->ex_op = OP_EQ;
+ }
+ break;
+*/
case '&':
- if (*exp_str == '&') {
- exp_str++;
+ if (*exp->exp_str == '&') {
+ exp->exp_str++;
eptr->ex_op = OP_LAND;
} else
eptr->ex_op = OP_AND;
break;
case '|':
- if ((*exp_str == '|')) {
- exp_str++;
+ if ((*exp->exp_str == '|')) {
+ exp->exp_str++;
eptr->ex_op = OP_LOR;
} else
eptr->ex_op = OP_OR;
break;
case '$':
- switch (*exp_str++) {
+ switch (*exp->exp_str++) {
case 'I':
case 'i':
eptr->ex_type = ET_II;
@@ -1536,36 +1710,44 @@ retry:
break;
}
post("$v? works only for expr~");
- post("expr: syntax error: %s\n", &exp_str[-2]);
+ post("expr: syntax error: %s\n", &exp->exp_str[-2]);
return (1);
case 'X':
case 'x':
if (IS_FEXPR_TILDE(exp)) {
eptr->ex_type = ET_XI;
- break;
+ if (isdigit(*exp->exp_str))
+ break;
+ /* for $x[] is a shorhand for $x1[] */
+ eptr->ex_int = 0;
+ goto noinletnum;
}
post("$x? works only for fexpr~");
- post("expr: syntax error: %s\n", &exp_str[-2]);
+ post("expr: syntax error: %s\n", &exp->exp_str[-2]);
return (1);
case 'y':
case 'Y':
if (IS_FEXPR_TILDE(exp)) {
- eptr->ex_type = ET_VO;
+ eptr->ex_type = ET_YO;
/*$y takes no number */
+ if (isdigit(*exp->exp_str))
+ break;
+ /* for $y[] is a shorhand for $y1[] */
+ eptr->ex_int = 0;
goto noinletnum;
}
post("$y works only for fexpr~");
default:
- post("expr: syntax error: %s\n", &exp_str[-2]);
+ post("expr: syntax error: %s\n", &exp->exp_str[-2]);
return (1);
}
- p = atoif(exp_str, &eptr->ex_op, &i);
+ p = atoif(exp->exp_str, &eptr->ex_op, &i);
if (!p) {
- post("expr: syntax error: %s\n", &exp_str[-2]);
+ post("expr: syntax error: %s\n", &exp->exp_str[-2]);
return (1);
}
if (i != ET_INT) {
- post("expr: syntax error: %s\n", exp_str);
+ post("expr: syntax error: %s\n", exp->exp_str);
return (1);
}
/*
@@ -1573,39 +1755,46 @@ retry:
* therefore we decrement the number that user has supplied
*/
if (!eptr->ex_op || (eptr->ex_op)-- > MAX_VARS) {
- post("expr: syntax error: inlet out of range: %s\n",
- exp_str);
+ post("expr: syntax error: inlet or outlet out of range: %s\n",
+ exp->exp_str);
return (1);
}
-/*
- * until we can change the input type of inlets on the fly (at pd_new()
- * time) the first input to expr~ is always a vectore and $f1 or $i1 is
- * illegal for fexr~
- */
-if (eptr->ex_op == 0 &&
- (IS_FEXPR_TILDE(exp) || IS_EXPR_TILDE(exp)) &&
- (eptr->ex_type==ET_II || eptr->ex_type==ET_FI || eptr->ex_type==ET_SI)) {
- post("first inlet of expr~ for fexpr~ can only be a vector");
- return (1);
-}
- /* record the inlet type and check for consistency */
- if (!exp->exp_var[eptr->ex_op].ex_type)
+ /*
+ * until we can change the input type of inlets on
+ * the fly (at pd_new()
+ * time) the first input to expr~ is always a vectore
+ * and $f1 or $i1 is
+ * illegal for fexr~
+ */
+ if (eptr->ex_op == 0 &&
+ (IS_FEXPR_TILDE(exp) || IS_EXPR_TILDE(exp)) &&
+ (eptr->ex_type==ET_II || eptr->ex_type==ET_FI ||
+ eptr->ex_type==ET_SI)) {
+ post("first inlet of expr~/fexpr~ can only be a vector");
+ return (1);
+ }
+ /* record the inlet or outlet type and check for consistency */
+ if (eptr->ex_type == ET_YO ) {
+ /* it is an outlet for fexpr~*/
+ /* no need to do anything */
+ ;
+ } else if (!exp->exp_var[eptr->ex_op].ex_type)
exp->exp_var[eptr->ex_op].ex_type = eptr->ex_type;
else if (exp->exp_var[eptr->ex_op].ex_type != eptr->ex_type) {
- post("expr: syntax error: inlets can only have one type: %s\n", exp_str);
+ post("expr: syntax error: inlets can only have one type: %s\n", exp->exp_str);
return (1);
}
- exp_str = p;
+ exp->exp_str = p;
noinletnum:
break;
case '"':
{
struct ex_ex ex;
- p = exp_str;
- if (!*exp_str || *exp_str == '"') {
- post("expr: syntax error: empty symbol: %s\n", --exp_str);
+ p = exp->exp_str;
+ if (!*exp->exp_str || *exp->exp_str == '"') {
+ post("expr: syntax error: empty symbol: %s\n", --exp->exp_str);
return (1);
}
if (getoken(exp, &ex))
@@ -1626,7 +1815,7 @@ noinletnum:
post("expr: syntax error: bad symbol name: %s\n", p);
return (1);
}
- if (*exp_str++ != '"') {
+ if (*exp->exp_str++ != '"') {
post("expr: syntax error: missing '\"'\n");
return (1);
}
@@ -1643,10 +1832,10 @@ noinletnum:
case '7':
case '8':
case '9':
- p = atoif(--exp_str, &eptr->ex_int, &eptr->ex_type);
+ p = atoif(--exp->exp_str, &eptr->ex_int, &eptr->ex_type);
if (!p)
return (1);
- exp_str = p;
+ exp->exp_str = p;
break;
default:
@@ -1654,17 +1843,17 @@ noinletnum:
* has to be a string, it should either be a
* function or a table
*/
- p = --exp_str;
+ p = --exp->exp_str;
for (i = 0; name_ok(*p); i++)
p++;
if (!i) {
- post("expr: syntax error: %s\n", exp_str);
+ post("expr: syntax error: %s\n", exp->exp_str);
return (1);
}
eptr->ex_ptr = (char *)fts_malloc(i + 1);
- strncpy(eptr->ex_ptr, exp_str, (int) i);
+ strncpy(eptr->ex_ptr, exp->exp_str, (int) i);
(eptr->ex_ptr)[i] = 0;
- exp_str = p;
+ exp->exp_str = p;
/*
* we mark this as a string and later we will change this
* to either a function or a table
@@ -1798,6 +1987,7 @@ ex_print(struct ex_ex *eptr)
post("%s ", eptr->ex_ptr);
break;
case ET_TBL:
+ case ET_VAR:
post("%s ", ex_symname((fts_symbol_t )eptr->ex_ptr));
break;
case ET_SYM:
@@ -1841,8 +2031,9 @@ ex_print(struct ex_ex *eptr)
case ET_VEC:
post("vec = %ld ", eptr->ex_vec);
break;
- case ET_VO:
- post("$y");
+ case ET_YOM1:
+ case ET_YO:
+ post("$y%d", eptr->ex_int + 1);
break;
case ET_XI:
case ET_XI0:
@@ -1907,6 +2098,9 @@ ex_print(struct ex_ex *eptr)
case OP_EQ:
post("%s", "==");
break;
+ case OP_STORE:
+ post("%s", "=");
+ break;
case OP_NE:
post("%s", "!=");
break;
diff --git a/pd/extra/expr~/vexp.h b/pd/extra/expr~/vexp.h
index dd93d2b8..e90c8409 100644
--- a/pd/extra/expr~/vexp.h
+++ b/pd/extra/expr~/vexp.h
@@ -94,6 +94,7 @@
#define OP_LB ((long)(14<<16|25)) /* [ */
#define OP_RP ((long)(14<<16|26)) /* ) */
#define OP_LP ((long)(14<<16|27)) /* ( */
+#define OP_STORE ((long)(15<<16|28)) /* = */
#define HI_PRE ((long)(100<<16)) /* infinite precedence */
#define PRE_MASK ((long)0xffff0000) /* precedence level mask */
@@ -121,28 +122,30 @@ struct ex_ex {
#define exNULL ((struct ex_ex *)0)
/* defines for ex_type */
-#define ET_INT 0x1 /* an int */
-#define ET_FLT 0x2 /* a float */
-#define ET_OP 0x3 /* operator */
-#define ET_STR 0x4 /* string */
-#define ET_TBL 0x5 /* a table, the content is a pointer */
-#define ET_FUNC 0x6 /* a function */
-#define ET_SYM 0x7 /* symbol ("string") */
-#define ET_VSYM 0x8 /* variable symbol ("$s?") */
+#define ET_INT 1 /* an int */
+#define ET_FLT 2 /* a float */
+#define ET_OP 3 /* operator */
+#define ET_STR 4 /* string */
+#define ET_TBL 5 /* a table, the content is a pointer */
+#define ET_FUNC 6 /* a function */
+#define ET_SYM 7 /* symbol ("string") */
+#define ET_VSYM 8 /* variable symbol ("$s?") */
/* we treat parenthesis and brackets */
/* special to keep a pointer to their */
/* match in the content */
-#define ET_LP 0x9 /* left parenthesis */
-#define ET_LB 0x10 /* left bracket */
-#define ET_II 0x11 /* and integer inlet */
-#define ET_FI 0x12 /* float inlet */
-#define ET_SI 0x13 /* string inlet */
-#define ET_VI 0x14 /* signal inlet */
-#define ET_VEC 0x15 /* allocated signal vector */
+#define ET_LP 9 /* left parenthesis */
+#define ET_LB 10 /* left bracket */
+#define ET_II 11 /* and integer inlet */
+#define ET_FI 12 /* float inlet */
+#define ET_SI 13 /* string inlet */
+#define ET_VI 14 /* signal inlet */
+#define ET_VEC 15 /* allocated signal vector */
/* special types for fexpr~ */
-#define ET_VO 0x16 /* vector output for fexpr~ */
-#define ET_XI 0x17 /* vector input for fexpr~ */
-#define ET_XI0 0x18 /* shorthand for $x?[0] */
+#define ET_YO 16 /* vector output for fexpr~ */
+#define ET_YOM1 17 /* shorthand for $y?[-1] */
+#define ET_XI 18 /* vector input for fexpr~ */
+#define ET_XI0 20 /* shorthand for $x?[0] */
+#define ET_VAR 21 /* variable */
/* defines for ex_flags */
#define EF_TYPE_MASK 0x07 /* first three bits define the type of expr */
@@ -151,6 +154,7 @@ struct ex_ex {
#define EF_FEXPR_TILDE 0x04 /* fexpr~ filter expression */
#define EF_STOP 0x08 /* is it stopped used for expr~ and fexpr~ */
+#define EF_VERBOSE 0x10 /* verbose mode */
#define IS_EXPR(x) ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR) == EF_EXPR)
#define IS_EXPR_TILDE(x) \
@@ -177,6 +181,7 @@ struct ex_ex {
#define EE_BI_OUTPUT 0x02 /* Bad output index */
#define EE_BI_INPUT 0x04 /* Bad input index */
#define EE_NOTABLE 0x08 /* NO TABLE */
+#define EE_NOVAR 0x10 /* NO VARIABLE */
typedef struct expr {
#ifdef PD
@@ -186,19 +191,22 @@ typedef struct expr {
#endif
int exp_flags; /* are we expr~, fexpr~, or expr */
int exp_error; /* reported errors */
- t_outlet *exp_outlet;
+ int exp_nexpr; /* number of expressions */
+ char *exp_string; /* the full expression string */
+ char *exp_str; /* current parsing position */
+ t_outlet *exp_outlet[MAX_VARS];
#ifdef PD
struct _exprproxy *exp_proxy;
#else /* MAX */
void *exp_proxy[MAX_VARS];
long exp_proxy_id;
#endif
- struct ex_ex *exp_stack;
+ struct ex_ex *exp_stack[MAX_VARS];
struct ex_ex exp_var[MAX_VARS];
- struct ex_ex exp_res; /* the evluation result */
+ struct ex_ex exp_res[MAX_VARS]; /* the evluation result */
t_float *exp_p_var[MAX_VARS];
- t_float *exp_p_res; /* the previous evaluation result */
- t_float *exp_tmpres; /* temporty result for fexpr~ */
+ t_float *exp_p_res[MAX_VARS]; /* the previous evaluation result */
+ t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */
int exp_vsize; /* the size of the signal vector */
int exp_nivec; /* # of vector inlets */
float exp_f; /* control value to be transformed to signal */
@@ -214,6 +222,7 @@ typedef struct ex_funcs {
/* function prototypes for pd-related functions called withing vexp.h */
extern int max_ex_tab(struct expr *expr, t_symbol *s, struct ex_ex *arg, struct ex_ex *optr);
+extern int max_ex_var(struct expr *expr, t_symbol *s, struct ex_ex *optr);
extern int ex_getsym(char *p, t_symbol **s);
extern const char *ex_symname(t_symbol *s);
void ex_mkvector(t_float *fp, t_float x, int size);
@@ -225,6 +234,8 @@ extern void ex_avg(t_expr *expr, long int argc, struct ex_ex *argv, stru
extern void ex_Avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
extern void ex_store(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
+int value_getonly(t_symbol *s, t_float *f);
+
#ifdef NT
#pragma warning (disable: 4305 4244)
diff --git a/pd/extra/expr~/vexp_fun.c b/pd/extra/expr~/vexp_fun.c
index 2879d96b..53e9092f 100644
--- a/pd/extra/expr~/vexp_fun.c
+++ b/pd/extra/expr~/vexp_fun.c
@@ -24,8 +24,42 @@
*
*/
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* Nov. 2001 - conversion for expr~ --sdy */
+/* "expr" was written by Shahrokh Yadegari c. 1989. -msp
+ *
+ * Nov. 2001 --sdy
+ * conversion for expr~
+ *
+ * Jan, 2002 --sdy
+ * added fmod()
+ *
+ * May 2002
+ * added floor and ceil for expr -- Orm Finnendahl
+ *
+ * July 2002 --sdy
+ * added the following math funtions:
+ * cbrt - cube root
+ * erf - error function
+ * erfc - complementary error function
+ * expm1 - exponential minus 1,
+ * log1p - logarithm of 1 plus
+ * isinf - is the value infinite,
+ * finite - is the value finite
+ * isnan -- is the resut a nan (Not a number)
+ * copysign - copy sign of a number
+ * ldexp - multiply floating-point number by integral power of 2
+ * imodf - get signed integral value from floating-point number
+ * modf - get signed fractional value from floating-point number
+ * drem - floating-point remainder function
+ *
+ * The following are done but not popular enough in math libss
+ * to be included yet
+ * hypoth - Euclidean distance function
+ * trunc
+ * round
+ * nearbyint -
+ */
+
+
/*
* vexp_func.c -- this file include all the functions for vexp.
@@ -45,6 +79,7 @@
*/
#include <stdlib.h>
+#include <string.h>
#define __STRICT_BSD__
#include <math.h>
@@ -81,6 +116,33 @@ static void ex_sqrt(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_e
static void ex_fact(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
static void ex_random(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
static void ex_abs(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_fmod(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_ceil(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_floor(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_if(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_ldexp(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_imodf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_modf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+#ifndef NT
+static void ex_cbrt(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_erf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_erfc(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_expm1(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_log1p(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_isinf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_finite(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_isnan(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_copysign(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_drem(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+#endif
+#ifdef notdef
+/* the following will be added once they are more popular in math libraries */
+static void ex_round(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_trunc(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_nearbyint(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+static void ex_hypoth(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
+#endif
+
t_ex_func ex_funcs[] = {
{"min", ex_min, 2},
@@ -88,6 +150,9 @@ t_ex_func ex_funcs[] = {
{"int", ex_toint, 1},
{"rint", ex_rint, 1},
{"float", ex_tofloat, 1},
+ {"fmod", ex_fmod, 2},
+ {"floor", ex_floor, 2},
+ {"ceil", ex_ceil, 2},
{"pow", ex_pow, 2},
{"sqrt", ex_sqrt, 1},
{"exp", ex_exp, 1},
@@ -107,7 +172,21 @@ t_ex_func ex_funcs[] = {
{"fact", ex_fact, 1},
{"random", ex_random, 2}, /* random number */
{"abs", ex_abs, 1},
+ {"if", ex_if, 3},
+ {"ldexp ", ex_ldexp, 1},
+ {"imodf ", ex_imodf, 1},
+ {"modf", ex_modf, 1},
#ifndef NT
+ {"cbrt", ex_cbrt, 1},
+ {"erf", ex_erf, 1},
+ {"erfc", ex_erfc, 1},
+ {"expm1", ex_expm1, 1},
+ {"log1p", ex_log1p, 1},
+ {"isinf", ex_isinf, 1},
+ {"finite", ex_finite, 1},
+ {"isnan", ex_isnan, 1},
+ {"copysig", ex_copysign, 1},
+ {"drem", ex_drem, 1},
{"asinh", ex_asinh, 1},
{"acosh", ex_acosh, 1},
{"atanh", ex_atanh, 1}, /* hyperbolic atan */
@@ -120,13 +199,22 @@ t_ex_func ex_funcs[] = {
{"Avg", ex_Avg, 3},
{"store", ex_store, 3},
#endif
+#ifdef notdef
+/* the following will be added once they are more popular in math libraries */
+ {"round", ex_round, 1},
+ {"trunc", ex_trunc, 1},
+ {"nearbyint", ex_nearbyint, 1},
+ {"hypoth", ex_hypoth, 1},
+#endif
{0, 0, 0}
};
/*
- * FUN_EVAL --
+ * FUN_EVAL -- do type checking, evaluate a function,
+ * if fltret is set return float
+ * otherwise return value based on regular typechecking,
*/
-#define FUNC_EVAL(left, right, func, leftfuncast, rightfuncast, optr) \
+#define FUNC_EVAL(left, right, func, leftfuncast, rightfuncast, optr, fltret) \
switch (left->ex_type) { \
case ET_INT: \
switch(right->ex_type) { \
@@ -139,9 +227,15 @@ case ET_INT: \
while (j--) \
*op++ = scalar; \
} else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_int); \
+ if (fltret) { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = (float)func(leftfuncast \
+ left->ex_int, rightfuncast right->ex_int); \
+ } else { \
+ optr->ex_type = ET_INT; \
+ optr->ex_int = (int)func(leftfuncast \
+ left->ex_int, rightfuncast right->ex_int); \
+ } \
} \
break; \
case ET_FLT: \
@@ -197,8 +291,8 @@ case ET_FLT: \
while (j--) \
*op++ = scalar; \
} else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int)func(leftfuncast left->ex_flt, \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = (float)func(leftfuncast left->ex_flt, \
rightfuncast right->ex_int); \
} \
break; \
@@ -306,9 +400,11 @@ default: \
}
/*
- * evaluate a unary operator, TYPE is applied to float operands
+ * FUNC_EVAL_UNARY - evaluate a unary function,
+ * if fltret is set return float
+ * otherwise return value based on regular typechecking,
*/
-#define FUNC_EVAL_UNARY(left, func, leftcast, optr) \
+#define FUNC_EVAL_UNARY(left, func, leftcast, optr, fltret) \
switch(left->ex_type) { \
case ET_INT: \
if (optr->ex_type == ET_VEC) { \
@@ -316,6 +412,11 @@ case ET_INT: \
(float)(func (leftcast left->ex_int)), e->exp_vsize);\
break; \
} \
+ if (fltret) { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = (float) func(leftcast left->ex_int); \
+ break; \
+ } \
optr->ex_type = ET_INT; \
optr->ex_int = (int) func(leftcast left->ex_int); \
break; \
@@ -352,8 +453,39 @@ default: \
#define min(x,y) (x > y ? y : x)
#define max(x,y) (x > y ? x : y)
+#define FUNC_DEF(ex_func, func, castleft, castright, fltret); \
+static void \
+ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
+{ \
+ struct ex_ex *left, *right; \
+ float *op; /* output pointer */ \
+ float *lp, *rp; /* left and right vector pointers */ \
+ float scalar; \
+ int j; \
+ \
+ left = argv++; \
+ right = argv; \
+ FUNC_EVAL(left, right, func, castleft, castright, optr, fltret); \
+}
+
+
+#define FUNC_DEF_UNARY(ex_func, func, cast, fltret); \
+static void \
+ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
+{ \
+ struct ex_ex *left; \
+ float *op; /* output pointer */ \
+ float *lp, *rp; /* left and right vector pointers */ \
+ float scalar; \
+ int j; \
+ \
+ left = argv++; \
+ \
+ FUNC_EVAL_UNARY(left, func, cast, optr, fltret); \
+}
+
/*
- * ex_min -- if any of the arfuments are or the output are vectors, a vector
+ * ex_min -- if any of the arguments are or the output are vectors, a vector
* of floats is generated otherwise the type of the result is the
* type of the smaller value
*/
@@ -369,12 +501,11 @@ ex_min(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
right = argv;
- /* minimum needs no cast, as it is not a real function */
- FUNC_EVAL(left, right, min, (double), (double), optr);
+ FUNC_EVAL(left, right, min, (double), (double), optr, 0);
}
/*
- * ex_max -- if any of the arfuments are or the output are vectors, a vector
+ * ex_max -- if any of the arguments are or the output are vectors, a vector
* of floats is generated otherwise the type of the result is the
* type of the larger value
*/
@@ -390,12 +521,9 @@ ex_max(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
right = argv;
- /* minimum needs no cast, as it is not a real function */
- FUNC_EVAL(left, right, max, (double), (double), optr);
+ FUNC_EVAL(left, right, max, (double), (double), optr, 0);
}
-/* SDY changed to new form up to here */
-
/*
* ex_toint -- convert to integer
*/
@@ -411,8 +539,8 @@ ex_toint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
#define toint(x) ((int)(x))
- FUNC_EVAL_UNARY(left, toint, (int), optr);
-}
+ FUNC_EVAL_UNARY(left, toint, (int), optr, 0);
+ }
#ifdef NT
/* No rint in NT land ??? */
@@ -441,25 +569,7 @@ ex_rint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, rint, (double), optr);
-
-#ifdef old
-
- if (argv->ex_type == ET_INT)
- *optr = *argv;
- else if (argv->ex_type == ET_FLT) {
- optr->ex_type = ET_FLT;
-#ifdef NT /* no rint() in NT??? */
- optr->ex_flt = floor(argv->ex_flt + 0.5);
-#else
- optr->ex_flt = rint(argv->ex_flt);
-#endif
- } else {
-/* SDY what does this mean? this is wrong!!???? */
- optr->ex_type = ET_INT;
- optr->ex_int = (int)argv->ex_ptr;
- }
-#endif
+ FUNC_EVAL_UNARY(left, rint, (double), optr, 1);
}
/*
@@ -477,7 +587,7 @@ ex_tofloat(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
#define tofloat(x) ((float)(x))
- FUNC_EVAL_UNARY(left, toint, (int), optr);
+ FUNC_EVAL_UNARY(left, tofloat, (int), optr, 1);
}
@@ -495,7 +605,7 @@ ex_pow(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
right = argv;
- FUNC_EVAL(left, right, pow, (double), (double), optr);
+ FUNC_EVAL(left, right, pow, (double), (double), optr, 1);
}
/*
@@ -512,7 +622,7 @@ ex_sqrt(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, sqrt, (double), optr);
+ FUNC_EVAL_UNARY(left, sqrt, (double), optr, 1);
}
/*
@@ -529,7 +639,7 @@ ex_exp(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, exp, (double), optr);
+ FUNC_EVAL_UNARY(left, exp, (double), optr, 1);
}
/*
@@ -546,7 +656,7 @@ ex_log(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, log10, (double), optr);
+ FUNC_EVAL_UNARY(left, log10, (double), optr, 1);
}
/*
@@ -563,7 +673,7 @@ ex_ln(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, log, (double), optr);
+ FUNC_EVAL_UNARY(left, log, (double), optr, 1);
}
static void
@@ -577,7 +687,7 @@ ex_sin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, sin, (double), optr);
+ FUNC_EVAL_UNARY(left, sin, (double), optr, 1);
}
static void
@@ -591,7 +701,7 @@ ex_cos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, cos, (double), optr);
+ FUNC_EVAL_UNARY(left, cos, (double), optr, 1);
}
@@ -606,7 +716,7 @@ ex_tan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, tan, (double), optr);
+ FUNC_EVAL_UNARY(left, tan, (double), optr, 1);
}
static void
@@ -620,7 +730,7 @@ ex_asin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, asin, (double), optr);
+ FUNC_EVAL_UNARY(left, asin, (double), optr, 1);
}
static void
@@ -634,7 +744,7 @@ ex_acos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, acos, (double), optr);
+ FUNC_EVAL_UNARY(left, acos, (double), optr, 1);
}
@@ -649,7 +759,7 @@ ex_atan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, atan, (double), optr);
+ FUNC_EVAL_UNARY(left, atan, (double), optr, 1);
}
/*
@@ -666,9 +776,59 @@ ex_atan2(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
right = argv;
- FUNC_EVAL(left, right, atan2, (double), (double), optr);
+ FUNC_EVAL(left, right, atan2, (double), (double), optr, 1);
}
+/*
+ * ex_fmod -- floating point modulo
+ */
+static void
+ex_fmod(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
+{
+ struct ex_ex *left, *right;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
+
+ left = argv++;
+ right = argv;
+ FUNC_EVAL(left, right, fmod, (double), (double), optr, 1);
+}
+
+
+/*
+ * ex_floor -- floor
+ */
+static void
+ex_floor(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
+{
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
+
+ left = argv++;
+ FUNC_EVAL_UNARY(left, floor, (double), optr, 1);
+}
+
+
+/*
+ * ex_ceil -- ceil
+ */
+static void
+ex_ceil(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
+{
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
+
+ left = argv++;
+ FUNC_EVAL_UNARY(left, ceil, (double), optr, 1);
+}
static void
ex_sinh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
@@ -681,7 +841,7 @@ ex_sinh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, sinh, (double), optr);
+ FUNC_EVAL_UNARY(left, sinh, (double), optr, 1);
}
static void
@@ -695,7 +855,7 @@ ex_cosh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, cosh, (double), optr);
+ FUNC_EVAL_UNARY(left, cosh, (double), optr, 1);
}
@@ -710,7 +870,7 @@ ex_tanh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, tanh, (double), optr);
+ FUNC_EVAL_UNARY(left, tanh, (double), optr, 1);
}
@@ -726,7 +886,7 @@ ex_asinh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, asinh, (double), optr);
+ FUNC_EVAL_UNARY(left, asinh, (double), optr, 1);
}
static void
@@ -740,7 +900,7 @@ ex_acosh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, acosh, (double), optr);
+ FUNC_EVAL_UNARY(left, acosh, (double), optr, 1);
}
static void
@@ -754,7 +914,7 @@ ex_atanh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, atanh, (double), optr);
+ FUNC_EVAL_UNARY(left, atanh, (double), optr, 1);
}
#endif
@@ -786,7 +946,7 @@ ex_fact(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, ex_dofact, (int), optr);
+ FUNC_EVAL_UNARY(left, ex_dofact, (int), optr, 0);
}
static int
@@ -808,7 +968,7 @@ ex_random(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
right = argv;
- FUNC_EVAL(left, right, ex_dorandom, (int), (int), optr);
+ FUNC_EVAL(left, right, ex_dorandom, (int), (int), optr, 0);
}
@@ -823,6 +983,333 @@ ex_abs(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
left = argv++;
- FUNC_EVAL_UNARY(left, fabs, (double), optr);
+ FUNC_EVAL_UNARY(left, fabs, (double), optr, 0);
}
+/*
+ *ex_if -- floating point modulo
+ */
+static void
+ex_if(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
+{
+ struct ex_ex *left, *right, *cond, *res;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float *cp; /* condition pointer */
+ float leftvalue, rightvalue;
+ int j;
+
+ cond = argv++;
+ left = argv++;
+ right = argv;
+
+ switch (cond->ex_type) {
+ case ET_VEC:
+ case ET_VI:
+ if (optr->ex_type != ET_VEC) {
+ if (optr->ex_type == ET_VI) {
+ /* SDY remove this test */
+ post("expr~: Int. error %d", __LINE__);
+ return;
+ }
+ optr->ex_type = ET_VEC;
+ optr->ex_vec = (t_float *)
+ fts_malloc(sizeof (t_float) * e->exp_vsize);
+ }
+ op = optr->ex_vec;
+ j = e->exp_vsize;
+ cp = cond->ex_vec;
+ switch (left->ex_type) {
+ case ET_INT:
+ leftvalue = left->ex_int;
+ switch (right->ex_type) {
+ case ET_INT:
+ rightvalue = right->ex_int;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = rightvalue;
+ }
+ return;
+ case ET_FLT:
+ rightvalue = right->ex_flt;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = rightvalue;
+ }
+ return;
+ case ET_VEC:
+ case ET_VI:
+ rp = right->ex_vec;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = *rp;
+ rp++;
+ }
+ return;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad right type %ld\n",
+ __LINE__, right->ex_type);
+ return;
+ }
+ case ET_FLT:
+ leftvalue = left->ex_flt;
+ switch (right->ex_type) {
+ case ET_INT:
+ rightvalue = right->ex_int;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = rightvalue;
+ }
+ return;
+ case ET_FLT:
+ rightvalue = right->ex_flt;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = rightvalue;
+ }
+ return;
+ case ET_VEC:
+ case ET_VI:
+ rp = right->ex_vec;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = *rp;
+ rp++;
+ }
+ return;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad right type %ld\n",
+ __LINE__, right->ex_type);
+ return;
+ }
+ case ET_VEC:
+ case ET_VI:
+ lp = left->ex_vec;
+ switch (right->ex_type) {
+ case ET_INT:
+ rightvalue = right->ex_int;
+ while (j--) {
+ if (*cp++)
+ *op++ = *lp;
+ else
+ *op++ = rightvalue;
+ lp++;
+ }
+ return;
+ case ET_FLT:
+ rightvalue = right->ex_flt;
+ while (j--) {
+ if (*cp++)
+ *op++ = *lp;
+ else
+ *op++ = rightvalue;
+ lp++;
+ }
+ return;
+ case ET_VEC:
+ case ET_VI:
+ rp = right->ex_vec;
+ while (j--) {
+ if (*cp++)
+ *op++ = *lp;
+ else
+ *op++ = *rp;
+ lp++; rp++;
+ }
+ return;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad right type %ld\n",
+ __LINE__, right->ex_type);
+ return;
+ }
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad left type %ld\n",
+ __LINE__, left->ex_type);
+ return;
+ }
+ case ET_INT:
+ if (cond->ex_int)
+ res = left;
+ else
+ res = right;
+ break;
+ case ET_FLT:
+ if (cond->ex_flt)
+ res = left;
+ else
+ res = right;
+ break;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad condition type %ld\n",
+ __LINE__, cond->ex_type);
+ return;
+ }
+ switch(res->ex_type) {
+ case ET_INT:
+ if (optr->ex_type == ET_VEC) {
+ ex_mkvector(optr->ex_vec, (float)res->ex_int,
+ e->exp_vsize);
+ return;
+ }
+ *optr = *res;
+ return;
+ case ET_FLT:
+ if (optr->ex_type == ET_VEC) {
+ ex_mkvector(optr->ex_vec, (float)res->ex_flt,
+ e->exp_vsize);
+ return;
+ }
+ *optr = *res;
+ return;
+ case ET_VEC:
+ case ET_VI:
+ if (optr->ex_type != ET_VEC) {
+ if (optr->ex_type == ET_VI) {
+ /* SDY remove this test */
+ post("expr~: Int. error %d", __LINE__);
+ return;
+ }
+ optr->ex_type = ET_VEC;
+ optr->ex_vec = (t_float *)
+ fts_malloc(sizeof (t_float) * e->exp_vsize);
+ }
+ memcpy(optr->ex_vec, res->ex_vec, e->exp_vsize*sizeof(t_float));
+ return;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad res type %ld\n",
+ __LINE__, res->ex_type);
+ return;
+ }
+
+}
+
+/*
+ * ex_imodf - extract signed integral value from floating-point number
+ */
+static double
+imodf(double x)
+{
+ double xx;
+
+ modf(x, &xx);
+ return (xx);
+}
+FUNC_DEF_UNARY(ex_imodf, imodf, (double), 1);
+
+/*
+ * ex_modf - extract signed fractional value from floating-point number
+ *
+ * using fracmodf because fmodf() is alrady defined in a .h file
+ */
+static double
+fracmodf(double x)
+{
+ double xx;
+
+ return(modf(x, &xx));
+}
+FUNC_DEF_UNARY(ex_modf, fracmodf, (double), 1);
+
+/*
+ * ex_ldexp - multiply floating-point number by integral power of 2
+ */
+FUNC_DEF(ex_ldexp, ldexp, (double), (int), 1);
+
+#ifndef NT
+/*
+ * ex_cbrt - cube root
+ */
+FUNC_DEF_UNARY(ex_cbrt, cbrt, (double), 1);
+
+/*
+ * ex_erf - error function
+ */
+FUNC_DEF_UNARY(ex_erf, erf, (double), 1);
+
+/*
+ * ex_erfc - complementary error function
+ */
+FUNC_DEF_UNARY(ex_erfc, erfc, (double), 1);
+
+/*
+ * ex_expm1 - exponential minus 1,
+ */
+FUNC_DEF_UNARY(ex_expm1, expm1, (double), 1);
+
+/*
+ * ex_log1p - logarithm of 1 plus
+ */
+FUNC_DEF_UNARY(ex_log1p, log1p, (double), 1);
+
+/*
+ * ex_isinf - is the value infinite,
+ */
+FUNC_DEF_UNARY(ex_isinf, isinf, (double), 0);
+
+/*
+ * ex_finite - is the value finite
+ */
+FUNC_DEF_UNARY(ex_finite, finite, (double), 0);
+
+/*
+ * ex_isnan -- is the resut a nan (Not a number)
+ */
+FUNC_DEF_UNARY(ex_isnan, isnan, (double), 0);
+
+/*
+ * ex_copysign - copy sign of a number
+ */
+FUNC_DEF(ex_copysign, copysign, (double), (double), 1);
+
+/*
+ * ex_drem - floating-point remainder function
+ */
+FUNC_DEF(ex_drem, drem, (double), (double), 1);
+#endif
+
+#ifdef notdef
+/* the following will be added once they are more popular in math libraries */
+/*
+ * ex_hypoth - Euclidean distance function
+ */
+FUNC_DEF(ex_hypoth, hypoth, (double), (double), 1);
+
+/*
+ * ex_round - round to nearest integer, away from zero
+ */
+FUNC_DEF_UNARY(ex_round, round, (double), 1);
+
+/*
+ * ex_trunc - round to interger, towards zero
+ */
+FUNC_DEF_UNARY(ex_trunc, trunc, (double), 1);
+
+/*
+ * ex_nearbyint - round to nearest integer
+ */
+FUNC_DEF_UNARY(ex_nearbyint, nearbyint, (double), 1);
+#endif
diff --git a/pd/extra/expr~/vexp_if.c b/pd/extra/expr~/vexp_if.c
index 6d86ff1c..c75013ba 100644
--- a/pd/extra/expr~/vexp_if.c
+++ b/pd/extra/expr~/vexp_if.c
@@ -27,23 +27,22 @@
/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
+/*
+ * Feb 2002 - added access to variables
+ * multiple expression support
+ * new short hand forms for fexpr~
+ * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
+ * --sdy
+ */
+
#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
#include "vexp.h"
-#ifndef MSP
-#ifndef MACOSX
-/*
- * the compiler on mac seems not to like this, perhaps we could get away with
- * not having it at all.
- */
-#include "stdlib.h"
-#endif
-#endif
-#include "string.h"
-static char *exp_version = "0.3";
+static char *exp_version = "0.4";
extern struct ex_ex *ex_eval(struct expr *exp, struct ex_ex *eptr,
struct ex_ex *optr, int n);
@@ -149,6 +148,7 @@ static void
expr_ff(t_expr *x)
{
t_exprproxy *y;
+ int i;
y = x->exp_proxy;
while (y)
@@ -162,20 +162,32 @@ expr_ff(t_expr *x)
#endif
y = x->exp_proxy;
}
- if (x->exp_stack)
- fts_free(x->exp_stack);
+ for (i = 0 ; i < x->exp_nexpr; i++);
+ if (x->exp_stack[i])
+ fts_free(x->exp_stack[i]);
/*
* SDY free all the allocated buffers here for expr~ and fexpr~
+ * check to see if there are others
*/
+ for (i = 0; i < MAX_VARS; i++) {
+ if (x->exp_p_var[i])
+ fts_free(x->exp_p_var[i]);
+ if (x->exp_p_res[i])
+ fts_free(x->exp_p_res[i]);
+ if (x->exp_tmpres[i])
+ fts_free(x->exp_tmpres[i]);
+ }
+
+
}
static void
expr_bang(t_expr *x)
{
+ int i;
#ifdef EXPR_DEBUG
{
- int i;
struct ex_ex *eptr;
for (i = 0, eptr = x->exp_var; ; eptr++, i++)
@@ -202,28 +214,30 @@ expr_bang(t_expr *x)
if (!IS_EXPR(x))
return;
- if (!ex_eval(x, x->exp_stack, &x->exp_res, 0))
- {
- /* fprintf(stderr,"expr_bang(error evaluation)\n"); */
- return;
- }
-
-
- switch(x->exp_res.ex_type)
- {
- case ET_INT:
- outlet_float(x->exp_outlet, (t_float) x->exp_res.ex_int);
- break;
+ for (i = x->exp_nexpr - 1; i > -1 ; i--) {
+ if (!ex_eval(x, x->exp_stack[i], &x->exp_res[i], 0)) {
+ /*fprintf(stderr,"expr_bang(error evaluation)\n"); */
+ /* SDY now that we have mutiple ones, on error we should
+ * continue
+ return;
+ */
+ }
+ switch(x->exp_res[i].ex_type) {
+ case ET_INT:
+ outlet_float(x->exp_outlet[i],
+ (t_float) x->exp_res[i].ex_int);
+ break;
- case ET_FLT:
- outlet_float(x->exp_outlet, x->exp_res.ex_flt);
- break;
+ case ET_FLT:
+ outlet_float(x->exp_outlet[i], x->exp_res[i].ex_flt);
+ break;
- case ET_SYM:
- /* CHANGE this will have to be taken care of */
+ case ET_SYM:
+ /* CHANGE this will have to be taken care of */
- default:
- post("expr: bang: unrecognized result %ld\n", x->exp_res.ex_type);
+ default:
+ post("expr: bang: unrecognized result %ld\n", x->exp_res[i].ex_type);
+ }
}
}
@@ -280,19 +294,21 @@ Nexpr_new(t_symbol *s, int ac, t_atom *av)
/*
* initialize the newly allocated object
*/
- x->exp_stack = (struct ex_ex *)0;
x->exp_proxy = 0;
x->exp_nivec = 0;
+ x->exp_nexpr = 0;
x->exp_error = 0;
- x->exp_outlet = (t_outlet *)0;
- x->exp_res.ex_type = 0;
- x->exp_res.ex_int = 0;
- x->exp_p_res = (t_float *)0;
- x->exp_tmpres = (t_float *)0;
for (i = 0; i < MAX_VARS; i++) {
+ x->exp_stack[i] = (struct ex_ex *)0;
+ x->exp_outlet[i] = (t_outlet *)0;
+ x->exp_res[i].ex_type = 0;
+ x->exp_res[i].ex_int = 0;
+ x->exp_p_res[i] = (t_float *)0;
x->exp_var[i].ex_type = 0;
x->exp_var[i].ex_int = 0;
x->exp_p_var[i] = (t_float *)0;
+ x->exp_tmpres[i] = (t_float *)0;
+ x->exp_vsize = 0;
}
x->exp_f = 0; /* save the control value to be transformed to signal */
@@ -369,15 +385,25 @@ SDY the following coredumps why?
}
}
if (IS_EXPR(x)) {
- x->exp_outlet = outlet_new(&x->exp_ob, 0);
+ for (i = 0; i < x->exp_nexpr; i++)
+ x->exp_outlet[i] = outlet_new(&x->exp_ob, 0);
} else {
-#ifdef PD
- x->exp_outlet = outlet_new(&x->exp_ob, gensym("signal"));
-#else /* MSP */
- x->exp_outlet = outlet_new(&x->exp_ob, "signal");
-#endif
+ for (i = 0; i < x->exp_nexpr; i++)
+ x->exp_outlet[i] = outlet_new(&x->exp_ob,
+ gensym("signal"));
x->exp_nivec = dsp_index;
}
+ /*
+ * for now assume a 64 sample size block but this may change once
+ * expr_dsp is called
+ */
+ x->exp_vsize = 64;
+ for (i = 0; i < x->exp_nexpr; i++) {
+ x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+ x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+ }
+ for (i = 0; i < MAX_VARS; i++)
+ x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
return (x);
}
@@ -385,7 +411,7 @@ SDY the following coredumps why?
t_int *
expr_perform(t_int *w)
{
- int i;
+ int i, j;
t_expr *x = (t_expr *)w[1];
struct ex_ex res;
int n;
@@ -397,34 +423,54 @@ expr_perform(t_int *w)
}
if (x->exp_flags & EF_STOP) {
- memset(x->exp_res.ex_vec, 0, x->exp_vsize * sizeof (float));
+ for (i = 0; i < x->exp_nexpr; i++)
+ memset(x->exp_res[i].ex_vec, 0,
+ x->exp_vsize * sizeof (float));
return (w + 2);
}
if (IS_EXPR_TILDE(x)) {
- ex_eval(x, x->exp_stack, &x->exp_res, 0);
+ /*
+ * if we have only one expression, we can right on
+ * on the output directly, otherwise we have to copy
+ * the data because, outputs could be the same buffer as
+ * inputs
+ */
+ if ( x->exp_nexpr == 1)
+ ex_eval(x, x->exp_stack[0], &x->exp_res[0], 0);
+ else {
+ res.ex_type = ET_VEC;
+ for (i = 0; i < x->exp_nexpr; i++) {
+ res.ex_vec = x->exp_tmpres[i];
+ ex_eval(x, x->exp_stack[i], &res, 0);
+ }
+ n = x->exp_vsize * sizeof(t_float);
+ for (i = 0; i < x->exp_nexpr; i++)
+ memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i],
+ n);
+ }
return (w + 2);
}
if (!IS_FEXPR_TILDE(x)) {
post("expr_perform: bad x->exp_flags = %d - expecting fexpr",
x->exp_flags);
- abort();
+ return (w + 2);
}
/*
* since the output buffer could be the same as one of the inputs
* we need to keep the output in a different buffer
*/
- for (i = 0; i < x->exp_vsize; i++) {
+ for (i = 0; i < x->exp_vsize; i++) for (j = 0; j < x->exp_nexpr; j++) {
res.ex_type = 0;
res.ex_int = 0;
- ex_eval(x, x->exp_stack, &res, i);
+ ex_eval(x, x->exp_stack[j], &res, i);
switch (res.ex_type) {
case ET_INT:
- x->exp_tmpres[i] = (t_float) res.ex_int;
+ x->exp_tmpres[j][i] = (t_float) res.ex_int;
break;
case ET_FLT:
- x->exp_tmpres[i] = res.ex_flt;
+ x->exp_tmpres[j][i] = res.ex_flt;
break;
default:
post("expr_perform: bad result type %d", res.ex_type);
@@ -439,8 +485,10 @@ expr_perform(t_int *w)
for (i = 0; i < MAX_VARS; i++)
if (x->exp_var[i].ex_type == ET_XI)
memcpy(x->exp_p_var[i], x->exp_var[i].ex_vec, n);
- memcpy(x->exp_p_res, x->exp_tmpres, n);
- memcpy(x->exp_res.ex_vec, x->exp_tmpres, n);
+ for (i = 0; i < x->exp_nexpr; i++) {
+ memcpy(x->exp_p_res[i], x->exp_tmpres[i], n);
+ memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i], n);
+ }
return (w + 2);
}
@@ -453,8 +501,10 @@ expr_dsp(t_expr *x, t_signal **sp)
x->exp_error = 0; /* reset all errors */
newsize = (x->exp_vsize != sp[0]->s_n);
x->exp_vsize = sp[0]->s_n; /* record the vector size */
- x->exp_res.ex_type = ET_VEC;
- x->exp_res.ex_vec = sp[x->exp_nivec]->s_vec;
+ for (i = 0; i < x->exp_nexpr; i++) {
+ x->exp_res[i].ex_type = ET_VEC;
+ x->exp_res[i].ex_vec = sp[x->exp_nivec + i]->s_vec;
+ }
for (i = 0, nv = 0; i < MAX_VARS; i++)
/*
* the first inlet is always a signal
@@ -481,27 +531,55 @@ expr_dsp(t_expr *x, t_signal **sp)
dsp_add(expr_perform, 1, (t_int *) x);
+ /*
+ * The buffer are now being allocated for expr~ and fexpr~
+ * because if we have more than one expression we need the
+ * temporary buffers, The save buffers are not really needed
if (!IS_FEXPR_TILDE(x))
return;
- if (x->exp_p_res) {
+ */
+ /*
+ * if we have already allocated the buffers and we have a
+ * new size free all the buffers
+ */
+ if (x->exp_p_res[0]) {
if (!newsize)
return;
/*
* if new size, reallocate all the previous buffers for fexpr~
*/
- fts_free(x->exp_p_res);
- fts_free(x->exp_tmpres);
+ for (i = 0; i < x->exp_nexpr; i++) {
+ fts_free(x->exp_p_res[i]);
+ fts_free(x->exp_tmpres[i]);
+ }
for (i = 0; i < MAX_VARS; i++)
fts_free(x->exp_p_var[i]);
}
- x->exp_p_res = fts_calloc(x->exp_vsize, sizeof (t_float));
- x->exp_tmpres = fts_calloc(x->exp_vsize, sizeof (t_float));
+ for (i = 0; i < x->exp_nexpr; i++) {
+ x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+ x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+ }
for (i = 0; i < MAX_VARS; i++)
x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
}
/*
+ * expr_verbose -- toggle the verbose switch
+ */
+static void
+expr_verbose(t_expr *x)
+{
+ if (x->exp_flags & EF_VERBOSE) {
+ x->exp_flags &= ~EF_VERBOSE;
+ post ("verbose off");
+ } else {
+ x->exp_flags |= EF_VERBOSE;
+ post ("verbose on");
+ }
+}
+
+/*
* expr_start -- turn on expr processing for now only used for fexpr~
*/
static void
@@ -518,6 +596,195 @@ expr_stop(t_expr *x)
{
x->exp_flags |= EF_STOP;
}
+static void
+fexpr_set_usage(void)
+{
+ post("fexpr~: set val ...");
+ post("fexpr~: set {xy}[#] val ...");
+}
+
+/*
+ * fexpr_tilde_set -- set previous values of the buffers
+ * set val val ... - sets the first elements of output buffers
+ * set x val ... - sets the elements of the first input buffer
+ * set x# val ... - sets the elements of the #th input buffers
+ * set y val ... - sets the elements of the first output buffer
+ * set y# val ... - sets the elements of the #th output buffers
+ */
+static void
+fexpr_tilde_set(t_expr *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_symbol *sx;
+ int vecno;
+ int i, nargs;
+
+ if (!argc)
+ return;
+ sx = atom_getsymbolarg(0, argc, argv);
+ switch(sx->s_name[0]) {
+ case 'x':
+ if (!sx->s_name[1])
+ vecno = 0;
+ else {
+ vecno = atoi(sx->s_name + 1);
+ if (!vecno) {
+ post("fexpr~.set: bad set x vector number");
+ fexpr_set_usage();
+ return;
+ }
+ if (vecno >= MAX_VARS) {
+ post("fexpr~.set: no more than %d inlets",
+ MAX_VARS);
+ return;
+ }
+ vecno--;
+ }
+ if (x->exp_var[vecno].ex_type != ET_XI) {
+ post("fexpr~-set: no signal at inlet %d", vecno + 1);
+ return;
+ }
+ nargs = argc - 1;
+ if (!nargs) {
+ post("fexpr~-set: no argument to set");
+ return;
+ }
+ if (nargs > x->exp_vsize) {
+ post("fexpr~.set: %d set values larger than vector size(%d)",
+ nargs, x->exp_vsize);
+ post("fexpr~.set: only the first %d values will be set",
+ x->exp_vsize);
+ nargs = x->exp_vsize;
+ }
+ for (i = 0; i < nargs; i++) {
+ x->exp_p_var[vecno][x->exp_vsize - i - 1] =
+ atom_getfloatarg(i + 1, argc, argv);
+ }
+ return;
+ case 'y':
+ if (!sx->s_name[1])
+ vecno = 0;
+ else {
+ vecno = atoi(sx->s_name + 1);
+ if (!vecno) {
+ post("fexpr~.set: bad set y vector number");
+ fexpr_set_usage();
+ return;
+ }
+ vecno--;
+ }
+ if (vecno >= x->exp_nexpr) {
+ post("fexpr~.set: only %d outlets", x->exp_nexpr);
+ return;
+ }
+ nargs = argc - 1;
+ if (!nargs) {
+ post("fexpr~-set: no argument to set");
+ return;
+ }
+ if (nargs > x->exp_vsize) {
+ post("fexpr~-set: %d set values larger than vector size(%d)",
+ nargs, x->exp_vsize);
+ post("fexpr~.set: only the first %d values will be set",
+ x->exp_vsize);
+ nargs = x->exp_vsize;
+ }
+ for (i = 0; i < nargs; i++) {
+ x->exp_p_res[vecno][x->exp_vsize - i - 1] =
+ atom_getfloatarg(i + 1, argc, argv);
+ }
+ return;
+ case 0:
+ if (argc > x->exp_nexpr) {
+ post("fexpr~.set: only %d outlets available",
+ x->exp_nexpr);
+ post("fexpr~.set: the extra set values are ignored");
+ }
+ for (i = 0; i < x->exp_nexpr && i < argc; i++)
+ x->exp_p_res[i][x->exp_vsize - 1] =
+ atom_getfloatarg(i, argc, argv);
+ return;
+ default:
+ fexpr_set_usage();
+ return;
+ }
+ return;
+}
+
+/*
+ * fexpr_tilde_clear - clear the past buffers
+ */
+static void
+fexpr_tilde_clear(t_expr *x, t_symbol *s, int argc, t_atom *argv)
+{
+ t_symbol *sx;
+ int vecno;
+ int i, nargs;
+
+ /*
+ * if no arguement clear all input and output buffers
+ */
+ if (!argc) {
+ for (i = 0; i < x->exp_nexpr; i++)
+ memset(x->exp_p_res[i], 0, x->exp_vsize*sizeof(float));
+ for (i = 0; i < MAX_VARS; i++)
+ if (x->exp_var[i].ex_type == ET_XI)
+ memset(x->exp_p_var[i], 0,
+ x->exp_vsize*sizeof(float));
+ return;
+ }
+ if (argc > 1) {
+ post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
+ return;
+ }
+
+ sx = atom_getsymbolarg(0, argc, argv);
+ switch(sx->s_name[0]) {
+ case 'x':
+ if (!sx->s_name[1])
+ vecno = 0;
+ else {
+ vecno = atoi(sx->s_name + 1);
+ if (!vecno) {
+ post("fexpr~.clear: bad clear x vector number");
+ return;
+ }
+ if (vecno >= MAX_VARS) {
+ post("fexpr~.clear: no more than %d inlets",
+ MAX_VARS);
+ return;
+ }
+ vecno--;
+ }
+ if (x->exp_var[vecno].ex_type != ET_XI) {
+ post("fexpr~-clear: no signal at inlet %d", vecno + 1);
+ return;
+ }
+ memset(x->exp_p_var[vecno], 0, x->exp_vsize*sizeof(float));
+ return;
+ case 'y':
+ if (!sx->s_name[1])
+ vecno = 0;
+ else {
+ vecno = atoi(sx->s_name + 1);
+ if (!vecno) {
+ post("fexpr~.clear: bad clear y vector number");
+ return;
+ }
+ vecno--;
+ }
+ if (vecno >= x->exp_nexpr) {
+ post("fexpr~.clear: only %d outlets", x->exp_nexpr);
+ return;
+ }
+ memset(x->exp_p_res[vecno], 0, x->exp_vsize*sizeof(float));
+ return;
+ return;
+ default:
+ post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
+ return;
+ }
+ return;
+}
#ifdef PD
@@ -542,7 +809,7 @@ expr_setup(void)
class_addmethod(expr_tilde_class, nullfn, gensym("signal"), 0);
CLASS_MAINSIGNALIN(expr_tilde_class, t_expr, exp_f);
class_addmethod(expr_tilde_class,(t_method)expr_dsp, gensym("dsp"), 0);
-
+ class_sethelpsymbol(expr_tilde_class, gensym("expr"));
/*
* fexpr~ initialization
*/
@@ -555,6 +822,15 @@ expr_setup(void)
gensym("stop"), 0);
class_addmethod(fexpr_tilde_class,(t_method)expr_dsp,gensym("dsp"), 0);
+ class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_set,
+ gensym("set"), A_GIMME, 0);
+ class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_clear,
+ gensym("clear"), A_GIMME, 0);
+ class_addmethod(fexpr_tilde_class,(t_method)expr_verbose,
+ gensym("verbose"), 0);
+ class_sethelpsymbol(fexpr_tilde_class, gensym("expr"));
+
+
post("expr, expr~, fexpr~ version %s under GNU General Public License ", exp_version);
@@ -586,7 +862,8 @@ main(void)
/* -- the following functions use Pd internals and so are in the "if" file. */
-int ex_getsym(char *p, fts_symbol_t *s)
+int
+ex_getsym(char *p, fts_symbol_t *s)
{
*s = gensym(p);
return (0);
@@ -622,7 +899,7 @@ max_ex_tab(struct expr *exp,fts_symbol_t s,struct ex_ex *arg,struct ex_ex *optr)
!garray_getfloatarray(garray, &size, &vec))
{
optr->ex_type = ET_FLT;
- optr->ex_int = 0;
+ optr->ex_flt = 0;
pd_error(exp, "no such table '%s'", s->s_name);
return (1);
}
@@ -655,6 +932,19 @@ max_ex_tab(struct expr *exp,fts_symbol_t s,struct ex_ex *arg,struct ex_ex *optr)
return (0);
}
+int
+max_ex_var(struct expr *exp, fts_symbol_t var, struct ex_ex *optr)
+{
+ optr->ex_type = ET_FLT;
+ if (value_getfloat(var, &(optr->ex_flt))) {
+ optr->ex_type = ET_FLT;
+ optr->ex_flt = 0;
+ pd_error(exp, "no such var '%s'", var->s_name);
+ return (1);
+ }
+ return (0);
+}
+
#ifdef PD /* this goes to the end of this file as the following functions
* should be defined in the expr object in MSP
*/
diff --git a/pd/extra/fiddle~/fiddle~.c b/pd/extra/fiddle~/fiddle~.c
index 373a43eb..3c0b2719 100644
--- a/pd/extra/fiddle~/fiddle~.c
+++ b/pd/extra/fiddle~/fiddle~.c
@@ -39,7 +39,7 @@
#define fsqrt sqrt
#endif
-char fiddle_version[] = "fiddle version 1.1 TEST3";
+char fiddle_version[] = "fiddle version 1.1 TEST4";
#ifdef JMAX
#include "fts.h"
@@ -319,6 +319,7 @@ void sigfiddle_vibrato(t_sigfiddle *x, t_floatarg vibtime, t_floatarg
vibdepth);
void sigfiddle_npartial(t_sigfiddle *x, double npartial);
void sigfiddle_auto(t_sigfiddle *x, t_floatarg f);
+void sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg f);
int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch, long
npeakanal, long npeakout);
static t_int *fiddle_perform(t_int *w);
@@ -693,11 +694,11 @@ void sigfiddle_doit(t_sigfiddle *x)
for (npitch = 0; npitch < x->x_npitch; npitch++)
{
- int index;
+ int indx;
float best;
if (npitch)
{
- for (best = 0, index = -1, j=1; j < maxbin-1; j++)
+ for (best = 0, indx = -1, j=1; j < maxbin-1; j++)
{
if (histogram[j] > best && histogram[j] > histogram[j-1] &&
histogram[j] > histogram[j+1])
@@ -717,7 +718,7 @@ void sigfiddle_doit(t_sigfiddle *x)
if (histogram[j + sigfiddle_intpartialonset[k]]
> histogram[j]) goto peaknogood;
}
- index = j;
+ indx = j;
best = histogram[j];
}
peaknogood: ;
@@ -725,13 +726,13 @@ void sigfiddle_doit(t_sigfiddle *x)
}
else
{
- for (best = 0, index = -1, j=0; j < maxbin; j++)
+ for (best = 0, indx = -1, j=0; j < maxbin; j++)
if (histogram[j] > best)
- index = j, best = histogram[j];
+ indx = j, best = histogram[j];
}
- if (index < 0) break;
+ if (indx < 0) break;
histvec[npitch].h_value = best;
- histvec[npitch].h_index = index;
+ histvec[npitch].h_index = indx;
}
#if 1
if (x->x_nprint)
@@ -1003,6 +1004,7 @@ void sigfiddle_debug(t_sigfiddle *x)
void sigfiddle_print(t_sigfiddle *x)
{
+ post("npoints %d,", 2 * x->x_hop);
post("amp-range %f %f,", x->x_amplo, x->x_amphi);
post("reattack %d %f,", x->x_attacktime, x->x_attackthresh);
post("vibrato %d %f", x->x_vibtime, x->x_vibdepth);
@@ -1051,16 +1053,70 @@ void sigfiddle_auto(t_sigfiddle *x, t_floatarg f)
x->x_auto = (f != 0);
}
+static void sigfiddle_freebird(t_sigfiddle *x)
+{
+ if (x->x_inbuf)
+ {
+ freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
+ x->x_inbuf = 0;
+ }
+ if (x->x_lastanalysis)
+ {
+ freebytes(x->x_lastanalysis,
+ sizeof(float) * (2 * x->x_hop + 4 * FILTSIZE));
+ x->x_lastanalysis = 0;
+ }
+ if (x->x_spiral)
+ {
+ freebytes(x->x_spiral, sizeof(float) * 2 * x->x_hop);
+ x->x_spiral = 0;
+ }
+ x->x_hop = 0;
+}
+
+int sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg fnpoints)
+{
+ int i, npoints = fnpoints;
+ sigfiddle_freebird(x);
+ if (npoints < MINPOINTS || npoints > MAXPOINTS)
+ {
+ error("fiddle~: npoints out of range; using %d",
+ npoints = DEFAULTPOINTS);
+ }
+ if (npoints != (1 << sigfiddle_ilog2(npoints)))
+ {
+ error("fiddle~: npoints not a power of 2; using %d",
+ npoints = (1 << sigfiddle_ilog2(npoints)));
+ }
+ x->x_hop = npoints >> 1;
+ if (!(x->x_inbuf = (float *)getbytes(sizeof(float) * x->x_hop)))
+ goto fail;
+ if (!(x->x_lastanalysis = (float *)getbytes(
+ sizeof(float) * (2 * x->x_hop + 4 * FILTSIZE))))
+ goto fail;
+ if (!(x->x_spiral = (float *)getbytes(sizeof(float) * 2 * x->x_hop)))
+ goto fail;
+ for (i = 0; i < x->x_hop; i++)
+ x->x_inbuf[i] = 0;
+ for (i = 0; i < npoints + 4 * FILTSIZE; i++)
+ x->x_lastanalysis[i] = 0;
+ for (i = 0; i < x->x_hop; i++)
+ x->x_spiral[2*i] = cos((3.14159*i)/(npoints)),
+ x->x_spiral[2*i+1] = -sin((3.14159*i)/(npoints));
+ x->x_phase = 0;
+ return (1);
+fail:
+ sigfiddle_freebird(x);
+ return (0);
+}
+
int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch,
long npeakanal, long npeakout)
{
float *buf1, *buf2, *buf3;
t_peakout *buf4;
- int i, hop;
+ int i;
- if (npoints < MINPOINTS || npoints > MAXPOINTS) npoints = DEFAULTPOINTS;
- npoints = 1 << sigfiddle_ilog2(npoints);
- hop = npoints>>1;
if (!npeakanal && !npeakout) npeakanal = DEFNPEAK, npeakout = 0;
if (!npeakanal < 0) npeakanal = 0;
else if (npeakanal > MAXPEAK) npeakanal = MAXPEAK;
@@ -1070,50 +1126,25 @@ int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch,
else if (npitch > MAXNPITCH) npitch = MAXNPITCH;
if (npeakanal && !npitch) npitch = 1;
-
- if (!(buf1 = (float *)getbytes(sizeof(float) * hop)))
- {
- error("fiddle~: out of memory");
- return (0);
- }
- if (!(buf2 = (float *)getbytes(sizeof(float) * (npoints + 4 * FILTSIZE))))
- {
- freebytes(buf1, sizeof(float) * hop);
- error("fiddle~: out of memory");
- return (0);
- }
- if (!(buf3 = (float *)getbytes(sizeof(float) * npoints)))
+ if (!sigfiddle_setnpoints(x, npoints))
{
- freebytes(buf1, sizeof(float) * hop);
- freebytes(buf2, sizeof(float) * (npoints + 4 * FILTSIZE));
error("fiddle~: out of memory");
return (0);
}
if (!(buf4 = (t_peakout *)getbytes(sizeof(*buf4) * npeakout)))
{
- freebytes(buf1, sizeof(float) * hop);
- freebytes(buf2, sizeof(float) * (npoints + 4 * FILTSIZE));
- freebytes(buf3, sizeof(float) * npoints);
+ sigfiddle_freebird(x);
error("fiddle~: out of memory");
return (0);
}
- for (i = 0; i < hop; i++) buf1[i] = 0;
- for (i = 0; i < npoints + 4 * FILTSIZE; i++) buf2[i] = 0;
- for (i = 0; i < hop; i++)
- buf3[2*i] = cos((3.14159*i)/(npoints)),
- buf3[2*i+1] = -sin((3.14159*i)/(npoints));
for (i = 0; i < npeakout; i++)
buf4[i].po_freq = buf4[i].po_amp = 0;
- x->x_inbuf = buf1;
- x->x_lastanalysis = buf2;
- x->x_spiral = buf3;
x->x_peakbuf = buf4;
x->x_npeakout = npeakout;
x->x_npeakanal = npeakanal;
x->x_phase = 0;
x->x_histphase = 0;
- x->x_hop = npoints>>1;
x->x_sr = 44100; /* this and the next are filled in later */
for (i = 0; i < MAXNPITCH; i++)
{
@@ -1364,6 +1395,8 @@ static t_int *fiddle_perform(t_int *w)
int n = (int)(w[3]);
int count;
float *fp;
+ if (!x->x_hop)
+ goto nono;
for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count++)
*fp++ = *in++;
if (fp == x->x_inbuf + x->x_hop)
@@ -1374,6 +1407,7 @@ static t_int *fiddle_perform(t_int *w)
if (x->x_nprint) x->x_nprint--;
}
else x->x_phase += n;
+nono:
return (w+4);
}
@@ -1469,6 +1503,8 @@ void fiddle_tilde_setup(void)
gensym("dsp"), 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_debug,
gensym("debug"), 0);
+ class_addmethod(sigfiddle_class, (t_method)sigfiddle_setnpoints,
+ gensym("npoints"), A_FLOAT, 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_amprange,
gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_reattack,
@@ -1632,8 +1668,7 @@ void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp)
{
if (sp[0]->s_n > x->x_hop) {
x->x_downsample = sp[0]->s_n / x->x_hop;
- post("* warning: fiddle~: will downsample input by
-%ld",x->x_downsample);
+ post("* warning: fiddle~: will downsample input by %ld",x->x_downsample);
x->x_sr = sp[0]->s_sr / x->x_downsample;
} else {
x->x_downsample = 1;
@@ -1644,8 +1679,7 @@ void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp)
dsp_add(fiddle_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
}
-void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock
-MSP*/
+void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock MSP*/
{
int i;
t_pitchhist *ph;
@@ -1762,6 +1796,7 @@ A_DEFLONG, A_DEFLONG, 0);
addmess((method)sigfiddle_dsp, "dsp",
A_CANT, 0);
addmess((method)sigfiddle_debug, "debug", 0);
+ addmess((method)sigfiddle_setnpoints, "npoints", A_FLOAT, 0);
addmess((method)sigfiddle_amprange, "amp-range", A_FLOAT, A_FLOAT, 0);
addmess((method)sigfiddle_reattack, "reattack", A_FLOAT, A_FLOAT, 0);
addmess((method)sigfiddle_vibrato, "vibrato", A_FLOAT,
diff --git a/pd/extra/fiddle~/help-fiddle~.pd b/pd/extra/fiddle~/help-fiddle~.pd
deleted file mode 100644
index a7feb4f7..00000000
--- a/pd/extra/fiddle~/help-fiddle~.pd
+++ /dev/null
@@ -1,107 +0,0 @@
-#N canvas 93 26 980 745 10;
-#X obj 262 522 phasor~;
-#X obj 531 616 unpack;
-#X floatatom 531 666;
-#X msg 437 449 print;
-#X obj 262 500 sig~;
-#X floatatom 262 478;
-#X obj 262 456 mtof;
-#X floatatom 262 434;
-#X floatatom 545 643;
-#X obj 531 576 route 1 2 3 4;
-#X obj 614 616 unpack;
-#X floatatom 614 666;
-#X floatatom 628 643;
-#X obj 698 616 unpack;
-#X floatatom 698 666;
-#X floatatom 712 643;
-#X obj 389 616 unpack;
-#X floatatom 389 666;
-#X floatatom 403 643;
-#X obj 334 545 *~;
-#X obj 322 394 loadbang;
-#X obj 353 522 sig~;
-#X floatatom 353 500;
-#X msg 322 478 1;
-#X msg 353 478 0;
-#X floatatom 466 666;
-#X obj 281 666 print attack;
-#X obj 190 666 print pitch;
-#X msg 555 45 \; pd dsp 1;
-#X text 460 39 click here;
-#X text 460 61 to start DSP;
-#X text 226 4 FIDDLE - pitch estimator and sinusoidal peak finder;
-#X text 8 70 The Fiddle object estimates the pitch and amplitude of an incoming sound \, both continuously and as a stream of discrete "note" events. Fiddle optionally outputs a list of detected sinusoidal peaks used to make the pitch determination. Fiddle is described theoretically in the 1998 ICMC proceedings \, reprinted on http://man104nfs.ucsd.edu/~mpuckett.;
-#X text 8 170 Fiddle's creation arguments specify an analysis window size \, the maximum polyphony (i.e. \, the number of simultaneous "pitches" to try to find) \, the number of peaks in the spectrum to consider \, and the number of peaks \, if any \, to output "raw." The outlets give discrete pitch (a number) \, detected attacks in the amplitude envelope (a bang) \, one or more voices of continuous pitch and amplitude \, overall amplitude \, and optionally a sequence of messages with the peaks.;
-#X text 8 296 The analysis hop size is half the window size so in the example shown here \, one analysis is done every 512 samples (11.6 msec at 44K1) \, and the analysis uses the most recent 1024 samples (23.2 msec at 44K1). The minimum frequency that Fiddle will report is 2-1/2 cycles per analysis windows \, or about 108 Hz. (just below MIDI 45.);
-#X text 669 535 number of pitch outlets (1-3 \, default 1);
-#X text 669 557 number of peaks to find (1-100 \, default 20);
-#X text 669 579 number of peaks to output (default 0.);
-#X msg 441 107 amp-range 40 50;
-#X msg 439 227 reattack 100 10;
-#X msg 438 282 npartial 7;
-#X msg 438 170 vibrato 50 0.5;
-#X text 560 91 a low and high amplitude threshold: if signal amplitude is below the low threshold \, no pitches or peaks are output. The high threshold is a minimum at which "cooked" outputs may appear.;
-#X text 560 152 A period in milliseconds (50) over which the raw pitch may not deviate more than an interval in half-tones (0.5) from the average pitch to report it as a note to the "cooked" pitch outlet.;
-#X text 560 213 A period in milliseconds (100) over which a re-attack is reported if the amplitude rises more than (1) dB. The re-attack will result in a "bang" in the attack outlet and may give rise to repeated notes in the cooked pitch output.;
-#X text 142 432 test input pitch;
-#X text 330 444 test input;
-#X text 330 457 amplitude;
-#X obj 410 545 fiddle~ 1024 1 20 3;
-#X text 538 690 individual sinusoidal components;
-#X text 466 688 amplitude;
-#X text 476 703 (dB);
-#X text 389 688 raw pitch;
-#X text 376 712 and amplitude;
-#X text 364 729 (up to 3 outputs);
-#X text 287 686 bang on;
-#X text 287 708 attack;
-#X text 185 686 cooked pitch;
-#X text 202 703 output;
-#X text 545 545 ------ arguments:;
-#X msg 262 412 57;
-#X msg 440 340 auto 1;
-#X msg 440 362 auto 0;
-#X msg 440 407 bang;
-#X text 561 405 poll current values --- useful if not in auto mode \,;
-#X text 560 274 Higher partials are weighed less strongly than lower ones in determining the pitch. This specifies the number of the partial (7) which will be weighted half as strongly as the fundamental.;
-#X text 560 335 start and stop "auto" mode (on by default.) If off \, output only appears on "bang" (poll mode).;
-#X text 561 448 print out all settings;
-#X text 669 513 window size (128-2048 \, default 1024);
-#X connect 0 0 19 0;
-#X connect 1 0 2 0;
-#X connect 1 1 8 0;
-#X connect 3 0 48 0;
-#X connect 4 0 0 0;
-#X connect 5 0 4 0;
-#X connect 6 0 5 0;
-#X connect 7 0 6 0;
-#X connect 9 0 1 0;
-#X connect 9 1 10 0;
-#X connect 9 2 13 0;
-#X connect 10 0 11 0;
-#X connect 10 1 12 0;
-#X connect 13 0 14 0;
-#X connect 13 1 15 0;
-#X connect 16 0 17 0;
-#X connect 16 1 18 0;
-#X connect 19 0 48 0;
-#X connect 20 0 60 0;
-#X connect 20 0 23 0;
-#X connect 21 0 19 1;
-#X connect 22 0 21 0;
-#X connect 23 0 22 0;
-#X connect 24 0 22 0;
-#X connect 38 0 48 0;
-#X connect 39 0 48 0;
-#X connect 40 0 48 0;
-#X connect 41 0 48 0;
-#X connect 48 0 27 0;
-#X connect 48 1 26 0;
-#X connect 48 2 16 0;
-#X connect 48 3 25 0;
-#X connect 48 4 9 0;
-#X connect 60 0 7 0;
-#X connect 61 0 48 0;
-#X connect 62 0 48 0;
-#X connect 63 0 48 0;
diff --git a/pd/extra/fiddle~/makefile b/pd/extra/fiddle~/makefile
index a23303d3..6f6a963c 100644
--- a/pd/extra/fiddle~/makefile
+++ b/pd/extra/fiddle~/makefile
@@ -12,13 +12,13 @@ pd_nt: $(NAME).dll
PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
VC="C:\Program Files\Microsoft Visual Studio\Vc98"
-PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include
+PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include
PDNTLDIR = $(VC)\lib
PDNTLIB = $(PDNTLDIR)\libc.lib \
$(PDNTLDIR)\oldnames.lib \
$(PDNTLDIR)\kernel32.lib \
- \ftp\pd\bin\pd.lib
+ ..\..\bin\pd.lib
.c.dll:
cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
@@ -37,8 +37,7 @@ SGIINCLUDE = -I../../src
.c.pd_irix5:
cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
- rm -f $*.o ../$*.pd_linux
- ln -s $*.pd_linux ..
+ rm $*.o
# ----------------------- IRIX 6.x -----------------------
@@ -52,7 +51,7 @@ SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
.c.pd_irix6:
cc $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
+ ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
rm $*.o
# ----------------------- LINUX i386 -----------------------
@@ -61,20 +60,17 @@ pd_linux: $(NAME).pd_linux
.SUFFIXES: .pd_linux
-LINUXCFLAGS = -fPIC -DPD -O2 -funroll-loops -fomit-frame-pointer \
+LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \
-Wall -W -Wshadow -Wstrict-prototypes -Werror \
-Wno-unused -Wno-parentheses -Wno-switch
LINUXINCLUDE = -I../../src
-LSTRIP = strip --strip-unneeded -R .note -R .comment
-
.c.pd_linux:
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -Wl,-export_dynamic --shared -o $*.pd_linux $*.o -lm
- $(LSTRIP) $*.pd_linux
- rm -f $*.o ../$*.pd_linux
- ln -s $*/$*.pd_linux ..
+ ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
+ strip --strip-unneeded $*.pd_linux
+ rm -f $*.o
# ----------------------- Mac OSX -----------------------
@@ -87,9 +83,8 @@ DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
.c.pd_darwin:
cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
- rm -f $*.o ../$*.pd_darwin
- ln -s $*/$*.pd_darwin ..
+ cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
+ rm -f $*.o
# ----------------------------------------------------------
diff --git a/pd/extra/loop~/help-loop~.pd b/pd/extra/loop~/help-loop~.pd
deleted file mode 100644
index 6acff93c..00000000
--- a/pd/extra/loop~/help-loop~.pd
+++ /dev/null
@@ -1,66 +0,0 @@
-#N canvas 33 0 538 640 12;
-#X floatatom 55 169;
-#X obj 273 343 print~;
-#X msg 273 305 bang;
-#X obj 55 303 loop~;
-#X floatatom 80 244;
-#X msg 69 217 bang;
-#X obj 172 350 print~;
-#X msg 170 311 bang;
-#X graph graph1 0 -1 150000 1 306 586 506 436;
-#X array array2 150000 float;
-#X pop;
-#X msg 306 594 \; array2 resize 150000;
-#X obj 29 578 soundfiler;
-#X obj 55 419 tabread4~ array2;
-#X obj 55 373 *~;
-#X obj 55 488 dac~;
-#X obj 55 465 hip~ 5;
-#X obj 101 377 samphold~;
-#X obj 55 396 +~;
-#X floatatom 102 268;
-#X obj 102 291 *~ 1000;
-#X msg 47 533 read ../doc/sound/bell.aiff array2;
-#X msg 47 556 read ../doc/sound/vocal.aiff array2;
-#X msg 61 194 set 0.5;
-#X text 100 164 left signal input is transposition (1 is normal \, 2 is up an octave \, etc);
-#X text 37 6 loop~ - phase generator for looping samplers;
-#X text 121 193 set phase (0 to 1);
-#X text 121 213 reset phase to 0;
-#X text 118 243 right signal input is window size in samples;
-#X text 140 267 here's how to handle onsets;
-#X obj 55 442 *~;
-#X floatatom 171 397;
-#X obj 171 466 line~;
-#X obj 171 420 dbtorms;
-#X obj 171 443 pack 0 50;
-#X text 205 396 output level 0-100;
-#X text 170 290 print outputs;
-#X text 21 25 loop~ takes input signals to set a window size and transposition \, and outputs a phase and a sampled window size. The window size only changes at phase zero crossings and the phase output is adjusted so that changing window size doesn't change the transposition.;
-#X text 22 95 You can send "bang" or "set" message to force the phase to zero--you should mute the output before doing so. This may be desirable if you've set a large window size but then want to decrease it without waiting for the next phase crossing.;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 6 0;
-#X connect 3 0 12 0;
-#X connect 3 0 15 1;
-#X connect 3 1 1 0;
-#X connect 3 1 12 1;
-#X connect 4 0 3 1;
-#X connect 5 0 3 0;
-#X connect 7 0 6 0;
-#X connect 11 0 28 0;
-#X connect 12 0 16 0;
-#X connect 14 0 13 0;
-#X connect 14 0 13 1;
-#X connect 15 0 16 1;
-#X connect 16 0 11 0;
-#X connect 17 0 18 0;
-#X connect 18 0 15 0;
-#X connect 19 0 10 0;
-#X connect 20 0 10 0;
-#X connect 21 0 3 0;
-#X connect 28 0 14 0;
-#X connect 29 0 31 0;
-#X connect 30 0 28 1;
-#X connect 31 0 32 0;
-#X connect 32 0 30 0;
diff --git a/pd/extra/loop~/makefile b/pd/extra/loop~/makefile
index 7adffbd6..881ec5f1 100644
--- a/pd/extra/loop~/makefile
+++ b/pd/extra/loop~/makefile
@@ -1,6 +1,7 @@
NAME=loop~
CSYM=loop_tilde
+
current: pd_linux
# ----------------------- NT -----------------------
@@ -12,13 +13,13 @@ pd_nt: $(NAME).dll
PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
VC="C:\Program Files\Microsoft Visual Studio\Vc98"
-PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include
+PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include
PDNTLDIR = $(VC)\lib
PDNTLIB = $(PDNTLDIR)\libc.lib \
$(PDNTLDIR)\oldnames.lib \
$(PDNTLDIR)\kernel32.lib \
- \ftp\pd\bin\pd.lib
+ ..\..\bin\pd.lib
.c.dll:
cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
@@ -37,8 +38,7 @@ SGIINCLUDE = -I../../src
.c.pd_irix5:
cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
- rm -f $*.o ../$*.pd_linux
- ln -s $*.pd_linux ..
+ rm $*.o
# ----------------------- IRIX 6.x -----------------------
@@ -52,7 +52,7 @@ SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
.c.pd_irix6:
cc $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
+ ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
rm $*.o
# ----------------------- LINUX i386 -----------------------
@@ -61,20 +61,17 @@ pd_linux: $(NAME).pd_linux
.SUFFIXES: .pd_linux
-LINUXCFLAGS = -fPIC -DPD -O2 -funroll-loops -fomit-frame-pointer \
+LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \
-Wall -W -Wshadow -Wstrict-prototypes -Werror \
-Wno-unused -Wno-parentheses -Wno-switch
LINUXINCLUDE = -I../../src
-LSTRIP = strip --strip-unneeded -R .note -R .comment
-
.c.pd_linux:
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -Wl,-export_dynamic --shared -o $*.pd_linux $*.o -lm
- $(LSTRIP) $*.pd_linux
- rm -f $*.o ../$*.pd_linux
- ln -s $*/$*.pd_linux ..
+ ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
+ strip --strip-unneeded $*.pd_linux
+ rm -f $*.o
# ----------------------- Mac OSX -----------------------
@@ -87,9 +84,8 @@ DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
.c.pd_darwin:
cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
- rm -f $*.o ../$*.pd_darwin
- ln -s $*/$*.pd_darwin ..
+ cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
+ rm -f $*.o
# ----------------------------------------------------------
diff --git a/pd/extra/loop~/test-loop~.pd b/pd/extra/loop~/test-loop~.pd
index 9f454109..9966483d 100644
--- a/pd/extra/loop~/test-loop~.pd
+++ b/pd/extra/loop~/test-loop~.pd
@@ -1,56 +1,58 @@
-#N canvas 33 0 498 586 12;
-#X floatatom 52 262;
+#N canvas 33 0 680 609 12;
+#X floatatom 52 262 0 0 0 0 - - -;
#X obj 261 346 print~;
-#X msg 57 370 bang;
+#X msg 47 373 bang;
#X msg 274 313 bang;
#X obj 52 306 loop~;
-#X floatatom 102 245;
-#X graph graph1 0 0 44100 10 120 186 320 36;
-#X array array1 44100 float;
-#X pop;
+#X floatatom 102 245 0 0 0 0 - - -;
+#N canvas 0 0 450 300 graph1 0;
+#X array array1 44100 float 0;
+#X coords 0 10 44100 0 200 150 1;
+#X restore 65 17 graph;
#X msg 43 204 \; array1 resize 44100;
#X obj 25 401 tabwrite~ array1;
-#X msg 180 376 bang;
-#X obj 148 407 tabwrite~ array1;
+#X msg 208 371 bang;
+#X obj 176 402 tabwrite~ array1;
#X msg 194 261 bang;
#X obj 204 347 print~;
#X msg 217 314 bang;
-#X graph graph1 0 -1 150000 1 273 543 473 393;
-#X array array2 150000 float;
-#X pop;
+#N canvas 0 0 450 300 graph1 0;
+#X array array2 150000 float 0;
+#X coords 0 1 150000 -1 200 150 1;
+#X restore 332 398 graph;
#X msg 326 274 \; array2 resize 150000;
-#X obj 235 234 soundfiler;
-#X msg 215 199 read ../../../ham/Hamburger.wav array2;
#X obj 103 529 tabread4~ array2;
-#X obj 64 496 *~;
+#X obj 64 481 *~;
#X obj 107 581 dac~;
#X obj 105 552 hip~ 5;
#X obj 123 482 samphold~;
#X obj 102 506 +~;
-#X floatatom 106 430;
+#X floatatom 106 430 0 0 0 0 - - -;
#X obj 108 453 *~ 1000;
-#X msg 222 169 read ../../../ham/Wrong.wav array2;
+#X obj 312 215 soundfiler;
+#X msg 330 170 read ../doc/sound/bell.aiff array2;
+#X msg 330 193 read ../doc/sound/vocal.aiff array2;
#X connect 0 0 4 0;
#X connect 2 0 8 0;
#X connect 3 0 1 0;
#X connect 4 0 12 0;
-#X connect 4 0 19 0;
+#X connect 4 0 17 0;
#X connect 4 0 8 0;
-#X connect 4 0 22 1;
+#X connect 4 0 20 1;
#X connect 4 1 10 0;
#X connect 4 1 1 0;
-#X connect 4 1 19 1;
+#X connect 4 1 17 1;
#X connect 5 0 4 1;
#X connect 9 0 10 0;
#X connect 11 0 4 0;
#X connect 13 0 12 0;
-#X connect 17 0 16 0;
-#X connect 18 0 21 0;
-#X connect 19 0 23 0;
-#X connect 21 0 20 0;
-#X connect 21 0 20 1;
-#X connect 22 0 23 1;
-#X connect 23 0 18 0;
-#X connect 24 0 25 0;
-#X connect 25 0 22 0;
-#X connect 26 0 16 0;
+#X connect 16 0 19 0;
+#X connect 17 0 21 0;
+#X connect 19 0 18 0;
+#X connect 19 0 18 1;
+#X connect 20 0 21 1;
+#X connect 21 0 16 0;
+#X connect 22 0 23 0;
+#X connect 23 0 20 0;
+#X connect 25 0 24 0;
+#X connect 26 0 24 0;
diff --git a/pd/extra/lrshift~/help-rlshift~.pd b/pd/extra/lrshift~/help-rlshift~.pd
deleted file mode 100644
index cdfd8830..00000000
--- a/pd/extra/lrshift~/help-rlshift~.pd
+++ /dev/null
@@ -1,29 +0,0 @@
-#N canvas 143 0 673 325 12;
-#X msg 268 277 bang;
-#X obj 244 303 print~;
-#X msg 185 278 bang;
-#X obj 161 304 print~;
-#X text 53 117 click here first;
-#X msg 72 270 bang;
-#X obj 48 296 print~;
-#X text 162 222 shift left;
-#X text 243 224 shift right;
-#X obj 161 252 lrshift~ 1;
-#X obj 244 251 lrshift~ -1;
-#X text 39 37 Acting at whatever vector size the window is running at \, lrshift~ shifts samples to the left (toward the beginning sample) or to the right. The argument gives the direction and the amount of the shift. The rightmost (or leftmost) samples are set to zero.;
-#X graph graph2 0 0 63 1 448 258 648 118;
-#X array shiftin 64 float;
-#X pop;
-#X obj 47 11 rlshift~;
-#X text 115 11 -- shift signal vector elements left or right;
-#X msg 54 138 \; pd dsp 1 \; shiftin 1 1;
-#X obj 48 204 tabreceive~ shiftin;
-#X text 525 308 Updated for Pd 0.31.;
-#X connect 0 0 1 0;
-#X connect 2 0 3 0;
-#X connect 5 0 6 0;
-#X connect 9 0 3 0;
-#X connect 10 0 1 0;
-#X connect 16 0 6 0;
-#X connect 16 0 9 0;
-#X connect 16 0 10 0;
diff --git a/pd/extra/lrshift~/makefile b/pd/extra/lrshift~/makefile
index 99c1f83c..67afef10 100644
--- a/pd/extra/lrshift~/makefile
+++ b/pd/extra/lrshift~/makefile
@@ -1,6 +1,7 @@
NAME=lrshift~
CSYM=lrshift_tilde
+
current: pd_linux
# ----------------------- NT -----------------------
@@ -12,13 +13,13 @@ pd_nt: $(NAME).dll
PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
VC="C:\Program Files\Microsoft Visual Studio\Vc98"
-PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include
+PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include
PDNTLDIR = $(VC)\lib
PDNTLIB = $(PDNTLDIR)\libc.lib \
$(PDNTLDIR)\oldnames.lib \
$(PDNTLDIR)\kernel32.lib \
- \ftp\pd\bin\pd.lib
+ ..\..\bin\pd.lib
.c.dll:
cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
@@ -37,8 +38,7 @@ SGIINCLUDE = -I../../src
.c.pd_irix5:
cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
- rm -f $*.o ../$*.pd_linux
- ln -s $*.pd_linux ..
+ rm $*.o
# ----------------------- IRIX 6.x -----------------------
@@ -52,7 +52,7 @@ SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
.c.pd_irix6:
cc $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
+ ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
rm $*.o
# ----------------------- LINUX i386 -----------------------
@@ -61,20 +61,17 @@ pd_linux: $(NAME).pd_linux
.SUFFIXES: .pd_linux
-LINUXCFLAGS = -fPIC -DPD -O2 -funroll-loops -fomit-frame-pointer \
+LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \
-Wall -W -Wshadow -Wstrict-prototypes -Werror \
-Wno-unused -Wno-parentheses -Wno-switch
LINUXINCLUDE = -I../../src
-LSTRIP = strip --strip-unneeded -R .note -R .comment
-
.c.pd_linux:
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -Wl,-export_dynamic --shared -o $*.pd_linux $*.o -lm
- $(LSTRIP) $*.pd_linux
- rm -f $*.o ../$*.pd_linux
- ln -s $*/$*.pd_linux ..
+ ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
+ strip --strip-unneeded $*.pd_linux
+ rm -f $*.o
# ----------------------- Mac OSX -----------------------
@@ -87,9 +84,8 @@ DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
.c.pd_darwin:
cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
- rm -f $*.o ../$*.pd_darwin
- ln -s $*/$*.pd_darwin ..
+ cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
+ rm -f $*.o
# ----------------------------------------------------------
diff --git a/pd/extra/paf~/help-paf~.pd b/pd/extra/paf~/help-paf~.pd
deleted file mode 100644
index c6c63c25..00000000
--- a/pd/extra/paf~/help-paf~.pd
+++ /dev/null
@@ -1,166 +0,0 @@
-#N canvas 314 261 819 436 12;
-#X msg 2 279 freq \$1 100;
-#X obj 2 254 mtof;
-#X msg 108 279 amp \$1 100;
-#X obj 108 229 r amp;
-#X obj 206 230 r cf;
-#X obj 206 255 mtof;
-#X msg 206 280 cf \$1 100;
-#X obj 2 229 r pit;
-#X msg 140 374 bang;
-#X obj 71 403 dac~;
-#X obj 519 179 s vfr;
-#X obj 519 104 r vfr;
-#X obj 467 179 s vib;
-#X obj 467 104 r vib;
-#X msg 519 129 set \$1;
-#X floatatom 519 154 0 0 0 0 - - -;
-#X msg 467 129 set \$1;
-#X floatatom 467 154 0 0 0 0 - - -;
-#X obj 418 179 s bw;
-#X obj 369 179 s cf;
-#X obj 250 178 s amp;
-#X obj 309 177 s pit;
-#X obj 309 102 r pit;
-#X msg 309 127 set \$1;
-#X floatatom 309 152 0 0 0 0 - - -;
-#X obj 250 103 r amp;
-#X msg 250 128 set \$1;
-#X floatatom 250 153 0 0 0 0 - - -;
-#X msg 369 129 set \$1;
-#X floatatom 369 154 0 0 0 0 - - -;
-#X obj 369 104 r cf;
-#X msg 418 129 set \$1;
-#X floatatom 418 154 0 0 0 0 - - -;
-#X obj 418 104 r bw;
-#X msg 296 280 bw \$1 100;
-#X obj 296 230 r bw;
-#X obj 296 255 mtof;
-#X obj 385 229 r vib;
-#X msg 385 279 vib \$1 100;
-#X msg 483 279 vfr \$1 100;
-#X obj 483 254 / 8;
-#X obj 483 229 r vfr;
-#X obj 385 254 / 660;
-#X msg 573 129 set \$1;
-#X floatatom 573 154 0 0 0 0 - - -;
-#X obj 573 104 r shift;
-#X obj 573 179 s shift;
-#X obj 584 227 r shift;
-#X msg 584 277 shift \$1 100;
-#X obj 108 254 dbtorms;
-#X obj 85 348 paf~;
-#X obj 21 380 s~ foo;
-#X msg 705 278 phase 0 0 0;
-#X obj 140 399 print~ output;
-#N canvas 447 311 726 483 spectrum 0;
-#N canvas 0 0 450 300 graph1 0;
-#X array pulse-output 882 float 0;
-#X coords 0 1.02 882 -1.02 200 130 1;
-#X restore 405 271 graph;
-#X text 405 403 --------- 0.02 seconds ------;
-#N canvas 0 0 450 300 graph1 0;
-#X array spectrum 128 float 0;
-#X coords 0 500 128 0 256 130 1;
-#X restore 391 78 graph;
-#X obj 137 257 tabwrite~ pulse-output;
-#X msg 106 174 bang;
-#N canvas 204 17 358 238 fft 0;
-#X obj 46 48 inlet~;
-#X obj 159 181 tabwrite~ spectrum;
-#X obj 159 145 inlet;
-#X obj 46 78 rfft~;
-#X obj 46 111 *~;
-#X obj 77 111 *~;
-#X obj 46 141 sqrt~;
-#X obj 191 45 block~ 1024 1;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 4 0;
-#X connect 3 0 4 1;
-#X connect 3 1 5 0;
-#X connect 3 1 5 1;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X connect 6 0 1 0;
-#X restore 46 228 pd fft;
-#X text 33 8 PULSE SPECTRUM MEASUREMENT;
-#X text 379 221 0;
-#X text 627 218 5512;
-#X obj 94 123 r~ foo;
-#X obj 41 160 *~ 1;
-#X floatatom 44 113 0 0 0 0 - - -;
-#X obj 179 136 metro 1000;
-#X floatatom 178 108 0 0 0 0 - - -;
-#X obj 56 44 r graph;
-#X obj 140 205 *~ 10;
-#X connect 4 0 3 0;
-#X connect 4 0 5 1;
-#X connect 9 0 10 0;
-#X connect 9 0 15 0;
-#X connect 10 0 5 0;
-#X connect 11 0 10 1;
-#X connect 12 0 4 0;
-#X connect 13 0 12 0;
-#X connect 14 0 11 0;
-#X connect 14 0 13 0;
-#X connect 15 0 3 0;
-#X restore 664 340 pd spectrum;
-#X msg 20 136 \; pd dsp 1 \; pit 60 \; cf 60 \; graph 20;
-#X text 32 3 The "PAF" generator \, described in a paper in JAES 43/1
-pp. 40-47 \, reprinted on Miller Puckette's web page. Often used in
-Philippe Manoury's music. The important controls are center frequency
-("cf") and bandwidth ("bw") here controlled as MIDI values.;
-#X text 15 96 clich here to test;
-#X text 12 114 (then set amplitude);
-#X text 414 338 click here to see spectrum:;
-#X text 295 380 NOTE: the PAF algorithm is patented by IRCAM \, but
-is free for non-commercial use. For commercial use \, please see http://forum.ircam.fr
-;
-#X connect 0 0 50 0;
-#X connect 1 0 0 0;
-#X connect 2 0 50 0;
-#X connect 3 0 49 0;
-#X connect 4 0 5 0;
-#X connect 5 0 6 0;
-#X connect 6 0 50 0;
-#X connect 7 0 1 0;
-#X connect 8 0 53 0;
-#X connect 11 0 14 0;
-#X connect 13 0 16 0;
-#X connect 14 0 15 0;
-#X connect 15 0 10 0;
-#X connect 16 0 17 0;
-#X connect 17 0 12 0;
-#X connect 22 0 23 0;
-#X connect 23 0 24 0;
-#X connect 24 0 21 0;
-#X connect 25 0 26 0;
-#X connect 26 0 27 0;
-#X connect 27 0 20 0;
-#X connect 28 0 29 0;
-#X connect 29 0 19 0;
-#X connect 30 0 28 0;
-#X connect 31 0 32 0;
-#X connect 32 0 18 0;
-#X connect 33 0 31 0;
-#X connect 34 0 50 0;
-#X connect 35 0 36 0;
-#X connect 36 0 34 0;
-#X connect 37 0 42 0;
-#X connect 38 0 50 0;
-#X connect 39 0 50 0;
-#X connect 40 0 39 0;
-#X connect 41 0 40 0;
-#X connect 42 0 38 0;
-#X connect 43 0 44 0;
-#X connect 44 0 46 0;
-#X connect 45 0 43 0;
-#X connect 47 0 48 0;
-#X connect 48 0 50 0;
-#X connect 49 0 2 0;
-#X connect 50 0 9 0;
-#X connect 50 0 51 0;
-#X connect 50 0 9 1;
-#X connect 50 0 53 0;
-#X connect 52 0 50 0;
diff --git a/pd/extra/pique/help-pique.pd b/pd/extra/pique/help-pique.pd
deleted file mode 100644
index 1689c95b..00000000
--- a/pd/extra/pique/help-pique.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 143 0 729 407 12;
-#X obj 47 11 pique;
-#X text 105 12 -- find peaks in an FFT spectrum;
-#X obj 214 174 rfft~;
-#X obj 131 129 osc~ 2000;
-#X graph graph2 0 -64 63 64 519 179 719 39;
-#X array fft-real 64 float;
-#X pop;
-#X graph graph3 0 -64 63 64 519 327 719 187;
-#X array fft-imag 64 float;
-#X pop;
-#X obj 214 215 tabwrite~ fft-real;
-#X obj 245 240 tabwrite~ fft-imag;
-#X obj 315 158 metro 1000;
-#X obj 315 116 loadbang;
-#X msg 315 138 1;
-#X obj 91 349 pique;
-#X msg 91 322 64 fft-real fft-imag 10;
-#X obj 91 376 print;
-#X obj 205 132 osc~ 5000;
-#X text 25 37 pique takes unwindowed FFT analyses as input (they should be stored in arrays) and outputs a list of peaks \, giving their peak number \, frequency \, amplitude \, and phase (as a cosine/sine pair.);
-#X text 13 289 message argumnets: number of FFT points \, fft real part \, fft imaginary part \, maximum number of peaks to report.;
-#X text 578 387 updated for Pd 0.31.;
-#X connect 2 0 6 0;
-#X connect 2 1 7 0;
-#X connect 3 0 2 0;
-#X connect 8 0 6 0;
-#X connect 8 0 7 0;
-#X connect 9 0 10 0;
-#X connect 10 0 8 0;
-#X connect 11 0 13 0;
-#X connect 12 0 11 0;
-#X connect 14 0 2 0;
diff --git a/pd/extra/rev2~.pd b/pd/extra/rev2~.pd
index e2aa7bae..5b87faa7 100644
--- a/pd/extra/rev2~.pd
+++ b/pd/extra/rev2~.pd
@@ -133,8 +133,6 @@
#X text 399 79 4: high frequency damping \, 0-100;
#X text 400 62 3: crossover frequency in Hz. (3000 default);
#X text 400 45 2: liveness \, 0-100 \, usually between 85 and 100;
-#X floatatom 437 260 5 0 0 0 - - -;
-#X floatatom 711 332 5 0 0 0 - - -;
#X connect 0 0 9 0;
#X connect 0 0 7 0;
#X connect 1 0 38 0;
@@ -188,7 +186,6 @@
#X connect 28 0 72 0;
#X connect 29 0 16 0;
#X connect 30 0 17 0;
-#X connect 30 0 80 0;
#X connect 31 0 49 0;
#X connect 34 0 30 0;
#X connect 35 0 34 0;
diff --git a/pd/src/build.bat b/pd/src/build.bat
new file mode 100644
index 00000000..15d65957
--- /dev/null
+++ b/pd/src/build.bat
@@ -0,0 +1,42 @@
+nmake
+cd ..
+cd extra
+
+del *.dll
+
+cd bonk~
+nmake pd_nt
+move bonk~.dll ..
+cd ..
+
+cd choice
+nmake pd_nt
+move choice.dll ..
+cd ..
+
+cd expr~
+nmake pd_nt
+move expr.dll ..
+cd ..
+
+cd fiddle~
+nmake pd_nt
+move fiddle~.dll ..
+cd ..
+
+cd loop~
+nmake pd_nt
+move loop~.dll ..
+cd ..
+
+cd lrshift~
+nmake pd_nt
+move lrshift~.dll ..
+cd ..
+
+cd pique
+nmake pd_nt
+move pique.dll ..
+cd ..
+
+
diff --git a/pd/src/d_array.c b/pd/src/d_array.c
index 2a78e144..9b68b758 100644
--- a/pd/src/d_array.c
+++ b/pd/src/d_array.c
@@ -80,7 +80,7 @@ void tabwrite_tilde_set(t_tabwrite_tilde *x, t_symbol *s)
}
else if (!garray_getfloatarray(a, &x->x_nsampsintab, &x->x_vec))
{
- error("%s: bad template for tabwrite~", x->x_arrayname->s_name);
+ pd_error(x, "%s: bad template for tabwrite~", x->x_arrayname->s_name);
x->x_vec = 0;
}
else garray_usedindsp(a);
@@ -209,7 +209,7 @@ void tabplay_tilde_set(t_tabplay_tilde *x, t_symbol *s)
}
else if (!garray_getfloatarray(a, &x->x_nsampsintab, &x->x_vec))
{
- error("%s: bad template for tabplay~", x->x_arrayname->s_name);
+ pd_error(x, "%s: bad template for tabplay~", x->x_arrayname->s_name);
x->x_vec = 0;
}
else garray_usedindsp(a);
@@ -323,12 +323,12 @@ void tabread_tilde_set(t_tabread_tilde *x, t_symbol *s)
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
{
if (*s->s_name)
- error("tabread~: %s: no such array", x->x_arrayname->s_name);
+ pd_error(x, "tabread~: %s: no such array", x->x_arrayname->s_name);
x->x_vec = 0;
}
else if (!garray_getfloatarray(a, &x->x_npoints, &x->x_vec))
{
- error("%s: bad template for tabread~", x->x_arrayname->s_name);
+ pd_error(x, "%s: bad template for tabread~", x->x_arrayname->s_name);
x->x_vec = 0;
}
else garray_usedindsp(a);
@@ -452,12 +452,12 @@ void tabread4_tilde_set(t_tabread4_tilde *x, t_symbol *s)
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
{
if (*s->s_name)
- error("tabread4~: %s: no such array", x->x_arrayname->s_name);
+ pd_error(x, "tabread4~: %s: no such array", x->x_arrayname->s_name);
x->x_vec = 0;
}
else if (!garray_getfloatarray(a, &x->x_npoints, &x->x_vec))
{
- error("%s: bad template for tabread4~", x->x_arrayname->s_name);
+ pd_error(x, "%s: bad template for tabread4~", x->x_arrayname->s_name);
x->x_vec = 0;
}
else garray_usedindsp(a);
@@ -756,10 +756,10 @@ static void tabsend_dsp(t_tabsend *x, t_signal **sp)
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
{
if (*x->x_arrayname->s_name)
- error("tabsend~: %s: no such array", x->x_arrayname->s_name);
+ pd_error(x, "tabsend~: %s: no such array", x->x_arrayname->s_name);
}
else if (!garray_getfloatarray(a, &vecsize, &x->x_vec))
- error("%s: bad template for tabsend~", x->x_arrayname->s_name);
+ pd_error(x, "%s: bad template for tabsend~", x->x_arrayname->s_name);
else
{
int n = sp[0]->s_n;
@@ -823,10 +823,10 @@ static void tabreceive_dsp(t_tabreceive *x, t_signal **sp)
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
{
if (*x->x_arrayname->s_name)
- error("tabsend~: %s: no such array", x->x_arrayname->s_name);
+ pd_error(x, "tabsend~: %s: no such array", x->x_arrayname->s_name);
}
else if (!garray_getfloatarray(a, &vecsize, &x->x_vec))
- error("%s: bad template for tabreceive~", x->x_arrayname->s_name);
+ pd_error(x, "%s: bad template for tabreceive~", x->x_arrayname->s_name);
else
{
int n = sp[0]->s_n;
@@ -870,9 +870,9 @@ static void tabread_float(t_tabread *x, t_float f)
t_float *vec;
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
- error("%s: no such array", x->x_arrayname->s_name);
+ pd_error(x, "%s: no such array", x->x_arrayname->s_name);
else if (!garray_getfloatarray(a, &npoints, &vec))
- error("%s: bad template for tabread", x->x_arrayname->s_name);
+ pd_error(x, "%s: bad template for tabread", x->x_arrayname->s_name);
else
{
int n = f;
@@ -921,9 +921,9 @@ static void tabread4_float(t_tabread4 *x, t_float f)
t_float *vec;
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
- error("%s: no such array", x->x_arrayname->s_name);
+ pd_error(x, "%s: no such array", x->x_arrayname->s_name);
else if (!garray_getfloatarray(a, &npoints, &vec))
- error("%s: bad template for tabread4", x->x_arrayname->s_name);
+ pd_error(x, "%s: bad template for tabread4", x->x_arrayname->s_name);
else if (npoints < 4)
outlet_float(x->x_obj.ob_outlet, 0);
else if (f <= 1)
@@ -1001,9 +1001,9 @@ static void tabwrite_float(t_tabwrite *x, t_float f)
t_float *vec;
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
- error("%s: no such array", x->x_arrayname->s_name);
+ pd_error(x, "%s: no such array", x->x_arrayname->s_name);
else if (!garray_getfloatarray(a, &vecsize, &vec))
- error("%s: bad template for tabwrite", x->x_arrayname->s_name);
+ pd_error(x, "%s: bad template for tabwrite", x->x_arrayname->s_name);
else
{
int n = x->x_ft1;
diff --git a/pd/src/d_ctl.c b/pd/src/d_ctl.c
index a2f5cd76..e94a598d 100644
--- a/pd/src/d_ctl.c
+++ b/pd/src/d_ctl.c
@@ -254,7 +254,7 @@ static t_int *vline_tilde_perform(t_int *w)
}
}
if (x->x_targettime <= timenext)
- f = x->x_target, inc = 0;
+ f = x->x_target, inc = x->x_inc = 0, x->x_targettime = 1e20;
*out++ = f;
f = f + inc;
timenow = timenext;
@@ -271,6 +271,8 @@ static void vline_tilde_stop(t_vline *x)
x->x_list = 0;
x->x_inc = 0;
x->x_inlet1 = x->x_inlet2 = 0;
+ x->x_target = x->x_value;
+ x->x_targettime = 1e20;
}
static void vline_tilde_float(t_vline *x, t_float f)
@@ -279,18 +281,18 @@ static void vline_tilde_float(t_vline *x, t_float f)
float inlet1 = (x->x_inlet1 < 0 ? 0 : x->x_inlet1);
float inlet2 = x->x_inlet2;
double starttime = timenow + inlet2;
- t_vseg *s1, *s2, *deletefrom = 0,
- *snew = (t_vseg *)t_getbytes(sizeof(*snew));
+ t_vseg *s1, *s2, *deletefrom = 0, *snew;
if (PD_BADFLOAT(f))
f = 0;
/* negative delay input means stop and jump immediately to new value */
if (inlet2 < 0)
{
- vline_tilde_stop(x);
x->x_value = f;
+ vline_tilde_stop(x);
return;
}
+ snew = (t_vseg *)t_getbytes(sizeof(*snew));
/* check if we supplant the first item in the list. We supplant
an item by having an earlier starttime, or an equal starttime unless
the equal one was instantaneous and the new one isn't (in which case
@@ -350,6 +352,7 @@ static void *vline_tilde_new(void)
x->x_referencetime = clock_getlogicaltime();
x->x_list = 0;
x->x_samppermsec = 0;
+ x->x_targettime = 1e20;
return (x);
}
diff --git a/pd/src/d_dac.c b/pd/src/d_dac.c
index c090a214..1606b3a1 100644
--- a/pd/src/d_dac.c
+++ b/pd/src/d_dac.c
@@ -171,7 +171,7 @@ static void adc_free(t_adc *x)
static void adc_setup(void)
{
adc_class = class_new(gensym("adc~"), (t_newmethod)adc_new,
- (t_method)adc_free, sizeof(t_adc), CLASS_NOINLET, A_GIMME, 0);
+ (t_method)adc_free, sizeof(t_adc), 0, A_GIMME, 0);
class_addmethod(adc_class, (t_method)adc_dsp, gensym("dsp"), A_CANT, 0);
class_sethelpsymbol(adc_class, gensym("adc~_dac~"));
}
diff --git a/pd/src/d_filter.c b/pd/src/d_filter.c
index 88318900..732bd3d6 100644
--- a/pd/src/d_filter.c
+++ b/pd/src/d_filter.c
@@ -43,10 +43,13 @@ static void *sighip_new(t_floatarg f)
static void sighip_ft1(t_sighip *x, t_floatarg f)
{
- if (f < 0.001) f = 10;
+ if (f < 0) f = 0;
x->x_hz = f;
x->x_ctl->c_coef = 1 - f * (2 * 3.14159) / x->x_sr;
- if (x->x_ctl->c_coef < 0) x->x_ctl->c_coef = 0;
+ if (x->x_ctl->c_coef < 0)
+ x->x_ctl->c_coef = 0;
+ else if (x->x_ctl->c_coef > 1)
+ x->x_ctl->c_coef = 1;
}
static t_int *sighip_perform(t_int *w)
@@ -58,15 +61,24 @@ static t_int *sighip_perform(t_int *w)
int i;
float last = c->c_x;
float coef = c->c_coef;
- for (i = 0; i < n; i++)
+ if (coef < 1)
{
- float new = *in++ + coef * last;
- *out++ = new - last;
- last = new;
+ for (i = 0; i < n; i++)
+ {
+ float new = *in++ + coef * last;
+ *out++ = new - last;
+ last = new;
+ }
+ if (PD_BADFLOAT(last))
+ last = 0;
+ c->c_x = last;
+ }
+ else
+ {
+ for (i = 0; i < n; i++)
+ *out++ = *in++;
+ c->c_x = 0;
}
- if (PD_BADFLOAT(last))
- last = 0;
- c->c_x = last;
return (w+5);
}
@@ -133,10 +145,13 @@ static void *siglop_new(t_floatarg f)
static void siglop_ft1(t_siglop *x, t_floatarg f)
{
- if (f < 0.001) f = 10;
+ if (f < 0) f = 0;
x->x_hz = f;
x->x_ctl->c_coef = f * (2 * 3.14159) / x->x_sr;
- if (x->x_ctl->c_coef > 1) x->x_ctl->c_coef = 1;
+ if (x->x_ctl->c_coef > 1)
+ x->x_ctl->c_coef = 1;
+ else if (x->x_ctl->c_coef < 0)
+ x->x_ctl->c_coef = 0;
}
static void siglop_clear(t_siglop *x, t_floatarg q)
diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c
index a55e4d27..5752fade 100644
--- a/pd/src/d_soundfile.c
+++ b/pd/src/d_soundfile.c
@@ -478,7 +478,7 @@ static void soundfile_xferin(int sfchannels, int nvecs, float **vecs,
static int soundfiler_writeargparse(void *obj, int *p_argc, t_atom **p_argv,
t_symbol **p_filesym,
int *p_filetype, int *p_bytespersamp, int *p_swap, int *p_bigendian,
- int *p_normalize, long *p_onset, long *p_nframes)
+ int *p_normalize, long *p_onset, long *p_nframes, float *p_rate)
{
int argc = *p_argc;
t_atom *argv = *p_argv;
@@ -486,6 +486,7 @@ static int soundfiler_writeargparse(void *obj, int *p_argc, t_atom **p_argv,
endianness = -1, swap, filetype = FORMAT_WAVE, normalize = 0;
long onset = 0, nframes = 0x7fffffff;
t_symbol *filesym;
+ float rate = -1;
while (argc > 0 && argv->a_type == A_SYMBOL &&
*argv->a_w.w_symbol->s_name == '-')
{
@@ -542,6 +543,13 @@ static int soundfiler_writeargparse(void *obj, int *p_argc, t_atom **p_argv,
endianness = 1;
argc -= 1; argv += 1;
}
+ else if (!strcmp(flag, "r") || !strcmp(flag, "rate"))
+ {
+ if (argc < 2 || argv[1].a_type != A_FLOAT ||
+ ((rate = argv[1].a_w.w_float) <= 0))
+ goto usage;
+ argc -= 2; argv += 2;
+ }
else goto usage;
}
/* don't handle AIFF floating point samples */
@@ -586,6 +594,7 @@ static int soundfiler_writeargparse(void *obj, int *p_argc, t_atom **p_argv,
*p_onset = onset;
*p_nframes = nframes;
*p_bigendian = bigendian;
+ *p_rate = rate;
return (0);
usage:
return (-1);
@@ -593,7 +602,7 @@ usage:
static int create_soundfile(t_canvas *canvas, const char *filename,
int filetype, int nframes, int bytespersamp,
- int bigendian, int nchannels, int swap)
+ int bigendian, int nchannels, int swap, float samplerate)
{
char filenamebuf[MAXPDSTRING], buf2[MAXPDSTRING];
char headerbuf[WRITEHDRSIZE];
@@ -616,7 +625,7 @@ static int create_soundfile(t_canvas *canvas, const char *filename,
nexthdr->ns_length = 0;
nexthdr->ns_format = swap4((bytespersamp == 3 ? NS_FORMAT_LINEAR_24 :
(bytespersamp == 4 ? NS_FORMAT_FLOAT : NS_FORMAT_LINEAR_16)), swap);;
- nexthdr->ns_sr = swap4(44100, swap); /* lie */
+ nexthdr->ns_sr = swap4(samplerate, swap);
nexthdr->ns_nchans = swap4(nchannels, swap);
strcpy(nexthdr->ns_info, "Pd ");
swapstring(nexthdr->ns_info, swap);
@@ -658,8 +667,9 @@ static int create_soundfile(t_canvas *canvas, const char *filename,
wavehdr->w_fmttag =
swap2((bytespersamp == 4 ? WAV_FLOAT : WAV_INT), swap);
wavehdr->w_nchannels = swap2(nchannels, swap);
- wavehdr->w_samplespersec = swap4(44100, swap);
- wavehdr->w_navgbytespersec = swap4(44100 * nchannels * bytespersamp, swap);
+ wavehdr->w_samplespersec = swap4(samplerate, swap);
+ wavehdr->w_navgbytespersec =
+ swap4((int)(samplerate * nchannels * bytespersamp), swap);
wavehdr->w_nblockalign = swap2(bytespersamp, swap);
wavehdr->w_nbitspersample = swap2(8 * bytespersamp, swap);
strncpy(wavehdr->w_datachunkid, "data", 4);
@@ -815,8 +825,8 @@ static void soundfile_xferout(int nchannels, float **vecs,
{
float f2 = *fp * normalfactor;
xx = *(long *)&f2;
- sp2[0] = (xx >> 24); sp2[1] = (xx >> 24);
- sp2[2] = (xx >> 24); sp2[3] = xx;
+ sp2[0] = (xx >> 24); sp2[1] = (xx >> 16);
+ sp2[2] = (xx >> 8); sp2[3] = xx;
}
}
else
@@ -826,8 +836,8 @@ static void soundfile_xferout(int nchannels, float **vecs,
{
float f2 = *fp * normalfactor;
xx = *(long *)&f2;
- sp2[3] = (xx >> 24); sp2[2] = (xx >> 24);
- sp2[1] = (xx >> 24); sp2[0] = xx;
+ sp2[3] = (xx >> 24); sp2[2] = (xx >> 16);
+ sp2[1] = (xx >> 8); sp2[0] = xx;
}
}
}
@@ -1078,16 +1088,18 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas,
char sampbuf[SAMPBUFSIZE];
int bufframes, nitems;
int fd = -1;
- float normfactor, biggest = 0;
+ float normfactor, biggest = 0, samplerate;
t_symbol *filesym;
if (soundfiler_writeargparse(obj, &argc, &argv, &filesym, &filetype,
- &bytespersamp, &swap, &bigendian, &normalize, &onset, &nframes))
- goto usage;
+ &bytespersamp, &swap, &bigendian, &normalize, &onset, &nframes,
+ &samplerate))
+ goto usage;
nchannels = argc;
if (nchannels < 1 || nchannels > MAXSFCHANS)
goto usage;
-
+ if (samplerate < 0)
+ samplerate = sys_getsr();
for (i = 0; i < nchannels; i++)
{
int vecsize;
@@ -1121,7 +1133,7 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas,
if ((fd = create_soundfile(canvas, filesym->s_name, filetype,
nframes, bytespersamp, bigendian, nchannels,
- swap)) < 0)
+ swap, samplerate)) < 0)
{
post("%s: %s\n", filesym->s_name, strerror(errno));
goto fail;
@@ -1243,6 +1255,7 @@ typedef struct _readsf
int x_vecsize; /* vector size for transfers */
t_outlet *x_bangout; /* bang-on-done outlet */
int x_state; /* opened, running, or idle */
+ float x_insamplerate; /* sample rate of input signal if known */
/* parameters to communicate with subthread */
int x_requestcode; /* pending request from parent to I/O thread */
char *x_filename; /* file to open (string is permanently allocated) */
@@ -1251,6 +1264,7 @@ typedef struct _readsf
int x_bytespersample; /* bytes per sample (2 or 3) */
int x_bigendian; /* true if file is big-endian */
int x_sfchannels; /* number of channels in soundfile */
+ float x_samplerate; /* sample rate of soundfile */
long x_onsetframes; /* number of sample frames to skip */
long x_bytelimit; /* max number of data bytes to read */
int x_fd; /* filedesc */
@@ -1831,6 +1845,7 @@ static void *writesf_child_main(void *zz)
int filetype = x->x_filetype;
char *filename = x->x_filename;
t_canvas *canvas = x->x_canvas;
+ float samplerate = x->x_samplerate;
/* alter the request code so that an ensuing "open" will get
noticed. */
@@ -1852,7 +1867,7 @@ static void *writesf_child_main(void *zz)
pthread_mutex_unlock(&x->x_mutex);
fd = create_soundfile(canvas, filename, filetype, 0,
bytespersample, bigendian, sfchannels,
- garray_ambigendian() != bigendian);
+ garray_ambigendian() != bigendian, samplerate);
pthread_mutex_lock(&x->x_mutex);
pute("5\n");
@@ -2010,6 +2025,7 @@ static void *writesf_new(t_floatarg fnchannels, t_floatarg fbufsize)
pthread_cond_init(&x->x_requestcondition, 0);
pthread_cond_init(&x->x_answercondition, 0);
x->x_vecsize = MAXVECSIZE;
+ x->x_insamplerate = x->x_samplerate = 0;
x->x_state = STATE_IDLE;
x->x_clock = 0; /* no callback needed here */
x->x_canvas = canvas_getcurrent();
@@ -2092,13 +2108,14 @@ static void writesf_open(t_writesf *x, t_symbol *s, int argc, t_atom *argv)
t_symbol *filesym;
int filetype, bytespersamp, swap, bigendian, normalize;
long onset, nframes;
+ float samplerate;
if (soundfiler_writeargparse(x, &argc,
&argv, &filesym, &filetype, &bytespersamp, &swap, &bigendian,
- &normalize, &onset, &nframes))
+ &normalize, &onset, &nframes, &samplerate))
{
pd_error(x,
"writesf~: usage: open [-bytes [234]] [-wave,-nextstep,-aiff] ...");
- post("... [-big,-little] filename");
+ post("... [-big,-little] [-rate ####] filename");
}
if (normalize || onset || (nframes != 0x7fffffff))
pd_error(x, "normalize/onset/nframes argument to writesf~: ignored");
@@ -2118,6 +2135,11 @@ static void writesf_open(t_writesf *x, t_symbol *s, int argc, t_atom *argv)
x->x_fileerror = 0;
x->x_state = STATE_STARTUP;
x->x_bytespersample = (bytespersamp > 2 ? bytespersamp : 2);
+ if (samplerate > 0)
+ x->x_samplerate = samplerate;
+ else if (x->x_insamplerate > 0)
+ x->x_samplerate = x->x_insamplerate;
+ else x->x_samplerate = sys_getsr();
/* set fifosize from bufsize. fifosize must be a
multiple of the number of bytes eaten for each DSP
tick. */
@@ -2143,6 +2165,7 @@ static void writesf_dsp(t_writesf *x, t_signal **sp)
(x->x_bytespersample * ninlets * x->x_vecsize));
for (i = 0; i < ninlets; i++)
x->x_outvec[i] = sp[i]->s_vec;
+ x->x_insamplerate = sp[0]->s_sr;
pthread_mutex_unlock(&x->x_mutex);
dsp_add(writesf_perform, 1, x);
}
diff --git a/pd/src/d_ugen.c b/pd/src/d_ugen.c
index 2bc99936..2c359c38 100644
--- a/pd/src/d_ugen.c
+++ b/pd/src/d_ugen.c
@@ -125,19 +125,34 @@ typedef struct _block
char x_switched; /* true if we're acting as a a switch */
char x_switchon; /* true if we're switched on */
char x_reblock; /* true if inlets and outlets are reblocking */
-
- int x_upsample; /* IOhannes: upsampling-factor */
- int x_downsample; /* IOhannes: downsampling-factor */
+ int x_upsample; /* IOhannes: upsampling-factor */
+ int x_downsample; /* IOhannes: downsampling-factor */
} t_block;
+static void block_set(t_block *x, t_floatarg fvecsize, t_floatarg foverlap,
+ t_floatarg fupsample);
+
static void *block_new(t_floatarg fvecsize, t_floatarg foverlap,
t_floatarg fupsample) /* IOhannes */
{
+ t_block *x = (t_block *)pd_new(block_class);
+ x->x_phase = 0;
+ x->x_period = 1;
+ x->x_frequency = 1;
+ x->x_switched = 0;
+ x->x_switchon = 1;
+ block_set(x, fvecsize, foverlap, fupsample);
+ return (x);
+}
+
+static void block_set(t_block *x, t_floatarg fvecsize, t_floatarg foverlap,
+ t_floatarg fupsample)
+{
+ int upsample, downsample; /* IOhannes */
int vecsize = fvecsize;
int overlap = foverlap;
- int upsample, downsample; /* IOhannes */
- t_block *x = (t_block *)pd_new(block_class);
+ int dspstate = canvas_suspend_dsp();
if (overlap < 1)
overlap = 1;
if (vecsize < 0)
@@ -180,16 +195,11 @@ static void *block_new(t_floatarg fvecsize, t_floatarg foverlap,
x->x_vecsize = vecsize;
x->x_overlap = overlap;
- x->x_phase = 0;
- x->x_period = 1;
- x->x_frequency = 1;
- x->x_switched = 0;
- x->x_switchon = 1;
/* IOhannes { */
x->x_upsample = upsample;
x->x_downsample = downsample;
/* } IOhannes */
- return (x);
+ canvas_resume_dsp(dspstate);
}
static void *switch_new(t_floatarg fvecsize, t_floatarg foverlap,
@@ -312,7 +322,7 @@ int ilog2(int n)
/* list of signals which can be reused, sorted by buffer size */
static t_signal *signal_freelist[MAXLOGSIG+1];
- /* list of reusable "borrowed" signals */
+ /* list of reusable "borrowed" signals (which don't own sample buffers) */
static t_signal *signal_freeborrowed;
/* list of all signals allocated (not including "borrowed" ones) */
static t_signal *signal_usedlist;
@@ -360,8 +370,8 @@ void signal_makereusable(t_signal *sig)
if (ugen_loud) post("free %x: %d", sig, sig->s_isborrowed);
if (sig->s_isborrowed)
{
- /* if the signal is borrowed, decrement the borowee's reference
- count, possibly marking it reusable too */
+ /* if the signal is borrowed, decrement the borrowed-from signal's
+ reference count, possibly marking it reusable too */
t_signal *s2 = sig->s_borrowedfrom;
if ((s2 == sig) || !s2)
bug("signal_free");
@@ -373,8 +383,8 @@ void signal_makereusable(t_signal *sig)
}
else
{
- /* if it's a real signal, put it on the free list so we can
- reuse it. */
+ /* if it's a real signal (not borrowed), put it on the free list
+ so we can reuse it. */
if (signal_freelist[logn] == sig) bug("signal_free 2");
sig->s_nextfree = signal_freelist[logn];
signal_freelist[logn] = sig;
@@ -439,6 +449,8 @@ void signal_setborrowed(t_signal *sig, t_signal *sig2)
{
if (!sig->s_isborrowed || sig->s_borrowedfrom)
bug("signal_setborrowed");
+ if (sig == sig2)
+ bug("signal_setborrowed 2");
sig->s_borrowedfrom = sig2;
sig->s_vec = sig2->s_vec;
sig->s_n = sig2->s_n;
@@ -581,7 +593,7 @@ t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp,
}
/* first the canvas calls this to create all the boxes... */
-void ugen_add(t_dspcontext *dc, t_object *obj, int nextjump)
+void ugen_add(t_dspcontext *dc, t_object *obj)
{
t_ugenbox *x = (t_ugenbox *)getbytes(sizeof *x);
int i;
@@ -619,7 +631,8 @@ void ugen_connect(t_dspcontext *dc, t_object *x1, int outno, t_object *x2,
for (u2 = dc->dc_ugenlist; u2 && u2->u_obj != x2; u2 = u2->u_next);
if (!u1 || !u2 || siginno < 0)
{
- pd_error(u1->u_obj, "signal outlet connect to nonsignal inlet (ignored)");
+ pd_error(u1->u_obj,
+ "signal outlet connect to nonsignal inlet (ignored)");
return;
}
if (sigoutno < 0 || sigoutno >= u1->u_nout || siginno >= u2->u_nin)
@@ -802,6 +815,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u)
}
}
t_freebytes(insig,(u->u_nin + u->u_nout) * sizeof(t_signal *));
+ u->u_done = 1;
}
/* once the DSP graph is built, we call this routine to sort it.
@@ -851,7 +865,8 @@ void ugen_done_graph(t_dspcontext *dc)
t_pd *zz = &u->u_obj->ob_pd;
if (pd_class(zz) == block_class)
{
- if (blk) pd_error(blk, "conflicting block~ objects in same page");
+ if (blk)
+ pd_error(blk, "conflicting block~ objects in same page");
else blk = (t_block *)zz;
}
}
@@ -879,8 +894,10 @@ void ugen_done_graph(t_dspcontext *dc)
downsample = blk->x_downsample;
upsample = blk->x_upsample;
if (downsample > parent_vecsize) downsample=parent_vecsize;
- period = (vecsize * downsample)/(parent_vecsize * realoverlap * upsample);
- frequency = (parent_vecsize * realoverlap * upsample)/(vecsize * downsample);
+ period = (vecsize * downsample)/
+ (parent_vecsize * realoverlap * upsample);
+ frequency = (parent_vecsize * realoverlap * upsample)/
+ (vecsize * downsample);
/* } IOhannes*/
phase = blk->x_phase;
srate = parent_srate * realoverlap * upsample / downsample;
@@ -890,8 +907,9 @@ void ugen_done_graph(t_dspcontext *dc)
blk->x_frequency = frequency;
blk->x_period = period;
blk->x_phase = dsp_phase & (period - 1);
- if (! parent_context || (realoverlap != 1) || (vecsize != parent_vecsize) ||
- (downsample != 1) || (upsample != 1)) /* IOhannes */
+ if (! parent_context || (realoverlap != 1) ||
+ (vecsize != parent_vecsize) ||
+ (downsample != 1) || (upsample != 1)) /* IOhannes */
reblock = 1;
switched = blk->x_switched;
}
@@ -911,26 +929,29 @@ void ugen_done_graph(t_dspcontext *dc)
dc->dc_vecsize = vecsize;
/* if we're reblocking or switched, we now have to create output
- signals to fill in for the "borrowed" ones we have now. The
- output signals will be filled by the outlet epilog code. */
+ signals to fill in for the "borrowed" ones we have now. This
+ is also possibly true even if we're not blocked/switched, in
+ the case that there was a signal loop. But we don't know this
+ yet. */
- if (reblock || switched)
+ if (dc->dc_iosigs && (switched || reblock))
{
- t_signal **iosigs = dc->dc_iosigs;
- if (iosigs)
+ t_signal **sigp;
+ for (i = 0, sigp = dc->dc_iosigs + dc->dc_ninlets; i < dc->dc_noutlets;
+ i++, sigp++)
{
- t_signal **sigp;
- int noutlets = dc->dc_noutlets;
- for (i = 0, sigp = iosigs + dc->dc_ninlets; i < noutlets;
- i++, sigp++)
+ if ((*sigp)->s_isborrowed && !(*sigp)->s_borrowedfrom)
{
- signal_setborrowed(*sigp,
- signal_new(parent_vecsize, parent_srate));
+ signal_setborrowed(*sigp,
+ signal_new(parent_vecsize, parent_srate));
(*sigp)->s_refcount++;
- if (ugen_loud) post("set %x->%x", *sigp, (*sigp)->s_borrowedfrom);
+
+ if (ugen_loud) post("set %x->%x", *sigp,
+ (*sigp)->s_borrowedfrom);
}
- }
+ }
}
+
if (ugen_loud)
post("reblock %d, switched %d", reblock, switched);
@@ -987,6 +1008,34 @@ void ugen_done_graph(t_dspcontext *dc)
next: ;
}
+ /* check for a DSP loop, which is evidenced here by the presence
+ of ugens not yet scheduled. */
+
+ for (u = dc->dc_ugenlist; u; u = u->u_next)
+ if (!u->u_done)
+ {
+ t_signal **sigp;
+ pd_error(u->u_obj,
+ "DSP loop detected (some tilde objects not scheduled)");
+ /* this might imply that we have unfilled "borrowed" outputs
+ which we'd better fill in now. */
+ for (i = 0, sigp = dc->dc_iosigs + dc->dc_ninlets; i < dc->dc_noutlets;
+ i++, sigp++)
+ {
+ if ((*sigp)->s_isborrowed && !(*sigp)->s_borrowedfrom)
+ {
+ t_signal *s3 = signal_new(parent_vecsize, parent_srate);
+ signal_setborrowed(*sigp, s3);
+ (*sigp)->s_refcount++;
+ dsp_add_zero(s3->s_vec, s3->s_n);
+ if (ugen_loud)
+ post("oops, belatedly set %x->%x", *sigp,
+ (*sigp)->s_borrowedfrom);
+ }
+ }
+ break; /* don't need to keep looking. */
+ }
+
if (blk && (reblock || switched)) /* add block DSP epilog */
dsp_add(block_epilog, 1, blk);
chainblockend = dsp_chainsize;
@@ -1000,7 +1049,7 @@ void ugen_done_graph(t_dspcontext *dc)
{
t_signal **iosigs = dc->dc_iosigs;
if (iosigs) iosigs += dc->dc_ninlets;
- voutlet_dspepilog((struct _voutlet *)zz,
+ voutlet_dspepilog((struct _voutlet *)zz,
iosigs, vecsize, dsp_phase, period, frequency,
downsample, upsample, /* IOhannes */
reblock, switched);
@@ -1069,6 +1118,8 @@ void d_ugen_setup(void) /* really just block_setup */
sizeof(t_block), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT/*IOhannes*/, 0);
class_addcreator((t_newmethod)switch_new, gensym("switch~"),
A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT/*IOhannes*/, 0);
+ class_addmethod(block_class, (t_method)block_set, gensym("set"),
+ A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(block_class, (t_method)block_dsp, gensym("dsp"), 0);
class_addfloat(block_class, block_float);
}
diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c
index 97075684..606a6cf2 100644
--- a/pd/src/g_all_guis.c
+++ b/pd/src/g_all_guis.c
@@ -880,3 +880,79 @@ int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv)
iemgui_verify_snd_ne_rcv(iemgui);
return(oldsndrcvable);
}
+
+void iem_inttosymargs(t_iem_init_symargs *symargp, int n)
+{
+ memset(symargp, 0, sizeof(*symargp));
+ symargp->x_loadinit = (n >> 0);
+ symargp->x_rcv_arg_tail_len = (n >> 1);
+ symargp->x_snd_arg_tail_len = (n >> 7);
+ symargp->x_rcv_is_arg_num = (n >> 13);
+ symargp->x_snd_is_arg_num = (n >> 19);
+ symargp->x_scale = (n >> 20);
+ symargp->x_flashed = (n >> 21);
+ symargp->x_locked = (n >> 22);
+ symargp->x_reverse = (n >> 23);
+ symargp->dummy = (n >> 24);
+}
+
+int iem_symargstoint(t_iem_init_symargs *symargp)
+{
+ return (
+ ((symargp->x_loadinit << 0) |
+ (symargp->x_rcv_arg_tail_len << 1) |
+ (symargp->x_snd_arg_tail_len << 7) |
+ (symargp->x_rcv_is_arg_num << 13) |
+ (symargp->x_snd_is_arg_num << 19) |
+ (symargp->x_scale << 20) |
+ (symargp->x_flashed << 21) |
+ (symargp->x_locked << 22) |
+ (symargp->x_reverse << 23) |
+ (symargp->dummy << 24)) & IEM_INIT_ARGS_ALL
+ );
+}
+
+void iem_inttofstyle(t_iem_fstyle_flags *fstylep, int n)
+{
+ memset(fstylep, 0, sizeof(*fstylep));
+ fstylep->x_font_style = (n >> 0);
+ fstylep->x_rcv_able = (n >> 6);
+ fstylep->x_snd_able = (n >> 7);
+ fstylep->x_lab_is_unique = (n >> 8);
+ fstylep->x_rcv_is_unique = (n >> 9);
+ fstylep->x_snd_is_unique = (n >> 10);
+ fstylep->x_lab_arg_tail_len = (n >> 11);
+ fstylep->x_lab_is_arg_num = (n >> 17);
+ fstylep->x_shiftdown = (n >> 23);
+ fstylep->x_selected = (n >> 24);
+ fstylep->x_finemoved = (n >> 25);
+ fstylep->x_put_in2out = (n >> 26);
+ fstylep->x_change = (n >> 27);
+ fstylep->x_thick = (n >> 28);
+ fstylep->x_lin0_log1 = (n >> 29);
+ fstylep->x_steady = (n >> 30);
+ fstylep->dummy = (n >> 31);
+}
+
+int iem_fstyletoint(t_iem_fstyle_flags *fstylep)
+{
+ return (
+ ((fstylep->x_font_style << 0) |
+ (fstylep->x_rcv_able << 6) |
+ (fstylep->x_snd_able << 7) |
+ (fstylep->x_lab_is_unique << 8) |
+ (fstylep->x_rcv_is_unique << 9) |
+ (fstylep->x_snd_is_unique << 10) |
+ (fstylep->x_lab_arg_tail_len << 11) |
+ (fstylep->x_lab_is_arg_num << 17) |
+ (fstylep->x_shiftdown << 23) |
+ (fstylep->x_selected << 24) |
+ (fstylep->x_finemoved << 25) |
+ (fstylep->x_put_in2out << 26) |
+ (fstylep->x_change << 27) |
+ (fstylep->x_thick << 28) |
+ (fstylep->x_lin0_log1 << 29) |
+ (fstylep->x_steady << 30) |
+ (fstylep->dummy << 31)) & IEM_FSTYLE_FLAGS_ALL
+ );
+}
diff --git a/pd/src/g_all_guis.h b/pd/src/g_all_guis.h
index 77cf710d..91bf1753 100644
--- a/pd/src/g_all_guis.h
+++ b/pd/src/g_all_guis.h
@@ -317,3 +317,7 @@ EXTERN int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *arg
EXTERN int canvas_getdollarzero(void);
EXTERN void canvas_getargs(int *argcp, t_atom **argvp);
+EXTERN void iem_inttosymargs(t_iem_init_symargs *symargp, int n);
+EXTERN int iem_symargstoint(t_iem_init_symargs *symargp);
+EXTERN void iem_inttofstyle(t_iem_fstyle_flags *fstylep, int n);
+EXTERN int iem_fstyletoint(t_iem_fstyle_flags *fstylep);
diff --git a/pd/src/g_array.c b/pd/src/g_array.c
index 2c2dfa8b..f42e913e 100644
--- a/pd/src/g_array.c
+++ b/pd/src/g_array.c
@@ -735,8 +735,6 @@ t_widgetbehavior garray_widgetbehavior =
garray_delete,
garray_vis,
garray_click,
- garray_save,
- 0
};
/* ----------------------- public functions -------------------- */
@@ -1362,6 +1360,7 @@ void g_array_setup(void)
gensym("normalize"), A_DEFFLOAT, 0);
class_addmethod(garray_class, (t_method)garray_arraydialog,
gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
+ class_setsavefn(garray_class, garray_save);
}
diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c
index 07553972..1b1d6f4a 100644
--- a/pd/src/g_bang.c
+++ b/pd/src/g_bang.c
@@ -196,20 +196,18 @@ static void bng_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2,
static void bng_save(t_gobj *z, t_binbuf *b)
{
t_bng *x = (t_bng *)z;
- int bflcol[3], *ip1, *ip2;
+ int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
- ip1 = (int *)(&x->x_gui.x_isa);
- ip2 = (int *)(&x->x_gui.x_fsf);
binbuf_addv(b, "ssiisiiiisssiiiiiii", gensym("#X"),gensym("obj"),
(t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
gensym("bng"), x->x_gui.x_w,
x->x_flashtime_hold, x->x_flashtime_break,
- (*ip1)&IEM_INIT_ARGS_ALL,
+ iem_symargstoint(&x->x_gui.x_isa),
srl[0], srl[1], srl[2],
x->x_gui.x_ldx, x->x_gui.x_ldy,
- (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
bflcol[0], bflcol[1], bflcol[2]);
binbuf_addv(b, ";");
}
@@ -437,12 +435,13 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE;
int ldx=0, ldy=-6;
- int fs=8, iinit=0, ifstyle=0;
- int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
- t_iem_init_symargs *init=(t_iem_init_symargs *)(&iinit);
- t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle);
+ int fs=8;
+ int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME,
+ fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
char str[144];
+ iem_inttosymargs(&x->x_gui.x_isa, 0);
+ iem_inttofstyle(&x->x_gui.x_fsf, 0);
srl[0] = gensym("empty");
srl[1] = gensym("empty");
srl[2] = gensym("empty");
@@ -461,7 +460,7 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
a = (int)atom_getintarg(0, argc, argv);
fthold = (int)atom_getintarg(1, argc, argv);
ftbreak = (int)atom_getintarg(2, argc, argv);
- iinit = (int)(atom_getintarg(3, argc, argv));
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(3, argc, argv));
if(IS_A_SYMBOL(argv,4))
srl[0] = atom_getsymbolarg(4, argc, argv);
else if(IS_A_FLOAT(argv,4))
@@ -485,7 +484,7 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
}
ldx = (int)atom_getintarg(7, argc, argv);
ldy = (int)atom_getintarg(8, argc, argv);
- ifstyle = (int)(atom_getintarg(9, argc, argv));
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv));
fs = (int)atom_getintarg(10, argc, argv);
bflcol[0] = (int)atom_getintarg(11, argc, argv);
bflcol[1] = (int)atom_getintarg(12, argc, argv);
@@ -493,22 +492,18 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
}
x->x_gui.x_draw = (t_iemfunptr)bng_draw;
- iinit &= IEM_INIT_ARGS_ALL;
- ifstyle &= IEM_FSTYLE_FLAGS_ALL;
- fstyle->x_snd_able = 1;
- fstyle->x_rcv_able = 1;
+ x->x_gui.x_fsf.x_snd_able = 1;
+ x->x_gui.x_fsf.x_rcv_able = 1;
x->x_flashed = 0;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- x->x_gui.x_isa = *init;
- if(!strcmp(srl[0]->s_name, "empty")) fstyle->x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) fstyle->x_rcv_able = 0;
+ if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
+ if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
x->x_gui.x_unique_num = 0;
- if(fstyle->x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(fstyle->x_font_style == 2) strcpy(x->x_gui.x_font, "times");
- else { fstyle->x_font_style = 0;
+ if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_fsf = *fstyle;
iemgui_first_dollararg2sym(&x->x_gui, srl);
if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
@@ -577,8 +572,8 @@ void g_bang_setup(void)
bng_widgetbehavior.w_deletefn = iemgui_delete;
bng_widgetbehavior.w_visfn = iemgui_vis;
bng_widgetbehavior.w_clickfn = bng_newclick;
- bng_widgetbehavior.w_propertiesfn = bng_properties;
- bng_widgetbehavior.w_savefn = bng_save;
class_setwidget(bng_class, &bng_widgetbehavior);
class_sethelpsymbol(bng_class, gensym("bng"));
+ class_setsavefn(bng_class, bng_save);
+ class_setpropertiesfn(bng_class, bng_properties);
}
diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index be771aa0..aee25c77 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -599,8 +599,6 @@ void canvas_dirty(t_canvas *x, t_int n)
}
}
-extern t_gobj *canvas_selectme; /* HACK */
-
/* the window becomes "mapped" (visible and not miniaturized) or
"unmapped" (either miniaturized or just plain gone.) This should be
called from the GUI after the fact to "notify" us that we're mapped. */
@@ -623,12 +621,6 @@ void canvas_map(t_canvas *x, t_floatarg f)
for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
gobj_select(sel->sel_what, x, 1);
x->gl_mapped = 1;
- if (canvas_selectme)
- {
- glist_noselect(x);
- glist_select(x, canvas_selectme);
- canvas_selectme = 0;
- }
canvas_drawlines(x);
/* simulate a mouse up so u_main will calculate scrollbars...
ugly! */
@@ -639,8 +631,13 @@ void canvas_map(t_canvas *x, t_floatarg f)
{
if (glist_isvisible(x))
{
+ /* just clear out the whole canvas... */
+ sys_vgui(".x%x.c delete all\n", x);
+ /* alternatively, we could have erased them one by one...
for (y = x->gl_list; y; y = y->g_next)
gobj_vis(y, x, 0);
+ ... but we should go through and erase the lines as well
+ if we do it that way. */
x->gl_mapped = 0;
}
}
@@ -756,7 +753,7 @@ void canvas_vis(t_canvas *x, t_floatarg f)
if (!x->gl_havewindow)
{
/* bug workaround -- a graph in a visible patch gets "invised"
- when the patch is closed, and must lost the editor here. It's
+ when the patch is closed, and must lose the editor here. It's
probably not the natural place to do this. Other cases like
subpatches fall here too but don'd need the editor freed, so
we check if it exists. */
@@ -1303,9 +1300,15 @@ void glob_dsp(void *dummy, t_symbol *s, int argc, t_atom *argv)
{
newstate = atom_getintarg(0, argc, argv);
if (newstate && !canvas_dspstate)
+ {
canvas_start_dsp();
+ sys_set_audio_state(1);
+ }
else if (!newstate && canvas_dspstate)
+ {
canvas_stop_dsp();
+ sys_set_audio_state(0);
+ }
}
else post("dsp state %d", canvas_dspstate);
}
@@ -1341,65 +1344,11 @@ static void glist_redrawall(t_glist *gl)
void canvas_redrawallfortemplate(t_canvas *templatecanvas)
{
t_canvas *x;
- if (!templatecanvas->gl_imatemplate) return;
/* find all root canvases */
for (x = canvas_list; x; x = x->gl_next)
glist_redrawall(x);
}
- /* Same as above but just zap them. Call this if a template
- is changed by adding or removing a field. LATER we'll just
- modify all the items appropriately. */
-static void glist_zapall(t_glist *gl)
-{
- t_gobj *g;
- for (g = gl->gl_list; g; g = g->g_next)
- {
- t_class *cl;
- if (g->g_pd == canvas_class)
- glist_zapall((t_glist *)g);
- }
- /* do we have any scalars? */
- for (g = gl->gl_list; g; g = g->g_next)
- {
- if (g->g_pd == scalar_class)
- break;
- }
- if (!g) return;
- /* delete all the scalars. This is inefficient if for some reason
- you've mixed scalars with other items in a single glist. */
- while (1)
- {
- for (g = gl->gl_list; g; g = g->g_next)
- {
- if (g->g_pd == scalar_class)
- {
- glist_delete(gl, g);
- break;
- }
- }
- if (!g) break;
- }
-}
-
- /* public interface for above */
-void canvas_zapallfortemplate(t_canvas *templatecanvas)
-{
- t_canvas *x;
- if (!templatecanvas->gl_imatemplate) return;
- /* find all root canvases */
- for (x = canvas_list; x; x = x->gl_next)
- glist_zapall(x);
-}
-
- /* warn a canvas that some datum has used it as a template. If a
- canvas has no data associated with it (at load time, for instance)
- we don't have to search through the world for instances as it changes. */
-void canvas_setusedastemplate(t_canvas *x)
-{
- x->gl_imatemplate = 1;
-}
-
/* ------------------------------- setup routine ------------------------ */
/* why are some of these "glist" and others "canvas"? */
@@ -1427,6 +1376,7 @@ extern void glist_scalar(t_glist *canvas, t_symbol *s, int argc, t_atom *argv);
void g_graph_setup(void);
void g_editor_setup(void);
void g_readwrite_setup(void);
+extern void graph_properties(t_gobj *z, t_glist *owner);
void g_canvas_setup(void)
{
@@ -1497,6 +1447,7 @@ void g_canvas_setup(void)
gensym("menu-open"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_map,
gensym("map"), A_FLOAT, A_NULL);
+ class_setpropertiesfn(canvas_class, graph_properties);
/* ---------------------- list handling ------------------------ */
class_addmethod(canvas_class, (t_method)glist_clear, gensym("clear"),
diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h
index afaecbf5..d3070849 100644
--- a/pd/src/g_canvas.h
+++ b/pd/src/g_canvas.h
@@ -174,7 +174,6 @@ struct _glist
unsigned int gl_loading:1; /* am now loading from file */
unsigned int gl_willvis:1; /* make me visible after loading */
unsigned int gl_edit:1; /* edit mode */
- unsigned int gl_imatemplate:1; /* someone needs me as template */
unsigned int gl_isdeleting:1; /* we're inside glist_delete -- hack! */
unsigned int gl_stretch:1; /* stretch contents on resize */
unsigned int gl_isgraph:1; /* show as graph on parent */
@@ -259,10 +258,6 @@ typedef void (*t_visfn)(t_gobj *x, struct _glist *glist, int flag);
/* field a mouse click (when not in "edit" mode) */
typedef int (*t_clickfn)(t_gobj *x, struct _glist *glist,
int xpix, int ypix, int shift, int alt, int dbl, int doit);
- /* save to a binbuf */
-typedef void (*t_savefn)(t_gobj *x, t_binbuf *b);
- /* open properties dialog */
-typedef void (*t_propertiesfn)(t_gobj *x, struct _glist *glist);
/* ... and later, resizing; getting/setting font or color... */
struct _widgetbehavior
@@ -274,8 +269,6 @@ struct _widgetbehavior
t_deletefn w_deletefn;
t_visfn w_visfn;
t_clickfn w_clickfn;
- t_savefn w_savefn;
- t_propertiesfn w_propertiesfn;
};
/* -------- behaviors for scalars defined by objects in template --------- */
@@ -350,6 +343,7 @@ EXTERN int gobj_click(t_gobj *x, struct _glist *glist,
int xpix, int ypix, int shift, int alt, int dbl, int doit);
EXTERN void gobj_save(t_gobj *x, t_binbuf *b);
EXTERN void gobj_properties(t_gobj *x, struct _glist *glist);
+EXTERN void gobj_save(t_gobj *x, t_binbuf *b);
/* -------------------- functions on glists --------------------- */
EXTERN t_glist *glist_new( void);
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 3612d61f..74da81eb 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -74,18 +74,6 @@ int gobj_click(t_gobj *x, struct _glist *glist,
else return (0);
}
-void gobj_save(t_gobj *x, t_binbuf *b)
-{
- if (x->g_pd->c_wb && x->g_pd->c_wb->w_savefn)
- (*x->g_pd->c_wb->w_savefn)(x, b);
-}
-
-void gobj_properties(t_gobj *x, struct _glist *glist)
-{
- if (x->g_pd->c_wb && x->g_pd->c_wb->w_propertiesfn)
- (*x->g_pd->c_wb->w_propertiesfn)(x, glist);
-}
-
/* ------------------------ managing the selection ----------------- */
void glist_selectline(t_glist *x, t_outconnect *oc, int index1,
@@ -794,7 +782,7 @@ static t_gobj *canvas_findhitbox(t_canvas *x, int xpos, int ypos,
static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y)
{
int canprop, canopen;
- canprop = (!y || (y && y->g_pd->c_wb && y->g_pd->c_wb->w_propertiesfn));
+ canprop = (!y || (y && class_getpropertiesfn(pd_class(&y->g_pd))));
canopen = (y && zgetfn(&y->g_pd, gensym("menu-open")));
sys_vgui("pdtk_canvas_popup .x%x %d %d %d %d\n",
x, xpos, ypos, canprop, canopen);
@@ -906,9 +894,9 @@ static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos)
{
if (which == 0) /* properties */
{
- if (!y->g_pd->c_wb || !y->g_pd->c_wb->w_propertiesfn)
+ if (!class_getpropertiesfn(pd_class(&y->g_pd)))
continue;
- gobj_properties(y, x);
+ (*class_getpropertiesfn(pd_class(&y->g_pd)))(y, x);
return;
}
else if (which == 1) /* open */
@@ -1576,7 +1564,6 @@ static void canvas_menufont(t_canvas *x)
static int canvas_find_index1, canvas_find_index2;
static t_binbuf *canvas_findbuf;
int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf);
-t_gobj *canvas_selectme; /* HACK */
/* find an atom or string of atoms */
static int canvas_dofind(t_canvas *x, int *myindex1p)
@@ -1600,33 +1587,9 @@ static int canvas_dofind(t_canvas *x, int *myindex1p)
canvas_find_index1 = myindex1;
canvas_find_index2 = myindex2;
glist_noselect(x);
- if (glist_isvisible(x))
- {
-#ifdef MSW
- /* For windows canvas_vis() does something
- special so here we explicitly invis
- the window and proceed as in the "invis"
- case below. */
- canvas_vis(x, 0);
- canvas_selectme = y;
- canvas_vis(x, 1);
-#else
- canvas_vis(x, 1);
- canvas_editmode(x, 1.);
- glist_select(x, y);
-#endif
- }
- else
- {
- /* LATER fix so we can select it right here.
- ERight now, HACK it so that canvas_map selects it.
- We can't select earlier because the rtexts aren't
- created in time. Should create the rtexts in
- canvas_vis() but we don't so that yet. */
-
- canvas_selectme = y;
- canvas_vis(x, 1);
- }
+ canvas_vis(x, 1);
+ canvas_editmode(x, 1.);
+ glist_select(x, y);
return (1);
}
}
@@ -1701,9 +1664,7 @@ static int glist_dofinderror(t_glist *gl, void *error_object)
glist_noselect(gl);
canvas_vis(glist_getcanvas(gl), 1);
canvas_editmode(glist_getcanvas(gl), 1.);
- /* we can't just select here ala glist_select(gl, g); instead,
- as in "find", set "selectme" for when "map" function is called. */
- canvas_selectme = g;
+ glist_select(gl, g);
return (1);
}
else if (g->g_pd == canvas_class)
@@ -2160,7 +2121,6 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease)
}
sys_vgui("pdtk_canvas_editval .x%x %d\n",
glist_getcanvas(x), x->gl_edit);
- if (yesplease) canvas_dirty(x, 1);
}
/* called by canvas_font below */
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index 9bf998f8..3347fb9b 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -626,8 +626,6 @@ void glist_redraw(t_glist *x)
}
}
-t_class *graph_class;
-
/* --------------------------- widget behavior ------------------- */
extern t_widgetbehavior text_widgetbehavior;
@@ -1021,15 +1019,20 @@ static int graph_click(t_gobj *z, struct _glist *glist,
}
}
-static void graph_save(t_gobj *z, t_binbuf *b)
-{
- t_glist *x = (t_glist *)z;
- text_widgetbehavior.w_savefn(z, b);
-}
-
void garray_properties(t_garray *x);
-static void graph_properties(t_gobj *z, t_glist *owner)
+t_widgetbehavior graph_widgetbehavior =
+{
+ graph_getrect,
+ graph_displace,
+ graph_select,
+ graph_activate,
+ graph_delete,
+ graph_vis,
+ graph_click,
+};
+
+void graph_properties(t_gobj *z, t_glist *owner)
{
t_glist *x = (t_glist *)z;
{
@@ -1046,19 +1049,6 @@ static void graph_properties(t_gobj *z, t_glist *owner)
}
}
-t_widgetbehavior graph_widgetbehavior =
-{
- graph_getrect,
- graph_displace,
- graph_select,
- graph_activate,
- graph_delete,
- graph_vis,
- graph_click,
- graph_save,
- graph_properties,
-};
-
/* find the graph most recently added to this glist;
if none exists, return 0. */
diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c
index 1d1b4c6d..f7267c99 100644
--- a/pd/src/g_hdial.c
+++ b/pd/src/g_hdial.c
@@ -234,22 +234,20 @@ static void hradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *x
static void hradio_save(t_gobj *z, t_binbuf *b)
{
t_hradio *x = (t_hradio *)z;
- int bflcol[3], *ip1, *ip2;
+ int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
- ip1 = (int *)(&x->x_gui.x_isa);
- ip2 = (int *)(&x->x_gui.x_fsf);
binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"),
(t_int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist),
(t_int)text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist),
(pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ?
gensym("hdl") : gensym("hradio")),
x->x_gui.x_w,
- x->x_change, (*ip1)&IEM_INIT_ARGS_ALL, x->x_number,
+ x->x_change, iem_symargstoint(&x->x_gui.x_isa), x->x_number,
srl[0], srl[1], srl[2],
x->x_gui.x_ldx, x->x_gui.x_ldy,
- (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
bflcol[0], bflcol[1], bflcol[2], x->x_on);
binbuf_addv(b, ";");
}
@@ -544,12 +542,12 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
int ldx=0, ldy=-6, chg=1, num=8;
- int fs=8, iinit=0, ifstyle=0;
+ int fs=8;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
- t_iem_init_symargs *init=(t_iem_init_symargs *)(&iinit);
- t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle);
char str[144];
+ iem_inttosymargs(&x->x_gui.x_isa, 0);
+ iem_inttofstyle(&x->x_gui.x_fsf, 0);
srl[0] = gensym("empty");
srl[1] = gensym("empty");
srl[2] = gensym("empty");
@@ -565,7 +563,7 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
{
a = (int)atom_getintarg(0, argc, argv);
chg = (int)atom_getintarg(1, argc, argv);
- iinit = (int)atom_getintarg(2, argc, argv);
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(2, argc, argv));
num = (int)atom_getintarg(3, argc, argv);
if(IS_A_SYMBOL(argv,4))
srl[0] = atom_getsymbolarg(4, argc, argv);
@@ -590,7 +588,7 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
}
ldx = (int)atom_getintarg(7, argc, argv);
ldy = (int)atom_getintarg(8, argc, argv);
- ifstyle = (int)atom_getintarg(9, argc, argv);
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv));
fs = (int)atom_getintarg(10, argc, argv);
bflcol[0] = (int)atom_getintarg(11, argc, argv);
bflcol[1] = (int)atom_getintarg(12, argc, argv);
@@ -598,19 +596,15 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
on = (int)atom_getintarg(14, argc, argv);
}
x->x_gui.x_draw = (t_iemfunptr)hradio_draw;
- iinit &= IEM_INIT_ARGS_ALL;
- ifstyle &= IEM_FSTYLE_FLAGS_ALL;
- fstyle->x_snd_able = 1;
- fstyle->x_rcv_able = 1;
+ x->x_gui.x_fsf.x_snd_able = 1;
+ x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- x->x_gui.x_isa = *init;
- if(!strcmp(srl[0]->s_name, "empty")) fstyle->x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) fstyle->x_rcv_able = 0;
- if(fstyle->x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(fstyle->x_font_style == 2) strcpy(x->x_gui.x_font, "times");
- else { fstyle->x_font_style = 0;
+ if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
+ if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
+ if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_fsf = *fstyle;
x->x_gui.x_unique_num = 0;
if(num < 1)
num = 1;
@@ -709,10 +703,10 @@ void g_hradio_setup(void)
hradio_widgetbehavior.w_deletefn = iemgui_delete;
hradio_widgetbehavior.w_visfn = iemgui_vis;
hradio_widgetbehavior.w_clickfn = hradio_newclick;
- hradio_widgetbehavior.w_propertiesfn = hradio_properties;
- hradio_widgetbehavior.w_savefn = hradio_save;
class_setwidget(hradio_class, &hradio_widgetbehavior);
class_sethelpsymbol(hradio_class, gensym("hradio"));
+ class_setsavefn(hradio_class, hradio_save);
+ class_setpropertiesfn(hradio_class, hradio_properties);
/*obsolete version (0.34-0.35) */
hradio_old_class = class_new(gensym("hdl"), (t_newmethod)hdial_new,
@@ -759,5 +753,4 @@ void g_hradio_setup(void)
gensym("double_change"), 0);
class_setwidget(hradio_old_class, &hradio_widgetbehavior);
class_sethelpsymbol(hradio_old_class, gensym("hradio"));
-
}
diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c
index ed805f4b..a805e7dd 100644
--- a/pd/src/g_hslider.c
+++ b/pd/src/g_hslider.c
@@ -214,20 +214,18 @@ static void hslider_getrect(t_gobj *z, t_glist *glist,
static void hslider_save(t_gobj *z, t_binbuf *b)
{
t_hslider *x = (t_hslider *)z;
- int bflcol[3], *ip1, *ip2;
+ int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
- ip1 = (int *)(&x->x_gui.x_isa);
- ip2 = (int *)(&x->x_gui.x_fsf);
binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"),
(t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
gensym("hsl"), x->x_gui.x_w, x->x_gui.x_h,
(float)x->x_min, (float)x->x_max,
- x->x_lin0_log1, (*ip1)&IEM_INIT_ARGS_ALL,
+ x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa),
srl[0], srl[1], srl[2],
x->x_gui.x_ldx, x->x_gui.x_ldy,
- (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
bflcol[0], bflcol[1], bflcol[2],
x->x_val, x->x_steady);
binbuf_addv(b, ";");
@@ -529,12 +527,12 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
t_symbol *srl[3];
int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE;
int lilo=0, ldx=-2, ldy=-6, f=0, v=0, steady=1;
- int fs=8, iinit=0, ifstyle=0;
+ int fs=8;
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
- t_iem_init_symargs *init=(t_iem_init_symargs *)(&iinit);
- t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle);
char str[144];
+ iem_inttosymargs(&x->x_gui.x_isa, 0);
+ iem_inttofstyle(&x->x_gui.x_fsf, 0);
srl[0] = gensym("empty");
srl[1] = gensym("empty");
srl[2] = gensym("empty");
@@ -554,7 +552,7 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
min = (double)atom_getfloatarg(2, argc, argv);
max = (double)atom_getfloatarg(3, argc, argv);
lilo = (int)atom_getintarg(4, argc, argv);
- iinit = (int)atom_getintarg(5, argc, argv);
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv));
if(IS_A_SYMBOL(argv,6))
srl[0] = atom_getsymbolarg(6, argc, argv);
else if(IS_A_FLOAT(argv,6))
@@ -578,7 +576,7 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
}
ldx = (int)atom_getintarg(9, argc, argv);
ldy = (int)atom_getintarg(10, argc, argv);
- ifstyle = (int)atom_getintarg(11, argc, argv);
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv));
fs = (int)atom_getintarg(12, argc, argv);
bflcol[0] = (int)atom_getintarg(13, argc, argv);
bflcol[1] = (int)atom_getintarg(14, argc, argv);
@@ -589,14 +587,11 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
steady = (int)atom_getintarg(17, argc, argv);
x->x_gui.x_draw = (t_iemfunptr)hslider_draw;
- iinit &= IEM_INIT_ARGS_ALL;
- ifstyle &= IEM_FSTYLE_FLAGS_ALL;
- fstyle->x_snd_able = 1;
- fstyle->x_rcv_able = 1;
+ x->x_gui.x_fsf.x_snd_able = 1;
+ x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- x->x_gui.x_isa = *init;
if(x->x_gui.x_isa.x_loadinit)
x->x_val = v;
else
@@ -606,14 +601,13 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
x->x_lin0_log1 = lilo;
if(steady != 0) steady = 1;
x->x_steady = steady;
- if(!strcmp(srl[0]->s_name, "empty")) fstyle->x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) fstyle->x_rcv_able = 0;
+ if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
+ if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
x->x_gui.x_unique_num = 0;
- if(fstyle->x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(fstyle->x_font_style == 2) strcpy(x->x_gui.x_font, "times");
- else { fstyle->x_font_style = 0;
+ if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_fsf = *fstyle;
iemgui_first_dollararg2sym(&x->x_gui, srl);
if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
x->x_gui.x_snd = srl[0];
@@ -678,8 +672,8 @@ void g_hslider_setup(void)
hslider_widgetbehavior.w_deletefn = iemgui_delete;
hslider_widgetbehavior.w_visfn = iemgui_vis;
hslider_widgetbehavior.w_clickfn = hslider_newclick;
- hslider_widgetbehavior.w_propertiesfn = hslider_properties;
- hslider_widgetbehavior.w_savefn = hslider_save;
class_setwidget(hslider_class, &hslider_widgetbehavior);
class_sethelpsymbol(hslider_class, gensym("hslider"));
+ class_setsavefn(hslider_class, hslider_save);
+ class_setpropertiesfn(hslider_class, hslider_properties);
}
diff --git a/pd/src/g_io.c b/pd/src/g_io.c
index 487be350..196d44d8 100644
--- a/pd/src/g_io.c
+++ b/pd/src/g_io.c
@@ -481,11 +481,12 @@ static void voutlet_dsp(t_voutlet *x, t_signal **sp)
time to copy the samples out to the containing object's outlets.
If we aren't reblocking, there's nothing to do here. */
void voutlet_dspepilog(t_voutlet *x, t_signal **parentsigs,
- int myvecsize, int phase, int period, int frequency, int downsample, int upsample /* IOhannes */, int reblock,
- int switched)
+ int myvecsize, int phase, int period, int frequency, int downsample,
+ int upsample /* IOhannes */, int reblock, int switched)
{
if (!x->x_buf) return; /* this shouldn't be necesssary... */
- x->x_updown.downsample=downsample; x->x_updown.upsample=upsample; /* IOhannes */
+ x->x_updown.downsample=downsample;
+ x->x_updown.upsample=upsample; /* IOhannes */
if (reblock)
{
t_signal *insig, *outsig;
diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c
index 6af4e269..f723cff9 100644
--- a/pd/src/g_mycanvas.c
+++ b/pd/src/g_mycanvas.c
@@ -132,18 +132,16 @@ static void my_canvas_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int
static void my_canvas_save(t_gobj *z, t_binbuf *b)
{
t_my_canvas *x = (t_my_canvas *)z;
- int bflcol[3], *ip1, *ip2;
+ int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
- ip1 = (int *)(&x->x_gui.x_isa);
- ip2 = (int *)(&x->x_gui.x_fsf);
binbuf_addv(b, "ssiisiiisssiiiiiii", gensym("#X"),gensym("obj"),
(t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
gensym("cnv"), x->x_gui.x_w, x->x_vis_w, x->x_vis_h,
srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy,
- (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
- bflcol[0], bflcol[2], (*ip1)&IEM_INIT_ARGS_ALL);
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
+ bflcol[0], bflcol[2], iem_symargstoint(&x->x_gui.x_isa));
binbuf_addv(b, ";");
}
@@ -266,11 +264,11 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE, w=100, h=60;
int ldx=20, ldy=12, f=2, i=0;
- int fs=14, iinit=0, ifstyle=0;
- t_iem_init_symargs *init=(t_iem_init_symargs *)(&iinit);
- t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle);
+ int fs=14;
char str[144];
+ iem_inttosymargs(&x->x_gui.x_isa, 0);
+ iem_inttofstyle(&x->x_gui.x_fsf, 0);
srl[0] = gensym("empty");
srl[1] = gensym("empty");
srl[2] = gensym("empty");
@@ -327,24 +325,21 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
}
ldx = (int)atom_getintarg(i+4, argc, argv);
ldy = (int)atom_getintarg(i+5, argc, argv);
- ifstyle = (int)atom_getintarg(i+6, argc, argv);
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(i+6, argc, argv));
fs = (int)atom_getintarg(i+7, argc, argv);
bflcol[0] = (int)atom_getintarg(i+8, argc, argv);
bflcol[2] = (int)atom_getintarg(i+9, argc, argv);
}
if((argc == 13)&&IS_A_FLOAT(argv,i+10))
{
- iinit = (int)(atom_getintarg(i+10, argc, argv));
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(i+10, argc, argv));
}
x->x_gui.x_draw = (t_iemfunptr)my_canvas_draw;
- iinit &= IEM_INIT_ARGS_ALL;
- ifstyle &= IEM_FSTYLE_FLAGS_ALL;
- fstyle->x_snd_able = 1;
- fstyle->x_rcv_able = 1;
+ x->x_gui.x_fsf.x_snd_able = 1;
+ x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- x->x_gui.x_isa = *init;
- if(!strcmp(srl[0]->s_name, "empty")) fstyle->x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) fstyle->x_rcv_able = 0;
+ if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
+ if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
x->x_gui.x_unique_num = 0;
if(a < 1)
a = 1;
@@ -356,11 +351,10 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
if(h < 1)
h = 1;
x->x_vis_h = h;
- if(fstyle->x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(fstyle->x_font_style == 2) strcpy(x->x_gui.x_font, "times");
- else { fstyle->x_font_style = 0;
+ if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_fsf = *fstyle;
iemgui_first_dollararg2sym(&x->x_gui, srl);
if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
x->x_gui.x_snd = srl[0];
@@ -410,8 +404,8 @@ void g_mycanvas_setup(void)
my_canvas_widgetbehavior.w_deletefn = iemgui_delete;
my_canvas_widgetbehavior.w_visfn = iemgui_vis;
my_canvas_widgetbehavior.w_clickfn = NULL;
- my_canvas_widgetbehavior.w_propertiesfn = my_canvas_properties;
- my_canvas_widgetbehavior.w_savefn = my_canvas_save;
class_setwidget(my_canvas_class, &my_canvas_widgetbehavior);
class_sethelpsymbol(my_canvas_class, gensym("my_canvas"));
+ class_setsavefn(my_canvas_class, my_canvas_save);
+ class_setpropertiesfn(my_canvas_class, my_canvas_properties);
}
diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c
index abf19e44..f6288128 100644
--- a/pd/src/g_numbox.c
+++ b/pd/src/g_numbox.c
@@ -375,7 +375,7 @@ static void my_numbox_getrect(t_gobj *z, t_glist *glist,
static void my_numbox_save(t_gobj *z, t_binbuf *b)
{
t_my_numbox *x = (t_my_numbox *)z;
- int bflcol[3], *ip1, *ip2;
+ int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
@@ -387,16 +387,14 @@ static void my_numbox_save(t_gobj *z, t_binbuf *b)
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
}
- ip1 = (int *)(&x->x_gui.x_isa);
- ip2 = (int *)(&x->x_gui.x_fsf);
binbuf_addv(b, "ssiisiiffiisssiiiiiiifi", gensym("#X"),gensym("obj"),
(t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
gensym("nbx"), x->x_gui.x_w, x->x_gui.x_h,
(float)x->x_min, (float)x->x_max,
- x->x_lin0_log1, (*ip1)&IEM_INIT_ARGS_ALL,
+ x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa),
srl[0], srl[1], srl[2],
x->x_gui.x_ldx, x->x_gui.x_ldy,
- (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
bflcol[0], bflcol[1], bflcol[2],
x->x_val, x->x_log_height);
binbuf_addv(b, ";");
@@ -758,11 +756,9 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
t_symbol *srl[3];
int w=5, h=14;
int lilo=0, f=0, ldx=0, ldy=-6;
- int fs=10, iinit=0, ifstyle=0;
+ int fs=10;
int log_height=256;
double min=-1.0e+37, max=1.0e+37,v=0.0;
- t_iem_init_symargs *init=(t_iem_init_symargs *)(&iinit);
- t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle);
char str[144];
srl[0] = gensym("empty");
@@ -785,7 +781,7 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
min = (double)atom_getfloatarg(2, argc, argv);
max = (double)atom_getfloatarg(3, argc, argv);
lilo = (int)atom_getintarg(4, argc, argv);
- iinit = (int)atom_getintarg(5, argc, argv);
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv));
srl[0] = atom_getsymbolarg(6, argc, argv);
srl[1] = atom_getsymbolarg(7, argc, argv);
srl[2] = atom_getsymbolarg(8, argc, argv);
@@ -812,7 +808,7 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
}
ldx = (int)atom_getintarg(9, argc, argv);
ldy = (int)atom_getintarg(10, argc, argv);
- ifstyle = (int)atom_getintarg(11, argc, argv);
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv));
fs = (int)atom_getintarg(12, argc, argv);
bflcol[0] = (int)atom_getintarg(13, argc, argv);
bflcol[1] = (int)atom_getintarg(14, argc, argv);
@@ -824,12 +820,9 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
log_height = (int)atom_getintarg(17, argc, argv);
}
x->x_gui.x_draw = (t_iemfunptr)my_numbox_draw;
- iinit &= IEM_INIT_ARGS_ALL;
- ifstyle &= IEM_FSTYLE_FLAGS_ALL;
- fstyle->x_snd_able = 1;
- fstyle->x_rcv_able = 1;
+ x->x_gui.x_fsf.x_snd_able = 1;
+ x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- x->x_gui.x_isa = *init;
if(x->x_gui.x_isa.x_loadinit)
x->x_val = v;
else
@@ -839,14 +832,13 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
if(log_height < 10)
log_height = 10;
x->x_log_height = log_height;
- if(!strcmp(srl[0]->s_name, "empty")) fstyle->x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) fstyle->x_rcv_able = 0;
+ if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
+ if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
x->x_gui.x_unique_num = 0;
- if(fstyle->x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(fstyle->x_font_style == 2) strcpy(x->x_gui.x_font, "times");
- else { fstyle->x_font_style = 0;
+ if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_fsf = *fstyle;
iemgui_first_dollararg2sym(&x->x_gui, srl);
if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
x->x_gui.x_snd = srl[0];
@@ -938,8 +930,8 @@ void g_numbox_setup(void)
my_numbox_widgetbehavior.w_deletefn = iemgui_delete;
my_numbox_widgetbehavior.w_visfn = iemgui_vis;
my_numbox_widgetbehavior.w_clickfn = my_numbox_newclick;
- my_numbox_widgetbehavior.w_propertiesfn = my_numbox_properties;;
- my_numbox_widgetbehavior.w_savefn = my_numbox_save;
class_setwidget(my_numbox_class, &my_numbox_widgetbehavior);
class_sethelpsymbol(my_numbox_class, gensym("numbox2"));
+ class_setsavefn(my_numbox_class, my_numbox_save);
+ class_setpropertiesfn(my_numbox_class, my_numbox_properties);
}
diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c
index ddf11670..edcd5e24 100644
--- a/pd/src/g_readwrite.c
+++ b/pd/src/g_readwrite.c
@@ -571,7 +571,8 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b)
(t_int)(x->gl_screeny1),
(t_int)(x->gl_screenx2 - x->gl_screenx1),
(t_int)(x->gl_screeny2 - x->gl_screeny1),
- x->gl_name, x->gl_mapped);
+ (*x->gl_name->s_name ? x->gl_name: gensym("(subpatch)")),
+ x->gl_mapped);
}
/* root or abstraction */
else binbuf_addv(b, "ssiiiii;", gensym("#N"), gensym("canvas"),
diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c
index ee894b7e..aeeb5dfd 100644
--- a/pd/src/g_rtext.c
+++ b/pd/src/g_rtext.c
@@ -229,7 +229,13 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
sys_vgui(".x%x.c select from %s %d\n", canvas,
x->x_tag, x->x_selstart);
sys_vgui(".x%x.c select to %s %d\n", canvas,
- x->x_tag, x->x_selend);
+ x->x_tag, x->x_selend
+#if defined (MSW) || defined(MACOSX)
+ /* Why is linux selecting text differently from MSW and OSX???
+ Just adjust it here... LATER revisit this one */
+ -1
+#endif
+ );
sys_vgui(".x%x.c focus \"\"\n", canvas);
}
else
@@ -385,18 +391,23 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
{
int n = keynum;
if (n == '\r') n = '\n';
- if (n == '\b')
+ if (n == '\b') /* backspace */
{
- if ((!x->x_selstart) && (x->x_selend == x->x_bufsize))
+ /* LATER delete the box if all text is selected...
+ this causes reentrancy problems now. */
+ /* if ((!x->x_selstart) && (x->x_selend == x->x_bufsize))
{
- /* LATER delete the box... this causes reentrancy
- problems now. */
- /* glist_delete(x->x_glist, &x->x_text->te_g); */
- return;
- }
- else if (x->x_selstart && (x->x_selstart == x->x_selend))
+ ....
+ } */
+ if (x->x_selstart && (x->x_selstart == x->x_selend))
x->x_selstart--;
}
+ else if (n == 127) /* delete */
+ {
+ if (x->x_selend < x->x_bufsize && (x->x_selstart == x->x_selend))
+ x->x_selend++;
+ }
+
ndel = x->x_selend - x->x_selstart;
for (i = x->x_selend; i < x->x_bufsize; i++)
x->x_buf[i- ndel] = x->x_buf[i];
diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index d24564e4..538ca246 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -348,8 +348,6 @@ static t_widgetbehavior scalar_widgetbehavior =
scalar_delete,
scalar_vis,
scalar_click,
- scalar_save,
- scalar_properties,
};
static void scalar_free(t_scalar *x)
@@ -377,4 +375,6 @@ void g_scalar_setup(void)
scalar_class = class_new(gensym("scalar"), 0, (t_method)scalar_free, 0,
CLASS_GOBJ, 0);
class_setwidget(scalar_class, &scalar_widgetbehavior);
+ class_setsavefn(scalar_class, scalar_save);
+ class_setpropertiesfn(scalar_class, scalar_properties);
}
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 67c35413..1695079b 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -288,7 +288,6 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto,
/* possibly replace the scalar */
if (scfrom->sc_template == tfrom->t_sym)
{
- post("match");
/* see scalar_new() for comment about the gpointer. */
gpointer_init(&gp);
x = (t_scalar *)getbytes(sizeof(t_scalar) +
@@ -435,10 +434,10 @@ void template_conform(t_template *tfrom, t_template *tto)
if (doit)
{
t_glist *gl;
- post("conforming template '%s' to new structure",
+ /* post("conforming template '%s' to new structure",
tfrom->t_sym->s_name);
for (i = 0; i < nto; i++)
- post("... %d", conformaction[i]);
+ post("... %d", conformaction[i]); */
for (gl = canvas_list; gl; gl = gl->gl_next)
template_conformglist(tfrom, tto, gl, conformaction);
}
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index 13619493..7fc2bbdf 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -457,14 +457,19 @@ static t_symbol *gatom_realizedollar(t_gatom *x, t_symbol *s)
static void gatom_set(t_gatom *x, t_symbol *s, int argc, t_atom *argv)
{
+ t_atom oldatom = x->a_atom;
+ int update = 0;
if (!argc) return;
if (x->a_atom.a_type == A_FLOAT)
- x->a_atom.a_w.w_float = atom_getfloat(argv);
+ x->a_atom.a_w.w_float = atom_getfloat(argv),
+ update = (x->a_atom.a_w.w_float != oldatom.a_w.w_float);
else if (x->a_atom.a_type == A_SYMBOL)
- x->a_atom.a_w.w_symbol = atom_getsymbol(argv);
+ x->a_atom.a_w.w_symbol = atom_getsymbol(argv),
+ update = (x->a_atom.a_w.w_symbol != oldatom.a_w.w_symbol);
binbuf_clear(x->a_text.te_binbuf);
binbuf_add(x->a_text.te_binbuf, 1, &x->a_atom);
- glist_retext(x->a_glist, &x->a_text);
+ if (update)
+ glist_retext(x->a_glist, &x->a_text);
x->a_buf[0] = 0;
}
@@ -1010,7 +1015,7 @@ static int text_click(t_gobj *z, struct _glist *glist,
else return (0);
}
-static void text_save(t_gobj *z, t_binbuf *b)
+void text_save(t_gobj *z, t_binbuf *b)
{
t_text *x = (t_text *)z;
if (x->te_type == T_OBJECT)
@@ -1076,8 +1081,6 @@ t_widgetbehavior text_widgetbehavior =
text_delete,
text_vis,
text_click,
- text_save,
- 0,
};
static t_widgetbehavior gatom_widgetbehavior =
@@ -1089,8 +1092,6 @@ static t_widgetbehavior gatom_widgetbehavior =
text_delete,
gatom_vis,
text_click,
- text_save,
- gatom_properties,
};
/* -------------------- the "text" class ------------ */
@@ -1305,6 +1306,7 @@ void g_text_setup(void)
class_addmethod(gatom_class, (t_method)gatom_param, gensym("param"),
A_GIMME, 0);
class_setwidget(gatom_class, &gatom_widgetbehavior);
+ class_setpropertiesfn(gatom_class, gatom_properties);
}
diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c
index 9f5f5c3c..c6077b89 100644
--- a/pd/src/g_toggle.c
+++ b/pd/src/g_toggle.c
@@ -202,20 +202,18 @@ static void toggle_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *x
static void toggle_save(t_gobj *z, t_binbuf *b)
{
t_toggle *x = (t_toggle *)z;
- int bflcol[3], *ip1, *ip2;
+ int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
- ip1 = (int *)(&x->x_gui.x_isa);
- ip2 = (int *)(&x->x_gui.x_fsf);
binbuf_addv(b, "ssiisiisssiiiiiiiff", gensym("#X"),gensym("obj"),
(t_int)x->x_gui.x_obj.te_xpix,
(t_int)x->x_gui.x_obj.te_ypix,
gensym("tgl"), x->x_gui.x_w,
- (*ip1)&IEM_INIT_ARGS_ALL,
+ iem_symargstoint(&x->x_gui.x_isa),
srl[0], srl[1], srl[2],
x->x_gui.x_ldx, x->x_gui.x_ldy,
- (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
bflcol[0], bflcol[1], bflcol[2], x->x_on, x->x_nonzero);
binbuf_addv(b, ";");
}
@@ -367,12 +365,12 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE, f=0;
int ldx=0, ldy=-6;
- int fs=8, iinit=0, ifstyle=0;
+ int fs=8;
float on=0.0, nonzero=1.0;
- t_iem_init_symargs *init=(t_iem_init_symargs *)(&iinit);
- t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle);
char str[144];
+ iem_inttosymargs(&x->x_gui.x_isa, 0);
+ iem_inttofstyle(&x->x_gui.x_fsf, 0);
srl[0] = gensym("empty");
srl[1] = gensym("empty");
srl[2] = gensym("empty");
@@ -387,7 +385,7 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
&&IS_A_FLOAT(argv,10)&&IS_A_FLOAT(argv,11)&&IS_A_FLOAT(argv,12))
{
a = (int)atom_getintarg(0, argc, argv);
- iinit = (int)atom_getintarg(1, argc, argv);
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(1, argc, argv));
if(IS_A_SYMBOL(argv,2))
srl[0] = atom_getsymbolarg(2, argc, argv);
else if(IS_A_FLOAT(argv,2))
@@ -411,7 +409,7 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
}
ldx = (int)atom_getintarg(5, argc, argv);
ldy = (int)atom_getintarg(6, argc, argv);
- ifstyle = (int)atom_getintarg(7, argc, argv);
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(7, argc, argv));
fs = (int)atom_getintarg(8, argc, argv);
bflcol[0] = (int)atom_getintarg(9, argc, argv);
bflcol[1] = (int)atom_getintarg(10, argc, argv);
@@ -421,21 +419,17 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
if((argc == 14)&&IS_A_FLOAT(argv,13))
nonzero = (float)atom_getfloatarg(13, argc, argv);
x->x_gui.x_draw = (t_iemfunptr)toggle_draw;
- iinit &= IEM_INIT_ARGS_ALL;
- ifstyle &= IEM_FSTYLE_FLAGS_ALL;
- fstyle->x_snd_able = 1;
- fstyle->x_rcv_able = 1;
+ x->x_gui.x_fsf.x_snd_able = 1;
+ x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- x->x_gui.x_isa = *init;
- if(!strcmp(srl[0]->s_name, "empty")) fstyle->x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) fstyle->x_rcv_able = 0;
+ if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
+ if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
x->x_gui.x_unique_num = 0;
- if(fstyle->x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(fstyle->x_font_style == 2) strcpy(x->x_gui.x_font, "times");
- else { fstyle->x_font_style = 0;
+ if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_fsf = *fstyle;
x->x_nonzero = (nonzero!=0.0)?nonzero:1.0;
if(x->x_gui.x_isa.x_loadinit)
x->x_on = (on!=0.0)?nonzero:0.0;
@@ -498,8 +492,8 @@ void g_toggle_setup(void)
toggle_widgetbehavior.w_deletefn = iemgui_delete;
toggle_widgetbehavior.w_visfn = iemgui_vis;
toggle_widgetbehavior.w_clickfn = toggle_newclick;
- toggle_widgetbehavior.w_propertiesfn = toggle_properties;
- toggle_widgetbehavior.w_savefn = toggle_save;
class_setwidget(toggle_class, &toggle_widgetbehavior);
class_sethelpsymbol(toggle_class, gensym("toggle"));
+ class_setsavefn(toggle_class, toggle_save);
+ class_setpropertiesfn(toggle_class, toggle_properties);
}
diff --git a/pd/src/g_vdial.c b/pd/src/g_vdial.c
index 6424944a..be3956b5 100644
--- a/pd/src/g_vdial.c
+++ b/pd/src/g_vdial.c
@@ -234,22 +234,20 @@ static void vradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *x
static void vradio_save(t_gobj *z, t_binbuf *b)
{
t_vradio *x = (t_vradio *)z;
- int bflcol[3], *ip1, *ip2;
+ int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
- ip1 = (int *)(&x->x_gui.x_isa);
- ip2 = (int *)(&x->x_gui.x_fsf);
binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"),
(t_int)x->x_gui.x_obj.te_xpix,
(t_int)x->x_gui.x_obj.te_ypix,
(pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class ?
gensym("vdl") : gensym("vradio")),
x->x_gui.x_w,
- x->x_change, (*ip1)&IEM_INIT_ARGS_ALL, x->x_number,
+ x->x_change, iem_symargstoint(&x->x_gui.x_isa), x->x_number,
srl[0], srl[1], srl[2],
x->x_gui.x_ldx, x->x_gui.x_ldy,
- (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
bflcol[0], bflcol[1], bflcol[2], x->x_on);
binbuf_addv(b, ";");
}
@@ -547,10 +545,8 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
int ldx=0, ldy=-6, chg=1, num=8;
- int fs=8, iinit=0, ifstyle=0;
+ int fs=8;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
- t_iem_init_symargs *init=(t_iem_init_symargs *)(&iinit);
- t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle);
char str[144];
/* post("new %s %d", s->s_name, old); */
@@ -569,7 +565,7 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
{
a = (int)atom_getintarg(0, argc, argv);
chg = (int)atom_getintarg(1, argc, argv);
- iinit = (int)atom_getintarg(2, argc, argv);
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(2, argc, argv));
num = (int)atom_getintarg(3, argc, argv);
if(IS_A_SYMBOL(argv,4))
srl[0] = atom_getsymbolarg(4, argc, argv);
@@ -594,7 +590,7 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
}
ldx = (int)atom_getintarg(7, argc, argv);
ldy = (int)atom_getintarg(8, argc, argv);
- ifstyle = (int)atom_getintarg(9, argc, argv);
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv));
fs = (int)atom_getintarg(10, argc, argv);
bflcol[0] = (int)atom_getintarg(11, argc, argv);
bflcol[1] = (int)atom_getintarg(12, argc, argv);
@@ -602,19 +598,15 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
on = (int)atom_getintarg(14, argc, argv);
}
x->x_gui.x_draw = (t_iemfunptr)vradio_draw;
- iinit &= IEM_INIT_ARGS_ALL;
- ifstyle &= IEM_FSTYLE_FLAGS_ALL;
- fstyle->x_snd_able = 1;
- fstyle->x_rcv_able = 1;
+ x->x_gui.x_fsf.x_snd_able = 1;
+ x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- x->x_gui.x_isa = *init;
- if(!strcmp(srl[0]->s_name, "empty")) fstyle->x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) fstyle->x_rcv_able = 0;
- if(fstyle->x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(fstyle->x_font_style == 2) strcpy(x->x_gui.x_font, "times");
- else { fstyle->x_font_style = 0;
+ if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
+ if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
+ if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_fsf = *fstyle;
x->x_gui.x_unique_num = 0;
if(num < 1)
num = 1;
@@ -713,10 +705,10 @@ void g_vradio_setup(void)
vradio_widgetbehavior.w_deletefn = iemgui_delete;
vradio_widgetbehavior.w_visfn = iemgui_vis;
vradio_widgetbehavior.w_clickfn = vradio_newclick;
- vradio_widgetbehavior.w_propertiesfn = vradio_properties;
- vradio_widgetbehavior.w_savefn = vradio_save;
class_setwidget(vradio_class, &vradio_widgetbehavior);
class_sethelpsymbol(vradio_class, gensym("vradio"));
+ class_setsavefn(vradio_class, vradio_save);
+ class_setpropertiesfn(vradio_class, vradio_properties);
/* obsolete version (0.34-0.35) */
vradio_old_class = class_new(gensym("vdl"), (t_newmethod)vdial_new,
diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c
index a7780135..25522af3 100644
--- a/pd/src/g_vslider.c
+++ b/pd/src/g_vslider.c
@@ -206,20 +206,18 @@ static void vslider_getrect(t_gobj *z, t_glist *glist,
static void vslider_save(t_gobj *z, t_binbuf *b)
{
t_vslider *x = (t_vslider *)z;
- int bflcol[3], *ip1, *ip2;
+ int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
- ip1 = (int *)(&x->x_gui.x_isa);
- ip2 = (int *)(&x->x_gui.x_fsf);
binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"),
(t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
gensym("vsl"), x->x_gui.x_w, x->x_gui.x_h,
(float)x->x_min, (float)x->x_max,
- x->x_lin0_log1, (*ip1)&IEM_INIT_ARGS_ALL,
+ x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa),
srl[0], srl[1], srl[2],
x->x_gui.x_ldx, x->x_gui.x_ldy,
- (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
bflcol[0], bflcol[1], bflcol[2],
x->x_val, x->x_steady);
binbuf_addv(b, ";");
@@ -510,12 +508,12 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
t_symbol *srl[3];
int w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE;
int lilo=0, f=0, ldx=0, ldy=-8;
- int fs=8, iinit=0, ifstyle=0, v=0, steady=1;
+ int fs=8, v=0, steady=1;
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
- t_iem_init_symargs *init=(t_iem_init_symargs *)(&iinit);
- t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle);
char str[144];
+ iem_inttosymargs(&x->x_gui.x_isa, 0);
+ iem_inttofstyle(&x->x_gui.x_fsf, 0);
srl[0] = gensym("empty");
srl[1] = gensym("empty");
srl[2] = gensym("empty");
@@ -536,7 +534,7 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
min = (double)atom_getfloatarg(2, argc, argv);
max = (double)atom_getfloatarg(3, argc, argv);
lilo = (int)atom_getintarg(4, argc, argv);
- iinit = (int)atom_getintarg(5, argc, argv);
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv));
srl[0] = atom_getsymbolarg(6, argc, argv);
srl[1] = atom_getsymbolarg(7, argc, argv);
srl[2] = atom_getsymbolarg(8, argc, argv);
@@ -563,7 +561,7 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
}
ldx = (int)atom_getintarg(9, argc, argv);
ldy = (int)atom_getintarg(10, argc, argv);
- ifstyle = (int)atom_getintarg(11, argc, argv);
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv));
fs = (int)atom_getintarg(12, argc, argv);
bflcol[0] = (int)atom_getintarg(13, argc, argv);
bflcol[1] = (int)atom_getintarg(14, argc, argv);
@@ -573,12 +571,9 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
if((argc == 18)&&IS_A_FLOAT(argv,17))
steady = (int)atom_getintarg(17, argc, argv);
x->x_gui.x_draw = (t_iemfunptr)vslider_draw;
- iinit &= IEM_INIT_ARGS_ALL;
- ifstyle &= IEM_FSTYLE_FLAGS_ALL;
- fstyle->x_snd_able = 1;
- fstyle->x_rcv_able = 1;
+ x->x_gui.x_fsf.x_snd_able = 1;
+ x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- x->x_gui.x_isa = *init;
if(x->x_gui.x_isa.x_loadinit)
x->x_val = v;
else
@@ -588,14 +583,13 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
x->x_lin0_log1 = lilo;
if(steady != 0) steady = 1;
x->x_steady = steady;
- if(!strcmp(srl[0]->s_name, "empty")) fstyle->x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) fstyle->x_rcv_able = 0;
+ if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
+ if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
x->x_gui.x_unique_num = 0;
- if(fstyle->x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(fstyle->x_font_style == 2) strcpy(x->x_gui.x_font, "times");
- else { fstyle->x_font_style = 0;
+ if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_fsf = *fstyle;
iemgui_first_dollararg2sym(&x->x_gui, srl);
if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
x->x_gui.x_snd = srl[0];
@@ -658,8 +652,8 @@ void g_vslider_setup(void)
vslider_widgetbehavior.w_deletefn = iemgui_delete;
vslider_widgetbehavior.w_visfn = iemgui_vis;
vslider_widgetbehavior.w_clickfn = vslider_newclick;
- vslider_widgetbehavior.w_propertiesfn = vslider_properties;;
- vslider_widgetbehavior.w_savefn = vslider_save;
class_setwidget(vslider_class, &vslider_widgetbehavior);
class_sethelpsymbol(vslider_class, gensym("vslider"));
+ class_setsavefn(vslider_class, vslider_save);
+ class_setpropertiesfn(vslider_class, vslider_properties);
}
diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c
index f538eda7..dcb95b04 100644
--- a/pd/src/g_vumeter.c
+++ b/pd/src/g_vumeter.c
@@ -397,19 +397,18 @@ static void vu_getrect(t_gobj *z, t_glist *glist,
static void vu_save(t_gobj *z, t_binbuf *b)
{
t_vu *x = (t_vu *)z;
- int bflcol[3], *ip1, *ip2;
+ int bflcol[3];
t_symbol *srl[3];
iemgui_save(&x->x_gui, srl, bflcol);
- ip1 = (int *)(&x->x_gui.x_isa);
- ip2 = (int *)(&x->x_gui.x_fsf);
binbuf_addv(b, "ssiisiissiiiiiiii", gensym("#X"),gensym("obj"),
(t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
gensym("vu"), x->x_gui.x_w, x->x_gui.x_h,
srl[1], srl[2],
x->x_gui.x_ldx, x->x_gui.x_ldy,
- (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
- bflcol[0], bflcol[2], x->x_scale, (*ip1)&IEM_INIT_ARGS_ALL);
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
+ bflcol[0], bflcol[2], x->x_scale,
+ iem_symargstoint(&x->x_gui.x_isa));
binbuf_addv(b, ";");
}
@@ -611,12 +610,11 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
t_symbol *srl[3];
int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE;
int ldx=-1, ldy=-8, f=0, fs=8, scale=1;
- int iinit=0, ifstyle=0;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
- t_iem_init_symargs *init=(t_iem_init_symargs *)(&iinit);
- t_iem_fstyle_flags *fstyle=(t_iem_fstyle_flags *)(&ifstyle);
char str[144];
+ iem_inttosymargs(&x->x_gui.x_isa, 0);
+ iem_inttofstyle(&x->x_gui.x_fsf, 0);
srl[0] = gensym("empty");
srl[1] = gensym("empty");
srl[2] = gensym("empty");
@@ -646,29 +644,25 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
}
ldx = (int)atom_getintarg(4, argc, argv);
ldy = (int)atom_getintarg(5, argc, argv);
- ifstyle = (int)atom_getintarg(6, argc, argv);
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(6, argc, argv));
fs = (int)atom_getintarg(7, argc, argv);
bflcol[0] = (int)atom_getintarg(8, argc, argv);
bflcol[2] = (int)atom_getintarg(9, argc, argv);
scale = (int)atom_getintarg(10, argc, argv);
}
if((argc == 12)&&IS_A_FLOAT(argv,11))
- iinit = (int)atom_getintarg(11, argc, argv);
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(11, argc, argv));
x->x_gui.x_draw = (t_iemfunptr)vu_draw;
- iinit &= IEM_INIT_ARGS_ALL;
- ifstyle &= IEM_FSTYLE_FLAGS_ALL;
- fstyle->x_snd_able = 0;
- fstyle->x_rcv_able = 1;
+ x->x_gui.x_fsf.x_snd_able = 0;
+ x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- x->x_gui.x_isa = *init;
- if(!strcmp(srl[1]->s_name, "empty")) fstyle->x_rcv_able = 0;
+ if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
x->x_gui.x_unique_num = 0;
- if(fstyle->x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(fstyle->x_font_style == 2) strcpy(x->x_gui.x_font, "times");
- else { fstyle->x_font_style = 0;
+ if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_fsf = *fstyle;
iemgui_first_dollararg2sym(&x->x_gui, srl);
if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
x->x_gui.x_snd = srl[0];
@@ -729,8 +723,8 @@ void g_vumeter_setup(void)
vu_widgetbehavior.w_deletefn = iemgui_delete;
vu_widgetbehavior.w_visfn = iemgui_vis;
vu_widgetbehavior.w_clickfn = NULL;
- vu_widgetbehavior.w_propertiesfn = vu_properties;
- vu_widgetbehavior.w_savefn = vu_save;
class_setwidget(vu_class,&vu_widgetbehavior);
class_sethelpsymbol(vu_class, gensym("vu"));
+ class_setsavefn(vu_class, vu_save);
+ class_setpropertiesfn(vu_class, vu_properties);
}
diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c
index c40e5dff..60fb9974 100644
--- a/pd/src/m_binbuf.c
+++ b/pd/src/m_binbuf.c
@@ -851,6 +851,13 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd)
}
if (!strcmp(first, "#P"))
{
+ /* drop initial "hidden" flag */
+ if (!strcmp(second, "hidden"))
+ {
+ nextmess++;
+ natom--;
+ second = (nextmess+1)->a_w.w_symbol->s_name;
+ }
if (natom >= 7 && !strcmp(second, "newobj")
&& (ISSYMBOL(&nextmess[6], "patcher") ||
ISSYMBOL(&nextmess[6], "p")))
@@ -919,6 +926,9 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd)
}
else if (!strcmp(second, "slider"))
{
+ float inc = atom_getfloatarg(7, natom, nextmess);
+ if (inc <= 0)
+ inc = 1;
binbuf_addv(newb, "ssffsffffffsssfffffffff;",
gensym("#X"), gensym("obj"),
atom_getfloatarg(2, natom, nextmess),
@@ -926,10 +936,9 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd)
gensym("vsl"),
atom_getfloatarg(4, natom, nextmess),
atom_getfloatarg(5, natom, nextmess),
- atom_getfloatarg(7, natom, nextmess),
- atom_getfloatarg(7, natom, nextmess)
- + (atom_getfloatarg(5, natom, nextmess) - 1)
- * atom_getfloatarg(6, natom, nextmess),
+ atom_getfloatarg(6, natom, nextmess),
+ atom_getfloatarg(6, natom, nextmess)
+ + (atom_getfloatarg(5, natom, nextmess) - 1) * inc,
0., 0.,
gensym("empty"), gensym("empty"), gensym("empty"),
0., -8., 0., 8., -262144., -1., -1., 0., 1.);
@@ -962,6 +971,15 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd)
gensym((natom > 5 ? "outlet~" : "outlet")));
nobj++;
}
+ else if (!strcmp(second, "user"))
+ {
+ binbuf_addv(newb, "ssffs;",
+ gensym("#X"), gensym("obj"),
+ atom_getfloatarg(3, natom, nextmess),
+ atom_getfloatarg(4, natom, nextmess),
+ atom_getsymbolarg(2, natom, nextmess));
+ nobj++;
+ }
else if (!strcmp(second, "connect")||
!strcmp(second, "fasten"))
{
diff --git a/pd/src/m_class.c b/pd/src/m_class.c
index b13db89d..15610b23 100644
--- a/pd/src/m_class.c
+++ b/pd/src/m_class.c
@@ -86,6 +86,7 @@ static void pd_defaultsymbol(t_pd *x, t_symbol *s)
}
void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv);
+static void class_nosavefn(t_gobj *z, t_binbuf *b);
/* handle "list" messages to Pds without explicit list methods defined. */
static void pd_defaultlist(t_pd *x, t_symbol *s, int argc, t_atom *argv)
@@ -141,6 +142,7 @@ static void pd_defaultlist(t_pd *x, t_symbol *s, int argc, t_atom *argv)
how this is handled. */
extern t_widgetbehavior text_widgetbehavior;
+extern void text_save(t_gobj *z, t_binbuf *b);
t_class *class_new(t_symbol *s, t_newmethod newmethod, t_method freemethod,
size_t size, int flags, t_atomtype type1, ...)
@@ -205,6 +207,7 @@ t_class *class_new(t_symbol *s, t_newmethod newmethod, t_method freemethod,
c->c_drawcommand = 0;
c->c_floatsignalin = 0;
c->c_externdir = class_extern_dir;
+ c->c_savefn = (typeflag == CLASS_PATCHABLE ? text_save : class_nosavefn);
#if 0
post("class: %s", c->c_name->s_name);
#endif
@@ -417,6 +420,30 @@ char *class_gethelpdir(t_class *c)
return (c->c_externdir->s_name);
}
+static void class_nosavefn(t_gobj *z, t_binbuf *b)
+{
+ bug("save function called but not defined");
+}
+
+void class_setsavefn(t_class *c, t_savefn f)
+{
+ c->c_savefn = f;
+}
+
+t_savefn class_getsavefn(t_class *c)
+{
+ return (c->c_savefn);
+}
+
+void class_setpropertiesfn(t_class *c, t_propertiesfn f)
+{
+ c->c_propertiesfn = f;
+}
+
+t_propertiesfn class_getpropertiesfn(t_class *c)
+{
+ return (c->c_propertiesfn);
+}
/* ---------------- the symbol table ------------------------ */
diff --git a/pd/src/m_glob.c b/pd/src/m_glob.c
index eb240068..ba460aea 100644
--- a/pd/src/m_glob.c
+++ b/pd/src/m_glob.c
@@ -5,7 +5,7 @@
#include "m_pd.h"
#include "m_imp.h"
-static t_class *pdclass;
+t_class *glob_pdobject;
static t_class *maxclass;
/* These "glob" routines, which implement messages to Pd, are from all
@@ -18,6 +18,13 @@ void glob_meters(void *dummy, t_floatarg f);
void glob_key(void *dummy, t_symbol *s, int ac, t_atom *av);
void glob_audiostatus(void *dummy);
void glob_finderror(t_pd *dummy);
+void glob_audio_properties(t_pd *dummy, t_floatarg flongform);
+void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv);
+void glob_audio_setapi(t_pd *dummy, t_floatarg f);
+void glob_midi_properties(t_pd *dummy, t_floatarg flongform);
+void glob_midi_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv);
+void glob_start_path_dialog(t_pd *dummy, t_floatarg flongform);
+void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv);
void glob_ping(t_pd *dummy);
void alsa_resync( void);
@@ -30,7 +37,7 @@ void glob_audio(void *dummy, t_floatarg adc, t_floatarg dac);
/* a method you add for debugging printout */
void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv);
-#if 1
+#if 0
void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv)
{
*(int *)1 = 3;
@@ -58,27 +65,41 @@ void glob_init(void)
class_addanything(maxclass, max_default);
pd_bind(&maxclass, gensym("max"));
- pdclass = class_new(gensym("pd"), 0, 0, sizeof(t_pd),
+ glob_pdobject = class_new(gensym("pd"), 0, 0, sizeof(t_pd),
CLASS_DEFAULT, A_NULL);
- class_addmethod(pdclass, (t_method)glob_initfromgui, gensym("init"),
+ class_addmethod(glob_pdobject, (t_method)glob_initfromgui, gensym("init"),
A_GIMME, 0);
- class_addmethod(pdclass, (t_method)glob_setfilename, gensym("filename"),
+ class_addmethod(glob_pdobject, (t_method)glob_setfilename, gensym("filename"),
A_SYMBOL, A_SYMBOL, 0);
- class_addmethod(pdclass, (t_method)glob_evalfile, gensym("open"),
+ class_addmethod(glob_pdobject, (t_method)glob_evalfile, gensym("open"),
A_SYMBOL, A_SYMBOL, 0);
- class_addmethod(pdclass, (t_method)glob_quit, gensym("quit"), 0);
- class_addmethod(pdclass, (t_method)glob_foo, gensym("foo"), A_GIMME, 0);
- class_addmethod(pdclass, (t_method)glob_dsp, gensym("dsp"), A_GIMME, 0);
- class_addmethod(pdclass, (t_method)glob_meters, gensym("meters"),
+ class_addmethod(glob_pdobject, (t_method)glob_quit, gensym("quit"), 0);
+ class_addmethod(glob_pdobject, (t_method)glob_foo, gensym("foo"), A_GIMME, 0);
+ class_addmethod(glob_pdobject, (t_method)glob_dsp, gensym("dsp"), A_GIMME, 0);
+ class_addmethod(glob_pdobject, (t_method)glob_meters, gensym("meters"),
A_FLOAT, 0);
- class_addmethod(pdclass, (t_method)glob_key, gensym("key"), A_GIMME, 0);
- class_addmethod(pdclass, (t_method)glob_audiostatus,
+ class_addmethod(glob_pdobject, (t_method)glob_key, gensym("key"), A_GIMME, 0);
+ class_addmethod(glob_pdobject, (t_method)glob_audiostatus,
gensym("audiostatus"), 0);
- class_addmethod(pdclass, (t_method)glob_finderror,
+ class_addmethod(glob_pdobject, (t_method)glob_finderror,
gensym("finderror"), 0);
+ class_addmethod(glob_pdobject, (t_method)glob_audio_properties,
+ gensym("audio-properties"), A_DEFFLOAT, 0);
+ class_addmethod(glob_pdobject, (t_method)glob_audio_dialog,
+ gensym("audio-dialog"), A_GIMME, 0);
+ class_addmethod(glob_pdobject, (t_method)glob_audio_setapi,
+ gensym("audio-setapi"), A_FLOAT, 0);
+ class_addmethod(glob_pdobject, (t_method)glob_midi_properties,
+ gensym("midi-properties"), A_DEFFLOAT, 0);
+ class_addmethod(glob_pdobject, (t_method)glob_midi_dialog,
+ gensym("midi-dialog"), A_GIMME, 0);
+ class_addmethod(glob_pdobject, (t_method)glob_start_path_dialog,
+ gensym("start-path-dialog"), A_DEFFLOAT, 0);
+ class_addmethod(glob_pdobject, (t_method)glob_path_dialog,
+ gensym("path-dialog"), A_GIMME, 0);
#ifdef UNIX
- class_addmethod(pdclass, (t_method)glob_ping, gensym("ping"), 0);
+ class_addmethod(glob_pdobject, (t_method)glob_ping, gensym("ping"), 0);
#endif
- class_addanything(pdclass, max_default);
- pd_bind(&pdclass, gensym("pd"));
+ class_addanything(glob_pdobject, max_default);
+ pd_bind(&glob_pdobject, gensym("pd"));
}
diff --git a/pd/src/m_imp.h b/pd/src/m_imp.h
index b95f5d0e..f6724f9c 100644
--- a/pd/src/m_imp.h
+++ b/pd/src/m_imp.h
@@ -44,6 +44,8 @@ struct _class
t_anymethod c_anymethod;
struct _widgetbehavior *c_wb; /* "gobjs" only */
struct _parentwidgetbehavior *c_pwb;/* widget behavior in parent */
+ t_savefn c_savefn; /* function to call when saving */
+ t_propertiesfn c_propertiesfn; /* function to start prop dialog */
int c_floatsignalin; /* onset to float for signal input */
char c_gobj; /* true if is a gobj */
char c_patchable; /* true if we have a t_object header */
diff --git a/pd/src/m_pd.c b/pd/src/m_pd.c
index 8192c7e4..7ae53082 100644
--- a/pd/src/m_pd.c
+++ b/pd/src/m_pd.c
@@ -39,6 +39,13 @@ void pd_free(t_pd *x)
if (c->c_size) t_freebytes(x, c->c_size);
}
+void gobj_save(t_gobj *x, t_binbuf *b)
+{
+ t_class *c = x->g_pd;
+ if (c->c_savefn)
+ (c->c_savefn)(x, b);
+}
+
/* deal with several objects bound to the same symbol. If more than one, we
actually bind a collection object to the symbol, which forwards messages sent
to the symbol. */
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index b5f7f037..fd8d61bf 100644
--- a/pd/src/m_pd.h
+++ b/pd/src/m_pd.h
@@ -38,7 +38,7 @@ extern "C" {
/* and depending on the compiler, hidden data structures are
declared differently: */
-#if defined( __GNUC__) || defined( __BORLANDC__ )
+#if defined( __GNUC__) || defined( __BORLANDC__ ) || defined( __MWERKS__ )
#define EXTERN_STRUCT struct
#else
#define EXTERN_STRUCT extern struct
@@ -419,6 +419,15 @@ EXTERN void class_domainsignalin(t_class *c, int onset);
#define CLASS_MAINSIGNALIN(c, type, field) \
class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0)
+ /* prototype for functions to save Pd's to a binbuf */
+typedef void (*t_savefn)(t_gobj *x, t_binbuf *b);
+EXTERN void class_setsavefn(t_class *c, t_savefn f);
+EXTERN t_savefn class_getsavefn(t_class *c);
+ /* prototype for functions to open properties dialogs */
+typedef void (*t_propertiesfn)(t_gobj *x, struct _glist *glist);
+EXTERN void class_setpropertiesfn(t_class *c, t_propertiesfn f);
+EXTERN t_propertiesfn class_getpropertiesfn(t_class *c);
+
#ifndef PD_CLASS_DEF
#define class_addbang(x, y) class_addbang((x), (t_method)(y))
#define class_addpointer(x, y) class_addpointer((x), (t_method)(y))
@@ -457,6 +466,15 @@ EXTERN int open_via_path(const char *name, const char *ext, const char *dir,
EXTERN int sched_geteventno(void);
EXTERN double sys_getrealtime(void);
+
+/* ------------ threading ------------------- */
+/* T.Grill - see m_sched.c */
+
+EXTERN void sys_lock(void);
+EXTERN void sys_unlock(void);
+EXTERN int sys_trylock(void);
+
+
/* --------------- signals ----------------------------------- */
typedef float t_sample;
@@ -577,9 +595,12 @@ EXTERN int value_setfloat(t_symbol *s, t_float f);
EXTERN void sys_vgui(char *fmt, ...);
EXTERN void sys_gui(char *s);
+ /* dialog window creation and destruction */
EXTERN void gfxstub_new(t_pd *owner, void *key, const char *cmd);
EXTERN void gfxstub_deleteforkey(void *key);
+extern t_class *glob_pdobject; /* object to send "pd" messages */
+
/*------------- Max 0.26 compatibility --------------------*/
/* the following reflects the new way classes are laid out, with the class
diff --git a/pd/src/m_sched.c b/pd/src/m_sched.c
index b4a5dc3b..4020be06 100644
--- a/pd/src/m_sched.c
+++ b/pd/src/m_sched.c
@@ -12,10 +12,15 @@
rates we expect to see: 32000, 44100, 48000, 88200, 96000. */
#define TIMEUNITPERSEC (32.*441000.)
+
+/* T.Grill - enable PD global thread locking - sys_lock, sys_unlock, sys_trylock functions */
+#define THREAD_LOCKING
+#include "pthread.h"
+
+
static int sys_quit;
static double sys_time;
static double sys_time_per_msec = TIMEUNITPERSEC / 1000.;
-static double sys_time_per_dsp_tick;
int sys_schedblocksize = DEFDACBLKSIZE;
int sys_usecsincelastsleep(void);
@@ -128,7 +133,7 @@ static int sys_bin[] = {0, 2, 5, 10, 20, 30, 50, 100, 1000};
#define NHIST 10
static int sys_histogram[NHIST][NBIN];
static double sys_histtime;
-static int sched_diddsp, sched_didmidi, sched_didpoll, sched_didnothing;
+static int sched_diddsp, sched_didpoll, sched_didnothing;
static void sys_clearhist( void)
{
@@ -136,7 +141,7 @@ static void sys_clearhist( void)
for (i = 0; i < NHIST; i++)
for (j = 0; j < NBIN; j++) sys_histogram[i][j] = 0;
sys_histtime = sys_getrealtime();
- sched_diddsp = sched_didmidi = sched_didpoll = sched_didnothing = 0;
+ sched_diddsp = sched_didpoll = sched_didnothing = 0;
}
void sys_printhist( void)
@@ -159,8 +164,8 @@ void sys_printhist( void)
sys_histogram[i][7]);
}
}
- post("dsp %d, midi %d, poll %d, nothing %d",
- sched_diddsp, sched_didmidi, sched_didpoll, sched_didnothing);
+ post("dsp %d, pollgui %d, nothing %d",
+ sched_diddsp, sched_didpoll, sched_didnothing);
}
static int sys_histphase;
@@ -238,7 +243,8 @@ void sys_log_error(int type)
oss_resync[oss_resyncphase].r_error = type;
oss_nresync++;
if (++oss_resyncphase == NRESYNC) oss_resyncphase = 0;
- if (type != ERR_NOTHING && !sched_diored)
+ if (type != ERR_NOTHING && !sched_diored &&
+ (sched_diddsp >= sched_dioredtime))
{
sys_vgui("pdtk_pd_dio 1\n");
sched_diored = 1;
@@ -322,13 +328,42 @@ void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv)
void dsp_tick(void);
-static int m_nodacs = 0;
+static int sched_usedacs = 1;
+static double sched_referencerealtime, sched_referencelogicaltime;
+static double sys_time_per_dsp_tick;
+
+void sched_set_using_dacs(int flag)
+{
+ sched_usedacs = flag;
+ if (!flag)
+ {
+ sched_referencerealtime = sys_getrealtime();
+ sched_referencelogicaltime = clock_getlogicaltime();
+ }
+ sys_time_per_dsp_tick = (TIMEUNITPERSEC) *
+ ((double)sys_schedblocksize) / sys_dacsr;
+}
- /* this must be called earlier than any patches are loaded */
-void m_schedsetsr( void)
+ /* take the scheduler forward one DSP tick, also handling clock timeouts */
+static void sched_tick(double next_sys_time)
{
- sys_time_per_dsp_tick =
- (TIMEUNITPERSEC) * ((double)sys_schedblocksize) / sys_dacsr;
+ int countdown = 5000;
+ while (clock_setlist && clock_setlist->c_settime < next_sys_time)
+ {
+ t_clock *c = clock_setlist;
+ sys_time = c->c_settime;
+ clock_unset(clock_setlist);
+ outlet_setstacklim();
+ (*c->c_fn)(c->c_owner);
+ if (!countdown--)
+ {
+ countdown = 5000;
+ sys_pollgui();
+ }
+ }
+ sys_time = next_sys_time;
+ dsp_tick();
+ sched_diddsp++;
}
/*
@@ -339,26 +374,30 @@ lower priority than the rest.
The time source is normally the audio I/O subsystem via the "sys_send_dacs()"
call. This call returns true if samples were transferred; false means that
-the audio I/O system is still bussy with previous transfers.
-The sys_send_dacs call is OS dependent and is variously implemented in
-s_linux.c, s_nt.c, and s_sgi.c.
+the audio I/O system is still busy with previous transfers.
*/
void sys_pollmidiqueue( void);
void sys_initmidiqueue( void);
-int m_scheduler(int nodacs)
+int m_scheduler( void)
{
- int lasttimeforward = SENDDACS_YES;
int idlecount = 0;
- double lastdactime = 0;
sys_time_per_dsp_tick = (TIMEUNITPERSEC) *
((double)sys_schedblocksize) / sys_dacsr;
+
+#ifdef THREAD_LOCKING
+ /* T.Grill - lock mutex */
+ sys_lock();
+#endif
+
sys_clearhist();
- m_nodacs = nodacs;
if (sys_sleepgrain < 1000)
- sys_sleepgrain = (sys_schedadvance >= 4000?
- (sys_schedadvance >> 2) : 1000);
+ sys_sleepgrain = sys_schedadvance/4;
+ if (sys_sleepgrain < 100)
+ sys_sleepgrain = 100;
+ else if (sys_sleepgrain > 5000)
+ sys_sleepgrain = 5000;
sys_initmidiqueue();
while (1)
{
@@ -366,23 +405,14 @@ int m_scheduler(int nodacs)
int timeforward;
sys_addhist(0);
- if (m_nodacs)
- {
- double elapsed = sys_getrealtime() - lastdactime;
- static double next = 0;
- if (elapsed > next)
- {
- timeforward = SENDDACS_YES;
- next += (double)sys_schedblocksize / sys_dacsr;
- }
- else timeforward = SENDDACS_NO;
- }
- else
+ waitfortick:
+ if (sched_usedacs)
{
timeforward = sys_send_dacs();
/* if dacs remain "idle" for 1 sec, they're hung up. */
- if (timeforward != 0) idlecount = 0;
+ if (timeforward != 0)
+ idlecount = 0;
else
{
idlecount++;
@@ -396,42 +426,26 @@ int m_scheduler(int nodacs)
else if (sys_getrealtime() - idletime > 1.)
{
post("audio I/O stuck... closing audio\n");
- m_nodacs = 1;
sys_close_audio();
- lastdactime = sys_getrealtime();
+ sched_set_using_dacs(0);
+ goto waitfortick;
}
}
}
}
+ else
+ {
+ if (1000. * (sys_getrealtime() - sched_referencerealtime)
+ > clock_gettimesince(sched_referencelogicaltime))
+ timeforward = SENDDACS_YES;
+ else timeforward = SENDDACS_NO;
+ }
sys_setmiditimediff(0, 1e-6 * sys_schedadvance);
- lasttimeforward = timeforward;
sys_addhist(1);
if (timeforward != SENDDACS_NO)
- {
- /* time has moved forward. Check MIDI and clocks */
-
- double next_sys_time = sys_time + sys_time_per_dsp_tick;
- int countdown = 5000;
- while (clock_setlist && clock_setlist->c_settime < next_sys_time)
- {
- t_clock *c = clock_setlist;
- sys_time = c->c_settime;
- clock_unset(clock_setlist);
- outlet_setstacklim();
- (*c->c_fn)(c->c_owner);
- if (!countdown--)
- {
- countdown = 5000;
- sys_pollgui();
- }
- }
- sys_time = next_sys_time;
- if (sys_quit) break;
- dsp_tick();
- if (timeforward != SENDDACS_SLEPT)
- didsomething = 1;
- sched_diddsp++;
- }
+ sched_tick(sys_time + sys_time_per_dsp_tick);
+ if (timeforward == SENDDACS_YES)
+ didsomething = 1;
sys_addhist(2);
sys_pollmidiqueue();
@@ -445,15 +459,72 @@ int m_scheduler(int nodacs)
/* test for idle; if so, do graphics updates. */
if (!didsomething)
{
- sched_pollformeters();
- sys_reportidle();
+ sched_pollformeters();
+ sys_reportidle();
+
+#ifdef THREAD_LOCKING
+ /* T.Grill - enter idle phase -> unlock thread lock */
+ sys_unlock();
+#endif
if (timeforward != SENDDACS_SLEPT)
- sys_microsleep(sys_sleepgrain);
+ sys_microsleep(sys_sleepgrain);
+#ifdef THREAD_LOCKING
+ /* T.Grill - leave idle phase -> lock thread lock */
+ sys_lock();
+#endif
+
sys_addhist(5);
- sched_didnothing++;
+ sched_didnothing++;
+
}
}
+
+#ifdef THREAD_LOCKING
+ /* T.Grill - done */
+ sys_unlock();
+#endif
+
return (0);
}
+/* ------------ thread locking ------------------- */
+/* added by Thomas Grill */
+
+#ifdef THREAD_LOCKING
+static pthread_mutex_t sys_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+void sys_lock(void)
+{
+ pthread_mutex_lock(&sys_mutex);
+}
+
+void sys_unlock(void)
+{
+ pthread_mutex_unlock(&sys_mutex);
+}
+
+int sys_trylock(void)
+{
+ return pthread_mutex_trylock(&sys_mutex);
+}
+
+#else
+
+void sys_lock(void) {}
+void sys_unlock(void) {}
+int sys_trylock(void) {}
+
+#endif
+
+
+/* ------------ soft quit ------------------- */
+/* added by Thomas Grill -
+ just set the quit flag for the scheduler loop
+ this is useful for applications using the PD shared library to signal the scheduler to terminate
+*/
+
+void sys_exit(void)
+{
+ sys_quit = 1;
+}
diff --git a/pd/src/makefile b/pd/src/makefile
index 62e5f34b..8b7a7246 100644
--- a/pd/src/makefile
+++ b/pd/src/makefile
@@ -1,3 +1,131 @@
-all:
- ./configure
- make
+# Makefile for PD on MSW
+
+all: pd gui ..\bin\pd.tk ..\bin\pdsend.exe ..\bin\pdreceive.exe
+
+VC = "C:\Program Files\Microsoft Visual Studio\VC98"
+#VC="\Program Files\DevStudio\Vc"
+INCLUDE = -I.\ -I..\Tcl\include -I$(VC)\include
+
+LDIR = $(VC)\lib
+
+LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel \
+ /NODEFAULTLIB:uuid \
+ $(LDIR)\libc.lib $(LDIR)\oldnames.lib $(LDIR)\kernel32.lib \
+ $(LDIR)\wsock32.lib $(LDIR)\winmm.lib ..\bin\pthreadVC.lib
+
+GLIB = $(LIB) ..\bin\tcl83.lib ..\bin\tk83.lib
+CFLAGS = /nologo /W3 /DMSW /DNT /DPD /DPD_INTERNAL /DWIN32 /DWINDOWS /Ox \
+ -DPA_LITTLE_ENDIAN -DUSEAPI_MMIO -DUSEAPI_PORTAUDIO
+LFLAGS = /nologo
+
+SYSSRC = s_audio_pa.c s_audio_mmio.c s_midi_pm.c
+
+SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
+ g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
+ g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \
+ g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \
+ m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
+ m_conf.c m_glob.c m_sched.c \
+ s_main.c s_inter.c s_file.c s_print.c \
+ s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \
+ d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \
+ d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \
+ d_delay.c d_resample.c \
+ x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c \
+ x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c d_soundfile.c \
+ $(SYSSRC)
+
+PADIR = ..\portaudio
+INCPA = -I$(PADIR) -I$(PADIR)\pa_common -I$(PADIR)\pablio -I..\lib\asio
+SRCPA = $(PADIR)/pa_common/pa_lib.c $(PADIR)/pa_common/pa_trace.c \
+ $(PADIR)/pablio/pablio_pd.c $(PADIR)/pablio/ringbuffer_pd.c
+SRCASIO = $(PADIR)/pa_asio/pa_asio.cpp
+
+ASIOLIB = $(LDIR)\user32.lib $(LDIR)\gdi32.lib $(LDIR)\winspool.lib $(LDIR)\comdlg32.lib \
+$(LDIR)\advapi32.lib $(LDIR)\shell32.lib $(LDIR)\ole32.lib $(LDIR)\oleaut32.lib $(LDIR)\uuid.lib \
+$(LDIR)\odbc32.lib $(LDIR)\odbccp32.lib ..\lib\asio\asiolib.lib
+
+
+PAOBJ = pa_lib.obj pa_trace.obj pablio_pd.obj ringbuffer_pd.obj pa_asio.obj
+
+PMDIR = ..\portmidi
+INCPM = -I$(PMDIR)\pm_common -I$(PMDIR)\pm_win -I$(PMDIR)\porttime
+SRCPM = \
+ $(PMDIR)/pm_common/portmidi.c \
+ $(PMDIR)/pm_common/pmutil.c \
+ $(PMDIR)/pm_win/pmwin.c \
+ $(PMDIR)/pm_win/pmwinmm.c \
+ $(PMDIR)/porttime/porttime.c \
+ $(PMDIR)/porttime/ptwinmm.c \
+
+PMOBJ = portmidi.obj pmutil.obj pmwin.obj pmwinmm.obj porttime.obj ptwinmm.obj
+
+OBJC = $(SRC:.c=.obj) $(PAOBJ) $(PMOBJ)
+
+GSRC = t_main.c t_tkcmd.c
+
+GOBJ = $(GSRC:.c=.obj)
+.PHONY: pd gui
+
+ALLCF = $(CFLAGS) $(INCLUDE) $(INCASIO) $(INCPA) $(INCPM) /D_WINDOWS /DPA_NO_DS
+
+.c.obj:
+ cl /c $(ALLCF) /Tc$*.c
+
+pd: ..\bin\pd.exe
+
+gui: ..\bin\pdtcl.dll
+
+..\bin\pd.exe: s_entry.obj ..\bin\pd.lib
+ link $(LFLAGS) /out:..\bin\pd.exe /INCREMENTAL:NO s_entry.obj \
+ ..\bin\pd.lib $(LIB) $(ASIOLIB)
+
+..\bin\pd.dll ..\bin\pd.lib: $(OBJC) $(OBJASIO)
+ link $(LFLAGS) /dll /export:sys_main /out:..\bin\pd.dll $(OBJC) \
+ $(OBJASIO) $(LIB) $(ASIOLIB)
+
+..\bin\pdtcl.dll: t_tkcmd.obj
+ link $(LFLAGS) /dll /export:Pdtcl_Init /out:..\bin\pdtcl.dll \
+ t_tkcmd.obj $(GLIB)
+
+..\bin\pd.tk: u_main.tk; copy u_main.tk ..\bin\pd.tk
+
+..\bin\pdsend.exe: u_pdsend.obj
+ link $(LFLAGS) /out:..\bin\pdsend.exe /INCREMENTAL:NO u_pdsend.obj \
+ $(LIB)
+
+..\bin\pdreceive.exe: u_pdreceive.obj
+ link $(LFLAGS) /out:..\bin\pdreceive.exe /INCREMENTAL:NO u_pdreceive.obj \
+ $(LIB)
+
+# explicit rules to compile portaudio and portmidi sources:
+pa_lib.obj: $(PADIR)\pa_common\pa_lib.c
+ cl /c $(ALLCF) $(PADIR)\pa_common\pa_lib.c
+pa_trace.obj: $(PADIR)\pa_common\pa_trace.c
+ cl /c $(ALLCF) $(PADIR)\pa_common\pa_trace.c
+pablio_pd.obj: $(PADIR)\pablio\pablio_pd.c
+ cl /c $(ALLCF) $(PADIR)\pablio\pablio_pd.c
+ringbuffer_pd.obj: $(PADIR)\pablio\ringbuffer_pd.c
+ cl /c $(ALLCF) $(PADIR)\pablio\ringbuffer_pd.c
+
+pa_asio.obj: $(PADIR)\pa_asio\pa_asio.cpp
+ cl /c $(ALLCF) $(PADIR)\pa_asio\pa_asio.cpp
+
+portmidi.obj: $(PMDIR)\pm_common\portmidi.c
+ cl /c $(ALLCF) $(PMDIR)\pm_common\portmidi.c
+pmutil.obj: $(PMDIR)\pm_common\pmutil.c
+ cl /c $(ALLCF) $(PMDIR)\pm_common\pmutil.c
+pmwin.obj: $(PMDIR)\pm_win\pmwin.c
+ cl /c $(ALLCF) $(PMDIR)\pm_win\pmwin.c
+pmwinmm.obj: $(PMDIR)\pm_win\pmwinmm.c
+ cl /c $(ALLCF) $(PMDIR)\pm_win\pmwinmm.c
+porttime.obj: $(PMDIR)\porttime\porttime.c
+ cl /c $(ALLCF) $(PMDIR)\porttime\porttime.c
+ptwinmm.obj: $(PMDIR)\porttime\ptwinmm.c
+ cl /c $(ALLCF) $(PMDIR)\porttime\ptwinmm.c
+
+# the following should also clean up "bin" but it doesn't because "bin" holds
+# precious stuff from elsewhere.
+clean:
+ del *.obj
+
diff --git a/pd/src/makefile.nt.bad b/pd/src/makefile.nt.bad
deleted file mode 100644
index d45b72e0..00000000
--- a/pd/src/makefile.nt.bad
+++ /dev/null
@@ -1,92 +0,0 @@
-# Makefile for portaudio ASIO driver version of PD
-
-all: pd gui ..\bin\pd.tk
-
-VC = "C:\Program Files\Microsoft Visual Studio\VC98"
-#VC="\Program Files\DevStudio\Vc"
-INCLUDE = -I.\ -I..\Tcl\include -I$(VC)\include
-
-LDIR = $(VC)\lib
-
-LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel \
- /NODEFAULTLIB:uuid \
- $(LDIR)\libc.lib $(LDIR)\oldnames.lib $(LDIR)\kernel32.lib \
- $(LDIR)\wsock32.lib $(LDIR)\winmm.lib ..\bin\pthreadVC.lib
-
-GLIB = $(LIB) ..\lib\tcl83.lib ..\lib\tk83.lib
-CFLAGS = /nologo /W3 /DNT /DPD /DPD_INTERNAL /DWIN32 /DWINDOWS /Ox
-LFLAGS = /nologo
-
-SYSSRC = s_nt.c s_portaudio.c
-
-SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
- g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
- g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \
- g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \
- m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
- m_conf.c m_glob.c m_sched.c \
- s_main.c s_inter.c s_unix.c s_file.c s_print.c \
- s_loader.c s_path.c s_entry.c \
- d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \
- d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \
- d_delay.c d_resample.c \
- x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c \
- x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c d_soundfile.c \
- $(SYSSRC)
-
-SRCPA = pa_lib.c pa_trace.c pablio_pd.c ringbuffer_pd.c
-SRCASIO = pa_asio.cpp
-
-ASIOLIB = $(LDIR)\user32.lib $(LDIR)\gdi32.lib $(LDIR)\winspool.lib $(LDIR)\comdlg32.lib \
-$(LDIR)\advapi32.lib $(LDIR)\shell32.lib $(LDIR)\ole32.lib $(LDIR)\oleaut32.lib $(LDIR)\uuid.lib \
-$(LDIR)\odbc32.lib $(LDIR)\odbccp32.lib ..\lib\asio\asiolib.lib
-
-
-PAOBJ = pa_lib.obj pa_trace.obj pablio_pd.obj ringbuffer_pd.obj pa_asio.obj
-OBJC = $(SRC:.c=.obj) $(PAOBJ)
-
-GSRC = t_main.c t_tkcmd.c
-
-GOBJ = $(GSRC:.c=.obj)
-.PHONY: pd gui
-
-ALLCF = $(CFLAGS) $(INCLUDE) $(INCASIO) $(INCPA) /D_WINDOWS
-
-.c.obj:
- cl /c $(ALLCF) /Tc$*.c
-
-pd: ..\bin\pd.exe
-
-gui: ..\bin\pdtcl.dll
-
-..\bin\pd.exe: s_entry.obj ..\bin\pd.lib
- link $(LFLAGS) /out:..\bin\pd.exe /INCREMENTAL:NO s_entry.obj \
- ..\bin\pd.lib $(LIB) $(ASIOLIB)
-
-..\bin\pd.dll ..\bin\pd.lib: $(OBJC) $(OBJASIO)
- link $(LFLAGS) /dll /export:sys_main /out:..\bin\pd.dll $(OBJC) \
- $(OBJASIO) $(LIB) $(ASIOLIB)
-
-..\bin\pdtcl.dll: t_tkcmd.obj
- link $(LFLAGS) /dll /export:Pdtcl_Init /out:..\bin\pdtcl.dll \
- t_tkcmd.obj $(GLIB)
-
-..\bin\pd.tk: u_main.tk; copy u_main.tk ..\bin\pd.tk
-
-# explicit rules to compile portaudio sources:
-pa_lib.obj: pa_lib.c
- cl /c $(ALLCF) pa_lib.c
-pa_trace.obj: pa_trace.c
- cl /c $(ALLCF) pa_trace.c
-pablio_pd.obj: pablio_pd.c
- cl /c $(ALLCF) pablio_pd.c
-ringbuffer_pd.obj: ringbuffer_pd.c
- cl /c $(ALLCF) ringbuffer_pd.c
-pa_asio.obj: pa_asio.cpp
- cl /c $(ALLCF) pa_asio.cpp
-
-# the following should also clean up "bin" but it doesn't because "bin" holds
-# precious stuff from elsewhere.
-clean:
- del *.obj
-
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index 0f95929d..6cd97820 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -1,15 +1,29 @@
-vline object
-arrow keys in text objs for mac
-
---------------- dolist --------------------
-vline~ help window
-writesf help window, support 32 bit wav files, and fix sample rate writing
-check that latency is actually set (esp. in windows)
+
+fix for 0.37:
+don't prepend help- if sethalpname is called
+Tom schouten: $HOME undefined crashes Pd
+update 'getting pd to run' to start in with dialog panels
+MIDI on windows?
+
+0.38:
+message dialog not to disappear
+sprout inlets/outlets on objects whose creation failed.
+portaudio_pd files into src
+GOP bounding box object
+pd $1 bug ($1 is saved as it was evaluated, not as '$1')
+why does changing the name of an explode in jupiter patch take so long?
+close-subwindows menu item
+trouble typing into number boxes
+abstraction reload doesn't have to vis everyone??
+check MIDI device numbering on MSW
+show results of opening audio and MIDI on dialogs
+settings saver
+latency testing
windows escape from control-C
-dialogs for a/d/a, midi, path
-ALSA deglitch back in
-bug: resizing grow-upward patches leaves line traces around
+add standard bindings (ctl-o, etc) to dialogs
+settable netsend and netreceive port numbers
suspend/resume graphics updates
scheduler to handle callbacks
scheduler to do DSP computations even if no audio
@@ -22,6 +36,7 @@ try again to fix the font scene
addcomma message to message
pasting should look at current mouse location
open/save panel to take messages to init directory
+look at prctl(2) for FP exception handling
problems:
arrays of non-existent templates crash
@@ -36,14 +51,11 @@ deal with spaces in iemgui labels and send/receive names
get rid of messages causing renaming; try to prevent patches closing themselves.
Krzysztof's qlist_next reentrancy bug
dac~/ adc~/ block~ incompatibility
-is ALSA really checking /proc!?
scofo reports error on reading score1.txt
data copy/paste doesn't check templates aren't changed
rfft~ loses nyquist bin -- see "to hell with it" comment in d_fft.c
-soundfile writing gets wrong sample rate; see /* lie */ in d_soundfile.c
data:
-doesn't redraw when changing draw commands?
vget, vset traversal objects
cursor to show (x, y) location
better hit detection (getrect is too greedy)
@@ -55,6 +67,7 @@ sublists should display on parent if desired?
sublists seem not to handle canvas allocation right (get.pd->pointer.pd bug)
scalar hook to catch the mouse
protect against "plots" going away while you drag on them
+figure out why Pd sometimes crashes when you close example after adding fields
features:
command line flag to defeat loading objects
@@ -72,15 +85,10 @@ think about x and y scale preservation when changing between graph and object
show outlines of objects even when graph is "open"
make graph labels persistent and add to dialog
array click protection (Krzysztof's suggestion)
-Alsa in data late should carefuly reset DAC/ADC fill&empty pointers
increase MIDIQSIZE to at least 1024 in s_unix.c
add nonblock to linux open calls instead of using alarm
-make a hook so objects can specify help windows to open (for scheme object)
graph_vis() to decorate graphs when they're toplevel (parent_glist == 0)
get graphs to expand to hold their contents
-writing FLOAT wav files
-make "table" rescalable vertically
--compat34 flag to save files so that 0.34 can read them
suita.chopin.edu.pl/~czaja/miXed/externs/xeq.html -- MIDI file reader
in glist_delete, consider why this can't be just "vis 0" -- why do we need it?
abstraction auto-reload
@@ -89,10 +97,8 @@ switching between dac and gettimeofday timing on dsp_start/stop
check that -blocksize really reflects in audiobuf calc for Hammerfall
-version to print version and exit; usage() also to print version
NT and OSX: opening HTML files?
-message to change block~ sizes dynamically
MIDI file reading/writing?
makefile to have make install depend on make local.
-borrow arrow keys from IEMLIB
pd messages to close and reopen sound driver
Float method for random
figure out list, message objects
@@ -139,7 +145,6 @@ vreadsf~
benchmarking
flash menu when accelerator hits?
fix edit mode menu item
-"undo"
fancier text editing
tools (reassigns meaning of primary click)
get gui to notice early EOF
diff --git a/pd/src/s_audio.c b/pd/src/s_audio.c
index ca5e34c6..23c2197e 100644
--- a/pd/src/s_audio.c
+++ b/pd/src/s_audio.c
@@ -6,7 +6,6 @@
audio settings from argparse routine and from dialog window.
*/
-
#include "m_pd.h"
#include "s_stuff.h"
#include <stdio.h>
@@ -27,12 +26,11 @@ typedef long t_pa_sample;
#define SYS_BYTESPERCHAN (DEFDACBLKSIZE * SYS_SAMPLEWIDTH)
#define SYS_XFERSAMPS (SYS_DEFAULTCH*DEFDACBLKSIZE)
#define SYS_XFERSIZE (SYS_SAMPLEWIDTH * SYS_XFERSAMPS)
-#define MAXAUDIODEV 4
int sys_inchannels;
int sys_outchannels;
int sys_advance_samples; /* scheduler advance in samples */
-int sys_blocksize = 256; /* audio I/O block size in sample frames */
+int sys_blocksize = 0; /* audio I/O block size in sample frames */
int sys_audioapi = API_DEFAULT;
static int sys_meters; /* true if we're metering */
@@ -40,24 +38,94 @@ static float sys_inmax; /* max input amplitude */
static float sys_outmax; /* max output amplitude */
/* exported variables */
-#ifdef MSW
-#define DEFAULTADVANCE 70000
-#else
-#define DEFAULTADVANCE 50000
-#endif
-int sys_schedadvance = DEFAULTADVANCE; /* scheduler advance in microseconds */
+int sys_schedadvance; /* scheduler advance in microseconds */
float sys_dacsr;
int sys_hipriority = 0;
t_sample *sys_soundout;
t_sample *sys_soundin;
+ /* the "state" is normally one if we're open and zero otherwise;
+ but if the state is one, we still haven't necessarily opened the
+ audio hardware; see audio_isopen() below. */
+static int audio_state;
+
+ /* last requested parameters */
+static int audio_naudioindev;
+static int audio_audioindev[MAXAUDIOINDEV];
+static int audio_audiochindev[MAXAUDIOINDEV];
+static int audio_naudiooutdev;
+static int audio_audiooutdev[MAXAUDIOOUTDEV];
+static int audio_audiochoutdev[MAXAUDIOOUTDEV];
+static int audio_rate;
+static int audio_advance;
+
+static int audio_isopen(void)
+{
+ return (audio_state &&
+ ((audio_naudioindev > 0 && audio_audiochindev[0] > 0)
+ || (audio_naudiooutdev > 0 && audio_audiochoutdev[0] > 0)));
+}
+
+static void sys_get_audio_params(
+ int *pnaudioindev, int *paudioindev, int *chindev,
+ int *pnaudiooutdev, int *paudiooutdev, int *choutdev,
+ int *prate, int *padvance)
+{
+ int i;
+ *pnaudioindev = audio_naudioindev;
+ for (i = 0; i < MAXAUDIOINDEV; i++)
+ paudioindev[i] = audio_audioindev[i],
+ chindev[i] = audio_audiochindev[i];
+ *pnaudiooutdev = audio_naudiooutdev;
+ for (i = 0; i < MAXAUDIOOUTDEV; i++)
+ paudiooutdev[i] = audio_audiooutdev[i],
+ choutdev[i] = audio_audiochoutdev[i];
+ *prate = audio_rate;
+ *padvance = audio_advance;
+}
+
+static void sys_save_audio_params(
+ int naudioindev, int *audioindev, int *chindev,
+ int naudiooutdev, int *audiooutdev, int *choutdev,
+ int rate, int advance)
+{
+ int i;
+ audio_naudioindev = naudioindev;
+ for (i = 0; i < MAXAUDIOINDEV; i++)
+ audio_audioindev[i] = audioindev[i],
+ audio_audiochindev[i] = chindev[i];
+ audio_naudiooutdev = naudiooutdev;
+ for (i = 0; i < MAXAUDIOOUTDEV; i++)
+ audio_audiooutdev[i] = audiooutdev[i],
+ audio_audiochoutdev[i] = choutdev[i];
+ audio_rate = rate;
+ audio_advance = advance;
+}
+
+ /* init routines for any API which needs to set stuff up before
+ any other API gets used. This is only true of OSS so far. */
+#ifdef USEAPI_OSS
+void oss_init(void);
+#endif
+
+static void audio_init( void)
+{
+ static int initted = 0;
+ if (initted)
+ return;
+ initted = 1;
+#ifdef USEAPI_OSS
+ oss_init();
+#endif
+}
+
/* set channels and sample rate. */
static void sys_setchsr(int chin, int chout, int sr)
{
int nblk;
- int inbytes = chin * (DEFDACBLKSIZE*sizeof(float));
- int outbytes = chout * (DEFDACBLKSIZE*sizeof(float));
+ int inbytes = (chin ? chin : 2) * (DEFDACBLKSIZE*sizeof(float));
+ int outbytes = (chout ? chout : 2) * (DEFDACBLKSIZE*sizeof(float));
sys_inchannels = chin;
sys_outchannels = chout;
@@ -79,49 +147,32 @@ static void sys_setchsr(int chin, int chout, int sr)
if (sys_verbose)
post("input channels = %d, output channels = %d",
sys_inchannels, sys_outchannels);
+ canvas_resume_dsp(canvas_suspend_dsp());
}
/* ----------------------- public routines ----------------------- */
-#if 0
-void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
- int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
- int *choutdev, int rate) /* IOhannes */
-{
- int inchans=
- (nchindev > 0 ? chindev[0] : (nchindev == 0 ? 0 : SYS_DEFAULTCH));
- int outchans=
- (nchoutdev > 0 ? choutdev[0] : (nchoutdev == 0 ? 0 : SYS_DEFAULTCH));
- int soundindev = (naudioindev <= 0 ? -1 : (audioindev[0]-1));
- int soundoutdev = (naudiooutdev <= 0 ? -1 : (audiooutdev[0]-1));
- int sounddev = (inchans > 0 ? soundindev : soundoutdev);
- if (naudioindev > 1 || nchindev > 1 || naudiooutdev > 1 || nchoutdev > 1)
- post("sorry, only one portaudio device can be open at once.\n");
- /* post("nindev %d, noutdev %d", naudioindev, naudiooutdev);
- post("soundindev %d, soundoutdev %d", soundindev, soundoutdev); */
- if (sys_verbose)
- post("channels in %d, out %d", inchans, outchans);
- if (rate < 1)
- rate = SYS_DEFAULTSRATE;
- sys_setchsr(inchans, outchans, rate);
- pa_open_audio(inchans, outchans, rate, sys_soundin, sys_soundout,
- sys_blocksize, sys_advance_samples/sys_blocksize,
- soundindev, soundoutdev);
-}
-#endif
+ /* open audio devices (after cleaning up the specified device and channel
+ vectors). The audio devices are "zero based" (i.e. "0" means the first
+ one.) We also save the cleaned-up device specification so that we
+ can later re-open audio and/or show the settings on a dialog window. */
void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
- int *choutdev, int rate) /* IOhannes */
+ int *choutdev, int rate, int advance, int enable)
{
int i, *ip;
int defaultchannels = SYS_DEFAULTCH;
int inchans, outchans;
if (rate < 1)
rate = SYS_DEFAULTSRATE;
-
+ audio_init();
+ /* Since the channel vector might be longer than the
+ audio device vector, or vice versa, we fill the shorter one
+ in to match the longer one. Also, if both are empty, we fill in
+ one device (the default) and two channels. */
if (naudioindev == -1)
- { /* not set */
+ { /* no input audio devices specified */
if (nchindev == -1)
{
nchindev=1;
@@ -131,7 +182,7 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
}
else
{
- for (i = 0; i < MAXAUDIODEV; i++)
+ for (i = 0; i < MAXAUDIOINDEV; i++)
audioindev[i] = i+1;
naudioindev = nchindev;
}
@@ -177,7 +228,7 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
}
else
{
- for (i = 0; i < MAXAUDIODEV; i++)
+ for (i = 0; i < MAXAUDIOOUTDEV; i++)
audiooutdev[i] = i+1;
naudiooutdev = nchoutdev;
}
@@ -211,52 +262,89 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
naudiooutdev = nchoutdev;
}
}
+
+ /* count total number of input and output channels */
for (i = inchans = 0; i < naudioindev; i++)
inchans += chindev[i];
for (i = outchans = 0; i < naudiooutdev; i++)
outchans += choutdev[i];
-
+ /* if no input or output devices seem to have been specified,
+ this really means just disable audio, which we now do. Meanwhile,
+ we can set audio input and output devices to their defaults. */
+ if (!inchans && !outchans)
+ {
+ enable = 0;
+ naudioindev = nchindev = naudiooutdev = nchoutdev = 1;
+ audioindev[0] = audiooutdev[0] = DEFAULTAUDIODEV;
+ chindev[0] = choutdev[0] = 0;
+ }
+ sys_schedadvance = advance * 1000;
sys_setchsr(inchans, outchans, rate);
+ sys_log_error(ERR_NOTHING);
+
+ if (enable && (inchans > 0 || outchans > 0))
+ {
+#ifdef USEAPI_PORTAUDIO
+ if (sys_audioapi == API_PORTAUDIO)
+ {
+ int blksize = (sys_blocksize ? sys_blocksize : 64);
+ pa_open_audio(inchans, outchans, rate, sys_soundin, sys_soundout,
+ blksize, sys_advance_samples/blksize,
+ (naudiooutdev > 0 ? audioindev[0] : 0),
+ (naudiooutdev > 0 ? audiooutdev[0] : 0));
+ }
+else
+#endif
+#ifdef USEAPI_JACK
+ if (sys_audioapi == API_JACK)
+ jack_open_audio((naudioindev > 0 ? chindev[0] : 0),
+ (naudiooutdev > 0 ? choutdev[0] : 0), rate);
+
+ else
+#endif
#ifdef USEAPI_OSS
- if (sys_audioapi == API_OSS)
- oss_open_audio(naudioindev, audioindev, nchindev, chindev,
- naudiooutdev, audiooutdev, nchoutdev, choutdev, rate);
- else
+ if (sys_audioapi == API_OSS)
+ oss_open_audio(naudioindev, audioindev, nchindev, chindev,
+ naudiooutdev, audiooutdev, nchoutdev, choutdev, rate);
+ else
#endif
#ifdef USEAPI_ALSA
- /* for alsa, the "device numbers" are ignored; they are sent
- straight to the alsa code via linux_alsa_devname(). Only one
- device is supported for each of input, output. */
- if (sys_audioapi == API_ALSA)
- alsa_open_audio((naudioindev > 0 ? chindev[0] : 0),
- (naudiooutdev > 0 ? choutdev[0] : 0), rate);
- else
-#endif
-#ifdef USEAPI_PORTAUDIO
- if (sys_audioapi == API_PORTAUDIO)
- pa_open_audio(inchans, outchans, rate, sys_soundin, sys_soundout,
- sys_blocksize, sys_advance_samples/sys_blocksize,
- (naudiooutdev > 0 ? audioindev[0] : 0),
- (naudiooutdev > 0 ? audiooutdev[0] : 0));
- else
+ /* for alsa, only one device is supported; it may
+ be open for both input and output. */
+ if (sys_audioapi == API_ALSA)
+ alsa_open_audio(naudioindev, audioindev, nchindev, chindev,
+ naudiooutdev, audiooutdev, nchoutdev, choutdev, rate);
+ else
#endif
#ifdef USEAPI_MMIO
- if (sys_audioapi == API_MMIO)
- mmio_open_audio(naudioindev, audioindev, nchindev, chindev,
- naudiooutdev, audiooutdev, nchoutdev, choutdev, rate);
- else
+ if (sys_audioapi == API_MMIO)
+ mmio_open_audio(naudioindev, audioindev, nchindev, chindev,
+ naudiooutdev, audiooutdev, nchoutdev, choutdev, rate);
+ else
#endif
- post("unknown audio API specified");
+ post("unknown audio API specified");
+ }
+ sys_save_audio_params(naudioindev, audioindev, chindev,
+ naudiooutdev, audiooutdev, choutdev, rate, advance);
+ audio_state = enable;
+ sys_vgui("set pd_whichapi %d\n", (audio_isopen() ? sys_audioapi : 0));
+ sched_set_using_dacs(enable);
}
void sys_close_audio(void)
{
-
+ if (!audio_isopen())
+ return;
#ifdef USEAPI_PORTAUDIO
if (sys_audioapi == API_PORTAUDIO)
pa_close_audio();
else
#endif
+#ifdef USEAPI_JACK
+ if (sys_audioapi == API_JACK)
+ jack_close_audio();
+ else
+#endif
#ifdef USEAPI_OSS
if (sys_audioapi == API_OSS)
oss_close_audio();
@@ -266,14 +354,26 @@ void sys_close_audio(void)
if (sys_audioapi == API_ALSA)
alsa_close_audio();
else
+#endif
#ifdef USEAPI_MMIO
if (sys_audioapi == API_MMIO)
mmio_close_audio();
else
#endif
-#endif
- post("unknown API");
+ post("sys_close_audio: unknown API %d", sys_audioapi);
+ sys_inchannels = sys_outchannels = 0;
+}
+ /* open audio using whatever parameters were last used */
+void sys_reopen_audio( void)
+{
+ int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
+ int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV];
+ int rate, advance;
+ sys_get_audio_params(&naudioindev, audioindev, chindev,
+ &naudiooutdev, audiooutdev, choutdev, &rate, &advance);
+ sys_open_audio(naudioindev, audioindev, naudioindev, chindev,
+ naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate, advance, 1);
}
int sys_send_dacs(void)
@@ -305,6 +405,11 @@ int sys_send_dacs(void)
return (pa_send_dacs());
else
#endif
+#ifdef USEAPI_JACK
+ if (sys_audioapi == API_JACK)
+ return (jack_send_dacs());
+ else
+#endif
#ifdef USEAPI_OSS
if (sys_audioapi == API_OSS)
return (oss_send_dacs());
@@ -364,26 +469,249 @@ void sys_reportidle(void)
{
}
+#define MAXNDEV 20
+#define DEVDESCSIZE 80
+
+static void audio_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize)
+{
+ audio_init();
+#ifdef USEAPI_OSS
+ if (sys_audioapi == API_OSS)
+ {
+ oss_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti,
+ maxndev, devdescsize);
+ }
+ else
+#endif
+#ifdef USEAPI_ALSA
+ if (sys_audioapi == API_ALSA)
+ {
+ alsa_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti,
+ maxndev, devdescsize);
+ }
+ else
+#endif
+#ifdef USEAPI_PORTAUDIO
+ if (sys_audioapi == API_PORTAUDIO)
+ {
+ pa_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti,
+ maxndev, devdescsize);
+ }
+ else
+#endif
+#ifdef USEAPI_MMIO
+ if (sys_audioapi == API_MMIO)
+ {
+ mmio_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti,
+ maxndev, devdescsize);
+ }
+ else
+#endif
+ {
+ /* this shouldn't happen once all the above get filled in. */
+ int i;
+ *nindevs = *noutdevs = 3;
+ for (i = 0; i < 3; i++)
+ {
+ sprintf(indevlist + i * devdescsize, "input device #%d", i+1);
+ sprintf(outdevlist + i * devdescsize, "output device #%d", i+1);
+ }
+ *canmulti = 0;
+ }
+}
+
+#ifdef MSW
+#define DEVONSET 0 /* microsoft device list starts at 0 (the "mapper"). */
+#else /* (see also MSW ifdef in sys_parsedevlist(), s_main.c) */
+#define DEVONSET 1 /* To agree with command line flags, normally start at 1 */
+#endif
+
+static void sys_listaudiodevs(void )
+{
+ char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
+ int nindevs = 0, noutdevs = 0, i, canmulti = 0;
+
+ audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti,
+ MAXNDEV, DEVDESCSIZE);
+
+ if (!nindevs)
+ post("no audio input devices found");
+ else
+ {
+ post("input devices:");
+ for (i = 0; i < nindevs; i++)
+ post("%d. %s", i+1, indevlist + i * DEVDESCSIZE);
+ }
+ if (!noutdevs)
+ post("no audio output devices found");
+ else
+ {
+ post("output devices:");
+ for (i = 0; i < noutdevs; i++)
+ post("%d. %s", i + DEVONSET, outdevlist + i * DEVDESCSIZE);
+ }
+ post("API number %d\n", sys_audioapi);
+}
+
+ /* start an audio settings dialog window */
+void glob_audio_properties(t_pd *dummy, t_floatarg flongform)
+{
+ char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)];
+ /* these are the devices you're using: */
+ int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
+ int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV];
+ int audioindev1, audioindev2, audioindev3, audioindev4,
+ audioinchan1, audioinchan2, audioinchan3, audioinchan4,
+ audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4,
+ audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4;
+ int rate, advance;
+ /* these are all the devices on your system: */
+ char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
+ int nindevs = 0, noutdevs = 0, canmulti = 0, i;
+
+ char indevliststring[MAXNDEV*(DEVDESCSIZE+4)+80],
+ outdevliststring[MAXNDEV*(DEVDESCSIZE+4)+80];
+
+ audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti,
+ MAXNDEV, DEVDESCSIZE);
+
+ strcpy(indevliststring, "{");
+ for (i = 0; i < nindevs; i++)
+ {
+ strcat(indevliststring, "\"");
+ strcat(indevliststring, indevlist + i * DEVDESCSIZE);
+ strcat(indevliststring, "\" ");
+ }
+ strcat(indevliststring, "}");
+
+ strcpy(outdevliststring, "{");
+ for (i = 0; i < noutdevs; i++)
+ {
+ strcat(outdevliststring, "\"");
+ strcat(outdevliststring, outdevlist + i * DEVDESCSIZE);
+ strcat(outdevliststring, "\" ");
+ }
+ strcat(outdevliststring, "}");
+
+ sys_get_audio_params(&naudioindev, audioindev, chindev,
+ &naudiooutdev, audiooutdev, choutdev, &rate, &advance);
+
+ /* post("naudioindev %d naudiooutdev %d longform %f",
+ naudioindev, naudiooutdev, flongform); */
+ if (naudioindev > 1 || naudiooutdev > 1)
+ flongform = 1;
+
+
+ audioindev1 = (naudioindev > 0 && audioindev[0]>= 0 ? audioindev[0] : 0);
+ audioindev2 = (naudioindev > 1 && audioindev[1]>= 0 ? audioindev[1] : 0);
+ audioindev3 = (naudioindev > 2 && audioindev[2]>= 0 ? audioindev[2] : 0);
+ audioindev4 = (naudioindev > 3 && audioindev[3]>= 0 ? audioindev[3] : 0);
+ audioinchan1 = (naudioindev > 0 ? chindev[0] : 0);
+ audioinchan2 = (naudioindev > 1 ? chindev[1] : 0);
+ audioinchan3 = (naudioindev > 2 ? chindev[2] : 0);
+ audioinchan4 = (naudioindev > 3 ? chindev[3] : 0);
+ audiooutdev1 = (naudiooutdev > 0 && audiooutdev[0]>=0 ? audiooutdev[0] : 0);
+ audiooutdev2 = (naudiooutdev > 1 && audiooutdev[1]>=0 ? audiooutdev[1] : 0);
+ audiooutdev3 = (naudiooutdev > 2 && audiooutdev[2]>=0 ? audiooutdev[2] : 0);
+ audiooutdev4 = (naudiooutdev > 3 && audiooutdev[3]>=0 ? audiooutdev[3] : 0);
+ audiooutchan1 = (naudiooutdev > 0 ? choutdev[0] : 0);
+ audiooutchan2 = (naudiooutdev > 1 ? choutdev[1] : 0);
+ audiooutchan3 = (naudiooutdev > 2 ? choutdev[2] : 0);
+ audiooutchan4 = (naudiooutdev > 3 ? choutdev[3] : 0);
+ sprintf(buf,
+"pdtk_audio_dialog %%s \
+%s %d %d %d %d %d %d %d %d \
+%s %d %d %d %d %d %d %d %d \
+%d %d %d %d\n",
+ indevliststring,
+ audioindev1, audioindev2, audioindev3, audioindev4,
+ audioinchan1, audioinchan2, audioinchan3, audioinchan4,
+ outdevliststring,
+ audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4,
+ audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4,
+ rate, advance, canmulti, (flongform != 0));
+ gfxstub_deleteforkey(0);
+ gfxstub_new(&glob_pdobject, glob_audio_properties, buf);
+}
+
+ /* new values from dialog window */
+void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
+{
+ int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
+ int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV];
+ int rate, advance, audioon, i, nindev, noutdev;
+ int audioindev1, audioinchan1, audiooutdev1, audiooutchan1;
+ int newaudioindev[4], newaudioinchan[4],
+ newaudiooutdev[4], newaudiooutchan[4];
+ /* the new values the dialog came back with: */
+ int newrate = atom_getintarg(16, argc, argv);
+ int newadvance = atom_getintarg(17, argc, argv);
+ int statewas;
+
+ for (i = 0; i < 4; i++)
+ {
+ newaudioindev[i] = atom_getintarg(i, argc, argv);
+ newaudioinchan[i] = atom_getintarg(i+4, argc, argv);
+ newaudiooutdev[i] = atom_getintarg(i+8, argc, argv);
+ newaudiooutchan[i] = atom_getintarg(i+12, argc, argv);
+ }
+
+ for (i = 0, nindev = 0; i < 4; i++)
+ {
+ if (newaudioinchan[i] > 0)
+ {
+ newaudioindev[nindev] = newaudioindev[i];
+ newaudioinchan[nindev] = newaudioinchan[i];
+ /* post("in %d %d %d", nindev,
+ newaudioindev[nindev] , newaudioinchan[nindev]); */
+ nindev++;
+ }
+ }
+ for (i = 0, noutdev = 0; i < 4; i++)
+ {
+ if (newaudiooutchan[i] > 0)
+ {
+ newaudiooutdev[noutdev] = newaudiooutdev[i];
+ newaudiooutchan[noutdev] = newaudiooutchan[i];
+ /* post("out %d %d %d", noutdev,
+ newaudiooutdev[noutdev] , newaudioinchan[noutdev]); */
+ noutdev++;
+ }
+ }
+
+ sys_close_audio();
+ sys_open_audio(nindev, newaudioindev, nindev, newaudioinchan,
+ noutdev, newaudiooutdev, noutdev, newaudiooutchan,
+ newrate, newadvance, 1);
+}
+
void sys_listdevs(void )
{
#ifdef USEAPI_PORTAUDIO
if (sys_audioapi == API_PORTAUDIO)
- pa_listdevs();
+ sys_listaudiodevs();
else
#endif
+#ifdef USEAPI_JACK
+ if (sys_audioapi == API_JACK)
+ jack_listdevs();
+ else
+#endif
#ifdef USEAPI_OSS
if (sys_audioapi == API_OSS)
- oss_listdevs();
+ sys_listaudiodevs();
else
#endif
#ifdef USEAPI_MMIO
if (sys_audioapi == API_MMIO)
- mmio_listdevs();
+ sys_listaudiodevs();
else
#endif
#ifdef USEAPI_ALSA
if (sys_audioapi == API_ALSA)
- alsa_listdevs();
+ sys_listaudiodevs();
else
#endif
post("unknown API");
@@ -401,10 +729,135 @@ void sys_setblocksize(int n)
sys_blocksize = n;
}
-void sys_set_sound_api(int which)
+void sys_set_audio_api(int which)
{
sys_audioapi = which;
if (sys_verbose)
post("sys_audioapi %d", sys_audioapi);
}
+void glob_audio_setapi(void *dummy, t_floatarg f)
+{
+ int newapi = f;
+ if (newapi)
+ {
+ if (newapi == sys_audioapi)
+ {
+ if (!audio_isopen())
+ sys_reopen_audio();
+ }
+ else
+ {
+ sys_close_audio();
+ sys_audioapi = newapi;
+ /* bash device params back to default */
+ audio_naudioindev = audio_naudiooutdev = 1;
+ audio_audioindev[0] = audio_audiooutdev[0] = DEFAULTAUDIODEV;
+ audio_audiochindev[0] = audio_audiochoutdev[0] = SYS_DEFAULTCH;
+ sys_reopen_audio();
+ }
+ glob_audio_properties(0, 0);
+ }
+ else if (audio_isopen())
+ {
+ sys_close_audio();
+ audio_state = 0;
+ sched_set_using_dacs(0);
+ }
+}
+
+ /* start or stop the audio hardware */
+void sys_set_audio_state(int onoff)
+{
+ if (onoff) /* start */
+ {
+ if (!audio_isopen())
+ sys_reopen_audio();
+ }
+ else
+ {
+ if (audio_isopen())
+ {
+ sys_close_audio();
+ sched_set_using_dacs(0);
+ }
+ }
+ audio_state = onoff;
+}
+
+void sys_get_audio_apis(char *buf)
+{
+ int n = 0;
+ strcpy(buf, "{ ");
+#ifdef USEAPI_OSS
+ sprintf(buf + strlen(buf), "{OSS %d} ", API_OSS); n++;
+#endif
+#ifdef USEAPI_MMIO
+ sprintf(buf + strlen(buf), "{\"standard (MMIO)\" %d} ", API_MMIO); n++;
+#endif
+#ifdef USEAPI_ALSA
+ sprintf(buf + strlen(buf), "{ALSA %d} ", API_ALSA); n++;
+#endif
+#ifdef USEAPI_PORTAUDIO
+#ifdef MSW
+ sprintf(buf + strlen(buf),
+ "{\"ASIO (via portaudio)\" %d} ", API_PORTAUDIO);
+#else
+#ifdef OSX
+ sprintf(buf + strlen(buf),
+ "{\"standard (portaudio)\" %d} ", API_PORTAUDIO);
+#else
+ sprintf(buf + strlen(buf), "{portaudio %d} ", API_PORTAUDIO);
+#endif
+#endif
+ n++;
+#endif
+#ifdef USEAPI_JACK
+ sprintf(buf + strlen(buf), "{jack %d} ", API_JACK); n++;
+#endif
+ strcat(buf, "}");
+ /* then again, if only one API (or none) we don't offer any choice. */
+ if (n < 2)
+ strcpy(buf, "{}");
+
+}
+
+#ifdef USEAPI_ALSA
+void alsa_putzeros(int n);
+void alsa_getzeros(int n);
+void alsa_printstate( void);
+#endif
+
+ /* debugging */
+void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv)
+{
+ t_symbol *arg = atom_getsymbolarg(0, argc, argv);
+ if (arg == gensym("restart"))
+ {
+ int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
+ int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV];
+ int rate, advance;
+ sys_get_audio_params(&naudioindev, audioindev, chindev,
+ &naudiooutdev, audiooutdev, choutdev, &rate, &advance);
+ sys_close_audio();
+ sys_open_audio(naudioindev, audioindev, naudioindev, chindev,
+ naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate, advance,
+ 1);
+ }
+#ifdef USEAPI_ALSA
+ else if (arg == gensym("alsawrite"))
+ {
+ int n = atom_getintarg(1, argc, argv);
+ alsa_putzeros(n);
+ }
+ else if (arg == gensym("alsaread"))
+ {
+ int n = atom_getintarg(1, argc, argv);
+ alsa_getzeros(n);
+ }
+ else if (arg == gensym("print"))
+ {
+ alsa_printstate();
+ }
+#endif
+}
diff --git a/pd/src/s_audio_alsa.c b/pd/src/s_audio_alsa.c
index 0fa3d791..b94a4e04 100644
--- a/pd/src/s_audio_alsa.c
+++ b/pd/src/s_audio_alsa.c
@@ -45,39 +45,27 @@ typedef struct _alsa_dev
} t_alsa_dev;
t_alsa_dev alsa_device;
-static short *alsa_buf;
+static short *alsa_buf = 0;
static int alsa_samplewidth;
static snd_pcm_status_t* in_status;
static snd_pcm_status_t* out_status;
static int alsa_mode;
+static int alsa_buf_samps; /* believed actual ALSA bufsize in sample frames */
+static int alsa_inchannels;
+static int alsa_outchannels;
/* Defines */
#define DEBUG(x) x
#define DEBUG2(x) {x;}
-static char alsa_devname[512] = "hw:0,0";
-static int alsa_use_plugin = 0;
+static void alsa_checkiosync( void);
/* don't assume we can turn all 31 bits when doing float-to-fix;
otherwise some audio drivers (e.g. Midiman/ALSA) wrap around. */
#define FMAX 0x7ffff000
#define CLIP32(x) (((x)>FMAX)?FMAX:((x) < -FMAX)?-FMAX:(x))
- /* ugly Alsa-specific flags */
-void linux_alsa_devname(char *devname)
-{
- strncpy(alsa_devname, devname, 511);
-}
-
-void linux_alsa_use_plugin(int t)
-{
- if (t == 1)
- alsa_use_plugin = 1;
- else
- alsa_use_plugin = 0;
-}
-
/* support for ALSA pcmv2 api by Karl MacMillan<karlmac@peabody.jhu.edu> */
static void check_error(int err, const char *why)
@@ -86,7 +74,11 @@ static void check_error(int err, const char *why)
fprintf(stderr, "%s: %s\n", why, snd_strerror(err));
}
-int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
+/* was: alsa_open_audio(int wantinchans, int wantoutchans, int srate) */
+
+int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
+ int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
+ int *choutdev, int rate)
{
int err, inchans = 0, outchans = 0, subunitdir;
char devname[512];
@@ -97,14 +89,42 @@ int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
int nfrags, i;
short* tmp_buf;
unsigned int tmp_uint;
+ int wantinchans, wantoutchans, devno;
+
+ if (naudioindev >= 2 || naudiooutdev >= 2)
+ post("alsa: only one input and output device allowed (extras ignored");
+ if (naudioindev >= 1 && naudiooutdev >= 1 &&
+ audioindev[0] != audiooutdev[0])
+ post("alsa: changing output device to agree with input device");
+ if (nchindev)
+ wantinchans = chindev[0];
+ else wantinchans = (naudioindev ? 2 : 0);
+ if (nchoutdev)
+ wantoutchans = choutdev[0];
+ else wantoutchans = (naudiooutdev ? 2 : 0);
+ devno = (naudioindev > 0 ? audioindev[0] :
+ (naudiooutdev > 0 ? audiooutdev[0] : 0));
+
+ /* device names are hw:0, plughw:0, hw:1, and so on. */
+ if (devno & 1)
+ sprintf(devname, "plughw:%d", devno/2);
+ else sprintf(devname, "hw:%d", devno/2);
- nfrags = sys_schedadvance * (float)srate / (1e6 * frag_size);
+ if (sys_verbose)
+ post("device name %s; channels in %d, out %d", devname, wantinchans,
+ wantoutchans);
+
+ nfrags = sys_schedadvance * (float)rate / (1e6 * frag_size);
+ /* save our belief as to ALSA's buffer size for later */
+ alsa_buf_samps = nfrags * frag_size;
if (sys_verbose)
post("audio buffer set to %d", (int)(0.001 * sys_schedadvance));
+
+
if (wantinchans)
{
- err = snd_pcm_open(&alsa_device.inhandle, alsa_devname,
+ err = snd_pcm_open(&alsa_device.inhandle, devname,
SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK);
check_error(err, "snd_pcm_open (input)");
@@ -118,7 +138,7 @@ int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
}
if (wantoutchans)
{
- err = snd_pcm_open(&alsa_device.outhandle, alsa_devname,
+ err = snd_pcm_open(&alsa_device.outhandle, devname,
SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
check_error(err, "snd_pcm_open (output)");
@@ -175,7 +195,7 @@ int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
inchans = tmp_uint;
// set the sampling rate
err = snd_pcm_hw_params_set_rate_min(alsa_device.inhandle, hw_params,
- &srate, 0);
+ &rate, 0);
check_error(err, "snd_pcm_hw_params_set_rate_min (input)");
#if 0
err = snd_pcm_hw_params_get_rate(hw_params, &subunitdir);
@@ -191,7 +211,7 @@ int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
snd_pcm_hw_params_get_period_size(hw_params, 0),
snd_pcm_hw_params_get_period_size_min(hw_params, 0),
snd_pcm_hw_params_get_period_size_max(hw_params, 0));
-#endif
+#endif
err = snd_pcm_hw_params_set_period_size_near(alsa_device.inhandle,
hw_params,
(snd_pcm_uframes_t)
@@ -217,22 +237,12 @@ int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
check_error(err, "snd_pcm_sw_params_malloc (input)");
err = snd_pcm_sw_params_current(alsa_device.inhandle, sw_params);
check_error(err, "snd_pcm_sw_params_current (input)");
-#if 1
- err = snd_pcm_sw_params_set_start_mode(alsa_device.inhandle, sw_params,
- SND_PCM_START_EXPLICIT);
- check_error(err, "snd_pcm_sw_params_set_start_mode (input)");
- err = snd_pcm_sw_params_set_xrun_mode(alsa_device.inhandle, sw_params,
- SND_PCM_XRUN_NONE);
- check_error(err, "snd_pcm_sw_params_set_xrun_mode (input)");
-#else
err = snd_pcm_sw_params_set_start_threshold(alsa_device.inhandle,
sw_params, nfrags * frag_size);
check_error(err, "snd_pcm_sw_params_set_start_threshold (input)");
err = snd_pcm_sw_params_set_stop_threshold(alsa_device.inhandle,
- sw_params, 1);
+ sw_params, 0x7fffffff);
check_error(err, "snd_pcm_sw_params_set_stop_threshold (input)");
-#endif
-
err = snd_pcm_sw_params_set_avail_min(alsa_device.inhandle, sw_params,
frag_size);
check_error(err, "snd_pcm_sw_params_set_avail_min (input)");
@@ -296,7 +306,7 @@ int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
outchans = tmp_uint;
// set the sampling rate
err = snd_pcm_hw_params_set_rate_min(alsa_device.outhandle, hw_params,
- &srate, 0);
+ &rate, 0);
check_error(err, "snd_pcm_hw_params_set_rate_min (output)");
#if 0
err = snd_pcm_hw_params_get_rate(hw_params, &subunitdir);
@@ -325,39 +335,27 @@ int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
hw_params, nfrags * frag_size);
check_error(err, "snd_pcm_hw_params_set_buffer_size_near (output)");
-
+
err = snd_pcm_hw_params(alsa_device.outhandle, hw_params);
check_error(err, "snd_pcm_hw_params (output)");
-
+
snd_pcm_hw_params_free(hw_params);
err = snd_pcm_sw_params_malloc(&sw_params);
check_error(err, "snd_pcm_sw_params_malloc (output)");
err = snd_pcm_sw_params_current(alsa_device.outhandle, sw_params);
check_error(err, "snd_pcm_sw_params_current (output)");
-#if 1
- err = snd_pcm_sw_params_set_start_mode(alsa_device.outhandle,
- sw_params,
- SND_PCM_START_EXPLICIT);
- check_error(err, "snd_pcm_sw_params_set_start_mode (output)");
- err = snd_pcm_sw_params_set_xrun_mode(alsa_device.outhandle, sw_params,
- SND_PCM_XRUN_NONE);
- check_error(err, "snd_pcm_sw_params_set_xrun_mode (output)");
-#else
- err = snd_pcm_sw_params_set_start_threshold(alsa_device.inhandle,
+ err = snd_pcm_sw_params_set_start_threshold(alsa_device.outhandle,
sw_params, nfrags * frag_size);
check_error(err, "snd_pcm_sw_params_set_start_threshold (output)");
- err = snd_pcm_sw_params_set_stop_threshold(alsa_device.inhandle,
- sw_params, 1);
+ err = snd_pcm_sw_params_set_stop_threshold(alsa_device.outhandle,
+ sw_params, 0x7fffffff);
check_error(err, "snd_pcm_sw_params_set_stop_threshold (output)");
-#endif
-
err = snd_pcm_sw_params_set_avail_min(alsa_device.outhandle, sw_params,
- frag_size);
+ frag_size);
check_error(err, "snd_pcm_sw_params_set_avail_min (output)");
err = snd_pcm_sw_params(alsa_device.outhandle, sw_params);
check_error(err, "snd_pcm_sw_params (output)");
-
snd_pcm_sw_params_free(sw_params);
snd_output_stdio_attach(&out, stderr, 0);
@@ -379,40 +377,36 @@ int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
if (inchans && outchans)
snd_pcm_link(alsa_device.inhandle, alsa_device.outhandle);
- // set up the buffer
- if (outchans > inchans)
- alsa_buf = (short *)calloc(sizeof(char) * alsa_samplewidth,
- DEFDACBLKSIZE * outchans);
- else
- alsa_buf = (short *)calloc(sizeof(char) * alsa_samplewidth,
- DEFDACBLKSIZE * inchans);
- // fill the buffer with silence
- if (outchans)
- {
- i = nfrags + 1;
- while (i--)
- snd_pcm_writei(alsa_device.outhandle, alsa_buf, frag_size);
- }
-
// set up the status variables
err = snd_pcm_status_malloc(&in_status);
check_error(err, "snd_pcm_status_malloc");
err = snd_pcm_status_malloc(&out_status);
check_error(err, "snd_pcm_status_malloc");
- // start the device
-#if 1
+ // set up the buffer
+ if (alsa_buf)
+ free(alsa_buf);
+ alsa_buf = (short *)malloc(
+ sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE *
+ (outchans > inchans ? outchans : inchans));
+ memset(alsa_buf, 0, sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE *
+ (outchans > inchans ? outchans : inchans));
+ // fill the buffer with silence
if (outchans)
{
- err = snd_pcm_start(alsa_device.outhandle);
- check_error(err, "snd_pcm_start");
- }
- else if (inchans)
- {
- err = snd_pcm_start(alsa_device.inhandle);
- check_error(err, "snd_pcm_start");
+ i = (frag_size * nfrags)/DEFDACBLKSIZE + 1;
+ while (i--)
+ snd_pcm_writei(alsa_device.outhandle, alsa_buf, DEFDACBLKSIZE);
+ /* apparently we're not suppposed to start it in this case,
+ but can (and must) if there's only ADC open (below). */
+ /* if ((err = snd_pcm_start(alsa_device.outhandle) < 0))
+ check_error(err, "output start failed\n"); */
}
-#endif
+ else if (snd_pcm_start(alsa_device.inhandle) < 0)
+ check_error(err, "input start failed\n");
+
+ alsa_outchannels = outchans;
+ alsa_inchannels = inchans;
return 0;
}
@@ -445,8 +439,10 @@ int alsa_send_dacs(void)
int i, j, k, err, devno = 0;
int inputcount = 0, outputcount = 0, inputlate = 0, outputlate = 0;
int result;
- int inchannels = sys_inchannels;
- int outchannels = sys_outchannels;
+ int inchannels = (sys_inchannels > alsa_inchannels ?
+ alsa_inchannels : sys_inchannels);
+ int outchannels = (sys_outchannels > alsa_outchannels ?
+ alsa_outchannels : sys_outchannels);
unsigned int intransfersize = DEFDACBLKSIZE;
unsigned int outtransfersize = DEFDACBLKSIZE;
@@ -467,13 +463,15 @@ int alsa_send_dacs(void)
callno++;
- if (inchannels)
+ alsa_checkiosync(); /* check I/O are in sync and data not late */
+
+ if (alsa_inchannels)
{
snd_pcm_status(alsa_device.inhandle, in_status);
if (snd_pcm_status_get_avail(in_status) < intransfersize)
return SENDDACS_NO;
}
- if (outchannels)
+ if (alsa_outchannels)
{
snd_pcm_status(alsa_device.outhandle, out_status);
if (snd_pcm_status_get_avail(out_status) < outtransfersize)
@@ -481,7 +479,7 @@ int alsa_send_dacs(void)
}
/* do output */
- if (outchannels)
+ if (alsa_outchannels)
{
fp = sys_soundout;
if (alsa_samplewidth == 4)
@@ -489,7 +487,7 @@ int alsa_send_dacs(void)
for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DEFDACBLKSIZE)
{
for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
+ j += alsa_outchannels, fp2++)
{
float s1 = *fp2 * INT32_MAX;
((t_alsa_sample32 *)alsa_buf)[j] = CLIP32(s1);
@@ -501,7 +499,7 @@ int alsa_send_dacs(void)
for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DEFDACBLKSIZE)
{
for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
+ j += alsa_outchannels, fp2++)
{
int s = *fp2 * 32767.;
if (s > 32767)
@@ -547,7 +545,7 @@ int alsa_send_dacs(void)
}
}
/* do input */
- if (sys_inchannels)
+ if (alsa_inchannels)
{
result = snd_pcm_readi(alsa_device.inhandle, alsa_buf, intransfersize);
if (result < (int)intransfersize)
@@ -575,7 +573,7 @@ int alsa_send_dacs(void)
for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DEFDACBLKSIZE)
{
for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--;
- j += inchannels, fp2++)
+ j += alsa_inchannels, fp2++)
*fp2 = (float) ((t_alsa_sample32 *)alsa_buf)[j]
* (1./ INT32_MAX);
}
@@ -584,8 +582,8 @@ int alsa_send_dacs(void)
{
for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DEFDACBLKSIZE)
{
- for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--; j += inchannels,
- fp2++)
+ for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--;
+ j += alsa_inchannels, fp2++)
*fp2 = (float) ((t_alsa_sample16 *)alsa_buf)[j]
* 3.051850e-05;
}
@@ -603,6 +601,35 @@ int alsa_send_dacs(void)
return SENDDACS_YES;
}
+void alsa_printstate( void)
+{
+ int i, result;
+ snd_pcm_sframes_t indelay, outdelay;
+ if (sys_audioapi != API_ALSA)
+ {
+ error("restart-audio: implemented for ALSA only.");
+ return;
+ }
+ if (sys_inchannels)
+ {
+ result = snd_pcm_delay(alsa_device.inhandle, &indelay);
+ if (result < 0)
+ post("snd_pcm_delay 1 failed");
+ else post("in delay %d", indelay);
+ }
+ if (sys_outchannels)
+ {
+ result = snd_pcm_delay(alsa_device.outhandle, &outdelay);
+ if (result < 0)
+ post("snd_pcm_delay 2 failed");
+ else post("out delay %d", outdelay);
+ }
+ post("sum %d (%d mod 64)\n", indelay + outdelay, (indelay+outdelay)%64);
+
+ post("buf samples %d", alsa_buf_samps);
+}
+
+
void alsa_resync( void)
{
int i, result;
@@ -623,8 +650,131 @@ void alsa_resync( void)
post("%d written", i);
}
+void alsa_putzeros(int n)
+{
+ int i, result;
+ memset(alsa_buf, 0,
+ sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE * alsa_outchannels);
+ for (i = 0; i < n; i++)
+ {
+ result = snd_pcm_writei(alsa_device.outhandle, alsa_buf, DEFDACBLKSIZE);
+#if 0
+ if (result != DEFDACBLKSIZE)
+ post("result %d", result);
+#endif
+ }
+}
+
+void alsa_getzeros(int n)
+{
+ int i, result;
+ for (i = 0; i < n; i++)
+ {
+ result = snd_pcm_readi(alsa_device.inhandle, alsa_buf, DEFDACBLKSIZE);
+#if 0
+ if (result != DEFDACBLKSIZE)
+ post("result %d", result);
+#endif
+ }
+}
+
+ /* call this only if both input and output are open */
+static void alsa_checkiosync( void)
+{
+ int i, result, checkit = 1, giveup = 1000, alreadylogged = 0;
+ snd_pcm_sframes_t indelay, outdelay, defect;
+
+ if (!(alsa_outchannels && alsa_inchannels))
+ return;
+ while (checkit)
+ {
+ checkit = 0;
+ if (giveup-- <= 0)
+ return;
+ result = snd_pcm_delay(alsa_device.outhandle, &outdelay);
+ if (result < 0)
+ {
+ post("output snd_pcm_delay failed: %s", snd_strerror(result));
+ if (snd_pcm_status(alsa_device.outhandle, out_status) < 0)
+ post("output snd_pcm_status failed");
+ else post("astate %d",
+ snd_pcm_status_get_state(out_status));
+ return;
+ }
+ if (outdelay < 0)
+ sys_log_error(ERR_DATALATE), alreadylogged = 1;
+
+ if (sys_inchannels)
+ {
+ result = snd_pcm_delay(alsa_device.inhandle, &indelay);
+ if (result < 0)
+ {
+ post("input snd_pcm_delay failed");
+ return;
+ }
+ defect = indelay + outdelay - alsa_buf_samps;
+ if (defect < -DEFDACBLKSIZE)
+ {
+ checkit = 1;
+ alsa_putzeros(1);
+ if (!alreadylogged)
+ sys_log_error(ERR_RESYNC), alreadylogged = 1;
+ }
+ else if (defect > 0)
+ {
+ checkit = 1;
+ alsa_getzeros(1);
+ if (!alreadylogged)
+ sys_log_error(ERR_RESYNC), alreadylogged = 1;
+ }
+ }
+ }
+}
+
void alsa_listdevs( void)
{
post("device listing not implemented in ALSA yet\n");
}
+ /* For each hardware card found, we list two devices, the "hard" and
+ "plug" one. The card scan is derived from portaudio code. */
+void alsa_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize)
+{
+ int ndev = 0, cardno = -1;
+ *canmulti = 0; /* only one device; must be the same for input&output */
+ while (!snd_card_next(&cardno) && cardno >= 0)
+ {
+ snd_ctl_t *ctl;
+ snd_ctl_card_info_t *info;
+ char devname[80];
+ const char *desc;
+ if (2 * ndev + 2 > maxndev)
+ break;
+ /* apparently, "cardno" is just a counter; but check that here */
+ if (ndev != cardno)
+ fprintf(stderr, "oops: ALSA cards not reported in order?\n");
+ sprintf(devname, "hw:%d", cardno );
+ /* fprintf(stderr, "\ntry %s...\n", devname); */
+ if (snd_ctl_open(&ctl, devname, 0) >= 0)
+ {
+ snd_ctl_card_info_malloc(&info);
+ snd_ctl_card_info(ctl, info);
+ desc = snd_ctl_card_info_get_name(info);
+ snd_ctl_card_info_free(info);
+ }
+ else
+ {
+ fprintf(stderr, "ALSA card scan error\n");
+ desc = "???";
+ }
+ /* fprintf(stderr, "name: %s\n", snd_ctl_card_info_get_name(info)); */
+ sprintf(indevlist + 2*ndev * devdescsize, "%s (hardware)", desc);
+ sprintf(indevlist + (2*ndev + 1) * devdescsize, "%s (plug-in)", desc);
+ sprintf(outdevlist + 2*ndev * devdescsize, "%s (hardware)", desc);
+ sprintf(outdevlist + (2*ndev + 1) * devdescsize, "%s (plug-in)", desc);
+ ndev++;
+ }
+ *nindevs = *noutdevs = 2 * ndev;
+}
diff --git a/pd/src/s_audio_jack.c b/pd/src/s_audio_jack.c
new file mode 100644
index 00000000..6f9937db
--- /dev/null
+++ b/pd/src/s_audio_jack.c
@@ -0,0 +1,350 @@
+
+
+/* ----------------------- Experimental routines for jack -------------- */
+#ifdef USEAPI_JACK
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <m_pd.h>
+#include <s_stuff.h>
+#include <jack/jack.h>
+#include <regex.h>
+
+
+#define MAX_CLIENTS 100
+#define NUM_JACK_PORTS 32
+#define BUF_JACK 4096
+static jack_nframes_t jack_out_max;
+#define JACK_OUT_MAX 64
+static jack_nframes_t jack_filled = 0;
+static float jack_outbuf[NUM_JACK_PORTS*BUF_JACK];
+static float jack_inbuf[NUM_JACK_PORTS*BUF_JACK];
+static int jack_started = 0;
+
+
+static jack_port_t *input_port[NUM_JACK_PORTS];
+static jack_port_t *output_port[NUM_JACK_PORTS];
+static jack_client_t *jack_client;
+char *jack_client_names[MAX_CLIENTS];
+
+pthread_mutex_t jack_mutex;
+pthread_cond_t jack_sem;
+
+static int
+process (jack_nframes_t nframes, void *arg)
+{
+ int j;
+ float *out;
+ float *in;
+
+ if (nframes > JACK_OUT_MAX) jack_out_max = nframes;
+ else jack_out_max = JACK_OUT_MAX;
+
+ if (jack_filled >= nframes) {
+ if (jack_filled != nframes) fprintf(stderr,"Partial read");
+
+ for (j = 0; j < sys_outchannels; j++) {
+ out = jack_port_get_buffer (output_port[j], nframes);
+ memcpy(out, jack_outbuf + (j * BUF_JACK), sizeof (float) * nframes);
+ }
+ for (j = 0; j < sys_inchannels; j++) {
+ in = jack_port_get_buffer( input_port[j], nframes);
+ memcpy(jack_inbuf + (j * BUF_JACK), in, sizeof (float) * nframes);
+ }
+ jack_filled -= nframes;
+ } else { /* PD could not keep up ! */
+ if (jack_started) sys_log_error(ERR_RESYNC);
+ for (j = 0; j < sys_outchannels; j++) {
+ out = jack_port_get_buffer (output_port[j], nframes);
+ memset(out, 0, sizeof (float) * nframes);
+ }
+ memset(jack_outbuf,0,sizeof(jack_outbuf));
+ jack_filled = 0;
+ }
+ pthread_cond_broadcast(&jack_sem);
+ return 0;
+}
+
+static int
+srate (jack_nframes_t srate, void *arg)
+{
+ printf ("jack: sample rate %ld/sec\n", srate);
+ sys_dacsr = srate;
+ return 0;
+}
+
+static void
+jack_shutdown (void *arg)
+{
+ /* Ignore for now */
+ // exit (1);
+}
+
+static int jack_xrun(void* arg) {
+ sys_log_error(ERR_DACSLEPT);
+ return 0;
+}
+
+
+static char** jack_get_clients(void)
+{
+ const char **jack_ports;
+ int i,j;
+ int num_clients = 0;
+ regex_t port_regex;
+ jack_ports = jack_get_ports( jack_client, "", "", 0 );
+ regcomp( &port_regex, "^[^:]*", REG_EXTENDED );
+
+ jack_client_names[0] = NULL;
+
+ /* Build a list of clients from the list of ports */
+ for( i = 0; jack_ports[i] != NULL; i++ )
+ {
+ int client_seen;
+ regmatch_t match_info;
+ char tmp_client_name[100];
+
+ /* extract the client name from the port name, using a regex
+ * that parses the clientname:portname syntax */
+ regexec( &port_regex, jack_ports[i], 1, &match_info, 0 );
+ memcpy( tmp_client_name, &jack_ports[i][match_info.rm_so],
+ match_info.rm_eo - match_info.rm_so );
+ tmp_client_name[ match_info.rm_eo - match_info.rm_so ] = '\0';
+
+ /* do we know about this port's client yet? */
+ client_seen = 0;
+
+ for( j = 0; j < num_clients; j++ )
+ if( strcmp( tmp_client_name, jack_client_names[j] ) == 0 )
+ client_seen = 1;
+
+ if( client_seen == 0 )
+ {
+ jack_client_names[num_clients] = (char*)getbytes(strlen(tmp_client_name) + 1);
+
+ /* The alsa_pcm client should go in spot 0. If this
+ * is the alsa_pcm client AND we are NOT about to put
+ * it in spot 0 put it in spot 0 and move whatever
+ * was already in spot 0 to the end. */
+
+ if( strcmp( "alsa_pcm", tmp_client_name ) == 0 && num_clients > 0 )
+ {
+ char* tmp;
+ /* alsa_pcm goes in spot 0 */
+ tmp = jack_client_names[ num_clients ];
+ jack_client_names[ num_clients ] = jack_client_names[0];
+ jack_client_names[0] = tmp;
+ strcpy( jack_client_names[0], tmp_client_name);
+ }
+ else
+ {
+ /* put the new client at the end of the client list */
+ strcpy( jack_client_names[ num_clients ], tmp_client_name );
+ }
+ num_clients++;
+
+ }
+ }
+
+ /* for (i=0;i<num_clients;i++) post("client: %s",jack_client_names[i]); */
+
+ free( jack_ports );
+ return jack_client_names;
+}
+
+/*
+ * Wire up all the ports of one client.
+ *
+ */
+
+static int jack_connect_ports(char* client)
+{
+ char regex_pattern[100]; /* its always the same, ... */
+ int i;
+ const char **jack_ports;
+
+ if (strlen(client) > 96) return -1;
+
+ sprintf( regex_pattern, "%s:.*", client );
+
+ jack_ports = jack_get_ports( jack_client, regex_pattern,
+ NULL, JackPortIsOutput);
+ if (jack_ports)
+ for (i=0;jack_ports[i] != NULL && i < sys_inchannels;i++)
+ if (jack_connect (jack_client, jack_ports[i], jack_port_name (input_port[i])))
+ fprintf (stderr, "cannot connect input ports %s -> %s\n", jack_ports[i],jack_port_name (input_port[i]));
+
+
+
+ jack_ports = jack_get_ports( jack_client, regex_pattern,
+ NULL, JackPortIsInput);
+ if (jack_ports)
+ for (i=0;jack_ports[i] != NULL && i < sys_outchannels;i++)
+ if (jack_connect (jack_client, jack_port_name (output_port[i]), jack_ports[i]))
+ fprintf (stderr, "cannot connect output ports %s -> %s\n", jack_port_name (output_port[i]),jack_ports[i]);
+
+
+
+ free(jack_ports);
+ return 0;
+}
+
+
+void jack_error(const char *desc) {
+ return;
+}
+
+
+int
+jack_open_audio(int inchans, int outchans, int rate)
+
+{
+ int j;
+ char port_name[80] = "";
+ int samplerate;
+ int client_iterator = 0;
+
+ if ((inchans == 0) && (outchans == 0)) return 0;
+
+ post("Testing for Jack");
+ if (outchans > NUM_JACK_PORTS) {
+ fprintf(stderr,"%d output ports not supported, setting to %d\n",outchans, NUM_JACK_PORTS);
+ outchans = NUM_JACK_PORTS;
+ }
+
+ if (inchans > NUM_JACK_PORTS) {
+ fprintf(stderr,"%d input ports not supported, setting to %d\n",inchans, NUM_JACK_PORTS);
+ inchans = NUM_JACK_PORTS;
+ }
+
+ /* try to become a client of the JACK server (we allow two pd's)*/
+
+ do {
+ sprintf(port_name,"pure_data_%d",client_iterator);
+ client_iterator++;
+ }
+ while (((jack_client = jack_client_new (port_name)) == 0) && client_iterator < 2);
+
+ if (!jack_client) { // jack spits out enough messages already, do not warn
+ return 1;
+ }
+
+ jack_get_clients();
+
+ /* tell the JACK server to call `process()' whenever
+ there is work to be done.
+ */
+
+ jack_set_process_callback (jack_client, process, 0);
+
+ jack_set_error_function (jack_error);
+
+#ifdef JACK_XRUN
+ jack_set_xrun_callback (jack_client, jack_xrun, NULL);
+#endif
+
+ /* tell the JACK server to call `srate()' whenever
+ the sample rate of the system changes.
+ */
+
+ jack_set_sample_rate_callback (jack_client, srate, 0);
+
+
+ /* tell the JACK server to call `jack_shutdown()' if
+ it ever shuts down, either entirely, or if it
+ just decides to stop calling us.
+ */
+
+ jack_on_shutdown (jack_client, jack_shutdown, 0);
+
+
+ /* display the current sample rate. once the client is activated
+ (see below), you should rely on your own sample rate
+ callback (see above) for this value.
+ */
+
+ samplerate = jack_get_sample_rate (jack_client);
+
+ /* create the ports */
+
+ for (j = 0; j < inchans; j++) {
+ sprintf(port_name, "input%d", j);
+ input_port[j] = jack_port_register (jack_client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
+ }
+ for (j = 0; j < outchans; j++) {
+ sprintf(port_name, "output%d", j);
+ output_port[j] = jack_port_register (jack_client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+ }
+
+ /* tell the JACK server that we are ready to roll */
+
+ if (jack_activate (jack_client)) {
+ fprintf (stderr, "cannot activate client");
+ return 1;
+ }
+
+ memset(jack_outbuf,0,sizeof(jack_outbuf));
+
+ if (jack_client_names[0])
+ jack_connect_ports(jack_client_names[0]);
+
+ pthread_mutex_init(&jack_mutex,NULL);
+ pthread_cond_init(&jack_sem,NULL);
+
+ post("using JACK audio interface");
+ return 0;
+}
+
+void jack_close_audio(void)
+
+{
+ jack_started = 0;
+ /* ignore for now */
+}
+
+int jack_send_dacs(void)
+
+{
+ float * fp;
+ int j;
+ int rtnval = SENDDACS_YES;
+ int timenow;
+ int timeref = sys_getrealtime();
+
+ if (!jack_client) return SENDDACS_NO;
+
+ if (!sys_inchannels && !sys_outchannels) return (SENDDACS_NO);
+
+ if (jack_filled >= jack_out_max)
+ pthread_cond_wait(&jack_sem,&jack_mutex);
+
+ jack_started = 1;
+
+ fp = sys_soundout;
+ for (j = 0; j < sys_outchannels; j++) {
+ memcpy(jack_outbuf + (j * BUF_JACK) + jack_filled,fp, DEFDACBLKSIZE*sizeof(float));
+ fp += DEFDACBLKSIZE;
+ }
+ fp = sys_soundin;
+ for (j = 0; j < sys_inchannels; j++) {
+ memcpy(fp, jack_inbuf + (j * BUF_JACK) + jack_filled, DEFDACBLKSIZE*sizeof(float));
+ fp += DEFDACBLKSIZE;
+ }
+
+ if ((timenow = sys_getrealtime()) - timeref > 0.002)
+ {
+ rtnval = SENDDACS_SLEPT;
+ }
+
+ memset(sys_soundout,0,DEFDACBLKSIZE*sizeof(float)*sys_outchannels);
+ jack_filled += DEFDACBLKSIZE;
+ return rtnval;
+}
+
+void jack_listdevs( void)
+{
+ post("device listing not implemented for jack yet\n");
+}
+
+#endif /* JACK */
diff --git a/pd/src/s_audio_mmio.c b/pd/src/s_audio_mmio.c
index d0657be4..9c088574 100644
--- a/pd/src/s_audio_mmio.c
+++ b/pd/src/s_audio_mmio.c
@@ -26,7 +26,8 @@ static void postflags(void);
#define DEFAULTSRATE 44100
#define SAMPSIZE 2
-#define REALDACBLKSIZE (4 * DEFDACBLKSIZE) /* larger underlying bufsize */
+int nt_realdacblksize;
+#define DEFREALDACBLKSIZE (4 * DEFDACBLKSIZE) /* larger underlying bufsize */
#define MAXBUFFER 100 /* number of buffers in use at maximum advance */
#define DEFBUFFER 30 /* default is about 30x6 = 180 msec! */
@@ -83,7 +84,7 @@ static void wave_prep(t_sbuf *bp)
if (!(bp->hData =
GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE,
- (DWORD) (CHANNELS_PER_DEVICE * REALDACBLKSIZE * SAMPSIZE))))
+ (DWORD) (CHANNELS_PER_DEVICE * SAMPSIZE * nt_realdacblksize))))
printf("alloc 1 failed\n");
if (!(bp->lpData =
@@ -100,12 +101,12 @@ static void wave_prep(t_sbuf *bp)
(WAVEHDR *) GlobalLock(bp->hWaveHdr)))
printf("lock 2 failed\n");
- for (i = CHANNELS_PER_DEVICE * REALDACBLKSIZE,
+ for (i = CHANNELS_PER_DEVICE * nt_realdacblksize,
sp = (short *)bp->lpData; i--; )
*sp++ = 0;
wh->lpData = bp->lpData;
- wh->dwBufferLength = (CHANNELS_PER_DEVICE * REALDACBLKSIZE * SAMPSIZE);
+ wh->dwBufferLength = (CHANNELS_PER_DEVICE * SAMPSIZE * nt_realdacblksize);
wh->dwFlags = 0;
wh->dwLoops = 0L;
wh->lpNext = 0;
@@ -273,7 +274,7 @@ static void nt_midisync(void)
if (initsystime == -1) nt_resetmidisync();
jittersec = (nt_dacjitterbufsallowed > nt_adcjitterbufsallowed ?
nt_dacjitterbufsallowed : nt_adcjitterbufsallowed)
- * REALDACBLKSIZE / sys_getsr();
+ * nt_realdacblksize / sys_getsr();
diff = sys_getrealtime() - 0.001 * clock_gettimesince(initsystime);
if (diff > nt_hibuftime) nt_hibuftime = diff;
if (diff < nt_hibuftime - jittersec)
@@ -436,7 +437,7 @@ static void nt_resyncaudio(void)
outwavehdr, sizeof(WAVEHDR));
outwavehdr->dwFlags = 0L;
memset((char *)(ntsnd_outvec[nda][phase].lpData),
- 0, (CHANNELS_PER_DEVICE * REALDACBLKSIZE * SAMPSIZE));
+ 0, (CHANNELS_PER_DEVICE * SAMPSIZE * nt_realdacblksize));
waveOutPrepareHeader(ntsnd_outdev[nda], outwavehdr,
sizeof(WAVEHDR));
mmresult = waveOutWrite(ntsnd_outdev[nda], outwavehdr,
@@ -598,7 +599,7 @@ int mmio_send_dacs(void)
}
nt_fill = nt_fill + DEFDACBLKSIZE;
- if (nt_fill == REALDACBLKSIZE)
+ if (nt_fill == nt_realdacblksize)
{
nt_fill = 0;
@@ -692,11 +693,12 @@ void mmio_open_audio(int naudioindev, int *audioindev,
{
int nbuf;
- nbuf = sys_advance_samples/REALDACBLKSIZE;
+ nt_realdacblksize = (sys_blocksize ? sys_blocksize : DEFREALDACBLKSIZE);
+ nbuf = sys_advance_samples/nt_realdacblksize;
if (nbuf >= MAXBUFFER)
{
fprintf(stderr, "pd: audio buffering maxed out to %d\n",
- (int)(MAXBUFFER * ((REALDACBLKSIZE * 1000.)/44100.)));
+ (int)(MAXBUFFER * ((nt_realdacblksize * 1000.)/44100.)));
nbuf = MAXBUFFER;
}
else if (nbuf < 4) nbuf = 4;
@@ -710,13 +712,9 @@ void mmio_open_audio(int naudioindev, int *audioindev,
nt_nwavein = sys_inchannels / 2;
nt_nwaveout = sys_outchannels / 2;
nt_whichadc = (naudioindev < 1 ?
- (nt_nwavein > 1 ? WAVE_MAPPER : -1) :
- (audioindev[0] == DEFAULTAUDIODEV ? WAVE_MAPPER :
- audioindev[0] - 1));
+ (nt_nwavein > 1 ? WAVE_MAPPER : -1) : audioindev[0]);
nt_whichdac = (naudiooutdev < 1 ?
- (nt_nwaveout > 1 ? WAVE_MAPPER : -1) :
- (audiooutdev[0] == DEFAULTAUDIODEV ? WAVE_MAPPER :
- audiooutdev[0] - 1));
+ (nt_nwaveout > 1 ? WAVE_MAPPER : -1) : audiooutdev[0]);
if (naudiooutdev > 1 || naudioindev > 1)
post("separate audio device choice not supported; using sequential devices.");
mmio_do_open_audio();
@@ -727,7 +725,7 @@ void mmio_reportidle(void)
{
}
-
+#if 0
/* list the audio and MIDI device names */
void mmio_listdevs(void)
{
@@ -756,3 +754,34 @@ void mmio_listdevs(void)
"audio output device #%d: %s\n", i+1, wocap.szPname);
}
}
+#endif
+
+void mmio_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize)
+{
+ int wRtn, ndev, i;
+
+ *canmulti = 2; /* supports multiple devices */
+ ndev = waveInGetNumDevs();
+ if (ndev > maxndev)
+ ndev = maxndev;
+ *nindevs = ndev;
+ for (i = 0; i < ndev; i++)
+ {
+ WAVEINCAPS wicap;
+ wRtn = waveInGetDevCaps(i, (LPWAVEINCAPS) &wicap, sizeof(wicap));
+ sprintf(indevlist + i * devdescsize, (wRtn ? "???" : wicap.szPname));
+ }
+
+ ndev = waveOutGetNumDevs();
+ if (ndev > maxndev)
+ ndev = maxndev;
+ *noutdevs = ndev;
+ for (i = 0; i < ndev; i++)
+ {
+ WAVEOUTCAPS wocap;
+ wRtn = waveOutGetDevCaps(i, (LPWAVEOUTCAPS) &wocap, sizeof(wocap));
+ sprintf(outdevlist + i * devdescsize, (wRtn ? "???" : wocap.szPname));
+ }
+}
diff --git a/pd/src/s_audio_oss.c b/pd/src/s_audio_oss.c
index 382e6a75..b612b458 100644
--- a/pd/src/s_audio_oss.c
+++ b/pd/src/s_audio_oss.c
@@ -78,25 +78,37 @@ static char ossdsp[] = "/dev/dsp%d";
#define FMAX 0x7ffff000
#define CLIP32(x) (((x)>FMAX)?FMAX:((x) < -FMAX)?-FMAX:(x))
+/* ---------------- public routines ----------------------- */
-/* ------------- private routines for all APIS ------------------- */
+static int oss_ndev = 0;
-static void linux_flush_all_underflows_to_zero(void)
+ /* find out how many OSS devices we have. Since this has to
+ open the devices to find out if they're there, we have
+ to be called before audio is actually started up. So we
+ cache the results, which in effect are the number of available
+ devices. */
+void oss_init(void)
{
-/*
- TODO: Implement similar thing for linux (GGeiger)
-
- One day we will figure this out, I hope, because it
- costs CPU time dearly on Intel - LT
- */
- /* union fpc_csr f;
- f.fc_word = get_fpc_csr();
- f.fc_struct.flush = 1;
- set_fpc_csr(f.fc_word);
- */
+ int fd, i;
+ static int countedthem = 0;
+ if (countedthem)
+ return;
+ for (i = 0; i < 10; i++)
+ {
+ char devname[100];
+ if (i == 0)
+ strcpy(devname, "/dev/dsp");
+ else sprintf(devname, "/dev/dsp%d", i);
+ if ( (fd = open(devname, O_WRONLY|O_NONBLOCK)) != -1)
+ {
+ oss_ndev++;
+ close(fd);
+ }
+ else break;
+ }
+ countedthem = 1;
}
-
void oss_set32bit( void)
{
oss_32bit = 1;
@@ -172,11 +184,12 @@ void oss_configure(t_oss_dev *dev, int srate, int dac, int skipblocksize)
{
int fragbytes, logfragsize, nfragment;
/* setting fragment count and size. */
+ linux_fragsize = sys_blocksize;
if (!linux_fragsize)
{
linux_fragsize = OSS_DEFFRAGSIZE;
while (linux_fragsize > DEFDACBLKSIZE
- && linux_fragsize * 4 > sys_advance_samples)
+ && linux_fragsize * 6 > sys_advance_samples)
linux_fragsize = linux_fragsize/2;
}
/* post("adv_samples %d", sys_advance_samples); */
@@ -239,14 +252,14 @@ static int oss_setchannels(int fd, int wantchannels, char *devname)
{ /* IOhannes */
int param = wantchannels;
- while (param>1) {
- int save = param;
- if (ioctl(fd, SNDCTL_DSP_CHANNELS, &param) == -1) {
- error("OSS: SNDCTL_DSP_CHANNELS failed %s",devname);
- } else {
- if (param == save) return (param);
- }
- param=save-1;
+ while (param > 1)
+ {
+ int save = param;
+ if (ioctl(fd, SNDCTL_DSP_CHANNELS, &param) == -1)
+ error("OSS: SNDCTL_DSP_CHANNELS failed %s",devname);
+ else if (param == save)
+ return (param);
+ param = save - 1;
}
return (0);
@@ -268,11 +281,9 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
audio_buf_info ainfo;
linux_nindevs = linux_noutdevs = 0;
-
-
- /* mark input devices unopened */
+ /* mark devices unopened */
for (i = 0; i < OSS_MAXDEV; i++)
- linux_adcs[i].d_fd = -1;
+ linux_adcs[i].d_fd = linux_dacs[i].d_fd = -1;
/* open output devices */
wantmore=0;
@@ -282,16 +293,15 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
for (n = 0; n < noutdev; n++)
{
int gotchans, j, inindex = -1;
- int thisdevice = (outdev[n] >= 0 ? outdev[n] : n-1);
+ int thisdevice = (outdev[n] >= 0 ? outdev[n] : 0);
int wantchannels = (nchout>n) ? chout[n] : wantmore;
fd = -1;
if (!wantchannels)
goto end_out_loop;
- if (thisdevice > 1)
- sprintf(devname, "/dev/dsp%d", thisdevice-1);
+ if (thisdevice > 0)
+ sprintf(devname, "/dev/dsp%d", thisdevice);
else sprintf(devname, "/dev/dsp");
-
/* search for input request for same device. Succeed only
if the number of channels matches. */
for (j = 0; j < nindev; j++)
@@ -369,14 +379,14 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
for (n = 0; n < nindev; n++)
{
int gotchans=0;
- int thisdevice = (indev[n] >= 0 ? indev[n] : n-1);
+ int thisdevice = (indev[n] >= 0 ? indev[n] : 0);
int wantchannels = (nchin>n)?chin[n]:wantmore;
int alreadyopened = 0;
if (!wantchannels)
goto end_in_loop;
- if (thisdevice > 1)
- sprintf(devname, "/dev/dsp%d", thisdevice - 1);
+ if (thisdevice > 0)
+ sprintf(devname, "/dev/dsp%d", thisdevice);
else sprintf(devname, "/dev/dsp");
sys_setalarm(1000000);
@@ -399,12 +409,13 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
post("opened %s for reading only\n", devname);
}
linux_adcs[linux_nindevs].d_fd = fd;
+
gotchans = oss_setchannels(fd,
(wantchannels>OSS_MAXCHPERDEV)?OSS_MAXCHPERDEV:wantchannels,
devname);
if (sys_verbose)
- post("opened audio input device %s; got %d channels",
- devname, gotchans);
+ post("opened audio input device %s; got %d channels",
+ devname, gotchans);
if (gotchans < 1)
{
@@ -442,6 +453,17 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
if (sys_verbose)
fprintf(stderr, "...done.\n");
}
+ /* now go and fill all the output buffers. */
+ for (i = 0; i < linux_noutdevs; i++)
+ {
+ int j;
+ memset(buf, 0, linux_dacs[i].d_bytespersamp *
+ linux_dacs[i].d_nchannels * DEFDACBLKSIZE);
+ for (j = 0; j < sys_advance_samples/DEFDACBLKSIZE; j++)
+ write(linux_dacs[i].d_fd, buf,
+ linux_dacs[i].d_bytespersamp *
+ linux_dacs[i].d_nchannels * DEFDACBLKSIZE);
+ }
sys_setalarm(0);
return (0);
}
@@ -765,8 +787,18 @@ int oss_send_dacs(void)
return (rtnval);
}
-void oss_listdevs( void)
+void oss_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize)
{
- post("device listing not implemented in OSS yet\n");
+ int i, ndev;
+ *canmulti = 2; /* supports multiple devices */
+ if ((ndev = oss_ndev) > maxndev)
+ ndev = maxndev;
+ for (i = 0; i < ndev; i++)
+ {
+ sprintf(indevlist + i * devdescsize, "OSS device #%d", i+1);
+ sprintf(outdevlist + i * devdescsize, "OSS device #%d", i+1);
+ }
+ *nindevs = *noutdevs = ndev;
}
-
diff --git a/pd/src/s_audio_pa.c b/pd/src/s_audio_pa.c
index 253b33cd..85f6252e 100644
--- a/pd/src/s_audio_pa.c
+++ b/pd/src/s_audio_pa.c
@@ -14,7 +14,10 @@
#include "portaudio.h"
#include "pablio_pd.h"
-#ifdef MACOSX
+ /* LATER try to figure out how to handle default devices in portaudio;
+ the way s_audio.c handles them isn't going to work here. */
+
+#if defined(MACOSX) || defined(MSW)
#define Pa_GetDefaultInputDevice Pa_GetDefaultInputDeviceID
#define Pa_GetDefaultOutputDevice Pa_GetDefaultOutputDeviceID
#endif
@@ -35,7 +38,8 @@ int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin,
{
PaError err;
static int initialized;
-
+ int j, devno, pa_indev = 0, pa_outdev = 0;
+
if (!initialized)
{
/* Initialize PortAudio */
@@ -53,9 +57,6 @@ int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin,
/* post("in %d out %d rate %d device %d", inchans, outchans, rate, deviceno); */
if (inchans != 0 && outchans != 0 && inchans != outchans)
error("portaudio: number of input and output channels must match");
- if (sys_verbose)
- post("portaudio: opening for %d channels in, %d out",
- inchans, outchans);
if (inchans > MAX_PA_CHANS)
{
post("input channels reduced to maximum %d", MAX_PA_CHANS);
@@ -66,25 +67,59 @@ int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin,
post("output channels reduced to maximum %d", MAX_PA_CHANS);
outchans = MAX_PA_CHANS;
}
- if (indeviceno < 0)
- indeviceno = Pa_GetDefaultInputDevice();
- if (outdeviceno < 0)
- outdeviceno = Pa_GetDefaultOutputDevice();
-
- fprintf(stderr, "input device %d, output device %d\n",
- indeviceno, outdeviceno);
+
+ if (inchans > 0)
+ {
+ for (j = 0, devno = 0; j < Pa_CountDevices(); j++)
+ {
+ const PaDeviceInfo *info = Pa_GetDeviceInfo(j);
+ if (info->maxInputChannels > 0)
+ {
+ if (devno == indeviceno)
+ {
+ pa_indev = j;
+ break;
+ }
+ devno++;
+ }
+ }
+ }
+
+ if (outchans > 0)
+ {
+ for (j = 0, devno = 0; j < Pa_CountDevices(); j++)
+ {
+ const PaDeviceInfo *info = Pa_GetDeviceInfo(j);
+ if (info->maxOutputChannels > 0)
+ {
+ if (devno == outdeviceno)
+ {
+ pa_outdev = j;
+ break;
+ }
+ devno++;
+ }
+ }
+ }
+
+ if (sys_verbose)
+ {
+ post("input device %d, channels %d", pa_indev, inchans);
+ post("output device %d, channels %d", pa_outdev, outchans);
+ post("framesperbuf %d, nbufs %d", framesperbuf, nbuffers);
+ }
if (inchans && outchans)
err = OpenAudioStream( &pa_stream, rate, paFloat32,
PABLIO_READ_WRITE, inchans, framesperbuf, nbuffers,
- indeviceno, outdeviceno);
+ pa_indev, pa_outdev);
else if (inchans)
err = OpenAudioStream( &pa_stream, rate, paFloat32,
PABLIO_READ, inchans, framesperbuf, nbuffers,
- indeviceno, outdeviceno);
+ pa_indev, pa_outdev);
else if (outchans)
err = OpenAudioStream( &pa_stream, rate, paFloat32,
PABLIO_WRITE, outchans, framesperbuf, nbuffers,
- indeviceno, outdeviceno);
+ pa_indev, pa_outdev);
else err = 0;
if ( err != paNoError )
{
@@ -117,9 +152,36 @@ int pa_send_dacs(void)
double timebefore;
timebefore = sys_getrealtime();
+ if ((pa_inchans && GetAudioStreamReadable(pa_stream) < DEFDACBLKSIZE) ||
+ (pa_outchans && GetAudioStreamWriteable(pa_stream) < DEFDACBLKSIZE))
+ {
+ if (pa_inchans && pa_outchans)
+ {
+ int synced = 0;
+ while (GetAudioStreamWriteable(pa_stream) > 2*DEFDACBLKSIZE)
+ {
+ for (j = 0; j < pa_outchans; j++)
+ for (i = 0, fp2 = samples + j; i < DEFDACBLKSIZE; i++,
+ fp2 += pa_outchans)
+ {
+ *fp2 = 0;
+ }
+ synced = 1;
+ WriteAudioStream(pa_stream, samples, DEFDACBLKSIZE);
+ }
+ while (GetAudioStreamReadable(pa_stream) > 2*DEFDACBLKSIZE)
+ {
+ synced = 1;
+ ReadAudioStream(pa_stream, samples, DEFDACBLKSIZE);
+ }
+ /* if (synced)
+ post("sync"); */
+ }
+ return (SENDDACS_NO);
+ }
if (pa_inchans)
{
- ReadAudioStream(pa_stream, samples, DEFDACBLKSIZE);
+ ReadAudioStream(pa_stream, samples, DEFDACBLKSIZE);
for (j = 0, fp1 = pa_soundin; j < pa_inchans; j++, fp1 += DEFDACBLKSIZE)
for (i = 0, fp2 = samples + j; i < DEFDACBLKSIZE; i++,
fp2 += pa_inchans)
@@ -127,6 +189,18 @@ int pa_send_dacs(void)
fp1[i] = *fp2;
}
}
+#if 0
+ {
+ static int nread;
+ if (nread == 0)
+ {
+ post("it's %f %f %f %f",
+ pa_soundin[0], pa_soundin[1], pa_soundin[2], pa_soundin[3]);
+ nread = 1000;
+ }
+ nread--;
+ }
+#endif
if (pa_outchans)
{
for (j = 0, fp1 = pa_soundout; j < pa_outchans; j++,
@@ -141,7 +215,10 @@ int pa_send_dacs(void)
}
if (sys_getrealtime() > timebefore + 0.002)
+ {
+ /* post("slept"); */
return (SENDDACS_SLEPT);
+ }
else return (SENDDACS_YES);
}
@@ -184,3 +261,31 @@ error:
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
}
+
+ /* scanning for devices */
+void pa_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize)
+{
+ int i, nin = 0, nout = 0, ndev;
+ *canmulti = 1; /* one dev each for input and output */
+
+ Pa_Initialize();
+ ndev = Pa_CountDevices();
+ for (i = 0; i < ndev; i++)
+ {
+ const PaDeviceInfo *pdi = Pa_GetDeviceInfo(i);
+ if (pdi->maxInputChannels > 0 && nin < maxndev)
+ {
+ strcpy(indevlist + nin * devdescsize, pdi->name);
+ nin++;
+ }
+ if (pdi->maxOutputChannels > 0 && nout < maxndev)
+ {
+ strcpy(outdevlist + nout * devdescsize, pdi->name);
+ nout++;
+ }
+ }
+ *nindevs = nin;
+ *noutdevs = nout;
+}
diff --git a/pd/src/s_freebsd.c b/pd/src/s_freebsd.c
deleted file mode 100644
index 4ed4241b..00000000
--- a/pd/src/s_freebsd.c
+++ /dev/null
@@ -1,3072 +0,0 @@
-/* Copyright (c) 1997-1999 Guenter Geiger, Miller Puckette, Larry Troxler,
-* Winfried Ritsch, Karl MacMillan, and others.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-/* this file implements the sys_ functions profiled in m_imp.h for
- audio and MIDI I/O. In Linux there might be several APIs for doing the
- audio part; right now there are three (OSS, ALSA, RME); the third is
- for the RME 9652 driver by Ritsch (but not for the OSS compatible
- one by Geiger; for that one, OSS should work.)
-
- FUNCTION PREFIXES.
- sys_ -- functions which must be exported to Pd on all platforms
- linux_ -- linux-specific objects which don't depend on API,
- mostly static but some exported.
- oss_, alsa_, rme_ -- API-specific functions, all of which are
- static.
-
- ALSA SUPPORT. If ALSA99 is defined we support ALSA 0.5x; if ALSA01,
- ALSA 0.9x. (the naming scheme reflects the possibility of further API
- changes in the future...) We define "ALSA" for code relevant to both
- APIs.
-
- For MIDI, we only offer the OSS API; ALSA has to emulate OSS for us.
-*/
-
-/* OSS include (whether we're doing OSS audio or not we need this for MIDI) */
-
-
-/* IOhannes:::
- * hacked this to add advanced multidevice-support
- * 1311:forum::für::umläute:2001
- */
-
-#include <sys/soundcard.h>
-
-#if (defined(ALSA01) || defined(ALSA99))
-#define ALSA
-#endif
-
-#ifdef ALSA99
-#include <sys/asoundlib.h>
-#endif
-#ifdef ALSA01
-#include <alsa/asoundlib.h>
-#endif
-
-#include "m_imp.h"
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <sys/mman.h>
-
-/* local function prototypes */
-
-static void linux_close_midi( void);
-
-static int oss_open_audio(int naudioindev, int *audioindev, int nchindev,
- int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
- int *choutdev, int rate); /* IOhannes */
-
-static void oss_close_audio(void);
-static int oss_send_dacs(void);
-static void oss_reportidle(void);
-
-#ifdef ALSA
-typedef int16_t t_alsa_sample16;
-typedef int32_t t_alsa_sample32;
-#define ALSA_SAMPLEWIDTH_16 sizeof(t_alsa_sample16)
-#define ALSA_SAMPLEWIDTH_32 sizeof(t_alsa_sample32)
-#define ALSA_XFERSIZE16 (signed int)(sizeof(t_alsa_sample16) * DACBLKSIZE)
-#define ALSA_XFERSIZE32 (signed int)(sizeof(t_alsa_sample32) * DACBLKSIZE)
-#define ALSA_MAXDEV 1
-#define ALSA_JITTER 1024
-#define ALSA_EXTRABUFFER 2048
-#define ALSA_DEFFRAGSIZE 64
-#define ALSA_DEFNFRAG 12
-
-#ifdef ALSA99
-typedef struct _alsa_dev
-{
- snd_pcm_t *handle;
- snd_pcm_channel_info_t info;
- snd_pcm_channel_setup_t setup;
-} t_alsa_dev;
-
-t_alsa_dev alsa_device[ALSA_MAXDEV];
-static int n_alsa_dev;
-static char *alsa_buf;
-static int alsa_samplewidth;
-#endif /* ALSA99 */
-
-#ifdef ALSA01
-typedef struct _alsa_dev
-{
- snd_pcm_t *inhandle;
- snd_pcm_t *outhandle;
-} t_alsa_dev;
-
-t_alsa_dev alsa_device;
-static short *alsa_buf;
-static int alsa_samplewidth;
-static snd_pcm_status_t* in_status;
-static snd_pcm_status_t* out_status;
-#endif /* ALSA01 */
-
-#if 0 /* early alsa 0.9 beta dists had different names for these: */
-#define SND_PCM_ACCESS_RW_INTERLEAVED SNDRV_PCM_ACCESS_RW_INTERLEAVED
-#define SND_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32
-#define SND_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16
-#define SND_PCM_SUBFORMAT_STD SNDRV_PCM_SUBFORMAT_STD
-#endif
-
-static int alsa_mode;
-static int alsa_open_audio(int inchans, int outchans, int rate);
-static void alsa_close_audio(void);
-static int alsa_send_dacs(void);
-static void alsa_set_params(t_alsa_dev *dev, int dir, int rate, int voices);
-static void alsa_reportidle(void);
-#endif /* ALSA */
-
-#ifdef RME_HAMMERFALL
-static int rme9652_open_audio(int inchans, int outchans, int rate);
-static void rme9652_close_audio(void);
-static int rme9652_send_dacs(void);
-static void rme9652_reportidle(void);
-#endif /* RME_HAMMERFALL */
-
-/* Defines */
-#define DEBUG(x) x
-#define DEBUG2(x) {x;}
-
-#define OSS_MAXCHPERDEV 32 /* max channels per OSS device */
-#define OSS_MAXDEV 4 /* maximum number of input or output devices */
-#define OSS_DEFFRAGSIZE 256 /* default log fragment size (frames) */
-#define OSS_DEFAUDIOBUF 40000 /* default audiobuffer, microseconds */
-#define OSS_DEFAULTCH 2
-#define RME_DEFAULTCH 8 /* need this even if RME undefined */
-typedef int16_t t_oss_int16;
-typedef int32_t t_oss_int32;
-#define OSS_MAXSAMPLEWIDTH sizeof(t_oss_int32)
-#define OSS_BYTESPERCHAN(width) (DACBLKSIZE * (width))
-#define OSS_XFERSAMPS(chans) (DACBLKSIZE* (chans))
-#define OSS_XFERSIZE(chans, width) (DACBLKSIZE * (chans) * (width))
-
-#ifdef RME_HAMMERFALL
-typedef int32_t t_rme_sample;
-#define RME_SAMPLEWIDTH sizeof(t_rme_sample)
-#define RME_BYTESPERCHAN (DACBLKSIZE * RME_SAMPLEWIDTH)
-#endif /* RME_HAMMERFALL */
-
-/* GLOBALS */
-static int linux_whichapi = API_OSS;
-static int linux_inchannels;
-static int linux_outchannels;
-static int linux_advance_samples; /* scheduler advance in samples */
-static int linux_meters; /* true if we're metering */
-static float linux_inmax; /* max input amplitude */
-static float linux_outmax; /* max output amplitude */
-static int linux_fragsize = 0; /* for block mode; block size (sample frames) */
-static int linux_nfragment = 0; /* ... and number of blocks. */
-
-#ifdef ALSA99
-static int alsa_devno = 1;
-#endif
-#ifdef ALSA01
-static char alsa_devname[512] = "hw:0,0";
-static int alsa_use_plugin = 0;
-#endif
-
-/* our device handles */
-
-typedef struct _oss_dev
-{
- int d_fd;
- unsigned int d_space; /* bytes available for writing/reading */
- int d_bufsize; /* total buffer size in blocks for this device */
- int d_dropcount; /* # of buffers to drop for resync (output only) */
- unsigned int d_nchannels; /* number of channels for this device */
- unsigned int d_bytespersamp; /* bytes per sample (2 for 16 bit, 4 for 32) */
-} t_oss_dev;
-
-static t_oss_dev linux_dacs[OSS_MAXDEV];
-static t_oss_dev linux_adcs[OSS_MAXDEV];
-static int linux_noutdevs = 0;
-static int linux_nindevs = 0;
-
- /* exported variables */
-int sys_schedadvance = OSS_DEFAUDIOBUF; /* scheduler advance in microsecs */
-float sys_dacsr;
-int sys_hipriority = 0;
-t_sample *sys_soundout;
-t_sample *sys_soundin;
-
- /* OSS-specific private variables */
-static int oss_blockmode = 1; /* flag to use "blockmode" */
-static char ossdsp[] = "/dev/dsp%d";
-
-#ifndef INT32_MAX
-#define INT32_MAX 0x7fffffff
-#endif
-#define CLIP32(x) (((x)>INT32_MAX)?INT32_MAX:((x) < -INT32_MAX)?-INT32_MAX:(x))
-
-
-/* ------------- private routines for all APIS ------------------- */
-
-static void linux_flush_all_underflows_to_zero(void)
-{
-/*
- TODO: Implement similar thing for linux (GGeiger)
-
- One day we will figure this out, I hope, because it
- costs CPU time dearly on Intel - LT
- */
- /* union fpc_csr f;
- f.fc_word = get_fpc_csr();
- f.fc_struct.flush = 1;
- set_fpc_csr(f.fc_word);
- */
-}
-
- /* set sample rate and channels. Must set sample rate before "configuring"
- any devices so we know scheduler advance in samples. */
-
-static void linux_setsr(int sr)
-{
- sys_dacsr = sr;
- linux_advance_samples = (sys_schedadvance * sys_dacsr) / (1000000.);
- if (linux_advance_samples < 3 * DACBLKSIZE)
- linux_advance_samples = 3 * DACBLKSIZE;
-}
-
-static void linux_setch(int chin, int chout)
-{
- int nblk;
- int inbytes = chin * (DACBLKSIZE*sizeof(float));
- int outbytes = chout * (DACBLKSIZE*sizeof(float));
-
- linux_inchannels = chin;
- linux_outchannels = chout;
- if (sys_soundin)
- free(sys_soundin);
- sys_soundin = (t_float *)malloc(inbytes);
- memset(sys_soundin, 0, inbytes);
-
- if (sys_soundout)
- free(sys_soundout);
- sys_soundout = (t_float *)malloc(outbytes);
- memset(sys_soundout, 0, outbytes);
-
- if (sys_verbose)
- post("input channels = %d, output channels = %d",
- linux_inchannels, linux_outchannels);
-}
-
-/* ---------------- MIDI routines -------------------------- */
-
-static int oss_nmidiin;
-static int oss_midiinfd[MAXMIDIINDEV];
-static int oss_nmidiout;
-static int oss_midioutfd[MAXMIDIOUTDEV];
-
-static void oss_midiout(int fd, int n)
-{
- char b = n;
- if ((write(fd, (char *) &b, 1)) != 1)
- perror("midi write");
-}
-
-#define O_MIDIFLAG O_NDELAY
-
-void linux_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
-{
- int i;
- for (i = 0; i < nmidiout; i++)
- oss_midioutfd[i] = -1;
- for (i = 0, oss_nmidiin = 0; i < nmidiin; i++)
- {
- int fd = -1, j, outdevindex = -1;
- char namebuf[80];
- int devno = midiinvec[i];
-
- for (j = 0; j < nmidiout; j++)
- if (midioutvec[j] == midiinvec[i])
- outdevindex = j;
-
- /* try to open the device for read/write. */
- if (devno == 1 && fd < 0 && outdevindex >= 0)
- {
- sys_setalarm(1000000);
- fd = open("/dev/midi", O_RDWR | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr,
- "device 1: tried /dev/midi READ/WRITE; returned %d\n", fd);
- if (outdevindex >= 0 && fd >= 0)
- oss_midioutfd[outdevindex] = fd;
- }
- if (fd < 0 && outdevindex >= 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%2.2d", devno-1);
- fd = open(namebuf, O_RDWR | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr,
- "device %d: tried %s READ/WRITE; returned %d\n",
- devno, namebuf, fd);
- if (outdevindex >= 0 && fd >= 0)
- oss_midioutfd[outdevindex] = fd;
- }
- if (fd < 0 && outdevindex >= 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%d", devno-1);
- fd = open(namebuf, O_RDWR | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s READ/WRITE; returned %d\n",
- devno, namebuf, fd);
- if (outdevindex >= 0 && fd >= 0)
- oss_midioutfd[outdevindex] = fd;
- }
- if (devno == 1 && fd < 0)
- {
- sys_setalarm(1000000);
- fd = open("/dev/midi", O_RDONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr,
- "device 1: tried /dev/midi READONLY; returned %d\n", fd);
- }
- if (fd < 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%2.2d", devno-1);
- fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s READONLY; returned %d\n",
- devno, namebuf, fd);
- }
- if (fd < 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%d", devno-1);
- fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s READONLY; returned %d\n",
- devno, namebuf, fd);
- }
- if (fd >= 0)
- oss_midiinfd[oss_nmidiin++] = fd;
- else post("couldn't open MIDI input device %d", devno);
- }
- for (i = 0, oss_nmidiout = 0; i < nmidiout; i++)
- {
- int fd = oss_midioutfd[i];
- char namebuf[80];
- int devno = midioutvec[i];
- if (devno == 1 && fd < 0)
- {
- sys_setalarm(1000000);
- fd = open("/dev/midi", O_WRONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr,
- "device 1: tried /dev/midi WRITEONLY; returned %d\n", fd);
- }
- if (fd < 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%2.2d", devno-1);
- fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n",
- devno, namebuf, fd);
- }
- if (fd < 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%d", devno-1);
- fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n",
- devno, namebuf, fd);
- }
- if (fd >= 0)
- oss_midioutfd[oss_nmidiout++] = fd;
- else post("couldn't open MIDI output device %d", devno);
- }
-
- if (oss_nmidiin < nmidiin || oss_nmidiout < nmidiout || sys_verbose)
- post("opened %d MIDI input device(s) and %d MIDI output device(s).",
- oss_nmidiin, oss_nmidiout);
-}
-
-#define md_msglen(x) (((x)<0xC0)?2:((x)<0xE0)?1:((x)<0xF0)?2:\
- ((x)==0xF2)?2:((x)<0xF4)?1:0)
-
-void sys_putmidimess(int portno, int a, int b, int c)
-{
- if (portno >= 0 && portno < oss_nmidiout)
- {
- switch (md_msglen(a))
- {
- case 2:
- oss_midiout(oss_midioutfd[portno],a);
- oss_midiout(oss_midioutfd[portno],b);
- oss_midiout(oss_midioutfd[portno],c);
- return;
- case 1:
- oss_midiout(oss_midioutfd[portno],a);
- oss_midiout(oss_midioutfd[portno],b);
- return;
- case 0:
- oss_midiout(oss_midioutfd[portno],a);
- return;
- };
- }
-}
-
-void sys_putmidibyte(int portno, int byte)
-{
- if (portno >= 0 && portno < oss_nmidiout)
- oss_midiout(oss_midioutfd[portno], byte);
-}
-
-#if 0 /* this is the "select" version which doesn't work with OSS
- driver for emu10k1 (it doesn't implement select.) */
-void sys_poll_midi(void)
-{
- int i, throttle = 100;
- struct timeval timout;
- int did = 1, maxfd = 0;
- while (did)
- {
- fd_set readset, writeset, exceptset;
- did = 0;
- if (throttle-- < 0)
- break;
- timout.tv_sec = 0;
- timout.tv_usec = 0;
-
- FD_ZERO(&writeset);
- FD_ZERO(&readset);
- FD_ZERO(&exceptset);
- for (i = 0; i < oss_nmidiin; i++)
- {
- if (oss_midiinfd[i] > maxfd)
- maxfd = oss_midiinfd[i];
- FD_SET(oss_midiinfd[i], &readset);
- }
- select(maxfd+1, &readset, &writeset, &exceptset, &timout);
- for (i = 0; i < oss_nmidiin; i++)
- if (FD_ISSET(oss_midiinfd[i], &readset))
- {
- char c;
- int ret = read(oss_midiinfd[i], &c, 1);
- if (ret <= 0)
- fprintf(stderr, "Midi read error\n");
- else sys_midibytein(i, (c & 0xff));
- did = 1;
- }
- }
-}
-#else
-
- /* this version uses the asynchronous "read()" ... */
-void sys_poll_midi(void)
-{
- int i, throttle = 100;
- struct timeval timout;
- int did = 1, maxfd = 0;
- while (did)
- {
- fd_set readset, writeset, exceptset;
- did = 0;
- if (throttle-- < 0)
- break;
- for (i = 0; i < oss_nmidiin; i++)
- {
- char c;
- int ret = read(oss_midiinfd[i], &c, 1);
- if (ret < 0)
- {
- if (errno != EAGAIN)
- perror("MIDI");
- }
- else if (ret != 0)
- {
- sys_midibytein(i, (c & 0xff));
- did = 1;
- }
- }
- }
-}
-#endif
-
-void linux_close_midi()
-{
- int i;
- for (i = 0; i < oss_nmidiin; i++)
- close(oss_midiinfd[i]);
- for (i = 0; i < oss_nmidiout; i++)
- close(oss_midioutfd[i]);
- oss_nmidiin = oss_nmidiout = 0;
-}
-
-#define MAXAUDIODEV 4
-#define DEFAULTINDEV 1
-#define DEFAULTOUTDEV 1
-
-/* ----------------------- public routines ----------------------- */
-void sys_listdevs( void)
-{
- post("device listing not implemented in Linux yet\n");
-}
-
-void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
- int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
- int *choutdev, int rate)
-{ /* IOhannes */
- int i, *ip;
- int defaultchannels =
- (linux_whichapi == API_RME ? RME_DEFAULTCH : OSS_DEFAULTCH);
- if (rate < 1)
- rate=44100;
-
- if (naudioindev == -1)
- { /* not set */
- if (nchindev==-1)
- {
- nchindev=1;
- chindev[0]=defaultchannels;
- naudioindev=1;
- audioindev[0] = DEFAULTINDEV;
- }
- else
- {
- for (i = 0; i < MAXAUDIODEV; i++)
- audioindev[i]=i+1;
- naudioindev = nchindev;
- }
- }
- else
- {
- if (nchindev == -1)
- {
- nchindev = naudioindev;
- for (i = 0; i < naudioindev; i++)
- chindev[i] = defaultchannels;
- }
- else if (nchindev > naudioindev)
- {
- for (i = naudioindev; i < nchindev; i++)
- {
- if (i == 0)
- audioindev[0] = DEFAULTINDEV;
- else audioindev[i] = audioindev[i-1] + 1;
- }
- naudioindev = nchindev;
- }
- else if (nchindev < naudioindev)
- {
- for (i = nchindev; i < naudioindev; i++)
- {
- if (i == 0)
- chindev[0] = defaultchannels;
- else chindev[i] = chindev[i-1];
- }
- naudioindev = nchindev;
- }
- }
-
- if (naudiooutdev == -1)
- { /* not set */
- if (nchoutdev==-1)
- {
- nchoutdev=1;
- choutdev[0]=defaultchannels;
- naudiooutdev=1;
- audiooutdev[0] = DEFAULTOUTDEV;
- }
- else
- {
- for (i = 0; i < MAXAUDIODEV; i++)
- audiooutdev[i] = i+1;
- naudiooutdev = nchoutdev;
- }
- }
- else
- {
- if (nchoutdev == -1)
- {
- nchoutdev = naudiooutdev;
- for (i = 0; i < naudiooutdev; i++)
- choutdev[i] = defaultchannels;
- }
- else if (nchoutdev > naudiooutdev)
- {
- for (i = naudiooutdev; i < nchoutdev; i++)
- {
- if (i == 0)
- audiooutdev[0] = DEFAULTOUTDEV;
- else audiooutdev[i] = audiooutdev[i-1] + 1;
- }
- naudiooutdev = nchoutdev;
- }
- else if (nchoutdev < naudiooutdev)
- {
- for (i = nchoutdev; i < naudiooutdev; i++)
- {
- if (i == 0)
- choutdev[0] = defaultchannels;
- else choutdev[i] = choutdev[i-1];
- }
- naudiooutdev = nchoutdev;
- }
- }
-
- linux_flush_all_underflows_to_zero();
-#ifdef ALSA
- if (linux_whichapi == API_ALSA)
- alsa_open_audio((naudioindev > 0 ? chindev[0] : 0),
- (naudiooutdev > 0 ? choutdev[0] : 0), rate);
- else
-#endif
-#ifdef RME_HAMMERFALL
- if (linux_whichapi == API_RME)
- rme9652_open_audio((naudioindev > 0 ? chindev[0] : 0),
- (naudiooutdev > 0 ? choutdev[0] : 0), rate);
- else
-#endif
- oss_open_audio(naudioindev, audioindev, nchindev, chindev,
- naudiooutdev, audiooutdev, nchoutdev, choutdev, rate);
-}
-
-void sys_close_audio(void)
-{
- /* set timeout to avoid hanging close() call */
-
- sys_setalarm(1000000);
-
-#ifdef ALSA
- if (linux_whichapi == API_ALSA)
- alsa_close_audio();
- else
-#endif
-#ifdef RME_HAMMERFALL
- if (linux_whichapi == API_RME)
- rme9652_close_audio();
- else
-#endif
- oss_close_audio();
-
- sys_setalarm(0);
-}
-
-void sys_open_midi(int nmidiin, int *midiinvec,
- int nmidiout, int *midioutvec)
-{
- linux_open_midi(nmidiin, midiinvec, nmidiout, midioutvec);
-}
-
-void sys_close_midi( void)
-{
- sys_setalarm(1000000);
- linux_close_midi();
- sys_setalarm(0);
-}
-
-int sys_send_dacs(void)
-{
- if (linux_meters)
- {
- int i, n;
- float maxsamp;
- for (i = 0, n = linux_inchannels * DACBLKSIZE, maxsamp = linux_inmax;
- i < n; i++)
- {
- float f = sys_soundin[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- linux_inmax = maxsamp;
- for (i = 0, n = linux_outchannels * DACBLKSIZE, maxsamp = linux_outmax;
- i < n; i++)
- {
- float f = sys_soundout[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- linux_outmax = maxsamp;
- }
-#ifdef ALSA
- if (linux_whichapi == API_ALSA)
- return alsa_send_dacs();
-#endif
-#ifdef RME_HAMMERFALL
- if (linux_whichapi == API_RME)
- return rme9652_send_dacs();
-#endif
- return oss_send_dacs();
-}
-
-float sys_getsr(void)
-{
- return (sys_dacsr);
-}
-
-int sys_get_outchannels(void)
-{
- return (linux_outchannels);
-}
-
-int sys_get_inchannels(void)
-{
- return (linux_inchannels);
-}
-
-void sys_audiobuf(int n)
-{
- /* set the size, in milliseconds, of the audio FIFO */
- if (n < 5) n = 5;
- else if (n > 5000) n = 5000;
- sys_schedadvance = n * 1000;
-}
-
-void sys_getmeters(float *inmax, float *outmax)
-{
- if (inmax)
- {
- linux_meters = 1;
- *inmax = linux_inmax;
- *outmax = linux_outmax;
- }
- else
- linux_meters = 0;
- linux_inmax = linux_outmax = 0;
-}
-
-void sys_reportidle(void)
-{
-}
-
-void sys_set_priority(int higher)
-{
- struct sched_param par;
- int p1 ,p2, p3;
-#ifdef _POSIX_PRIORITY_SCHEDULING
-
- p1 = sched_get_priority_min(SCHED_FIFO);
- p2 = sched_get_priority_max(SCHED_FIFO);
- p3 = (higher ? p2 - 1 : p2 - 3);
- par.sched_priority = p3;
-
- if (sched_setscheduler(0,SCHED_FIFO,&par) != -1)
- fprintf(stderr, "priority %d scheduling enabled.\n", p3);
-#endif
-
-#ifdef _POSIX_MEMLOCK
- if (mlockall(MCL_FUTURE) != -1)
- fprintf(stderr, "memory locking enabled.\n");
-#endif
-}
-
-/* ------------ linux-specific command-line flags -------------- */
-
-void linux_setfrags(int n)
-{
- linux_nfragment = n;
- oss_blockmode = 1;
-}
-
-void linux_setfragsize(int n)
-{
- if (n < 1)
- n = 1;
- linux_fragsize = n;
- oss_blockmode = 1;
-}
-
-void linux_streammode( void)
-{
- oss_blockmode = 0;
-}
-
-void linux_set_sound_api(int which)
-{
- linux_whichapi = which;
- if (sys_verbose)
- post("linux_whichapi %d", linux_whichapi);
-}
-
-#ifdef ALSA99
-void linux_alsa_devno(int devno)
-{
- alsa_devno = devno;
-}
-
-#endif
-
-#ifdef ALSA01
-void linux_alsa_devname(char *devname)
-{
- strncpy(alsa_devname, devname, 511);
-}
-
-void linux_alsa_use_plugin(int t)
-{
- if (t == 1)
- alsa_use_plugin = 1;
- else
- alsa_use_plugin = 0;
-}
-
-#endif
-
-/* -------------- Audio I/O using the OSS API ------------------ */
-
-typedef struct _multidev {
- int fd;
- int channels;
- int format;
-} t_multidev;
-
-int oss_reset(int fd) {
- int err;
- if ((err = ioctl(fd,SNDCTL_DSP_RESET)) < 0)
- error("OSS: Could not reset");
- return err;
-}
-
- /* The AFMT_S32_BLOCKED format is not defined in standard linux kernels
- but is proposed by Guenter Geiger to support extending OSS to handle
- 32 bit sample. This is user in Geiger's OSS driver for RME Hammerfall.
- I'm not clear why this isn't called AFMT_S32_[SLN]E... */
-
-#ifndef AFMT_S32_BLOCKED
-#define AFMT_S32_BLOCKED 0x0000400
-#endif
-
-void oss_configure(t_oss_dev *dev, int srate, int dac, int skipblocksize)
-{ /* IOhannes */
- int orig, param, nblk, fd = dev->d_fd, wantformat;
- int nchannels = dev->d_nchannels;
- int advwas = sys_schedadvance;
-
- audio_buf_info ainfo;
-
- /* IOhannes :
- * pd is very likely to crash if different formats are used on
- multiple soundcards
- */
-
- /* set resolution - first try 4 byte samples */
- if ((ioctl(fd,SNDCTL_DSP_GETFMTS,&param) >= 0) &&
- (param & AFMT_S32_BLOCKED))
- {
- wantformat = AFMT_S32_BLOCKED;
- dev->d_bytespersamp = 4;
- }
- else
- {
-/* FreeBSD's soundcard.h does not define AFMT_S16_NE */
- wantformat = AFMT_S16_BE;
- dev->d_bytespersamp = 2;
- }
- param = wantformat;
-
- if (sys_verbose)
- post("bytes per sample = %d", dev->d_bytespersamp);
- if (ioctl(fd, SNDCTL_DSP_SETFMT, &param) == -1)
- fprintf(stderr,"OSS: Could not set DSP format\n");
- else if (wantformat != param)
- fprintf(stderr,"OSS: DSP format: wanted %d, got %d\n",
- wantformat, param);
-
- /* sample rate */
- orig = param = srate;
- if (ioctl(fd, SNDCTL_DSP_SPEED, &param) == -1)
- fprintf(stderr,"OSS: Could not set sampling rate for device\n");
- else if( orig != param )
- fprintf(stderr,"OSS: sampling rate: wanted %d, got %d\n",
- orig, param );
-
- if (oss_blockmode && !skipblocksize)
- {
- int fragbytes, logfragsize, nfragment;
- /* setting fragment count and size. */
- if (linux_nfragment) /* if nfrags specified, take literally */
- {
- nfragment = linux_nfragment;
- if (!linux_fragsize)
- linux_fragsize = OSS_DEFFRAGSIZE;
- sys_schedadvance = ((nfragment * linux_fragsize) * 1.e6)
- / (float)srate;
- linux_setsr(srate);
- }
- else
- {
- if (!linux_fragsize)
- {
- linux_fragsize = OSS_DEFFRAGSIZE;
- while (linux_fragsize > DACBLKSIZE
- && linux_fragsize * 4 > linux_advance_samples)
- linux_fragsize = linux_fragsize/2;
- }
- /* post("adv_samples %d", linux_advance_samples); */
- nfragment = (sys_schedadvance * (44100. * 1.e-6)) / linux_fragsize;
- }
- fragbytes = linux_fragsize * (dev->d_bytespersamp * nchannels);
- logfragsize = ilog2(fragbytes);
-
- if (fragbytes != (1 << logfragsize))
- post("warning: OSS takes only power of 2 blocksize; using %d",
- (1 << logfragsize)/(dev->d_bytespersamp * nchannels));
- if (sys_verbose)
- post("setting nfrags = %d, fragsize %d\n", nfragment, fragbytes);
-
- param = orig = (nfragment<<16) + logfragsize;
- if (ioctl(fd,SNDCTL_DSP_SETFRAGMENT, &param) == -1)
- error("OSS: Could not set or read fragment size\n");
- if (param != orig)
- {
- nfragment = ((param >> 16) & 0xffff);
- logfragsize = (param & 0xffff);
- post("warning: actual fragments %d, blocksize %d",
- nfragment, (1 << logfragsize));
- }
- if (sys_verbose)
- post("audiobuffer set to %d msec", (int)(0.001 * sys_schedadvance));
- }
-
- if (dac)
- {
- /* use "free space" to learn the buffer size. Normally you
- should set this to your own desired value; but this seems not
- to be implemented uniformly across different sound cards. LATER
- we should figure out what to do if the requested scheduler advance
- is greater than this buffer size; for now, we just print something
- out. */
-
- int defect;
- if (ioctl(fd, SOUND_PCM_GETOSPACE,&ainfo) < 0)
- fprintf(stderr,"OSS: ioctl on output device failed");
- dev->d_bufsize = ainfo.bytes;
-
- defect = linux_advance_samples * (dev->d_bytespersamp * nchannels)
- - dev->d_bufsize - OSS_XFERSIZE(nchannels, dev->d_bytespersamp);
- if (defect > 0)
- {
- if (sys_verbose || defect > (dev->d_bufsize >> 2))
- fprintf(stderr,
- "OSS: requested audio buffer size %d limited to %d\n",
- linux_advance_samples * (dev->d_bytespersamp * nchannels),
- dev->d_bufsize);
- linux_advance_samples =
- (dev->d_bufsize - OSS_XFERSAMPS(nchannels)) /
- (dev->d_bytespersamp *nchannels);
- }
- }
-}
-
-static int oss_setchannels(int fd, int wantchannels, char *devname)
-{ /* IOhannes */
- int param = wantchannels;
-
- while (param>1) {
- int save = param;
- if (ioctl(fd, SNDCTL_DSP_CHANNELS, &param) == -1) {
- error("OSS: SNDCTL_DSP_CHANNELS failed %s",devname);
- } else {
- if (param == save) return (param);
- }
- param=save-1;
- }
-
- return (0);
-}
-
-int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
- int noutdev, int *outdev, int nchout, int *chout, int rate)
-{ /* IOhannes */
- int capabilities = 0;
- int inchannels = 0, outchannels = 0;
- char devname[20];
- int n, i, fd;
- char buf[OSS_MAXSAMPLEWIDTH * DACBLKSIZE * OSS_MAXCHPERDEV];
- int num_devs = 0;
- int wantmore=0;
- int spread = 0;
- audio_buf_info ainfo;
-
- linux_nindevs = linux_noutdevs = 0;
-
- /* set logical sample rate amd calculate linux_advance_samples. */
- linux_setsr(rate);
-
- /* mark input devices unopened */
- for (i = 0; i < OSS_MAXDEV; i++)
- linux_adcs[i].d_fd = -1;
-
- /* open output devices */
- wantmore=0;
- if (noutdev < 0 || nindev < 0)
- bug("linux_open_audio");
-
- for (n = 0; n < noutdev; n++)
- {
- int gotchans, j, inindex = -1;
- int thisdevice=outdev[n];
- int wantchannels = (nchout>n) ? chout[n] : wantmore;
- fd = -1;
- if (!wantchannels)
- goto end_out_loop;
-
- if (thisdevice > 1)
- sprintf(devname, "/dev/dsp%d", thisdevice-1);
- else sprintf(devname, "/dev/dsp");
-
- /* search for input request for same device. Succeed only
- if the number of channels matches. */
- for (j = 0; j < nindev; j++)
- if (indev[j] == thisdevice && chin[j] == wantchannels)
- inindex = j;
-
- /* if the same device is requested for input and output,
- try to open it read/write */
- if (inindex >= 0)
- {
- sys_setalarm(1000000);
- if ((fd = open(devname, O_RDWR)) == -1)
- {
- post("%s (read/write): %s", devname, strerror(errno));
- post("(now will try write-only...)");
- }
- else
- {
- if (sys_verbose)
- post("opened %s for reading and writing\n", devname);
- linux_adcs[inindex].d_fd = fd;
- }
- }
- /* if that didn't happen or if it failed, try write-only */
- if (fd == -1)
- {
- sys_setalarm(1000000);
- if ((fd = open(devname, O_WRONLY)) == -1)
- {
- post("%s (writeonly): %s",
- devname, strerror(errno));
- break;
- }
- if (sys_verbose)
- post("opened %s for writing only\n", devname);
- }
- if (ioctl(fd, SNDCTL_DSP_GETCAPS, &capabilities) == -1)
- error("OSS: SNDCTL_DSP_GETCAPS failed %s", devname);
-
- gotchans = oss_setchannels(fd,
- (wantchannels>OSS_MAXCHPERDEV)?OSS_MAXCHPERDEV:wantchannels,
- devname);
-
- if (sys_verbose)
- post("opened audio output on %s; got %d channels",
- devname, gotchans);
-
- if (gotchans < 2)
- {
- /* can't even do stereo? just give up. */
- close(fd);
- }
- else
- {
- linux_dacs[linux_noutdevs].d_nchannels = gotchans;
- linux_dacs[linux_noutdevs].d_fd = fd;
- oss_configure(linux_dacs+linux_noutdevs, rate, 1, 0);
-
- linux_noutdevs++;
- outchannels += gotchans;
- if (inindex >= 0)
- {
- linux_adcs[inindex].d_nchannels = gotchans;
- chin[inindex] = gotchans;
- }
- }
- /* LATER think about spreading large numbers of channels over
- various dsp's and vice-versa */
- wantmore = wantchannels - gotchans;
- end_out_loop: ;
- }
-
- /* open input devices */
- wantmore = 0;
- if (nindev==-1)
- nindev=4; /* spread channels over default-devices */
- for (n = 0; n < nindev; n++)
- {
- int gotchans=0;
- int thisdevice=indev[n];
- int wantchannels = (nchin>n)?chin[n]:wantmore;
- int alreadyopened = 0;
- if (!wantchannels)
- goto end_in_loop;
-
- if (thisdevice > 1)
- sprintf(devname, "/dev/dsp%d", thisdevice - 1);
- else sprintf(devname, "/dev/dsp");
-
- sys_setalarm(1000000);
-
- /* perhaps it's already open from the above? */
- if (linux_dacs[n].d_fd >= 0)
- {
- fd = linux_dacs[n].d_fd;
- alreadyopened = 1;
- }
- else
- {
- /* otherwise try to open it here. */
- if ((fd = open(devname, O_RDONLY)) == -1)
- {
- post("%s (readonly): %s", devname, strerror(errno));
- goto end_in_loop;
- }
- if (sys_verbose)
- post("opened %s for reading only\n", devname);
- }
- linux_adcs[linux_nindevs].d_fd = fd;
- gotchans = oss_setchannels(fd,
- (wantchannels>OSS_MAXCHPERDEV)?OSS_MAXCHPERDEV:wantchannels,
- devname);
- if (sys_verbose)
- post("opened audio input device %s; got %d channels",
- devname, gotchans);
-
- if (gotchans < 1)
- {
- close(fd);
- goto end_in_loop;
- }
-
- linux_adcs[linux_nindevs].d_nchannels = gotchans;
-
- oss_configure(linux_adcs+linux_nindevs, rate, 0, alreadyopened);
-
- inchannels += gotchans;
- linux_nindevs++;
-
- wantmore = wantchannels-gotchans;
- /* LATER think about spreading large numbers of channels over
- various dsp's and vice-versa */
- end_in_loop: ;
- }
-
- linux_setch(inchannels, outchannels);
-
- /* We have to do a read to start the engine. This is
- necessary because sys_send_dacs waits until the input
- buffer is filled and only reads on a filled buffer.
- This is good, because it's a way to make sure that we
- will not block. But I wonder why we only have to read
- from one of the devices and not all of them??? */
-
- if (linux_nindevs)
- {
- if (sys_verbose)
- fprintf(stderr,("OSS: issuing first ADC 'read' ... "));
- read(linux_adcs[0].d_fd, buf,
- linux_adcs[0].d_bytespersamp *
- linux_adcs[0].d_nchannels * DACBLKSIZE);
- if (sys_verbose)
- fprintf(stderr, "...done.\n");
- }
- sys_setalarm(0);
- return (0);
-}
-
-void oss_close_audio( void)
-{
- int i;
- for (i=0;i<linux_nindevs;i++)
- close(linux_adcs[i].d_fd);
-
- for (i=0;i<linux_noutdevs;i++)
- close(linux_dacs[i].d_fd);
-
- linux_nindevs = linux_noutdevs = 0;
-}
-
-static int linux_dacs_write(int fd,void* buf,long bytes)
-{
- return write(fd, buf, bytes);
-}
-
-static int linux_adcs_read(int fd,void* buf,long bytes)
-{
- return read(fd, buf, bytes);
-}
-
- /* query audio devices for "available" data size. */
-static void oss_calcspace(void)
-{
- int dev;
- audio_buf_info ainfo;
- for (dev=0; dev < linux_noutdevs; dev++)
- {
- if (ioctl(linux_dacs[dev].d_fd, SOUND_PCM_GETOSPACE, &ainfo) < 0)
- fprintf(stderr,"OSS: ioctl on output device %d failed",dev);
- linux_dacs[dev].d_space = ainfo.bytes;
- }
-
- for (dev = 0; dev < linux_nindevs; dev++)
- {
- if (ioctl(linux_adcs[dev].d_fd, SOUND_PCM_GETISPACE,&ainfo) < 0)
- fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed",
- dev, linux_adcs[dev].d_fd);
- linux_adcs[dev].d_space = ainfo.bytes;
- }
-}
-
-void linux_audiostatus(void)
-{
- int dev;
- if (!oss_blockmode)
- {
- oss_calcspace();
- for (dev=0; dev < linux_noutdevs; dev++)
- fprintf(stderr, "dac %d space %d\n", dev, linux_dacs[dev].d_space);
-
- for (dev = 0; dev < linux_nindevs; dev++)
- fprintf(stderr, "adc %d space %d\n", dev, linux_adcs[dev].d_space);
-
- }
-}
-
-/* this call resyncs audio output and input which will cause discontinuities
-in audio output and/or input. */
-
-static void oss_doresync( void)
-{
- int dev, zeroed = 0, wantsize;
- char buf[OSS_MAXSAMPLEWIDTH * DACBLKSIZE * OSS_MAXCHPERDEV];
- audio_buf_info ainfo;
-
- /* 1. if any input devices are ahead (have more than 1 buffer stored),
- drop one or more buffers worth */
- for (dev = 0; dev < linux_nindevs; dev++)
- {
- if (linux_adcs[dev].d_space == 0)
- {
- linux_adcs_read(linux_adcs[dev].d_fd, buf,
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp));
- }
- else while (linux_adcs[dev].d_space >
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp))
- {
- linux_adcs_read(linux_adcs[dev].d_fd, buf,
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp));
- if (ioctl(linux_adcs[dev].d_fd, SOUND_PCM_GETISPACE, &ainfo) < 0)
- {
- fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed",
- dev, linux_adcs[dev].d_fd);
- break;
- }
- linux_adcs[dev].d_space = ainfo.bytes;
- }
- }
-
- /* 2. if any output devices are behind, feed them zeros to catch them
- up */
- for (dev = 0; dev < linux_noutdevs; dev++)
- {
- while (linux_dacs[dev].d_space > linux_dacs[dev].d_bufsize -
- linux_advance_samples * (linux_dacs[dev].d_nchannels *
- linux_dacs[dev].d_bytespersamp))
- {
- if (!zeroed)
- {
- unsigned int i;
- for (i = 0; i < OSS_XFERSAMPS(linux_dacs[dev].d_nchannels);
- i++)
- buf[i] = 0;
- zeroed = 1;
- }
- linux_dacs_write(linux_dacs[dev].d_fd, buf,
- OSS_XFERSIZE(linux_dacs[dev].d_nchannels,
- linux_dacs[dev].d_bytespersamp));
- if (ioctl(linux_dacs[dev].d_fd, SOUND_PCM_GETOSPACE, &ainfo) < 0)
- {
- fprintf(stderr, "OSS: ioctl on output device %d, fd %d failed",
- dev, linux_dacs[dev].d_fd);
- break;
- }
- linux_dacs[dev].d_space = ainfo.bytes;
- }
- }
- /* 3. if any DAC devices are too far ahead, plan to drop the
- number of frames which will let the others catch up. */
- for (dev = 0; dev < linux_noutdevs; dev++)
- {
- if (linux_dacs[dev].d_space > linux_dacs[dev].d_bufsize -
- (linux_advance_samples - 1) * linux_dacs[dev].d_nchannels *
- linux_dacs[dev].d_bytespersamp)
- {
- linux_dacs[dev].d_dropcount = linux_advance_samples - 1 -
- (linux_dacs[dev].d_space - linux_dacs[dev].d_bufsize) /
- (linux_dacs[dev].d_nchannels *
- linux_dacs[dev].d_bytespersamp) ;
- }
- else linux_dacs[dev].d_dropcount = 0;
- }
-}
-
-int oss_send_dacs(void)
-{
- float *fp1, *fp2;
- long fill;
- int i, j, dev, rtnval = SENDDACS_YES;
- char buf[OSS_MAXSAMPLEWIDTH * DACBLKSIZE * OSS_MAXCHPERDEV];
- t_oss_int16 *sp;
- t_oss_int32 *lp;
- /* the maximum number of samples we should have in the ADC buffer */
- int idle = 0;
- int thischan;
- double timeref, timenow;
-
- if (!linux_nindevs && !linux_noutdevs)
- return (SENDDACS_NO);
-
- if (!oss_blockmode)
- {
- /* determine whether we're idle. This is true if either (1)
- some input device has less than one buffer to read or (2) some
- output device has fewer than (linux_advance_samples) blocks buffered
- already. */
- oss_calcspace();
-
- for (dev=0; dev < linux_noutdevs; dev++)
- if (linux_dacs[dev].d_dropcount ||
- (linux_dacs[dev].d_bufsize - linux_dacs[dev].d_space >
- linux_advance_samples * linux_dacs[dev].d_bytespersamp *
- linux_dacs[dev].d_nchannels))
- idle = 1;
- for (dev=0; dev < linux_nindevs; dev++)
- if (linux_adcs[dev].d_space <
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp))
- idle = 1;
- }
-
- if (idle && !oss_blockmode)
- {
- /* sometimes---rarely---when the ADC available-byte-count is
- zero, it's genuine, but usually it's because we're so
- late that the ADC has overrun its entire kernel buffer. We
- distinguish between the two by waiting 2 msec and asking again.
- There should be an error flag we could check instead; look for this
- someday... */
- for (dev = 0;dev < linux_nindevs; dev++)
- if (linux_adcs[dev].d_space == 0)
- {
- audio_buf_info ainfo;
- sys_microsleep(2000);
- oss_calcspace();
- if (linux_adcs[dev].d_space != 0) continue;
-
- /* here's the bad case. Give up and resync. */
- sys_log_error(ERR_DATALATE);
- oss_doresync();
- return (SENDDACS_NO);
- }
- /* check for slippage between devices, either because
- data got lost in the driver from a previous late condition, or
- because the devices aren't synced. When we're idle, no
- input device should have more than one buffer readable and
- no output device should have less than linux_advance_samples-1
- */
-
- for (dev=0; dev < linux_noutdevs; dev++)
- if (!linux_dacs[dev].d_dropcount &&
- (linux_dacs[dev].d_bufsize - linux_dacs[dev].d_space <
- (linux_advance_samples - 2) *
- (linux_dacs[dev].d_bytespersamp *
- linux_dacs[dev].d_nchannels)))
- goto badsync;
- for (dev=0; dev < linux_nindevs; dev++)
- if (linux_adcs[dev].d_space > 3 *
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp))
- goto badsync;
-
- /* return zero to tell the scheduler we're idle. */
- return (SENDDACS_NO);
- badsync:
- sys_log_error(ERR_RESYNC);
- oss_doresync();
- return (SENDDACS_NO);
-
- }
-
- /* do output */
-
- timeref = sys_getrealtime();
- for (dev=0, thischan = 0; dev < linux_noutdevs; dev++)
- {
- int nchannels = linux_dacs[dev].d_nchannels;
- if (linux_dacs[dev].d_dropcount)
- linux_dacs[dev].d_dropcount--;
- else
- {
- if (linux_dacs[dev].d_bytespersamp == 4)
- {
- for (i = DACBLKSIZE * nchannels, fp1 = sys_soundout +
- DACBLKSIZE*thischan,
- lp = (t_oss_int32 *)buf; i--; fp1++, lp++)
- {
- float f = *fp1 * 2147483648.;
- *lp = (f >= 2147483647. ? 2147483647. :
- (f < -2147483648. ? -2147483648. : f));
- }
- }
- else
- {
- for (i = DACBLKSIZE, fp1 = sys_soundout +
- DACBLKSIZE*thischan,
- sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels)
- {
- for (j=0, fp2 = fp1; j<nchannels; j++, fp2 += DACBLKSIZE)
- {
- int s = *fp2 * 32767.;
- if (s > 32767) s = 32767;
- else if (s < -32767) s = -32767;
- sp[j] = s;
- }
- }
- }
- linux_dacs_write(linux_dacs[dev].d_fd, buf,
- OSS_XFERSIZE(nchannels, linux_dacs[dev].d_bytespersamp));
- if ((timenow = sys_getrealtime()) - timeref > 0.002)
- {
- if (!oss_blockmode)
- sys_log_error(ERR_DACSLEPT);
- else rtnval = SENDDACS_SLEPT;
- }
- timeref = timenow;
- }
- thischan += nchannels;
- }
- memset(sys_soundout, 0,
- linux_outchannels * (sizeof(float) * DACBLKSIZE));
-
- /* do input */
-
- for (dev = 0, thischan = 0; dev < linux_nindevs; dev++)
- {
- int nchannels = linux_adcs[dev].d_nchannels;
- linux_adcs_read(linux_adcs[dev].d_fd, buf,
- OSS_XFERSIZE(nchannels, linux_adcs[dev].d_bytespersamp));
-
- if ((timenow = sys_getrealtime()) - timeref > 0.002)
- {
- if (!oss_blockmode)
- sys_log_error(ERR_ADCSLEPT);
- else
- rtnval = SENDDACS_SLEPT;
- }
- timeref = timenow;
-
- if (linux_adcs[dev].d_bytespersamp == 4)
- {
- for (i = DACBLKSIZE*nchannels,
- fp1 = sys_soundin + thischan*DACBLKSIZE,
- lp = (t_oss_int32 *)buf; i--; fp1++, lp++)
- {
- *fp1 = ((float)(*lp))*(float)(1./2147483648.);
- }
- }
- else
- {
- for (i = DACBLKSIZE,fp1 = sys_soundin + thischan*DACBLKSIZE,
- sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels)
- {
- for (j=0;j<linux_inchannels;j++)
- fp1[j*DACBLKSIZE] = (float)sp[j]*(float)3.051850e-05;
- }
- }
- thischan += nchannels;
- }
- if (thischan != linux_inchannels)
- bug("inchannels");
- return (rtnval);
-}
-
-/* ----------------- audio I/O using the ALSA native API ---------------- */
-
-#ifdef ALSA
-static void alsa_checkversion( void)
-{
- char snox[512];
- int fd, nbytes;
- if ((fd = open("/proc/asound/version", 0)) < 0 ||
- (nbytes = read(fd, snox, 511)) < 1)
- {
- perror("cannot check Alsa version -- /proc/asound/version");
- return;
- }
- snox[nbytes] = 0;
-#ifdef ALSA99
- if (!strstr(snox, "Version 0.5"))
- {
- fprintf(stderr,
-"warning: Pd compiled for Alsa version 0.5 appears to be incompatible with\n\
-the installed version of ALSA. Here is what I found in /proc/asound/version:\n"
- );
- fprintf(stderr, "%s", snox);
- }
-#else
- if (!strstr(snox, "Version 0.9"))
- {
- fprintf(stderr,
-"warning: Pd compiled for Alsa version 0.9 appears to be incompatible with\n\
-the installed version of ALSA. Here is what I found in /proc/asound/version:\n"
- );
- fprintf(stderr, "%s", snox);
- }
-#endif
-}
-#endif
-
-#ifdef ALSA99
-static int alsa_open_audio(int wantinchans, int wantoutchans,
- int srate)
-{
- int dir, voices, bsize;
- int err, id, rate, i;
- char *cardname;
- snd_ctl_hw_info_t hwinfo;
- snd_pcm_info_t pcminfo;
- snd_pcm_channel_info_t channelinfo;
- snd_ctl_t *handle;
- snd_pcm_sync_t sync;
-
- linux_inchannels = 0;
- linux_outchannels = 0;
-
- rate = 44100;
- alsa_samplewidth = 4; /* first try 4 byte samples */
-
- if (!wantinchans && !wantoutchans)
- return (1);
-
- alsa_checkversion();
- if (sys_verbose)
- {
- if ((err = snd_card_get_longname(alsa_devno-1, &cardname)) < 0)
- {
- fprintf(stderr, "PD-ALSA: unable to get name of card number %d\n",
- alsa_devno);
- return 1;
- }
- fprintf(stderr, "PD-ALSA: using card %s\n", cardname);
- free(cardname);
- }
-
- if ((err = snd_ctl_open(&handle, alsa_devno-1)) < 0)
- {
- fprintf(stderr, "PD-ALSA: unable to open control: %s\n",
- snd_strerror(err));
- return 1;
- }
-
- if ((err = snd_ctl_hw_info(handle, &hwinfo)) < 0)
- {
- fprintf(stderr, "PD-ALSA: unable to open get info: %s\n",
- snd_strerror(err));
- return 1;
- }
- if (hwinfo.pcmdevs < 1)
- {
- fprintf(stderr, "PD-ALSA: device %d doesn't support PCM\n",
- alsa_devno);
- snd_ctl_close(handle);
- return 1;
- }
-
- if ((err = snd_ctl_pcm_info(handle, 0, &pcminfo)) < 0)
- {
- fprintf(stderr, "PD-ALSA: unable to open get pcm info: %s\n",
- snd_strerror(err));
- snd_ctl_close(handle);
- return (1);
- }
- snd_ctl_close(handle);
-
- /* find out if opening for input, output, or both and check that the
- device can handle it. */
- if (wantinchans && wantoutchans)
- {
- if (!(pcminfo.flags & SND_PCM_INFO_DUPLEX))
- {
- fprintf(stderr, "PD-ALSA: device is not full duplex\n");
- return (1);
- }
- dir = SND_PCM_OPEN_DUPLEX;
- }
- else if (wantoutchans)
- {
- if (!(pcminfo.flags & SND_PCM_INFO_PLAYBACK))
- {
- fprintf(stderr, "PD-ALSA: device is not full duplex\n");
- return (1);
- }
- dir = SND_PCM_OPEN_PLAYBACK;
- }
- else
- {
- if (!(pcminfo.flags & SND_PCM_INFO_CAPTURE))
- {
- fprintf(stderr, "PD-ALSA: device is not full duplex\n");
- return (1);
- }
- dir = SND_PCM_OPEN_CAPTURE;
- }
-
- /* try to open the device */
- if ((err = snd_pcm_open(&alsa_device[0].handle, alsa_devno-1, 0, dir)) < 0)
- {
- fprintf(stderr, "PD-ALSA: error opening device: %s\n",
- snd_strerror(err));
- return (1);
- }
- /* get information from the handle */
- if (wantinchans)
- {
- channelinfo.channel = SND_PCM_CHANNEL_CAPTURE;
- channelinfo.subdevice = 0;
- if ((err = snd_pcm_channel_info(alsa_device[0].handle, &channelinfo))
- < 0)
- {
- fprintf(stderr, "PD-ALSA: snd_pcm_channel_info (input): %s\n",
- snd_strerror(err));
- return (1);
- }
- if (sys_verbose)
- post("input channels supported: %d-%d\n",
- channelinfo.min_voices, channelinfo.max_voices);
-
- if (wantinchans < channelinfo.min_voices)
- post("increasing input channels to minimum of %d\n",
- wantinchans = channelinfo.min_voices);
- if (wantinchans > channelinfo.max_voices)
- post("decreasing input channels to maximum of %d\n",
- wantinchans = channelinfo.max_voices);
- if (alsa_samplewidth == 4 &&
- !(channelinfo.formats & (1<<SND_PCM_SFMT_S32_LE)))
- {
- fprintf(stderr,
- "PD_ALSA: input doesn't support 32-bit samples; using 16\n");
- alsa_samplewidth = 2;
- }
- if (alsa_samplewidth == 2 &&
- !(channelinfo.formats & (1<<SND_PCM_SFMT_S16_LE)))
- {
- fprintf(stderr,
- "PD_ALSA: can't find 4 or 2 byte format; giving up\n");
- return (1);
- }
- }
-
- if (wantoutchans)
- {
- channelinfo.channel = SND_PCM_CHANNEL_PLAYBACK;
- channelinfo.subdevice = 0;
- if ((err = snd_pcm_channel_info(alsa_device[0].handle, &channelinfo))
- < 0)
- {
- fprintf(stderr, "PD-ALSA: snd_pcm_channel_info (output): %s\n",
- snd_strerror(err));
- return (1);
- }
- if (sys_verbose)
- post("output channels supported: %d-%d\n",
- channelinfo.min_voices, channelinfo.max_voices);
- if (wantoutchans < channelinfo.min_voices)
- post("increasing output channels to minimum of %d\n",
- wantoutchans = channelinfo.min_voices);
- if (wantoutchans > channelinfo.max_voices)
- post("decreasing output channels to maximum of %d\n",
- wantoutchans = channelinfo.max_voices);
- if (alsa_samplewidth == 4 &&
- !(channelinfo.formats & (1<<SND_PCM_SFMT_S32_LE)))
- {
- fprintf(stderr,
- "PD_ALSA: output doesn't support 32-bit samples; using 16\n");
- alsa_samplewidth = 2;
- }
- if (alsa_samplewidth == 2 &&
- !(channelinfo.formats & (1<<SND_PCM_SFMT_S16_LE)))
- {
- fprintf(stderr,
- "PD_ALSA: can't find 4 or 2 byte format; giving up\n");
- return (1);
- }
- }
-
- linux_setsr(rate);
- linux_setch(wantinchans, wantoutchans);
-
- if (wantinchans)
- alsa_set_params(&alsa_device[0], SND_PCM_CHANNEL_CAPTURE,
- srate, wantinchans);
- if (wantoutchans)
- alsa_set_params(&alsa_device[0], SND_PCM_CHANNEL_PLAYBACK,
- srate, wantoutchans);
-
- n_alsa_dev = 1;
-
- /* check that all is as we think it should be */
- for (i = 0; i < n_alsa_dev; i++)
- {
- /* We need to handle if the rate is not the same for all
- * devices. For now just hope. */
- rate = alsa_device[i].setup.format.rate;
-
- /* It turns out that this checking does not work on all of my cards
- * - in full duplex on my trident 4dwave the setup on the capture channel
- * shows a sampling rate of 0. This is not true on my ess solo1. Checking
- * the dac last helps the problem. All of this needs to be much smarter
- * anyway (last minute hack). A warning above is all I have time for.
- */
- if (rate != srate)
- {
- post("PD-ALSA: unable to obtain rate %i using %i", srate, rate);
- post("PD-ALSA: (despite this warning Pd might still work.)");
- }
- }
- bsize = alsa_samplewidth *
- (linux_inchannels > linux_outchannels ? linux_inchannels :
- linux_outchannels) * DACBLKSIZE;
- alsa_buf = malloc(bsize);
- if (!alsa_buf)
- return (1);
- memset(alsa_buf, 0, bsize);
- return 0;
-}
-
-void alsa_set_params(t_alsa_dev *dev, int dir, int rate, int voices)
-{
- int err;
- struct snd_pcm_channel_params params;
-
- memset(&dev->info, 0, sizeof(dev->info));
- dev->info.channel = dir;
- if ((err = snd_pcm_channel_info(dev->handle, &dev->info) < 0))
- {
- fprintf(stderr, "PD-ALSA: error getting channel info: %s\n",
- snd_strerror(err));
- }
- memset(&params, 0, sizeof(params));
- params.format.interleave = 1; /* may do non-interleaved later */
- /* format is 2 or 4 bytes per sample depending on what was possible */
- params.format.format =
- (alsa_samplewidth == 4 ? SND_PCM_SFMT_S32_LE : SND_PCM_SFMT_S16_LE);
-
- /*will check this further down -just try for now*/
- params.format.rate = rate;
- params.format.voices = voices;
- params.start_mode = SND_PCM_START_GO; /* seems most reliable */
- /*do not stop at overrun/underrun*/
- params.stop_mode = SND_PCM_STOP_ROLLOVER;
-
- params.channel = dir; /* playback|capture */
- params.buf.stream.queue_size =
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * voices;
- params.buf.stream.fill = SND_PCM_FILL_SILENCE_WHOLE;
- params.mode = SND_PCM_MODE_STREAM;
-
- if ((err = snd_pcm_channel_params(dev->handle, &params)) < 0)
- {
- printf("PD-ALSA: error setting parameters %s", snd_strerror(err));
- }
-
- /* This should clear the buffers but does not. There is often noise at
- startup that sounds like crap left in the buffers - maybe in the lib
- instead of the driver? Some solution needs to be found.
- */
-
- if ((err = snd_pcm_channel_prepare(dev->handle, dir)) < 0)
- {
- printf("PD-ALSA: error preparing channel %s", snd_strerror(err));
- }
- dev->setup.channel = dir;
-
- if ((err = snd_pcm_channel_setup(dev->handle, &dev->setup)) < 0)
- {
- printf("PD-ALSA: error getting setup %s", snd_strerror(err));
- }
- /* for some reason, if you don't writesomething before starting the
- converters we get trash on startup */
- if (dir == SND_PCM_CHANNEL_PLAYBACK)
- {
- char foo[1024];
- int xxx = 1024 - (1024 % (linux_outchannels * alsa_samplewidth));
- int i, r;
- for (i = 0; i < xxx; i++)
- foo[i] = 0;
- if ((r = snd_pcm_write(dev->handle, foo, xxx)) < xxx)
- fprintf(stderr, "alsa_write: %s\n", snd_strerror(errno));
- }
- snd_pcm_channel_go(dev->handle, dir);
-}
-
-void alsa_close_audio(void)
-{
- int i;
- for(i = 0; i < n_alsa_dev; i++)
- snd_pcm_close(alsa_device[i].handle);
-}
-
-/* #define DEBUG_ALSA_XFER */
-
-int alsa_send_dacs(void)
-{
- static int16_t *sp;
- t_sample *fp, *fp1, *fp2;
- int i, j, k, err, devno = 0;
- int inputcount = 0, outputcount = 0, inputlate = 0, outputlate = 0;
- int result;
- snd_pcm_channel_status_t stat;
- static int callno = 0;
- static int xferno = 0;
- int countwas = 0;
- double timelast;
- static double timenow;
- int inchannels = linux_inchannels;
- int outchannels = linux_outchannels;
- int inbytesperframe = inchannels * alsa_samplewidth;
- int outbytesperframe = outchannels * alsa_samplewidth;
- int intransfersize = DACBLKSIZE * inbytesperframe;
- int outtransfersize = DACBLKSIZE * outbytesperframe;
- int alsaerror;
- int loggederror = 0;
-
- if (!inchannels && !outchannels)
- return (SENDDACS_NO);
- timelast = timenow;
- timenow = sys_getrealtime();
-
-#ifdef DEBUG_ALSA_XFER
- if (timenow - timelast > 0.050)
- fprintf(stderr, "(%d)",
- (int)(1000 * (timenow - timelast))), fflush(stderr);
-#endif
-
- callno++;
- /* get input and output channel status */
- if (inchannels > 0)
- {
- devno = 0;
- stat.channel = SND_PCM_CHANNEL_CAPTURE;
- if (alsaerror = snd_pcm_channel_status(alsa_device[devno].handle,
- &stat))
- {
- fprintf(stderr, "snd_pcm_channel_status (input): %s\n",
- snd_strerror(alsaerror));
- return (SENDDACS_NO);
- }
- inputcount = stat.count;
- inputlate = (stat.underrun > 0 || stat.overrun > 0);
- }
- if (outchannels > 0)
- {
- devno = 0;
- stat.channel = SND_PCM_CHANNEL_PLAYBACK;
- if (alsaerror = snd_pcm_channel_status(alsa_device[devno].handle,
- &stat))
- {
- fprintf(stderr, "snd_pcm_channel_status (output): %s\n",
- snd_strerror(alsaerror));
- return (SENDDACS_NO);
- }
- outputcount = stat.count;
- outputlate = (stat.underrun > 0 || stat.overrun > 0);
- }
-
- /* check if input not ready */
- if (inputcount < intransfersize)
- {
- /* fprintf(stderr, "no adc; count %d, free %d, call %d, xfer %d\n",
- stat.count,
- stat.free,
- callno, xferno); */
- if (outchannels > 0)
- {
- /* if there's no input but output is hungry, feed output. */
- while (outputcount < (linux_advance_samples + ALSA_JITTER)
- * outbytesperframe)
- {
- if (!loggederror)
- sys_log_error(ERR_RESYNC), loggederror = 1;
- memset(alsa_buf, 0, outtransfersize);
- result = snd_pcm_write(alsa_device[devno].handle,
- alsa_buf, outtransfersize);
- if (result < outtransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result >= 0 || errno == EAGAIN)
- fprintf(stderr, "ALSA: write returned %d of %d\n",
- result, outtransfersize);
- else fprintf(stderr, "ALSA: write: %s\n",
- snd_strerror(errno));
- fprintf(stderr,
- "inputcount %d, outputcount %d, outbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * outchannels);
-#endif
- return (SENDDACS_NO);
- }
- stat.channel = SND_PCM_CHANNEL_PLAYBACK;
- if (alsaerror =
- snd_pcm_channel_status(alsa_device[devno].handle,
- &stat))
- {
- fprintf(stderr, "snd_pcm_channel_status (output): %s\n",
- snd_strerror(alsaerror));
- return (SENDDACS_NO);
- }
- outputcount = stat.count;
- }
- }
-
- return SENDDACS_NO;
- }
-
- /* if output buffer has at least linux_advance_samples in it, we're
- not ready for this batch. */
- if (outputcount > linux_advance_samples * outbytesperframe)
- {
- if (inchannels > 0)
- {
- while (inputcount > (DACBLKSIZE + ALSA_JITTER) * outbytesperframe)
- {
- if (!loggederror)
- sys_log_error(ERR_RESYNC), loggederror = 1;
- devno = 0;
- result = snd_pcm_read(alsa_device[devno].handle, alsa_buf,
- intransfersize);
- if (result < intransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result < 0)
- fprintf(stderr,
- "snd_pcm_read %d %d: %s\n",
- callno, xferno, snd_strerror(errno));
- else fprintf(stderr,
- "snd_pcm_read %d %d returned only %d\n",
- callno, xferno, result);
- fprintf(stderr,
- "inputcount %d, outputcount %d, inbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * inchannels);
-#endif
- return (SENDDACS_NO);
- }
- devno = 0;
- stat.channel = SND_PCM_CHANNEL_CAPTURE;
- if (alsaerror =
- snd_pcm_channel_status(alsa_device[devno].handle,
- &stat))
- {
- fprintf(stderr, "snd_pcm_channel_status (input): %s\n",
- snd_strerror(alsaerror));
- return (SENDDACS_NO);
- }
- inputcount = stat.count;
- inputlate = (stat.underrun > 0 || stat.overrun > 0);
- }
- return (SENDDACS_NO);
- }
- }
- if (sys_getrealtime() - timenow > 0.002)
- {
-#ifdef DEBUG_ALSA_XFER
- fprintf(stderr, "check %d took %d msec\n",
- callno, (int)(1000 * (timenow - timelast))), fflush(stderr);
-#endif
- sys_log_error(ERR_DACSLEPT);
- timenow = sys_getrealtime();
- }
- if (inputlate || outputlate)
- sys_log_error(ERR_DATALATE);
-
- /* do output */
- /* this "for" loop won't work for more than one device. */
- for (devno = 0, fp = sys_soundout; devno < (outchannels > 0); devno++,
- fp += 128)
- {
- if (alsa_samplewidth == 4)
- {
- for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
- {
- float s1 = *fp2 * INT32_MAX;
- ((t_alsa_sample32 *)alsa_buf)[j] = CLIP32(s1);
- }
- }
- }
- else
- {
- for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
- {
- int s = *fp2 * 32767.;
- if (s > 32767)
- s = 32767;
- else if (s < -32767)
- s = -32767;
- ((t_alsa_sample16 *)alsa_buf)[j] = s;
- }
- }
- }
-
- result = snd_pcm_write(alsa_device[devno].handle, alsa_buf,
- outtransfersize);
- if (result < outtransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result >= 0 || errno == EAGAIN)
- fprintf(stderr, "ALSA: write returned %d of %d\n",
- result, outtransfersize);
- else fprintf(stderr, "ALSA: write: %s\n",
- snd_strerror(errno));
- fprintf(stderr,
- "inputcount %d, outputcount %d, outbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * outchannels);
-#endif
- sys_log_error(ERR_DACSLEPT);
- return (SENDDACS_NO);
- }
- }
- /* zero out the output buffer */
- memset(sys_soundout, 0, DACBLKSIZE * sizeof(*sys_soundout) *
- linux_outchannels);
- if (sys_getrealtime() - timenow > 0.002)
- {
-#if DEBUG_ALSA_XFER
- fprintf(stderr, "output %d took %d msec\n",
- callno, (int)(1000 * (timenow - timelast))), fflush(stderr);
-#endif
- timenow = sys_getrealtime();
- sys_log_error(ERR_DACSLEPT);
- }
-
- /* do input */
- for (devno = 0, fp = sys_soundin; devno < (linux_inchannels > 0); devno++,
- fp += 128)
- {
- result = snd_pcm_read(alsa_device[devno].handle, alsa_buf,
- intransfersize);
- if (result < intransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result < 0)
- fprintf(stderr,
- "snd_pcm_read %d %d: %s\n",
- callno, xferno, snd_strerror(errno));
- else fprintf(stderr,
- "snd_pcm_read %d %d returned only %d\n",
- callno, xferno, result);
- fprintf(stderr,
- "inputcount %d, outputcount %d, inbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * inchannels);
-#endif
- sys_log_error(ERR_ADCSLEPT);
- return (SENDDACS_NO);
- }
- if (alsa_samplewidth == 4)
- {
- for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += inchannels, fp2++)
- *fp2 = (float) ((t_alsa_sample32 *)alsa_buf)[j]
- * (1./ INT32_MAX);
- }
- }
- else
- {
- for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--; j += inchannels, fp2++)
- *fp2 = (float) ((t_alsa_sample16 *)alsa_buf)[j]
- * 3.051850e-05;
- }
- }
- }
- xferno++;
- if (sys_getrealtime() - timenow > 0.002)
- {
-#ifdef DEBUG_ALSA_XFER
- fprintf(stderr, "routine took %d msec\n",
- (int)(1000 * (sys_getrealtime() - timenow)));
-#endif
- sys_log_error(ERR_ADCSLEPT);
- }
- return SENDDACS_YES;
-}
-
-#endif /* ALSA99 */
-
-/* support for ALSA pcmv2 api by Karl MacMillan<karlmac@peabody.jhu.edu> */
-
-#ifdef ALSA01
-
-static void check_error(int err, const char *why)
-{
- if (err < 0)
- fprintf(stderr, "%s: %s\n", why, snd_strerror(err));
-}
-
-static int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
-{
- int err, inchans = 0, outchans = 0, subunitdir;
- char devname[512];
- snd_pcm_hw_params_t* hw_params;
- snd_pcm_sw_params_t* sw_params;
- snd_output_t* out;
- int frag_size = (linux_fragsize ? linux_fragsize : ALSA_DEFFRAGSIZE);
- int nfrags, i;
- short* tmp_buf;
- unsigned int tmp_uint;
- int advwas = sys_schedadvance;
-
- if (linux_nfragment)
- {
- nfrags = linux_nfragment;
- sys_schedadvance = (frag_size * linux_nfragment * 1.0e6) / srate;
- }
- else nfrags = sys_schedadvance * (float)srate / (1e6 * frag_size);
-
- if (sys_verbose || (sys_schedadvance != advwas))
- post("audio buffer set to %d", (int)(0.001 * sys_schedadvance));
- if (wantinchans || wantoutchans)
- alsa_checkversion();
- if (wantinchans)
- {
- err = snd_pcm_open(&alsa_device.inhandle, alsa_devname,
- SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK);
-
- check_error(err, "snd_pcm_open (input)");
- if (err < 0)
- inchans = 0;
- else
- {
- inchans = wantinchans;
- snd_pcm_nonblock(alsa_device.inhandle, 1);
- }
- }
- if (wantoutchans)
- {
- err = snd_pcm_open(&alsa_device.outhandle, alsa_devname,
- SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
-
- check_error(err, "snd_pcm_open (output)");
- if (err < 0)
- outchans = 0;
- else
- {
- outchans = wantoutchans;
- snd_pcm_nonblock(alsa_device.outhandle, 1);
- }
- }
- if (inchans)
- {
- if (sys_verbose)
- post("opening sound input...");
- err = snd_pcm_hw_params_malloc(&hw_params);
- check_error(err, "snd_pcm_hw_params_malloc (input)");
-
- // get the default params
- err = snd_pcm_hw_params_any(alsa_device.inhandle, hw_params);
- check_error(err, "snd_pcm_hw_params_any (input)");
- // set interleaved access - FIXME deal with other access types
- err = snd_pcm_hw_params_set_access(alsa_device.inhandle, hw_params,
- SND_PCM_ACCESS_RW_INTERLEAVED);
- check_error(err, "snd_pcm_hw_params_set_access (input)");
- // Try to set 32 bit format first
- err = snd_pcm_hw_params_set_format(alsa_device.inhandle, hw_params,
- SND_PCM_FORMAT_S32);
- if (err < 0)
- {
- /* fprintf(stderr,
- "PD-ALSA: 32 bit format not available - using 16\n"); */
- err = snd_pcm_hw_params_set_format(alsa_device.inhandle, hw_params,
- SND_PCM_FORMAT_S16);
- check_error(err, "snd_pcm_hw_params_set_format (input)");
- alsa_samplewidth = 2;
- }
- else
- {
- alsa_samplewidth = 4;
- }
- post("Sample width set to %d bytes", alsa_samplewidth);
- // set the subformat
- err = snd_pcm_hw_params_set_subformat(alsa_device.inhandle, hw_params,
- SND_PCM_SUBFORMAT_STD);
- check_error(err, "snd_pcm_hw_params_set_subformat (input)");
- // set the number of channels
- tmp_uint = inchans;
- err = snd_pcm_hw_params_set_channels_min(alsa_device.inhandle,
- hw_params, &tmp_uint);
- check_error(err, "snd_pcm_hw_params_set_channels (input)");
- if (tmp_uint != (unsigned)inchans)
- post("ALSA: set input channels to %d", tmp_uint);
- inchans = tmp_uint;
- // set the sampling rate
- err = snd_pcm_hw_params_set_rate_min(alsa_device.inhandle, hw_params,
- &srate, 0);
- check_error(err, "snd_pcm_hw_params_set_rate_min (input)");
-#if 0
- err = snd_pcm_hw_params_get_rate(hw_params, &subunitdir);
- post("input sample rate %d", err);
-#endif
- // set the period - ie frag size
- // post("fragsize a %d", frag_size);
-
- /* LATER try this to get a recommended period size...
- right now, it trips an assertion failure in ALSA lib */
-#if 0
- post("input period was %d, min %d, max %d\n",
- snd_pcm_hw_params_get_period_size(hw_params, 0),
- snd_pcm_hw_params_get_period_size_min(hw_params, 0),
- snd_pcm_hw_params_get_period_size_max(hw_params, 0));
-#endif
- err = snd_pcm_hw_params_set_period_size_near(alsa_device.inhandle,
- hw_params,
- (snd_pcm_uframes_t)
- frag_size, 0);
- check_error(err, "snd_pcm_hw_params_set_period_size_near (input)");
- // post("fragsize b %d", frag_size);
- // set the number of periods - ie numfrags
- // post("nfrags a %d", nfrags);
- err = snd_pcm_hw_params_set_periods_near(alsa_device.inhandle,
- hw_params, nfrags, 0);
- check_error(err, "snd_pcm_hw_params_set_periods_near (input)");
- // set the buffer size
- err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.inhandle,
- hw_params, nfrags * frag_size);
- check_error(err, "snd_pcm_hw_params_set_buffer_size_near (input)");
-
- err = snd_pcm_hw_params(alsa_device.inhandle, hw_params);
- check_error(err, "snd_pcm_hw_params (input)");
-
- snd_pcm_hw_params_free(hw_params);
-
- err = snd_pcm_sw_params_malloc(&sw_params);
- check_error(err, "snd_pcm_sw_params_malloc (input)");
- err = snd_pcm_sw_params_current(alsa_device.inhandle, sw_params);
- check_error(err, "snd_pcm_sw_params_current (input)");
-#if 1
- err = snd_pcm_sw_params_set_start_mode(alsa_device.inhandle, sw_params,
- SND_PCM_START_EXPLICIT);
- check_error(err, "snd_pcm_sw_params_set_start_mode (input)");
- err = snd_pcm_sw_params_set_xrun_mode(alsa_device.inhandle, sw_params,
- SND_PCM_XRUN_NONE);
- check_error(err, "snd_pcm_sw_params_set_xrun_mode (input)");
-#else
- err = snd_pcm_sw_params_set_start_threshold(alsa_device.inhandle,
- sw_params, nfrags * frag_size);
- check_error(err, "snd_pcm_sw_params_set_start_threshold (input)");
- err = snd_pcm_sw_params_set_stop_threshold(alsa_device.inhandle,
- sw_params, 1);
- check_error(err, "snd_pcm_sw_params_set_stop_threshold (input)");
-#endif
-
- err = snd_pcm_sw_params_set_avail_min(alsa_device.inhandle, sw_params,
- frag_size);
- check_error(err, "snd_pcm_sw_params_set_avail_min (input)");
- err = snd_pcm_sw_params(alsa_device.inhandle, sw_params);
- check_error(err, "snd_pcm_sw_params (input)");
-
- snd_pcm_sw_params_free(sw_params);
-
- snd_output_stdio_attach(&out, stderr, 0);
-#if 0
- if (sys_verbose)
- {
- snd_pcm_dump_hw_setup(alsa_device.inhandle, out);
- snd_pcm_dump_sw_setup(alsa_device.inhandle, out);
- }
-#endif
- }
-
- if (outchans)
- {
- int foo;
- if (sys_verbose)
- post("opening sound output...");
- err = snd_pcm_hw_params_malloc(&hw_params);
- check_error(err, "snd_pcm_sw_params (output)");
-
- // get the default params
- err = snd_pcm_hw_params_any(alsa_device.outhandle, hw_params);
- check_error(err, "snd_pcm_hw_params_any (output)");
- // set interleaved access - FIXME deal with other access types
- err = snd_pcm_hw_params_set_access(alsa_device.outhandle, hw_params,
- SND_PCM_ACCESS_RW_INTERLEAVED);
- check_error(err, "snd_pcm_hw_params_set_access (output)");
- // Try to set 32 bit format first
- err = snd_pcm_hw_params_set_format(alsa_device.outhandle, hw_params,
- SND_PCM_FORMAT_S32);
- if (err < 0)
- {
- err = snd_pcm_hw_params_set_format(alsa_device.outhandle,
- hw_params,SND_PCM_FORMAT_S16);
- check_error(err, "snd_pcm_hw_params_set_format (output)");
- /* fprintf(stderr,
- "PD-ALSA: 32 bit format not available - using 16\n"); */
- alsa_samplewidth = 2;
- }
- else
- {
- alsa_samplewidth = 4;
- }
- // set the subformat
- err = snd_pcm_hw_params_set_subformat(alsa_device.outhandle, hw_params,
- SND_PCM_SUBFORMAT_STD);
- check_error(err, "snd_pcm_hw_params_set_subformat (output)");
- // set the number of channels
- tmp_uint = outchans;
- err = snd_pcm_hw_params_set_channels_min(alsa_device.outhandle,
- hw_params, &tmp_uint);
- check_error(err, "snd_pcm_hw_params_set_channels (output)");
- if (tmp_uint != (unsigned)outchans)
- post("alsa: set output channels to %d", tmp_uint);
- outchans = tmp_uint;
- // set the sampling rate
- err = snd_pcm_hw_params_set_rate_min(alsa_device.outhandle, hw_params,
- &srate, 0);
- check_error(err, "snd_pcm_hw_params_set_rate_min (output)");
-#if 0
- err = snd_pcm_hw_params_get_rate(hw_params, &subunitdir);
- post("output sample rate %d", err);
-#endif
- // set the period - ie frag size
-#if 0
- post("output period was %d, min %d, max %d\n",
- snd_pcm_hw_params_get_period_size(hw_params, 0),
- snd_pcm_hw_params_get_period_size_min(hw_params, 0),
- snd_pcm_hw_params_get_period_size_max(hw_params, 0));
-#endif
- // post("fragsize c %d", frag_size);
- err = snd_pcm_hw_params_set_period_size_near(alsa_device.outhandle,
- hw_params,
- (snd_pcm_uframes_t)
- frag_size, 0);
- // post("fragsize d %d", frag_size);
- check_error(err, "snd_pcm_hw_params_set_period_size_near (output)");
- // set the number of periods - ie numfrags
- err = snd_pcm_hw_params_set_periods_near(alsa_device.outhandle,
- hw_params, nfrags, 0);
- check_error(err, "snd_pcm_hw_params_set_periods_near (output)");
- // set the buffer size
- err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.outhandle,
- hw_params, nfrags * frag_size);
-
- check_error(err, "snd_pcm_hw_params_set_buffer_size_near (output)");
-
- err = snd_pcm_hw_params(alsa_device.outhandle, hw_params);
- check_error(err, "snd_pcm_hw_params (output)");
-
- snd_pcm_hw_params_free(hw_params);
-
- err = snd_pcm_sw_params_malloc(&sw_params);
- check_error(err, "snd_pcm_sw_params_malloc (output)");
- err = snd_pcm_sw_params_current(alsa_device.outhandle, sw_params);
- check_error(err, "snd_pcm_sw_params_current (output)");
-#if 1
- err = snd_pcm_sw_params_set_start_mode(alsa_device.outhandle,
- sw_params,
- SND_PCM_START_EXPLICIT);
- check_error(err, "snd_pcm_sw_params_set_start_mode (output)");
- err = snd_pcm_sw_params_set_xrun_mode(alsa_device.outhandle, sw_params,
- SND_PCM_XRUN_NONE);
- check_error(err, "snd_pcm_sw_params_set_xrun_mode (output)");
-#else
- err = snd_pcm_sw_params_set_start_threshold(alsa_device.inhandle,
- sw_params, nfrags * frag_size);
- check_error(err, "snd_pcm_sw_params_set_start_threshold (output)");
- err = snd_pcm_sw_params_set_stop_threshold(alsa_device.inhandle,
- sw_params, 1);
- check_error(err, "snd_pcm_sw_params_set_stop_threshold (output)");
-#endif
-
- err = snd_pcm_sw_params_set_avail_min(alsa_device.outhandle, sw_params,
- frag_size);
- check_error(err, "snd_pcm_sw_params_set_avail_min (output)");
- err = snd_pcm_sw_params(alsa_device.outhandle, sw_params);
- check_error(err, "snd_pcm_sw_params (output)");
-
- snd_pcm_sw_params_free(sw_params);
-
- snd_output_stdio_attach(&out, stderr, 0);
-#if 0
- if (sys_verbose)
- {
- snd_pcm_dump_hw_setup(alsa_device.outhandle, out);
- snd_pcm_dump_sw_setup(alsa_device.outhandle, out);
- }
-#endif
- }
-
- linux_setsr(srate);
- linux_setch(inchans, outchans);
-
- if (inchans)
- snd_pcm_prepare(alsa_device.inhandle);
- if (outchans)
- snd_pcm_prepare(alsa_device.outhandle);
-
- // if duplex we can link the channels so they start together
- if (inchans && outchans)
- snd_pcm_link(alsa_device.inhandle, alsa_device.outhandle);
-
- // set up the buffer
- if (outchans > inchans)
- alsa_buf = (short *)calloc(sizeof(char) * alsa_samplewidth, DACBLKSIZE
- * outchans);
- else
- alsa_buf = (short *)calloc(sizeof(char) * alsa_samplewidth, DACBLKSIZE
- * inchans);
- // fill the buffer with silence
- if (outchans)
- {
- i = nfrags + 1;
- while (i--)
- snd_pcm_writei(alsa_device.outhandle, alsa_buf, frag_size);
- }
-
- // set up the status variables
- err = snd_pcm_status_malloc(&in_status);
- check_error(err, "snd_pcm_status_malloc");
- err = snd_pcm_status_malloc(&out_status);
- check_error(err, "snd_pcm_status_malloc");
-
- // start the device
-#if 1
- if (outchans)
- {
- err = snd_pcm_start(alsa_device.outhandle);
- check_error(err, "snd_pcm_start");
- }
- else if (inchans)
- {
- err = snd_pcm_start(alsa_device.inhandle);
- check_error(err, "snd_pcm_start");
- }
-#endif
-
- return 0;
-}
-
-void alsa_close_audio(void)
-{
- int err;
- if (linux_inchannels)
- {
- err = snd_pcm_close(alsa_device.inhandle);
- check_error(err, "snd_pcm_close (input)");
- }
- if (linux_outchannels)
- {
- err = snd_pcm_close(alsa_device.outhandle);
- check_error(err, "snd_pcm_close (output)");
- }
-}
-
-// #define DEBUG_ALSA_XFER
-
-int alsa_send_dacs(void)
-{
- static int16_t *sp;
- static int xferno = 0;
- static int callno = 0;
- static double timenow;
- double timelast;
- t_sample *fp, *fp1, *fp2;
- int i, j, k, err, devno = 0;
- int inputcount = 0, outputcount = 0, inputlate = 0, outputlate = 0;
- int result;
- int inchannels = linux_inchannels;
- int outchannels = linux_outchannels;
- unsigned int intransfersize = DACBLKSIZE;
- unsigned int outtransfersize = DACBLKSIZE;
-
- // get the status
- if (!inchannels && !outchannels)
- {
- return SENDDACS_NO;
- }
-
- timelast = timenow;
- timenow = sys_getrealtime();
-
-#ifdef DEBUG_ALSA_XFER
- if (timenow - timelast > 0.050)
- fprintf(stderr, "(%d)",
- (int)(1000 * (timenow - timelast))), fflush(stderr);
-#endif
-
- callno++;
-
- if (inchannels)
- {
- snd_pcm_status(alsa_device.inhandle, in_status);
- if (snd_pcm_status_get_avail(in_status) < intransfersize)
- return SENDDACS_NO;
- }
- if (outchannels)
- {
- snd_pcm_status(alsa_device.outhandle, out_status);
- if (snd_pcm_status_get_avail(out_status) < outtransfersize)
- return SENDDACS_NO;
- }
-
- /* do output */
- if (outchannels)
- {
- fp = sys_soundout;
- if (alsa_samplewidth == 4)
- {
- for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
- {
- float s1 = *fp2 * INT32_MAX;
- ((t_alsa_sample32 *)alsa_buf)[j] = CLIP32(s1);
- }
- }
- }
- else
- {
- for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
- {
- int s = *fp2 * 32767.;
- if (s > 32767)
- s = 32767;
- else if (s < -32767)
- s = -32767;
- ((t_alsa_sample16 *)alsa_buf)[j] = s;
- }
- }
- }
-
- result = snd_pcm_writei(alsa_device.outhandle, alsa_buf,
- outtransfersize);
- if (result != (int)outtransfersize)
- {
- #ifdef DEBUG_ALSA_XFER
- if (result >= 0 || errno == EAGAIN)
- fprintf(stderr, "ALSA: write returned %d of %d\n",
- result, outtransfersize);
- else fprintf(stderr, "ALSA: write: %s\n",
- snd_strerror(errno));
- fprintf(stderr,
- "inputcount %d, outputcount %d, outbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * outchannels);
- #endif
- sys_log_error(ERR_DACSLEPT);
- return (SENDDACS_NO);
- }
-
- /* zero out the output buffer */
- memset(sys_soundout, 0, DACBLKSIZE * sizeof(*sys_soundout) *
- linux_outchannels);
- if (sys_getrealtime() - timenow > 0.002)
- {
- #ifdef DEBUG_ALSA_XFER
- fprintf(stderr, "output %d took %d msec\n",
- callno, (int)(1000 * (timenow - timelast))), fflush(stderr);
- #endif
- timenow = sys_getrealtime();
- sys_log_error(ERR_DACSLEPT);
- }
- }
- /* do input */
- if (linux_inchannels)
- {
- result = snd_pcm_readi(alsa_device.inhandle, alsa_buf, intransfersize);
- if (result < (int)intransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result < 0)
- fprintf(stderr,
- "snd_pcm_read %d %d: %s\n",
- callno, xferno, snd_strerror(errno));
- else fprintf(stderr,
- "snd_pcm_read %d %d returned only %d\n",
- callno, xferno, result);
- fprintf(stderr,
- "inputcount %d, outputcount %d, inbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * inchannels);
-#endif
- sys_log_error(ERR_ADCSLEPT);
- return (SENDDACS_NO);
- }
- fp = sys_soundin;
- if (alsa_samplewidth == 4)
- {
- for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += inchannels, fp2++)
- *fp2 = (float) ((t_alsa_sample32 *)alsa_buf)[j]
- * (1./ INT32_MAX);
- }
- }
- else
- {
- for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--; j += inchannels,
- fp2++)
- *fp2 = (float) ((t_alsa_sample16 *)alsa_buf)[j]
- * 3.051850e-05;
- }
- }
- }
- xferno++;
- if (sys_getrealtime() - timenow > 0.002)
- {
-#ifdef DEBUG_ALSA_XFER
- fprintf(stderr, "routine took %d msec\n",
- (int)(1000 * (sys_getrealtime() - timenow)));
-#endif
- sys_log_error(ERR_ADCSLEPT);
- }
- return SENDDACS_YES;
-}
-
-void alsa_resync( void)
-{
- int i, result;
- memset(alsa_buf, 0,
- sizeof(char) * alsa_samplewidth * DACBLKSIZE * linux_outchannels);
- for (i = 0; i < 100; i++)
- {
- result = snd_pcm_writei(alsa_device.outhandle, alsa_buf,
- DACBLKSIZE);
- if (result != (int)DACBLKSIZE)
- break;
- }
- post("%d written", i);
-}
-
-
-#endif /* ALSA01 */
-
-/***************************************************
- * Code using the RME_9652 API
- */
-
- /*
- trying native device for future use of native memory map:
- because of busmaster if you dont use the dac, you dont need
- CPU Power und also no nearly no CPU-Power is used in device
-
- since always all DAs and ADs are synced (else they wouldnt work)
- we use linux_dacs[0], linux_adcs[0]
- */
-
-#ifdef RME_HAMMERFALL
-
-#define RME9652_MAX_CHANNELS 26
-
-#define RME9652_CH_PER_NATIVE_DEVICE 1
-
-static int rme9652_dac_devices[RME9652_MAX_CHANNELS];
-static int rme9652_adc_devices[RME9652_MAX_CHANNELS];
-
-static char rme9652_dsp_dac[] = "/dev/rme9652/C0da%d";
-static char rme9652_dsp_adc[] = "/dev/rme9652/C0ad%d";
-
-static int num_of_rme9652_dac = 0;
-static int num_of_rme9652_adc = 0;
-
-static int rme_soundindevonset = 1;
-static int rme_soundoutdevonset = 1;
-
-void rme_soundindev(int which)
-{
- rme_soundindevonset = which;
-}
-
-void rme_soundoutdev(int which)
-{
- rme_soundoutdevonset = which;
-}
-
-void rme9652_configure(int dev, int fd,int srate, int dac) {
- int orig, param, nblk;
- audio_buf_info ainfo;
- orig = param = srate;
-
- /* samplerate */
-
- fprintf(stderr,"RME9652: configuring %d, fd=%d, sr=%d\n, dac=%d\n",
- dev,fd,srate,dac);
-
- if (ioctl(fd,SNDCTL_DSP_SPEED,&param) == -1)
- fprintf(stderr,"RME9652: Could not set sampling rate for device\n");
- else if( orig != param )
- fprintf(stderr,"RME9652: sampling rate: wanted %d, got %d\n",
- orig, param );
-
- // setting the correct samplerate (could be different than expected)
- srate = param;
-
-
- /* setting resolution */
-
- /* use ctrlpanel to change, experiment, channels 1 */
-
- orig = param = AFMT_S16_BE;
- if (ioctl(fd,SNDCTL_DSP_SETFMT,&param) == -1)
- fprintf(stderr,"RME9652: Could not set DSP format\n");
- else if( orig != param )
- fprintf(stderr,"RME9652: DSP format: wanted %d, got %d\n",orig, param );
-
- /* setting channels */
- orig = param = RME9652_CH_PER_NATIVE_DEVICE;
-
- if (ioctl(fd,SNDCTL_DSP_CHANNELS,&param) == -1)
- fprintf(stderr,"RME9652: Could not set channels\n");
- else if( orig != param )
- fprintf(stderr,"RME9652: num channels: wanted %d, got %d\n",orig, param );
-
- if (dac)
- {
-
- /* use "free space" to learn the buffer size. Normally you
- should set this to your own desired value; but this seems not
- to be implemented uniformly across different sound cards. LATER
- we should figure out what to do if the requested scheduler advance
- is greater than this buffer size; for now, we just print something
- out. */
-
- if( ioctl(linux_dacs[0].d_fd, SOUND_PCM_GETOSPACE,&ainfo) < 0 )
- fprintf(stderr,"RME: ioctl on output device %d failed",dev);
-
- linux_dacs[0].d_bufsize = ainfo.bytes;
-
- fprintf(stderr,"RME: ioctl SOUND_PCM_GETOSPACE says %d buffsize\n",
- linux_dacs[0].d_bufsize);
-
-
- if (linux_advance_samples * (RME_SAMPLEWIDTH *
- RME9652_CH_PER_NATIVE_DEVICE)
- > linux_dacs[0].d_bufsize - RME_BYTESPERCHAN)
- {
- fprintf(stderr,
- "RME: requested audio buffer size %d limited to %d\n",
- linux_advance_samples
- * (RME_SAMPLEWIDTH * RME9652_CH_PER_NATIVE_DEVICE),
- linux_dacs[0].d_bufsize);
- linux_advance_samples =
- (linux_dacs[0].d_bufsize - RME_BYTESPERCHAN)
- / (RME_SAMPLEWIDTH *RME9652_CH_PER_NATIVE_DEVICE);
- }
- }
-}
-
-
-int rme9652_open_audio(int inchans, int outchans,int srate)
-{
- int orig;
- int tmp;
- int inchannels = 0,outchannels = 0;
- char devname[20];
- int i;
- char buf[RME_SAMPLEWIDTH*RME9652_CH_PER_NATIVE_DEVICE*DACBLKSIZE];
- int num_devs = 0;
- audio_buf_info ainfo;
-
- linux_nindevs = linux_noutdevs = 0;
-
- if (sys_verbose)
- post("RME open");
- /* First check if we can */
- /* open the write ports */
-
- for (num_devs=0; outchannels < outchans; num_devs++)
- {
- int channels = RME9652_CH_PER_NATIVE_DEVICE;
-
- sprintf(devname, rme9652_dsp_dac, num_devs + rme_soundoutdevonset);
- if ((tmp = open(devname,O_WRONLY)) == -1)
- {
- DEBUG(fprintf(stderr,"RME9652: failed to open %s writeonly\n",
- devname);)
- break;
- }
- DEBUG(fprintf(stderr,"RME9652: out device Nr. %d (%d) on %s\n",
- linux_noutdevs+1,tmp,devname);)
-
- if (outchans > outchannels)
- {
- rme9652_dac_devices[linux_noutdevs] = tmp;
- linux_noutdevs++;
- outchannels += channels;
- }
- else close(tmp);
- }
- if( linux_noutdevs > 0)
- linux_dacs[0].d_fd = rme9652_dac_devices[0];
-
- /* Second check if we can */
- /* open the read ports */
-
- for (num_devs=0; inchannels < inchans; num_devs++)
- {
- int channels = RME9652_CH_PER_NATIVE_DEVICE;
-
- sprintf(devname, rme9652_dsp_adc, num_devs+rme_soundindevonset);
-
- if ((tmp = open(devname,O_RDONLY)) == -1)
- {
- DEBUG(fprintf(stderr,"RME9652: failed to open %s readonly\n",
- devname);)
- break;
- }
- DEBUG(fprintf(stderr,"RME9652: in device Nr. %d (%d) on %s\n",
- linux_nindevs+1,tmp,devname);)
-
- if (inchans > inchannels)
- {
- rme9652_adc_devices[linux_nindevs] = tmp;
- linux_nindevs++;
- inchannels += channels;
- }
- else
- close(tmp);
- }
- if(linux_nindevs > 0)
- linux_adcs[0].d_fd = rme9652_adc_devices[0];
-
- /* configure soundcards */
-
- rme9652_configure(0, linux_adcs[0].d_fd,srate, 0);
- rme9652_configure(0, linux_dacs[0].d_fd,srate, 1);
-
- /* We have to do a read to start the engine. This is
- necessary because sys_send_dacs waits until the input
- buffer is filled and only reads on a filled buffer.
- This is good, because it's a way to make sure that we
- will not block */
-
- if (linux_nindevs)
- {
- fprintf(stderr,("RME9652: starting read engine ... "));
-
-
- for (num_devs=0; num_devs < linux_nindevs; num_devs++)
- read(rme9652_adc_devices[num_devs],
- buf, RME_SAMPLEWIDTH* RME9652_CH_PER_NATIVE_DEVICE*
- DACBLKSIZE);
-
-
- for (num_devs=0; num_devs < linux_noutdevs; num_devs++)
- write(rme9652_dac_devices[num_devs],
- buf, RME_SAMPLEWIDTH* RME9652_CH_PER_NATIVE_DEVICE*
- DACBLKSIZE);
-
- if(linux_noutdevs)
- ioctl(rme9652_dac_devices[0],SNDCTL_DSP_SYNC);
-
- fprintf(stderr,"done\n");
- }
-
- linux_setsr(srate);
- linux_setch(linux_nindevs, linux_noutdevs);
-
- num_of_rme9652_dac = linux_noutdevs;
- num_of_rme9652_adc = linux_nindevs;
-
- if(linux_noutdevs)linux_noutdevs=1;
- if(linux_nindevs)linux_nindevs=1;
-
- /* trick RME9652 behaves as one device fromread write pointers */
- return (0);
-}
-
-void rme9652_close_audio( void)
-{
- int i;
- for (i=0;i<num_of_rme9652_dac;i++)
- close(rme9652_dac_devices[i]);
-
- for (i=0;i<num_of_rme9652_adc;i++)
- close(rme9652_adc_devices[i]);
-}
-
-
-/* query audio devices for "available" data size. */
-/* not needed because oss_calcspace does the same */
-static int rme9652_calcspace(void)
-{
- audio_buf_info ainfo;
-
-
- /* one for all */
-
- if (ioctl(linux_dacs[0].d_fd, SOUND_PCM_GETOSPACE,&ainfo) < 0)
- fprintf(stderr,
- "RME9652: calc ioctl SOUND_PCM_GETOSPACE on output device fd %d failed\n",
- linux_dacs[0].d_fd);
- linux_dacs[0].d_space = ainfo.bytes;
-
- if (ioctl(linux_adcs[0].d_fd, SOUND_PCM_GETISPACE,&ainfo) < 0)
- fprintf(stderr,
- "RME9652: calc ioctl SOUND_PCM_GETISPACE on input device fd %d failed\n",
- rme9652_adc_devices[0]);
-
- linux_adcs[0].d_space = ainfo.bytes;
-
- return 1;
-}
-
-/* this call resyncs audio output and input which will cause discontinuities
-in audio output and/or input. */
-
-static void rme9652_doresync( void)
-{
- if(linux_noutdevs)
- ioctl(rme9652_dac_devices[0],SNDCTL_DSP_SYNC);
-}
-
-static int mycount =0;
-
-int rme9652_send_dacs(void)
-{
- float *fp;
- long fill;
- int i, j, dev;
- /* the maximum number of samples we should have in the ADC buffer */
- t_rme_sample buf[RME9652_CH_PER_NATIVE_DEVICE*DACBLKSIZE], *sp;
-
- double timeref, timenow;
-
- mycount++;
-
- if (!linux_nindevs && !linux_noutdevs) return (0);
-
- rme9652_calcspace();
-
- /* do output */
-
- timeref = sys_getrealtime();
-
- if(linux_noutdevs){
-
- if (linux_dacs[0].d_dropcount)
- linux_dacs[0].d_dropcount--;
- else{
- /* fprintf(stderr,"output %d\n", linux_outchannels);*/
-
- for(j=0;j<linux_outchannels;j++){
-
- t_rme_sample *a,*b,*c,*d;
- float *fp1,*fp2,*fp3,*fp4;
-
- fp1 = sys_soundout + j*DACBLKSIZE-4;
- fp2 = fp1 + 1;
- fp3 = fp1 + 2;
- fp4 = fp1 + 3;
- a = buf-4;
- b=a+1;
- c=a+2;
- d=a+3;
-
- for (i = DACBLKSIZE>>2;i--;)
- {
- float s1 = *(fp1+=4) * INT32_MAX;
- float s2 = *(fp2+=4) * INT32_MAX;
- float s3 = *(fp3+=4) * INT32_MAX;
- float s4 = *(fp4+=4) * INT32_MAX;
-
- *(a+=4) = CLIP32(s1);
- *(b+=4) = CLIP32(s2);
- *(c+=4) = CLIP32(s3);
- *(d+=4) = CLIP32(s4);
- }
-
- linux_dacs_write(rme9652_dac_devices[j],buf,RME_BYTESPERCHAN);
- }
- }
-
- if ((timenow = sys_getrealtime()) - timeref > 0.02)
- sys_log_error(ERR_DACSLEPT);
- timeref = timenow;
- }
-
- memset(sys_soundout, 0,
- linux_outchannels * (sizeof(float) * DACBLKSIZE));
-
- /* do input */
-
- if(linux_nindevs) {
-
- for(j=0;j<linux_inchannels;j++){
-
- linux_adcs_read(rme9652_adc_devices[j], buf, RME_BYTESPERCHAN);
-
- if ((timenow = sys_getrealtime()) - timeref > 0.02)
- sys_log_error(ERR_ADCSLEPT);
- timeref = timenow;
- {
- t_rme_sample *a,*b,*c,*d;
- float *fp1,*fp2,*fp3,*fp4;
-
- fp1 = sys_soundin + j*DACBLKSIZE-4;
- fp2 = fp1 + 1;
- fp3 = fp1 + 2;
- fp4 = fp1 + 3;
- a = buf-4;
- b=a+1;
- c=a+2;
- d=a+3;
-
- for (i = (DACBLKSIZE>>2);i--;)
- {
- *(fp1+=4) = *(a+=4) * (float)(1./INT32_MAX);
- *(fp2+=4) = *(b+=4) * (float)(1./INT32_MAX);
- *(fp3+=4) = *(c+=4) * (float)(1./INT32_MAX);
- *(fp4+=4) = *(d+=4) * (float)(1./INT32_MAX);
- }
- }
- }
- }
- /* fprintf(stderr,"ready \n");*/
-
- return (1);
-}
-
-#endif /* RME_HAMMERFALL */
diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c
index 004820f6..d5beb866 100644
--- a/pd/src/s_inter.c
+++ b/pd/src/s_inter.c
@@ -109,7 +109,9 @@ double nt_tixtotime(LARGE_INTEGER *dumbass)
#endif
#endif /* MSW */
-double sys_getrealtime(void) /* get "real time" in seconds */
+ /* get "real time" in seconds; take the
+ first time we get called as a reference time of zero. */
+double sys_getrealtime(void)
{
#ifdef UNIX
static struct timeval then;
@@ -843,6 +845,7 @@ int sys_startgui(const char *guidir)
if (!sys_nogui)
{
+ char buf[256];
if (sys_verbose)
fprintf(stderr, "Waiting for connection request... \n");
if (listen(xsock, 5) < 0) sys_sockerror("listen");
@@ -861,8 +864,8 @@ int sys_startgui(const char *guidir)
/* here is where we start the pinging. */
if (sys_hipriority)
sys_gui("pdtk_watchdog\n");
-
- sys_vgui("pdtk_pd_startup {%s}\n", pd_version);
+ sys_get_audio_apis(buf);
+ sys_vgui("pdtk_pd_startup {%s} %s\n", pd_version, buf);
}
return (0);
@@ -894,8 +897,9 @@ void sys_bail(int n)
sys_close_midi();
fprintf(stderr, "... done.\n");
#endif
+ exit(1);
}
- _exit(n);
+ else _exit(n);
}
void glob_quit(void *dummy)
diff --git a/pd/src/s_linux.c b/pd/src/s_linux.c
deleted file mode 100644
index 54cdb978..00000000
--- a/pd/src/s_linux.c
+++ /dev/null
@@ -1,3087 +0,0 @@
-/* Copyright (c) 1997-1999 Guenter Geiger, Miller Puckette, Larry Troxler,
-* Winfried Ritsch, Karl MacMillan, and others.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-/* this file implements the sys_ functions profiled in m_imp.h for
- audio and MIDI I/O. In Linux there might be several APIs for doing the
- audio part; right now there are three (OSS, ALSA, RME); the third is
- for the RME 9652 driver by Ritsch (but not for the OSS compatible
- one by Geiger; for that one, OSS should work.)
-
- FUNCTION PREFIXES.
- sys_ -- functions which must be exported to Pd on all platforms
- linux_ -- linux-specific objects which don't depend on API,
- mostly static but some exported.
- oss_, alsa_, rme_ -- API-specific functions, all of which are
- static.
-
- ALSA SUPPORT. If ALSA99 is defined we support ALSA 0.5x; if ALSA01,
- ALSA 0.9x. (the naming scheme reflects the possibility of further API
- changes in the future...) We define "ALSA" for code relevant to both
- APIs.
-
- For MIDI, we only offer the OSS API; ALSA has to emulate OSS for us.
-*/
-
-/* OSS include (whether we're doing OSS audio or not we need this for MIDI) */
-
-
-/* IOhannes:::
- * hacked this to add advanced multidevice-support
- * 1311:forum::für::umläute:2001
- */
-
-#include <linux/soundcard.h>
-
-#if (defined(ALSA01) || defined(ALSA99))
-#define ALSA
-#endif
-
-#ifdef ALSA99
-#include <sys/asoundlib.h>
-#endif
-#ifdef ALSA01
-#include <alsa/asoundlib.h>
-#endif
-
-#include "m_imp.h"
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <sys/mman.h>
-
-/* local function prototypes */
-
-static void linux_close_midi( void);
-
-static int oss_open_audio(int naudioindev, int *audioindev, int nchindev,
- int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
- int *choutdev, int rate); /* IOhannes */
-
-static void oss_close_audio(void);
-static int oss_send_dacs(void);
-static void oss_reportidle(void);
-
-#ifdef ALSA
-typedef int16_t t_alsa_sample16;
-typedef int32_t t_alsa_sample32;
-#define ALSA_SAMPLEWIDTH_16 sizeof(t_alsa_sample16)
-#define ALSA_SAMPLEWIDTH_32 sizeof(t_alsa_sample32)
-#define ALSA_XFERSIZE16 (signed int)(sizeof(t_alsa_sample16) * DACBLKSIZE)
-#define ALSA_XFERSIZE32 (signed int)(sizeof(t_alsa_sample32) * DACBLKSIZE)
-#define ALSA_MAXDEV 1
-#define ALSA_JITTER 1024
-#define ALSA_EXTRABUFFER 2048
-#define ALSA_DEFFRAGSIZE 64
-#define ALSA_DEFNFRAG 12
-
-#ifdef ALSA99
-typedef struct _alsa_dev
-{
- snd_pcm_t *handle;
- snd_pcm_channel_info_t info;
- snd_pcm_channel_setup_t setup;
-} t_alsa_dev;
-
-t_alsa_dev alsa_device[ALSA_MAXDEV];
-static int n_alsa_dev;
-static char *alsa_buf;
-static int alsa_samplewidth;
-#endif /* ALSA99 */
-
-#ifdef ALSA01
-typedef struct _alsa_dev
-{
- snd_pcm_t *inhandle;
- snd_pcm_t *outhandle;
-} t_alsa_dev;
-
-t_alsa_dev alsa_device;
-static short *alsa_buf;
-static int alsa_samplewidth;
-static snd_pcm_status_t* in_status;
-static snd_pcm_status_t* out_status;
-#endif /* ALSA01 */
-
-#if 0 /* early alsa 0.9 beta dists had different names for these: */
-#define SND_PCM_ACCESS_RW_INTERLEAVED SNDRV_PCM_ACCESS_RW_INTERLEAVED
-#define SND_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32
-#define SND_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16
-#define SND_PCM_SUBFORMAT_STD SNDRV_PCM_SUBFORMAT_STD
-#endif
-
-static int alsa_mode;
-static int alsa_open_audio(int inchans, int outchans, int rate);
-static void alsa_close_audio(void);
-static int alsa_send_dacs(void);
-static void alsa_set_params(t_alsa_dev *dev, int dir, int rate, int voices);
-static void alsa_reportidle(void);
-#endif /* ALSA */
-
-#ifdef RME_HAMMERFALL
-static int rme9652_open_audio(int inchans, int outchans, int rate);
-static void rme9652_close_audio(void);
-static int rme9652_send_dacs(void);
-static void rme9652_reportidle(void);
-#endif /* RME_HAMMERFALL */
-
-/* Defines */
-#define DEBUG(x) x
-#define DEBUG2(x) {x;}
-
-#define OSS_MAXCHPERDEV 32 /* max channels per OSS device */
-#define OSS_MAXDEV 4 /* maximum number of input or output devices */
-#define OSS_DEFFRAGSIZE 256 /* default log fragment size (frames) */
-#define OSS_DEFAUDIOBUF 40000 /* default audiobuffer, microseconds */
-#define OSS_DEFAULTCH 2
-#define RME_DEFAULTCH 8 /* need this even if RME undefined */
-typedef int16_t t_oss_int16;
-typedef int32_t t_oss_int32;
-#define OSS_MAXSAMPLEWIDTH sizeof(t_oss_int32)
-#define OSS_BYTESPERCHAN(width) (DACBLKSIZE * (width))
-#define OSS_XFERSAMPS(chans) (DACBLKSIZE* (chans))
-#define OSS_XFERSIZE(chans, width) (DACBLKSIZE * (chans) * (width))
-
-#ifdef RME_HAMMERFALL
-typedef int32_t t_rme_sample;
-#define RME_SAMPLEWIDTH sizeof(t_rme_sample)
-#define RME_BYTESPERCHAN (DACBLKSIZE * RME_SAMPLEWIDTH)
-#endif /* RME_HAMMERFALL */
-
-/* GLOBALS */
-static int linux_whichapi = API_OSS;
-static int linux_inchannels;
-static int linux_outchannels;
-static int linux_advance_samples; /* scheduler advance in samples */
-static int linux_meters; /* true if we're metering */
-static float linux_inmax; /* max input amplitude */
-static float linux_outmax; /* max output amplitude */
-static int linux_fragsize = 0; /* for block mode; block size (sample frames) */
-static int linux_nfragment = 0; /* ... and number of blocks. */
-
-#ifdef ALSA99
-static int alsa_devno = 1;
-#endif
-#ifdef ALSA01
-static char alsa_devname[512] = "hw:0,0";
-static int alsa_use_plugin = 0;
-#endif
-
-/* our device handles */
-
-typedef struct _oss_dev
-{
- int d_fd;
- unsigned int d_space; /* bytes available for writing/reading */
- int d_bufsize; /* total buffer size in blocks for this device */
- int d_dropcount; /* # of buffers to drop for resync (output only) */
- unsigned int d_nchannels; /* number of channels for this device */
- unsigned int d_bytespersamp; /* bytes per sample (2 for 16 bit, 4 for 32) */
-} t_oss_dev;
-
-static t_oss_dev linux_dacs[OSS_MAXDEV];
-static t_oss_dev linux_adcs[OSS_MAXDEV];
-static int linux_noutdevs = 0;
-static int linux_nindevs = 0;
-
- /* exported variables */
-int sys_schedadvance = OSS_DEFAUDIOBUF; /* scheduler advance in microsecs */
-float sys_dacsr;
-int sys_hipriority = 0;
-t_sample *sys_soundout;
-t_sample *sys_soundin;
-
- /* OSS-specific private variables */
-static int oss_blockmode = 1; /* flag to use "blockmode" */
-static int oss_32bit = 0; /* allow 23 bit transfers in OSS */
-static char ossdsp[] = "/dev/dsp%d";
-
-#ifndef INT32_MAX
-#define INT32_MAX 0x7fffffff
-#endif
- /* don't assume we can turn all 31 bits when doing float-to-fix;
- otherwise some audio drivers (e.g. Midiman/ALSA) wrap around. */
-#define FMAX 0x7ffff000
-#define CLIP32(x) (((x)>FMAX)?FMAX:((x) < -FMAX)?-FMAX:(x))
-
-
-/* ------------- private routines for all APIS ------------------- */
-
-static void linux_flush_all_underflows_to_zero(void)
-{
-/*
- TODO: Implement similar thing for linux (GGeiger)
-
- One day we will figure this out, I hope, because it
- costs CPU time dearly on Intel - LT
- */
- /* union fpc_csr f;
- f.fc_word = get_fpc_csr();
- f.fc_struct.flush = 1;
- set_fpc_csr(f.fc_word);
- */
-}
-
- /* set sample rate and channels. Must set sample rate before "configuring"
- any devices so we know scheduler advance in samples. */
-
-static void linux_setsr(int sr)
-{
- sys_dacsr = sr;
- linux_advance_samples = (sys_schedadvance * sys_dacsr) / (1000000.);
- if (linux_advance_samples < 3 * DACBLKSIZE)
- linux_advance_samples = 3 * DACBLKSIZE;
-}
-
-static void linux_setch(int chin, int chout)
-{
- int nblk;
- int inbytes = chin * (DACBLKSIZE*sizeof(float));
- int outbytes = chout * (DACBLKSIZE*sizeof(float));
-
- linux_inchannels = chin;
- linux_outchannels = chout;
- if (sys_soundin)
- free(sys_soundin);
- sys_soundin = (t_float *)malloc(inbytes);
- memset(sys_soundin, 0, inbytes);
-
- if (sys_soundout)
- free(sys_soundout);
- sys_soundout = (t_float *)malloc(outbytes);
- memset(sys_soundout, 0, outbytes);
-
- if (sys_verbose)
- post("input channels = %d, output channels = %d",
- linux_inchannels, linux_outchannels);
-}
-
-/* ---------------- MIDI routines -------------------------- */
-
-static int oss_nmidiin;
-static int oss_midiinfd[MAXMIDIINDEV];
-static int oss_nmidiout;
-static int oss_midioutfd[MAXMIDIOUTDEV];
-
-static void oss_midiout(int fd, int n)
-{
- char b = n;
- if ((write(fd, (char *) &b, 1)) != 1)
- perror("midi write");
-}
-
-#define O_MIDIFLAG O_NDELAY
-
-void linux_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
-{
- int i;
- for (i = 0; i < nmidiout; i++)
- oss_midioutfd[i] = -1;
- for (i = 0, oss_nmidiin = 0; i < nmidiin; i++)
- {
- int fd = -1, j, outdevindex = -1;
- char namebuf[80];
- int devno = midiinvec[i];
-
- for (j = 0; j < nmidiout; j++)
- if (midioutvec[j] == midiinvec[i])
- outdevindex = j;
-
- /* try to open the device for read/write. */
- if (devno == 1 && fd < 0 && outdevindex >= 0)
- {
- sys_setalarm(1000000);
- fd = open("/dev/midi", O_RDWR | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr,
- "device 1: tried /dev/midi READ/WRITE; returned %d\n", fd);
- if (outdevindex >= 0 && fd >= 0)
- oss_midioutfd[outdevindex] = fd;
- }
- if (fd < 0 && outdevindex >= 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%2.2d", devno-1);
- fd = open(namebuf, O_RDWR | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr,
- "device %d: tried %s READ/WRITE; returned %d\n",
- devno, namebuf, fd);
- if (outdevindex >= 0 && fd >= 0)
- oss_midioutfd[outdevindex] = fd;
- }
- if (fd < 0 && outdevindex >= 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%d", devno-1);
- fd = open(namebuf, O_RDWR | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s READ/WRITE; returned %d\n",
- devno, namebuf, fd);
- if (outdevindex >= 0 && fd >= 0)
- oss_midioutfd[outdevindex] = fd;
- }
- if (devno == 1 && fd < 0)
- {
- sys_setalarm(1000000);
- fd = open("/dev/midi", O_RDONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr,
- "device 1: tried /dev/midi READONLY; returned %d\n", fd);
- }
- if (fd < 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%2.2d", devno-1);
- fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s READONLY; returned %d\n",
- devno, namebuf, fd);
- }
- if (fd < 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%d", devno-1);
- fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s READONLY; returned %d\n",
- devno, namebuf, fd);
- }
- if (fd >= 0)
- oss_midiinfd[oss_nmidiin++] = fd;
- else post("couldn't open MIDI input device %d", devno);
- }
- for (i = 0, oss_nmidiout = 0; i < nmidiout; i++)
- {
- int fd = oss_midioutfd[i];
- char namebuf[80];
- int devno = midioutvec[i];
- if (devno == 1 && fd < 0)
- {
- sys_setalarm(1000000);
- fd = open("/dev/midi", O_WRONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr,
- "device 1: tried /dev/midi WRITEONLY; returned %d\n", fd);
- }
- if (fd < 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%2.2d", devno-1);
- fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n",
- devno, namebuf, fd);
- }
- if (fd < 0)
- {
- sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%d", devno-1);
- fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
- if (sys_verbose)
- fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n",
- devno, namebuf, fd);
- }
- if (fd >= 0)
- oss_midioutfd[oss_nmidiout++] = fd;
- else post("couldn't open MIDI output device %d", devno);
- }
-
- if (oss_nmidiin < nmidiin || oss_nmidiout < nmidiout || sys_verbose)
- post("opened %d MIDI input device(s) and %d MIDI output device(s).",
- oss_nmidiin, oss_nmidiout);
-}
-
-#define md_msglen(x) (((x)<0xC0)?2:((x)<0xE0)?1:((x)<0xF0)?2:\
- ((x)==0xF2)?2:((x)<0xF4)?1:0)
-
-void sys_putmidimess(int portno, int a, int b, int c)
-{
- if (portno >= 0 && portno < oss_nmidiout)
- {
- switch (md_msglen(a))
- {
- case 2:
- oss_midiout(oss_midioutfd[portno],a);
- oss_midiout(oss_midioutfd[portno],b);
- oss_midiout(oss_midioutfd[portno],c);
- return;
- case 1:
- oss_midiout(oss_midioutfd[portno],a);
- oss_midiout(oss_midioutfd[portno],b);
- return;
- case 0:
- oss_midiout(oss_midioutfd[portno],a);
- return;
- };
- }
-}
-
-void sys_putmidibyte(int portno, int byte)
-{
- if (portno >= 0 && portno < oss_nmidiout)
- oss_midiout(oss_midioutfd[portno], byte);
-}
-
-#if 0 /* this is the "select" version which doesn't work with OSS
- driver for emu10k1 (it doesn't implement select.) */
-void sys_poll_midi(void)
-{
- int i, throttle = 100;
- struct timeval timout;
- int did = 1, maxfd = 0;
- while (did)
- {
- fd_set readset, writeset, exceptset;
- did = 0;
- if (throttle-- < 0)
- break;
- timout.tv_sec = 0;
- timout.tv_usec = 0;
-
- FD_ZERO(&writeset);
- FD_ZERO(&readset);
- FD_ZERO(&exceptset);
- for (i = 0; i < oss_nmidiin; i++)
- {
- if (oss_midiinfd[i] > maxfd)
- maxfd = oss_midiinfd[i];
- FD_SET(oss_midiinfd[i], &readset);
- }
- select(maxfd+1, &readset, &writeset, &exceptset, &timout);
- for (i = 0; i < oss_nmidiin; i++)
- if (FD_ISSET(oss_midiinfd[i], &readset))
- {
- char c;
- int ret = read(oss_midiinfd[i], &c, 1);
- if (ret <= 0)
- fprintf(stderr, "Midi read error\n");
- else sys_midibytein(i, (c & 0xff));
- did = 1;
- }
- }
-}
-#else
-
- /* this version uses the asynchronous "read()" ... */
-void sys_poll_midi(void)
-{
- int i, throttle = 100;
- struct timeval timout;
- int did = 1, maxfd = 0;
- while (did)
- {
- fd_set readset, writeset, exceptset;
- did = 0;
- if (throttle-- < 0)
- break;
- for (i = 0; i < oss_nmidiin; i++)
- {
- char c;
- int ret = read(oss_midiinfd[i], &c, 1);
- if (ret < 0)
- {
- if (errno != EAGAIN)
- perror("MIDI");
- }
- else if (ret != 0)
- {
- sys_midibytein(i, (c & 0xff));
- did = 1;
- }
- }
- }
-}
-#endif
-
-void linux_close_midi()
-{
- int i;
- for (i = 0; i < oss_nmidiin; i++)
- close(oss_midiinfd[i]);
- for (i = 0; i < oss_nmidiout; i++)
- close(oss_midioutfd[i]);
- oss_nmidiin = oss_nmidiout = 0;
-}
-
-#define MAXAUDIODEV 4
-#define DEFAULTINDEV 1
-#define DEFAULTOUTDEV 1
-
-/* ----------------------- public routines ----------------------- */
-void sys_listdevs( void)
-{
- post("device listing not implemented in Linux yet\n");
-}
-
-void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
- int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
- int *choutdev, int rate)
-{ /* IOhannes */
- int i, *ip;
- int defaultchannels =
- (linux_whichapi == API_RME ? RME_DEFAULTCH : OSS_DEFAULTCH);
- if (rate < 1)
- rate=44100;
-
- if (naudioindev == -1)
- { /* not set */
- if (nchindev==-1)
- {
- nchindev=1;
- chindev[0]=defaultchannels;
- naudioindev=1;
- audioindev[0] = DEFAULTINDEV;
- }
- else
- {
- for (i = 0; i < MAXAUDIODEV; i++)
- audioindev[i]=i+1;
- naudioindev = nchindev;
- }
- }
- else
- {
- if (nchindev == -1)
- {
- nchindev = naudioindev;
- for (i = 0; i < naudioindev; i++)
- chindev[i] = defaultchannels;
- }
- else if (nchindev > naudioindev)
- {
- for (i = naudioindev; i < nchindev; i++)
- {
- if (i == 0)
- audioindev[0] = DEFAULTINDEV;
- else audioindev[i] = audioindev[i-1] + 1;
- }
- naudioindev = nchindev;
- }
- else if (nchindev < naudioindev)
- {
- for (i = nchindev; i < naudioindev; i++)
- {
- if (i == 0)
- chindev[0] = defaultchannels;
- else chindev[i] = chindev[i-1];
- }
- naudioindev = nchindev;
- }
- }
-
- if (naudiooutdev == -1)
- { /* not set */
- if (nchoutdev==-1)
- {
- nchoutdev=1;
- choutdev[0]=defaultchannels;
- naudiooutdev=1;
- audiooutdev[0] = DEFAULTOUTDEV;
- }
- else
- {
- for (i = 0; i < MAXAUDIODEV; i++)
- audiooutdev[i] = i+1;
- naudiooutdev = nchoutdev;
- }
- }
- else
- {
- if (nchoutdev == -1)
- {
- nchoutdev = naudiooutdev;
- for (i = 0; i < naudiooutdev; i++)
- choutdev[i] = defaultchannels;
- }
- else if (nchoutdev > naudiooutdev)
- {
- for (i = naudiooutdev; i < nchoutdev; i++)
- {
- if (i == 0)
- audiooutdev[0] = DEFAULTOUTDEV;
- else audiooutdev[i] = audiooutdev[i-1] + 1;
- }
- naudiooutdev = nchoutdev;
- }
- else if (nchoutdev < naudiooutdev)
- {
- for (i = nchoutdev; i < naudiooutdev; i++)
- {
- if (i == 0)
- choutdev[0] = defaultchannels;
- else choutdev[i] = choutdev[i-1];
- }
- naudiooutdev = nchoutdev;
- }
- }
-
- linux_flush_all_underflows_to_zero();
-#ifdef ALSA
- if (linux_whichapi == API_ALSA)
- alsa_open_audio((naudioindev > 0 ? chindev[0] : 0),
- (naudiooutdev > 0 ? choutdev[0] : 0), rate);
- else
-#endif
-#ifdef RME_HAMMERFALL
- if (linux_whichapi == API_RME)
- rme9652_open_audio((naudioindev > 0 ? chindev[0] : 0),
- (naudiooutdev > 0 ? choutdev[0] : 0), rate);
- else
-#endif
- oss_open_audio(naudioindev, audioindev, nchindev, chindev,
- naudiooutdev, audiooutdev, nchoutdev, choutdev, rate);
-}
-
-void sys_close_audio(void)
-{
- /* set timeout to avoid hanging close() call */
-
- sys_setalarm(1000000);
-
-#ifdef ALSA
- if (linux_whichapi == API_ALSA)
- alsa_close_audio();
- else
-#endif
-#ifdef RME_HAMMERFALL
- if (linux_whichapi == API_RME)
- rme9652_close_audio();
- else
-#endif
- oss_close_audio();
-
- sys_setalarm(0);
-}
-
-void sys_open_midi(int nmidiin, int *midiinvec,
- int nmidiout, int *midioutvec)
-{
- linux_open_midi(nmidiin, midiinvec, nmidiout, midioutvec);
-}
-
-void sys_close_midi( void)
-{
- sys_setalarm(1000000);
- linux_close_midi();
- sys_setalarm(0);
-}
-
-int sys_send_dacs(void)
-{
- if (linux_meters)
- {
- int i, n;
- float maxsamp;
- for (i = 0, n = linux_inchannels * DACBLKSIZE, maxsamp = linux_inmax;
- i < n; i++)
- {
- float f = sys_soundin[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- linux_inmax = maxsamp;
- for (i = 0, n = linux_outchannels * DACBLKSIZE, maxsamp = linux_outmax;
- i < n; i++)
- {
- float f = sys_soundout[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- linux_outmax = maxsamp;
- }
-#ifdef ALSA
- if (linux_whichapi == API_ALSA)
- return alsa_send_dacs();
-#endif
-#ifdef RME_HAMMERFALL
- if (linux_whichapi == API_RME)
- return rme9652_send_dacs();
-#endif
- return oss_send_dacs();
-}
-
-float sys_getsr(void)
-{
- return (sys_dacsr);
-}
-
-int sys_get_outchannels(void)
-{
- return (linux_outchannels);
-}
-
-int sys_get_inchannels(void)
-{
- return (linux_inchannels);
-}
-
-void sys_audiobuf(int n)
-{
- /* set the size, in milliseconds, of the audio FIFO */
- if (n < 5) n = 5;
- else if (n > 5000) n = 5000;
- sys_schedadvance = n * 1000;
-}
-
-void sys_getmeters(float *inmax, float *outmax)
-{
- if (inmax)
- {
- linux_meters = 1;
- *inmax = linux_inmax;
- *outmax = linux_outmax;
- }
- else
- linux_meters = 0;
- linux_inmax = linux_outmax = 0;
-}
-
-void sys_reportidle(void)
-{
-}
-
-void sys_set_priority(int higher)
-{
- struct sched_param par;
- int p1 ,p2, p3;
-#ifdef _POSIX_PRIORITY_SCHEDULING
-
- p1 = sched_get_priority_min(SCHED_FIFO);
- p2 = sched_get_priority_max(SCHED_FIFO);
- p3 = (higher ? p2 - 1 : p2 - 3);
- par.sched_priority = p3;
-
- if (sched_setscheduler(0,SCHED_FIFO,&par) != -1)
- fprintf(stderr, "priority %d scheduling enabled.\n", p3);
-#endif
-
-#ifdef _POSIX_MEMLOCK
- if (mlockall(MCL_FUTURE) != -1)
- fprintf(stderr, "memory locking enabled.\n");
-#endif
-}
-
-void sys_setblocksize(int n)
-{
- if (n < 1)
- n = 1;
- linux_fragsize = n;
- oss_blockmode = 1;
-}
-
-/* ------------ linux-specific command-line flags -------------- */
-
-void linux_setfrags(int n)
-{
- linux_nfragment = n;
- oss_blockmode = 1;
-}
-
-void linux_streammode( void)
-{
- oss_blockmode = 0;
-}
-
-void linux_32bit( void)
-{
- oss_32bit = 1;
-}
-
-void linux_set_sound_api(int which)
-{
- linux_whichapi = which;
- if (sys_verbose)
- post("linux_whichapi %d", linux_whichapi);
-}
-
-#ifdef ALSA99
-void linux_alsa_devno(int devno)
-{
- alsa_devno = devno;
-}
-
-#endif
-
-#ifdef ALSA01
-void linux_alsa_devname(char *devname)
-{
- strncpy(alsa_devname, devname, 511);
-}
-
-void linux_alsa_use_plugin(int t)
-{
- if (t == 1)
- alsa_use_plugin = 1;
- else
- alsa_use_plugin = 0;
-}
-
-#endif
-
-/* -------------- Audio I/O using the OSS API ------------------ */
-
-typedef struct _multidev {
- int fd;
- int channels;
- int format;
-} t_multidev;
-
-int oss_reset(int fd) {
- int err;
- if ((err = ioctl(fd,SNDCTL_DSP_RESET)) < 0)
- error("OSS: Could not reset");
- return err;
-}
-
- /* The AFMT_S32_BLOCKED format is not defined in standard linux kernels
- but is proposed by Guenter Geiger to support extending OSS to handle
- 32 bit sample. This is user in Geiger's OSS driver for RME Hammerfall.
- I'm not clear why this isn't called AFMT_S32_[SLN]E... */
-
-#ifndef AFMT_S32_BLOCKED
-#define AFMT_S32_BLOCKED 0x0000400
-#endif
-
-void oss_configure(t_oss_dev *dev, int srate, int dac, int skipblocksize)
-{ /* IOhannes */
- int orig, param, nblk, fd = dev->d_fd, wantformat;
- int nchannels = dev->d_nchannels;
- int advwas = sys_schedadvance;
-
- audio_buf_info ainfo;
-
- /* IOhannes :
- * pd is very likely to crash if different formats are used on
- multiple soundcards
- */
-
- /* set resolution - first try 4 byte samples */
- if (oss_32bit && (ioctl(fd,SNDCTL_DSP_GETFMTS,&param) >= 0) &&
- (param & AFMT_S32_BLOCKED))
- {
- wantformat = AFMT_S32_BLOCKED;
- dev->d_bytespersamp = 4;
- }
- else
- {
- wantformat = AFMT_S16_NE;
- dev->d_bytespersamp = 2;
- }
- param = wantformat;
-
- if (sys_verbose)
- post("bytes per sample = %d", dev->d_bytespersamp);
- if (ioctl(fd, SNDCTL_DSP_SETFMT, &param) == -1)
- fprintf(stderr,"OSS: Could not set DSP format\n");
- else if (wantformat != param)
- fprintf(stderr,"OSS: DSP format: wanted %d, got %d\n",
- wantformat, param);
-
- /* sample rate */
- orig = param = srate;
- if (ioctl(fd, SNDCTL_DSP_SPEED, &param) == -1)
- fprintf(stderr,"OSS: Could not set sampling rate for device\n");
- else if( orig != param )
- fprintf(stderr,"OSS: sampling rate: wanted %d, got %d\n",
- orig, param );
-
- if (oss_blockmode && !skipblocksize)
- {
- int fragbytes, logfragsize, nfragment;
- /* setting fragment count and size. */
- if (linux_nfragment) /* if nfrags specified, take literally */
- {
- nfragment = linux_nfragment;
- if (!linux_fragsize)
- linux_fragsize = OSS_DEFFRAGSIZE;
- sys_schedadvance = ((nfragment * linux_fragsize) * 1.e6)
- / (float)srate;
- linux_setsr(srate);
- }
- else
- {
- if (!linux_fragsize)
- {
- linux_fragsize = OSS_DEFFRAGSIZE;
- while (linux_fragsize > DACBLKSIZE
- && linux_fragsize * 4 > linux_advance_samples)
- linux_fragsize = linux_fragsize/2;
- }
- /* post("adv_samples %d", linux_advance_samples); */
- nfragment = (sys_schedadvance * (44100. * 1.e-6)) / linux_fragsize;
- }
- fragbytes = linux_fragsize * (dev->d_bytespersamp * nchannels);
- logfragsize = ilog2(fragbytes);
-
- if (fragbytes != (1 << logfragsize))
- post("warning: OSS takes only power of 2 blocksize; using %d",
- (1 << logfragsize)/(dev->d_bytespersamp * nchannels));
- if (sys_verbose)
- post("setting nfrags = %d, fragsize %d\n", nfragment, fragbytes);
-
- param = orig = (nfragment<<16) + logfragsize;
- if (ioctl(fd,SNDCTL_DSP_SETFRAGMENT, &param) == -1)
- error("OSS: Could not set or read fragment size\n");
- if (param != orig)
- {
- nfragment = ((param >> 16) & 0xffff);
- logfragsize = (param & 0xffff);
- post("warning: actual fragments %d, blocksize %d",
- nfragment, (1 << logfragsize));
- }
- if (sys_verbose)
- post("audiobuffer set to %d msec", (int)(0.001 * sys_schedadvance));
- }
-
- if (dac)
- {
- /* use "free space" to learn the buffer size. Normally you
- should set this to your own desired value; but this seems not
- to be implemented uniformly across different sound cards. LATER
- we should figure out what to do if the requested scheduler advance
- is greater than this buffer size; for now, we just print something
- out. */
-
- int defect;
- if (ioctl(fd, SOUND_PCM_GETOSPACE,&ainfo) < 0)
- fprintf(stderr,"OSS: ioctl on output device failed");
- dev->d_bufsize = ainfo.bytes;
-
- defect = linux_advance_samples * (dev->d_bytespersamp * nchannels)
- - dev->d_bufsize - OSS_XFERSIZE(nchannels, dev->d_bytespersamp);
- if (defect > 0)
- {
- if (sys_verbose || defect > (dev->d_bufsize >> 2))
- fprintf(stderr,
- "OSS: requested audio buffer size %d limited to %d\n",
- linux_advance_samples * (dev->d_bytespersamp * nchannels),
- dev->d_bufsize);
- linux_advance_samples =
- (dev->d_bufsize - OSS_XFERSAMPS(nchannels)) /
- (dev->d_bytespersamp *nchannels);
- }
- }
-}
-
-static int oss_setchannels(int fd, int wantchannels, char *devname)
-{ /* IOhannes */
- int param = wantchannels;
-
- while (param>1) {
- int save = param;
- if (ioctl(fd, SNDCTL_DSP_CHANNELS, &param) == -1) {
- error("OSS: SNDCTL_DSP_CHANNELS failed %s",devname);
- } else {
- if (param == save) return (param);
- }
- param=save-1;
- }
-
- return (0);
-}
-
-#define O_AUDIOFLAG 0 /* O_NDELAY */
-
-int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
- int noutdev, int *outdev, int nchout, int *chout, int rate)
-{ /* IOhannes */
- int capabilities = 0;
- int inchannels = 0, outchannels = 0;
- char devname[20];
- int n, i, fd;
- char buf[OSS_MAXSAMPLEWIDTH * DACBLKSIZE * OSS_MAXCHPERDEV];
- int num_devs = 0;
- int wantmore=0;
- int spread = 0;
- audio_buf_info ainfo;
-
- linux_nindevs = linux_noutdevs = 0;
-
- /* set logical sample rate amd calculate linux_advance_samples. */
- linux_setsr(rate);
-
- /* mark input devices unopened */
- for (i = 0; i < OSS_MAXDEV; i++)
- linux_adcs[i].d_fd = -1;
-
- /* open output devices */
- wantmore=0;
- if (noutdev < 0 || nindev < 0)
- bug("linux_open_audio");
-
- for (n = 0; n < noutdev; n++)
- {
- int gotchans, j, inindex = -1;
- int thisdevice=outdev[n];
- int wantchannels = (nchout>n) ? chout[n] : wantmore;
- fd = -1;
- if (!wantchannels)
- goto end_out_loop;
-
- if (thisdevice > 1)
- sprintf(devname, "/dev/dsp%d", thisdevice-1);
- else sprintf(devname, "/dev/dsp");
-
- /* search for input request for same device. Succeed only
- if the number of channels matches. */
- for (j = 0; j < nindev; j++)
- if (indev[j] == thisdevice && chin[j] == wantchannels)
- inindex = j;
-
- /* if the same device is requested for input and output,
- try to open it read/write */
- if (inindex >= 0)
- {
- sys_setalarm(1000000);
- if ((fd = open(devname, O_RDWR | O_AUDIOFLAG)) == -1)
- {
- post("%s (read/write): %s", devname, strerror(errno));
- post("(now will try write-only...)");
- }
- else
- {
- if (sys_verbose)
- post("opened %s for reading and writing\n", devname);
- linux_adcs[inindex].d_fd = fd;
- }
- }
- /* if that didn't happen or if it failed, try write-only */
- if (fd == -1)
- {
- sys_setalarm(1000000);
- if ((fd = open(devname, O_WRONLY | O_AUDIOFLAG)) == -1)
- {
- post("%s (writeonly): %s",
- devname, strerror(errno));
- break;
- }
- if (sys_verbose)
- post("opened %s for writing only\n", devname);
- }
- if (ioctl(fd, SNDCTL_DSP_GETCAPS, &capabilities) == -1)
- error("OSS: SNDCTL_DSP_GETCAPS failed %s", devname);
-
- gotchans = oss_setchannels(fd,
- (wantchannels>OSS_MAXCHPERDEV)?OSS_MAXCHPERDEV:wantchannels,
- devname);
-
- if (sys_verbose)
- post("opened audio output on %s; got %d channels",
- devname, gotchans);
-
- if (gotchans < 2)
- {
- /* can't even do stereo? just give up. */
- close(fd);
- }
- else
- {
- linux_dacs[linux_noutdevs].d_nchannels = gotchans;
- linux_dacs[linux_noutdevs].d_fd = fd;
- oss_configure(linux_dacs+linux_noutdevs, rate, 1, 0);
-
- linux_noutdevs++;
- outchannels += gotchans;
- if (inindex >= 0)
- {
- linux_adcs[inindex].d_nchannels = gotchans;
- chin[inindex] = gotchans;
- }
- }
- /* LATER think about spreading large numbers of channels over
- various dsp's and vice-versa */
- wantmore = wantchannels - gotchans;
- end_out_loop: ;
- }
-
- /* open input devices */
- wantmore = 0;
- if (nindev==-1)
- nindev=4; /* spread channels over default-devices */
- for (n = 0; n < nindev; n++)
- {
- int gotchans=0;
- int thisdevice=indev[n];
- int wantchannels = (nchin>n)?chin[n]:wantmore;
- int alreadyopened = 0;
- if (!wantchannels)
- goto end_in_loop;
-
- if (thisdevice > 1)
- sprintf(devname, "/dev/dsp%d", thisdevice - 1);
- else sprintf(devname, "/dev/dsp");
-
- sys_setalarm(1000000);
-
- /* perhaps it's already open from the above? */
- if (linux_dacs[n].d_fd >= 0)
- {
- fd = linux_dacs[n].d_fd;
- alreadyopened = 1;
- }
- else
- {
- /* otherwise try to open it here. */
- if ((fd = open(devname, O_RDONLY | O_AUDIOFLAG)) == -1)
- {
- post("%s (readonly): %s", devname, strerror(errno));
- goto end_in_loop;
- }
- if (sys_verbose)
- post("opened %s for reading only\n", devname);
- }
- linux_adcs[linux_nindevs].d_fd = fd;
- gotchans = oss_setchannels(fd,
- (wantchannels>OSS_MAXCHPERDEV)?OSS_MAXCHPERDEV:wantchannels,
- devname);
- if (sys_verbose)
- post("opened audio input device %s; got %d channels",
- devname, gotchans);
-
- if (gotchans < 1)
- {
- close(fd);
- goto end_in_loop;
- }
-
- linux_adcs[linux_nindevs].d_nchannels = gotchans;
-
- oss_configure(linux_adcs+linux_nindevs, rate, 0, alreadyopened);
-
- inchannels += gotchans;
- linux_nindevs++;
-
- wantmore = wantchannels-gotchans;
- /* LATER think about spreading large numbers of channels over
- various dsp's and vice-versa */
- end_in_loop: ;
- }
-
- linux_setch(inchannels, outchannels);
-
- /* We have to do a read to start the engine. This is
- necessary because sys_send_dacs waits until the input
- buffer is filled and only reads on a filled buffer.
- This is good, because it's a way to make sure that we
- will not block. But I wonder why we only have to read
- from one of the devices and not all of them??? */
-
- if (linux_nindevs)
- {
- if (sys_verbose)
- fprintf(stderr,("OSS: issuing first ADC 'read' ... "));
- read(linux_adcs[0].d_fd, buf,
- linux_adcs[0].d_bytespersamp *
- linux_adcs[0].d_nchannels * DACBLKSIZE);
- if (sys_verbose)
- fprintf(stderr, "...done.\n");
- }
- sys_setalarm(0);
- return (0);
-}
-
-void oss_close_audio( void)
-{
- int i;
- for (i=0;i<linux_nindevs;i++)
- close(linux_adcs[i].d_fd);
-
- for (i=0;i<linux_noutdevs;i++)
- close(linux_dacs[i].d_fd);
-
- linux_nindevs = linux_noutdevs = 0;
-}
-
-static int linux_dacs_write(int fd,void* buf,long bytes)
-{
- return write(fd, buf, bytes);
-}
-
-static int linux_adcs_read(int fd,void* buf,long bytes)
-{
- return read(fd, buf, bytes);
-}
-
- /* query audio devices for "available" data size. */
-static void oss_calcspace(void)
-{
- int dev;
- audio_buf_info ainfo;
- for (dev=0; dev < linux_noutdevs; dev++)
- {
- if (ioctl(linux_dacs[dev].d_fd, SOUND_PCM_GETOSPACE, &ainfo) < 0)
- fprintf(stderr,"OSS: ioctl on output device %d failed",dev);
- linux_dacs[dev].d_space = ainfo.bytes;
- }
-
- for (dev = 0; dev < linux_nindevs; dev++)
- {
- if (ioctl(linux_adcs[dev].d_fd, SOUND_PCM_GETISPACE,&ainfo) < 0)
- fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed",
- dev, linux_adcs[dev].d_fd);
- linux_adcs[dev].d_space = ainfo.bytes;
- }
-}
-
-void linux_audiostatus(void)
-{
- int dev;
- if (!oss_blockmode)
- {
- oss_calcspace();
- for (dev=0; dev < linux_noutdevs; dev++)
- fprintf(stderr, "dac %d space %d\n", dev, linux_dacs[dev].d_space);
-
- for (dev = 0; dev < linux_nindevs; dev++)
- fprintf(stderr, "adc %d space %d\n", dev, linux_adcs[dev].d_space);
-
- }
-}
-
-/* this call resyncs audio output and input which will cause discontinuities
-in audio output and/or input. */
-
-static void oss_doresync( void)
-{
- int dev, zeroed = 0, wantsize;
- char buf[OSS_MAXSAMPLEWIDTH * DACBLKSIZE * OSS_MAXCHPERDEV];
- audio_buf_info ainfo;
-
- /* 1. if any input devices are ahead (have more than 1 buffer stored),
- drop one or more buffers worth */
- for (dev = 0; dev < linux_nindevs; dev++)
- {
- if (linux_adcs[dev].d_space == 0)
- {
- linux_adcs_read(linux_adcs[dev].d_fd, buf,
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp));
- }
- else while (linux_adcs[dev].d_space >
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp))
- {
- linux_adcs_read(linux_adcs[dev].d_fd, buf,
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp));
- if (ioctl(linux_adcs[dev].d_fd, SOUND_PCM_GETISPACE, &ainfo) < 0)
- {
- fprintf(stderr, "OSS: ioctl on input device %d, fd %d failed",
- dev, linux_adcs[dev].d_fd);
- break;
- }
- linux_adcs[dev].d_space = ainfo.bytes;
- }
- }
-
- /* 2. if any output devices are behind, feed them zeros to catch them
- up */
- for (dev = 0; dev < linux_noutdevs; dev++)
- {
- while (linux_dacs[dev].d_space > linux_dacs[dev].d_bufsize -
- linux_advance_samples * (linux_dacs[dev].d_nchannels *
- linux_dacs[dev].d_bytespersamp))
- {
- if (!zeroed)
- {
- unsigned int i;
- for (i = 0; i < OSS_XFERSAMPS(linux_dacs[dev].d_nchannels);
- i++)
- buf[i] = 0;
- zeroed = 1;
- }
- linux_dacs_write(linux_dacs[dev].d_fd, buf,
- OSS_XFERSIZE(linux_dacs[dev].d_nchannels,
- linux_dacs[dev].d_bytespersamp));
- if (ioctl(linux_dacs[dev].d_fd, SOUND_PCM_GETOSPACE, &ainfo) < 0)
- {
- fprintf(stderr, "OSS: ioctl on output device %d, fd %d failed",
- dev, linux_dacs[dev].d_fd);
- break;
- }
- linux_dacs[dev].d_space = ainfo.bytes;
- }
- }
- /* 3. if any DAC devices are too far ahead, plan to drop the
- number of frames which will let the others catch up. */
- for (dev = 0; dev < linux_noutdevs; dev++)
- {
- if (linux_dacs[dev].d_space > linux_dacs[dev].d_bufsize -
- (linux_advance_samples - 1) * linux_dacs[dev].d_nchannels *
- linux_dacs[dev].d_bytespersamp)
- {
- linux_dacs[dev].d_dropcount = linux_advance_samples - 1 -
- (linux_dacs[dev].d_space - linux_dacs[dev].d_bufsize) /
- (linux_dacs[dev].d_nchannels *
- linux_dacs[dev].d_bytespersamp) ;
- }
- else linux_dacs[dev].d_dropcount = 0;
- }
-}
-
-int oss_send_dacs(void)
-{
- float *fp1, *fp2;
- long fill;
- int i, j, dev, rtnval = SENDDACS_YES;
- char buf[OSS_MAXSAMPLEWIDTH * DACBLKSIZE * OSS_MAXCHPERDEV];
- t_oss_int16 *sp;
- t_oss_int32 *lp;
- /* the maximum number of samples we should have in the ADC buffer */
- int idle = 0;
- int thischan;
- double timeref, timenow;
-
- if (!linux_nindevs && !linux_noutdevs)
- return (SENDDACS_NO);
-
- if (!oss_blockmode)
- {
- /* determine whether we're idle. This is true if either (1)
- some input device has less than one buffer to read or (2) some
- output device has fewer than (linux_advance_samples) blocks buffered
- already. */
- oss_calcspace();
-
- for (dev=0; dev < linux_noutdevs; dev++)
- if (linux_dacs[dev].d_dropcount ||
- (linux_dacs[dev].d_bufsize - linux_dacs[dev].d_space >
- linux_advance_samples * linux_dacs[dev].d_bytespersamp *
- linux_dacs[dev].d_nchannels))
- idle = 1;
- for (dev=0; dev < linux_nindevs; dev++)
- if (linux_adcs[dev].d_space <
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp))
- idle = 1;
- }
-
- if (idle && !oss_blockmode)
- {
- /* sometimes---rarely---when the ADC available-byte-count is
- zero, it's genuine, but usually it's because we're so
- late that the ADC has overrun its entire kernel buffer. We
- distinguish between the two by waiting 2 msec and asking again.
- There should be an error flag we could check instead; look for this
- someday... */
- for (dev = 0;dev < linux_nindevs; dev++)
- if (linux_adcs[dev].d_space == 0)
- {
- audio_buf_info ainfo;
- sys_microsleep(2000);
- oss_calcspace();
- if (linux_adcs[dev].d_space != 0) continue;
-
- /* here's the bad case. Give up and resync. */
- sys_log_error(ERR_DATALATE);
- oss_doresync();
- return (SENDDACS_NO);
- }
- /* check for slippage between devices, either because
- data got lost in the driver from a previous late condition, or
- because the devices aren't synced. When we're idle, no
- input device should have more than one buffer readable and
- no output device should have less than linux_advance_samples-1
- */
-
- for (dev=0; dev < linux_noutdevs; dev++)
- if (!linux_dacs[dev].d_dropcount &&
- (linux_dacs[dev].d_bufsize - linux_dacs[dev].d_space <
- (linux_advance_samples - 2) *
- (linux_dacs[dev].d_bytespersamp *
- linux_dacs[dev].d_nchannels)))
- goto badsync;
- for (dev=0; dev < linux_nindevs; dev++)
- if (linux_adcs[dev].d_space > 3 *
- OSS_XFERSIZE(linux_adcs[dev].d_nchannels,
- linux_adcs[dev].d_bytespersamp))
- goto badsync;
-
- /* return zero to tell the scheduler we're idle. */
- return (SENDDACS_NO);
- badsync:
- sys_log_error(ERR_RESYNC);
- oss_doresync();
- return (SENDDACS_NO);
-
- }
-
- /* do output */
-
- timeref = sys_getrealtime();
- for (dev=0, thischan = 0; dev < linux_noutdevs; dev++)
- {
- int nchannels = linux_dacs[dev].d_nchannels;
- if (linux_dacs[dev].d_dropcount)
- linux_dacs[dev].d_dropcount--;
- else
- {
- if (linux_dacs[dev].d_bytespersamp == 4)
- {
- for (i = DACBLKSIZE * nchannels, fp1 = sys_soundout +
- DACBLKSIZE*thischan,
- lp = (t_oss_int32 *)buf; i--; fp1++, lp++)
- {
- float f = *fp1 * 2147483648.;
- *lp = (f >= 2147483647. ? 2147483647. :
- (f < -2147483648. ? -2147483648. : f));
- }
- }
- else
- {
- for (i = DACBLKSIZE, fp1 = sys_soundout +
- DACBLKSIZE*thischan,
- sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels)
- {
- for (j=0, fp2 = fp1; j<nchannels; j++, fp2 += DACBLKSIZE)
- {
- int s = *fp2 * 32767.;
- if (s > 32767) s = 32767;
- else if (s < -32767) s = -32767;
- sp[j] = s;
- }
- }
- }
- linux_dacs_write(linux_dacs[dev].d_fd, buf,
- OSS_XFERSIZE(nchannels, linux_dacs[dev].d_bytespersamp));
- if ((timenow = sys_getrealtime()) - timeref > 0.002)
- {
- if (!oss_blockmode)
- sys_log_error(ERR_DACSLEPT);
- else rtnval = SENDDACS_SLEPT;
- }
- timeref = timenow;
- }
- thischan += nchannels;
- }
- memset(sys_soundout, 0,
- linux_outchannels * (sizeof(float) * DACBLKSIZE));
-
- /* do input */
-
- for (dev = 0, thischan = 0; dev < linux_nindevs; dev++)
- {
- int nchannels = linux_adcs[dev].d_nchannels;
- linux_adcs_read(linux_adcs[dev].d_fd, buf,
- OSS_XFERSIZE(nchannels, linux_adcs[dev].d_bytespersamp));
-
- if ((timenow = sys_getrealtime()) - timeref > 0.002)
- {
- if (!oss_blockmode)
- sys_log_error(ERR_ADCSLEPT);
- else
- rtnval = SENDDACS_SLEPT;
- }
- timeref = timenow;
-
- if (linux_adcs[dev].d_bytespersamp == 4)
- {
- for (i = DACBLKSIZE*nchannels,
- fp1 = sys_soundin + thischan*DACBLKSIZE,
- lp = (t_oss_int32 *)buf; i--; fp1++, lp++)
- {
- *fp1 = ((float)(*lp))*(float)(1./2147483648.);
- }
- }
- else
- {
- for (i = DACBLKSIZE,fp1 = sys_soundin + thischan*DACBLKSIZE,
- sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels)
- {
- for (j=0;j<linux_inchannels;j++)
- fp1[j*DACBLKSIZE] = (float)sp[j]*(float)3.051850e-05;
- }
- }
- thischan += nchannels;
- }
- if (thischan != linux_inchannels)
- bug("inchannels");
- return (rtnval);
-}
-
-/* ----------------- audio I/O using the ALSA native API ---------------- */
-
-#ifdef ALSA
-static void alsa_checkversion( void)
-{
- char snox[512];
- int fd, nbytes;
- if ((fd = open("/proc/asound/version", 0)) < 0 ||
- (nbytes = read(fd, snox, 511)) < 1)
- {
- perror("cannot check Alsa version -- /proc/asound/version");
- return;
- }
- snox[nbytes] = 0;
-#ifdef ALSA99
- if (!strstr(snox, "Version 0.5"))
- {
- fprintf(stderr,
-"warning: Pd compiled for Alsa version 0.5 appears to be incompatible with\n\
-the installed version of ALSA. Here is what I found in /proc/asound/version:\n"
- );
- fprintf(stderr, "%s", snox);
- }
-#else
- if (!strstr(snox, "Version 0.9"))
- {
- fprintf(stderr,
-"warning: Pd compiled for Alsa version 0.9 appears to be incompatible with\n\
-the installed version of ALSA. Here is what I found in /proc/asound/version:\n"
- );
- fprintf(stderr, "%s", snox);
- }
-#endif
-}
-#endif
-
-#ifdef ALSA99
-static int alsa_open_audio(int wantinchans, int wantoutchans,
- int srate)
-{
- int dir, voices, bsize;
- int err, id, rate, i;
- char *cardname;
- snd_ctl_hw_info_t hwinfo;
- snd_pcm_info_t pcminfo;
- snd_pcm_channel_info_t channelinfo;
- snd_ctl_t *handle;
- snd_pcm_sync_t sync;
-
- linux_inchannels = 0;
- linux_outchannels = 0;
-
- rate = 44100;
- alsa_samplewidth = 4; /* first try 4 byte samples */
-
- if (!wantinchans && !wantoutchans)
- return (1);
-
- alsa_checkversion();
- if (sys_verbose)
- {
- if ((err = snd_card_get_longname(alsa_devno-1, &cardname)) < 0)
- {
- fprintf(stderr, "PD-ALSA: unable to get name of card number %d\n",
- alsa_devno);
- return 1;
- }
- fprintf(stderr, "PD-ALSA: using card %s\n", cardname);
- free(cardname);
- }
-
- if ((err = snd_ctl_open(&handle, alsa_devno-1)) < 0)
- {
- fprintf(stderr, "PD-ALSA: unable to open control: %s\n",
- snd_strerror(err));
- return 1;
- }
-
- if ((err = snd_ctl_hw_info(handle, &hwinfo)) < 0)
- {
- fprintf(stderr, "PD-ALSA: unable to open get info: %s\n",
- snd_strerror(err));
- return 1;
- }
- if (hwinfo.pcmdevs < 1)
- {
- fprintf(stderr, "PD-ALSA: device %d doesn't support PCM\n",
- alsa_devno);
- snd_ctl_close(handle);
- return 1;
- }
-
- if ((err = snd_ctl_pcm_info(handle, 0, &pcminfo)) < 0)
- {
- fprintf(stderr, "PD-ALSA: unable to open get pcm info: %s\n",
- snd_strerror(err));
- snd_ctl_close(handle);
- return (1);
- }
- snd_ctl_close(handle);
-
- /* find out if opening for input, output, or both and check that the
- device can handle it. */
- if (wantinchans && wantoutchans)
- {
- if (!(pcminfo.flags & SND_PCM_INFO_DUPLEX))
- {
- fprintf(stderr, "PD-ALSA: device is not full duplex\n");
- return (1);
- }
- dir = SND_PCM_OPEN_DUPLEX;
- }
- else if (wantoutchans)
- {
- if (!(pcminfo.flags & SND_PCM_INFO_PLAYBACK))
- {
- fprintf(stderr, "PD-ALSA: device is not full duplex\n");
- return (1);
- }
- dir = SND_PCM_OPEN_PLAYBACK;
- }
- else
- {
- if (!(pcminfo.flags & SND_PCM_INFO_CAPTURE))
- {
- fprintf(stderr, "PD-ALSA: device is not full duplex\n");
- return (1);
- }
- dir = SND_PCM_OPEN_CAPTURE;
- }
-
- /* try to open the device */
- if ((err = snd_pcm_open(&alsa_device[0].handle, alsa_devno-1, 0, dir)) < 0)
- {
- fprintf(stderr, "PD-ALSA: error opening device: %s\n",
- snd_strerror(err));
- return (1);
- }
- /* get information from the handle */
- if (wantinchans)
- {
- channelinfo.channel = SND_PCM_CHANNEL_CAPTURE;
- channelinfo.subdevice = 0;
- if ((err = snd_pcm_channel_info(alsa_device[0].handle, &channelinfo))
- < 0)
- {
- fprintf(stderr, "PD-ALSA: snd_pcm_channel_info (input): %s\n",
- snd_strerror(err));
- return (1);
- }
- if (sys_verbose)
- post("input channels supported: %d-%d\n",
- channelinfo.min_voices, channelinfo.max_voices);
-
- if (wantinchans < channelinfo.min_voices)
- post("increasing input channels to minimum of %d\n",
- wantinchans = channelinfo.min_voices);
- if (wantinchans > channelinfo.max_voices)
- post("decreasing input channels to maximum of %d\n",
- wantinchans = channelinfo.max_voices);
- if (alsa_samplewidth == 4 &&
- !(channelinfo.formats & (1<<SND_PCM_SFMT_S32_LE)))
- {
- fprintf(stderr,
- "PD_ALSA: input doesn't support 32-bit samples; using 16\n");
- alsa_samplewidth = 2;
- }
- if (alsa_samplewidth == 2 &&
- !(channelinfo.formats & (1<<SND_PCM_SFMT_S16_LE)))
- {
- fprintf(stderr,
- "PD_ALSA: can't find 4 or 2 byte format; giving up\n");
- return (1);
- }
- }
-
- if (wantoutchans)
- {
- channelinfo.channel = SND_PCM_CHANNEL_PLAYBACK;
- channelinfo.subdevice = 0;
- if ((err = snd_pcm_channel_info(alsa_device[0].handle, &channelinfo))
- < 0)
- {
- fprintf(stderr, "PD-ALSA: snd_pcm_channel_info (output): %s\n",
- snd_strerror(err));
- return (1);
- }
- if (sys_verbose)
- post("output channels supported: %d-%d\n",
- channelinfo.min_voices, channelinfo.max_voices);
- if (wantoutchans < channelinfo.min_voices)
- post("increasing output channels to minimum of %d\n",
- wantoutchans = channelinfo.min_voices);
- if (wantoutchans > channelinfo.max_voices)
- post("decreasing output channels to maximum of %d\n",
- wantoutchans = channelinfo.max_voices);
- if (alsa_samplewidth == 4 &&
- !(channelinfo.formats & (1<<SND_PCM_SFMT_S32_LE)))
- {
- fprintf(stderr,
- "PD_ALSA: output doesn't support 32-bit samples; using 16\n");
- alsa_samplewidth = 2;
- }
- if (alsa_samplewidth == 2 &&
- !(channelinfo.formats & (1<<SND_PCM_SFMT_S16_LE)))
- {
- fprintf(stderr,
- "PD_ALSA: can't find 4 or 2 byte format; giving up\n");
- return (1);
- }
- }
-
- linux_setsr(rate);
- linux_setch(wantinchans, wantoutchans);
-
- if (wantinchans)
- alsa_set_params(&alsa_device[0], SND_PCM_CHANNEL_CAPTURE,
- srate, wantinchans);
- if (wantoutchans)
- alsa_set_params(&alsa_device[0], SND_PCM_CHANNEL_PLAYBACK,
- srate, wantoutchans);
-
- n_alsa_dev = 1;
-
- /* check that all is as we think it should be */
- for (i = 0; i < n_alsa_dev; i++)
- {
- /* We need to handle if the rate is not the same for all
- * devices. For now just hope. */
- rate = alsa_device[i].setup.format.rate;
-
- /* It turns out that this checking does not work on all of my cards
- * - in full duplex on my trident 4dwave the setup on the capture channel
- * shows a sampling rate of 0. This is not true on my ess solo1. Checking
- * the dac last helps the problem. All of this needs to be much smarter
- * anyway (last minute hack). A warning above is all I have time for.
- */
- if (rate != srate)
- {
- post("PD-ALSA: unable to obtain rate %i using %i", srate, rate);
- post("PD-ALSA: (despite this warning Pd might still work.)");
- }
- }
- bsize = alsa_samplewidth *
- (linux_inchannels > linux_outchannels ? linux_inchannels :
- linux_outchannels) * DACBLKSIZE;
- alsa_buf = malloc(bsize);
- if (!alsa_buf)
- return (1);
- memset(alsa_buf, 0, bsize);
- return 0;
-}
-
-void alsa_set_params(t_alsa_dev *dev, int dir, int rate, int voices)
-{
- int err;
- struct snd_pcm_channel_params params;
-
- memset(&dev->info, 0, sizeof(dev->info));
- dev->info.channel = dir;
- if ((err = snd_pcm_channel_info(dev->handle, &dev->info) < 0))
- {
- fprintf(stderr, "PD-ALSA: error getting channel info: %s\n",
- snd_strerror(err));
- }
- memset(&params, 0, sizeof(params));
- params.format.interleave = 1; /* may do non-interleaved later */
- /* format is 2 or 4 bytes per sample depending on what was possible */
- params.format.format =
- (alsa_samplewidth == 4 ? SND_PCM_SFMT_S32_LE : SND_PCM_SFMT_S16_LE);
-
- /*will check this further down -just try for now*/
- params.format.rate = rate;
- params.format.voices = voices;
- params.start_mode = SND_PCM_START_GO; /* seems most reliable */
- /*do not stop at overrun/underrun*/
- params.stop_mode = SND_PCM_STOP_ROLLOVER;
-
- params.channel = dir; /* playback|capture */
- params.buf.stream.queue_size =
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * voices;
- params.buf.stream.fill = SND_PCM_FILL_SILENCE_WHOLE;
- params.mode = SND_PCM_MODE_STREAM;
-
- if ((err = snd_pcm_channel_params(dev->handle, &params)) < 0)
- {
- printf("PD-ALSA: error setting parameters %s", snd_strerror(err));
- }
-
- /* This should clear the buffers but does not. There is often noise at
- startup that sounds like crap left in the buffers - maybe in the lib
- instead of the driver? Some solution needs to be found.
- */
-
- if ((err = snd_pcm_channel_prepare(dev->handle, dir)) < 0)
- {
- printf("PD-ALSA: error preparing channel %s", snd_strerror(err));
- }
- dev->setup.channel = dir;
-
- if ((err = snd_pcm_channel_setup(dev->handle, &dev->setup)) < 0)
- {
- printf("PD-ALSA: error getting setup %s", snd_strerror(err));
- }
- /* for some reason, if you don't writesomething before starting the
- converters we get trash on startup */
- if (dir == SND_PCM_CHANNEL_PLAYBACK)
- {
- char foo[1024];
- int xxx = 1024 - (1024 % (linux_outchannels * alsa_samplewidth));
- int i, r;
- for (i = 0; i < xxx; i++)
- foo[i] = 0;
- if ((r = snd_pcm_write(dev->handle, foo, xxx)) < xxx)
- fprintf(stderr, "alsa_write: %s\n", snd_strerror(errno));
- }
- snd_pcm_channel_go(dev->handle, dir);
-}
-
-void alsa_close_audio(void)
-{
- int i;
- for(i = 0; i < n_alsa_dev; i++)
- snd_pcm_close(alsa_device[i].handle);
-}
-
-/* #define DEBUG_ALSA_XFER */
-
-int alsa_send_dacs(void)
-{
- static int16_t *sp;
- t_sample *fp, *fp1, *fp2;
- int i, j, k, err, devno = 0;
- int inputcount = 0, outputcount = 0, inputlate = 0, outputlate = 0;
- int result;
- snd_pcm_channel_status_t stat;
- static int callno = 0;
- static int xferno = 0;
- int countwas = 0;
- double timelast;
- static double timenow;
- int inchannels = linux_inchannels;
- int outchannels = linux_outchannels;
- int inbytesperframe = inchannels * alsa_samplewidth;
- int outbytesperframe = outchannels * alsa_samplewidth;
- int intransfersize = DACBLKSIZE * inbytesperframe;
- int outtransfersize = DACBLKSIZE * outbytesperframe;
- int alsaerror;
- int loggederror = 0;
-
- if (!inchannels && !outchannels)
- return (SENDDACS_NO);
- timelast = timenow;
- timenow = sys_getrealtime();
-
-#ifdef DEBUG_ALSA_XFER
- if (timenow - timelast > 0.050)
- fprintf(stderr, "(%d)",
- (int)(1000 * (timenow - timelast))), fflush(stderr);
-#endif
-
- callno++;
- /* get input and output channel status */
- if (inchannels > 0)
- {
- devno = 0;
- stat.channel = SND_PCM_CHANNEL_CAPTURE;
- if (alsaerror = snd_pcm_channel_status(alsa_device[devno].handle,
- &stat))
- {
- fprintf(stderr, "snd_pcm_channel_status (input): %s\n",
- snd_strerror(alsaerror));
- return (SENDDACS_NO);
- }
- inputcount = stat.count;
- inputlate = (stat.underrun > 0 || stat.overrun > 0);
- }
- if (outchannels > 0)
- {
- devno = 0;
- stat.channel = SND_PCM_CHANNEL_PLAYBACK;
- if (alsaerror = snd_pcm_channel_status(alsa_device[devno].handle,
- &stat))
- {
- fprintf(stderr, "snd_pcm_channel_status (output): %s\n",
- snd_strerror(alsaerror));
- return (SENDDACS_NO);
- }
- outputcount = stat.count;
- outputlate = (stat.underrun > 0 || stat.overrun > 0);
- }
-
- /* check if input not ready */
- if (inputcount < intransfersize)
- {
- /* fprintf(stderr, "no adc; count %d, free %d, call %d, xfer %d\n",
- stat.count,
- stat.free,
- callno, xferno); */
- if (outchannels > 0)
- {
- /* if there's no input but output is hungry, feed output. */
- while (outputcount < (linux_advance_samples + ALSA_JITTER)
- * outbytesperframe)
- {
- if (!loggederror)
- sys_log_error(ERR_RESYNC), loggederror = 1;
- memset(alsa_buf, 0, outtransfersize);
- result = snd_pcm_write(alsa_device[devno].handle,
- alsa_buf, outtransfersize);
- if (result < outtransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result >= 0 || errno == EAGAIN)
- fprintf(stderr, "ALSA: write returned %d of %d\n",
- result, outtransfersize);
- else fprintf(stderr, "ALSA: write: %s\n",
- snd_strerror(errno));
- fprintf(stderr,
- "inputcount %d, outputcount %d, outbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * outchannels);
-#endif
- return (SENDDACS_NO);
- }
- stat.channel = SND_PCM_CHANNEL_PLAYBACK;
- if (alsaerror =
- snd_pcm_channel_status(alsa_device[devno].handle,
- &stat))
- {
- fprintf(stderr, "snd_pcm_channel_status (output): %s\n",
- snd_strerror(alsaerror));
- return (SENDDACS_NO);
- }
- outputcount = stat.count;
- }
- }
-
- return SENDDACS_NO;
- }
-
- /* if output buffer has at least linux_advance_samples in it, we're
- not ready for this batch. */
- if (outputcount > linux_advance_samples * outbytesperframe)
- {
- if (inchannels > 0)
- {
- while (inputcount > (DACBLKSIZE + ALSA_JITTER) * outbytesperframe)
- {
- if (!loggederror)
- sys_log_error(ERR_RESYNC), loggederror = 1;
- devno = 0;
- result = snd_pcm_read(alsa_device[devno].handle, alsa_buf,
- intransfersize);
- if (result < intransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result < 0)
- fprintf(stderr,
- "snd_pcm_read %d %d: %s\n",
- callno, xferno, snd_strerror(errno));
- else fprintf(stderr,
- "snd_pcm_read %d %d returned only %d\n",
- callno, xferno, result);
- fprintf(stderr,
- "inputcount %d, outputcount %d, inbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * inchannels);
-#endif
- return (SENDDACS_NO);
- }
- devno = 0;
- stat.channel = SND_PCM_CHANNEL_CAPTURE;
- if (alsaerror =
- snd_pcm_channel_status(alsa_device[devno].handle,
- &stat))
- {
- fprintf(stderr, "snd_pcm_channel_status (input): %s\n",
- snd_strerror(alsaerror));
- return (SENDDACS_NO);
- }
- inputcount = stat.count;
- inputlate = (stat.underrun > 0 || stat.overrun > 0);
- }
- return (SENDDACS_NO);
- }
- }
- if (sys_getrealtime() - timenow > 0.002)
- {
-#ifdef DEBUG_ALSA_XFER
- fprintf(stderr, "check %d took %d msec\n",
- callno, (int)(1000 * (timenow - timelast))), fflush(stderr);
-#endif
- sys_log_error(ERR_DACSLEPT);
- timenow = sys_getrealtime();
- }
- if (inputlate || outputlate)
- sys_log_error(ERR_DATALATE);
-
- /* do output */
- /* this "for" loop won't work for more than one device. */
- for (devno = 0, fp = sys_soundout; devno < (outchannels > 0); devno++,
- fp += 128)
- {
- if (alsa_samplewidth == 4)
- {
- for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
- {
- float s1 = *fp2 * INT32_MAX;
- ((t_alsa_sample32 *)alsa_buf)[j] = CLIP32(s1);
- }
- }
- }
- else
- {
- for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
- {
- int s = *fp2 * 32767.;
- if (s > 32767)
- s = 32767;
- else if (s < -32767)
- s = -32767;
- ((t_alsa_sample16 *)alsa_buf)[j] = s;
- }
- }
- }
-
- result = snd_pcm_write(alsa_device[devno].handle, alsa_buf,
- outtransfersize);
- if (result < outtransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result >= 0 || errno == EAGAIN)
- fprintf(stderr, "ALSA: write returned %d of %d\n",
- result, outtransfersize);
- else fprintf(stderr, "ALSA: write: %s\n",
- snd_strerror(errno));
- fprintf(stderr,
- "inputcount %d, outputcount %d, outbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * outchannels);
-#endif
- sys_log_error(ERR_DACSLEPT);
- return (SENDDACS_NO);
- }
- }
- /* zero out the output buffer */
- memset(sys_soundout, 0, DACBLKSIZE * sizeof(*sys_soundout) *
- linux_outchannels);
- if (sys_getrealtime() - timenow > 0.002)
- {
-#if DEBUG_ALSA_XFER
- fprintf(stderr, "output %d took %d msec\n",
- callno, (int)(1000 * (timenow - timelast))), fflush(stderr);
-#endif
- timenow = sys_getrealtime();
- sys_log_error(ERR_DACSLEPT);
- }
-
- /* do input */
- for (devno = 0, fp = sys_soundin; devno < (linux_inchannels > 0); devno++,
- fp += 128)
- {
- result = snd_pcm_read(alsa_device[devno].handle, alsa_buf,
- intransfersize);
- if (result < intransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result < 0)
- fprintf(stderr,
- "snd_pcm_read %d %d: %s\n",
- callno, xferno, snd_strerror(errno));
- else fprintf(stderr,
- "snd_pcm_read %d %d returned only %d\n",
- callno, xferno, result);
- fprintf(stderr,
- "inputcount %d, outputcount %d, inbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * inchannels);
-#endif
- sys_log_error(ERR_ADCSLEPT);
- return (SENDDACS_NO);
- }
- if (alsa_samplewidth == 4)
- {
- for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += inchannels, fp2++)
- *fp2 = (float) ((t_alsa_sample32 *)alsa_buf)[j]
- * (1./ INT32_MAX);
- }
- }
- else
- {
- for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--; j += inchannels, fp2++)
- *fp2 = (float) ((t_alsa_sample16 *)alsa_buf)[j]
- * 3.051850e-05;
- }
- }
- }
- xferno++;
- if (sys_getrealtime() - timenow > 0.002)
- {
-#ifdef DEBUG_ALSA_XFER
- fprintf(stderr, "routine took %d msec\n",
- (int)(1000 * (sys_getrealtime() - timenow)));
-#endif
- sys_log_error(ERR_ADCSLEPT);
- }
- return SENDDACS_YES;
-}
-
-#endif /* ALSA99 */
-
-/* support for ALSA pcmv2 api by Karl MacMillan<karlmac@peabody.jhu.edu> */
-
-#ifdef ALSA01
-
-static void check_error(int err, const char *why)
-{
- if (err < 0)
- fprintf(stderr, "%s: %s\n", why, snd_strerror(err));
-}
-
-static int alsa_open_audio(int wantinchans, int wantoutchans, int srate)
-{
- int err, inchans = 0, outchans = 0, subunitdir;
- char devname[512];
- snd_pcm_hw_params_t* hw_params;
- snd_pcm_sw_params_t* sw_params;
- snd_output_t* out;
- int frag_size = (linux_fragsize ? linux_fragsize : ALSA_DEFFRAGSIZE);
- int nfrags, i;
- short* tmp_buf;
- unsigned int tmp_uint;
- int advwas = sys_schedadvance;
-
- if (linux_nfragment)
- {
- nfrags = linux_nfragment;
- sys_schedadvance = (frag_size * linux_nfragment * 1.0e6) / srate;
- }
- else nfrags = sys_schedadvance * (float)srate / (1e6 * frag_size);
-
- if (sys_verbose || (sys_schedadvance != advwas))
- post("audio buffer set to %d", (int)(0.001 * sys_schedadvance));
- if (wantinchans || wantoutchans)
- alsa_checkversion();
- if (wantinchans)
- {
- err = snd_pcm_open(&alsa_device.inhandle, alsa_devname,
- SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK);
-
- check_error(err, "snd_pcm_open (input)");
- if (err < 0)
- inchans = 0;
- else
- {
- inchans = wantinchans;
- snd_pcm_nonblock(alsa_device.inhandle, 1);
- }
- }
- if (wantoutchans)
- {
- err = snd_pcm_open(&alsa_device.outhandle, alsa_devname,
- SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
-
- check_error(err, "snd_pcm_open (output)");
- if (err < 0)
- outchans = 0;
- else
- {
- outchans = wantoutchans;
- snd_pcm_nonblock(alsa_device.outhandle, 1);
- }
- }
- if (inchans)
- {
- if (sys_verbose)
- post("opening sound input...");
- err = snd_pcm_hw_params_malloc(&hw_params);
- check_error(err, "snd_pcm_hw_params_malloc (input)");
-
- // get the default params
- err = snd_pcm_hw_params_any(alsa_device.inhandle, hw_params);
- check_error(err, "snd_pcm_hw_params_any (input)");
- // set interleaved access - FIXME deal with other access types
- err = snd_pcm_hw_params_set_access(alsa_device.inhandle, hw_params,
- SND_PCM_ACCESS_RW_INTERLEAVED);
- check_error(err, "snd_pcm_hw_params_set_access (input)");
- // Try to set 32 bit format first
- err = snd_pcm_hw_params_set_format(alsa_device.inhandle, hw_params,
- SND_PCM_FORMAT_S32);
- if (err < 0)
- {
- /* fprintf(stderr,
- "PD-ALSA: 32 bit format not available - using 16\n"); */
- err = snd_pcm_hw_params_set_format(alsa_device.inhandle, hw_params,
- SND_PCM_FORMAT_S16);
- check_error(err, "snd_pcm_hw_params_set_format (input)");
- alsa_samplewidth = 2;
- }
- else
- {
- alsa_samplewidth = 4;
- }
- post("Sample width set to %d bytes", alsa_samplewidth);
- // set the subformat
- err = snd_pcm_hw_params_set_subformat(alsa_device.inhandle, hw_params,
- SND_PCM_SUBFORMAT_STD);
- check_error(err, "snd_pcm_hw_params_set_subformat (input)");
- // set the number of channels
- tmp_uint = inchans;
- err = snd_pcm_hw_params_set_channels_min(alsa_device.inhandle,
- hw_params, &tmp_uint);
- check_error(err, "snd_pcm_hw_params_set_channels (input)");
- if (tmp_uint != (unsigned)inchans)
- post("ALSA: set input channels to %d", tmp_uint);
- inchans = tmp_uint;
- // set the sampling rate
- err = snd_pcm_hw_params_set_rate_min(alsa_device.inhandle, hw_params,
- &srate, 0);
- check_error(err, "snd_pcm_hw_params_set_rate_min (input)");
-#if 0
- err = snd_pcm_hw_params_get_rate(hw_params, &subunitdir);
- post("input sample rate %d", err);
-#endif
- // set the period - ie frag size
- // post("fragsize a %d", frag_size);
-
- /* LATER try this to get a recommended period size...
- right now, it trips an assertion failure in ALSA lib */
-#if 0
- post("input period was %d, min %d, max %d\n",
- snd_pcm_hw_params_get_period_size(hw_params, 0),
- snd_pcm_hw_params_get_period_size_min(hw_params, 0),
- snd_pcm_hw_params_get_period_size_max(hw_params, 0));
-#endif
- err = snd_pcm_hw_params_set_period_size_near(alsa_device.inhandle,
- hw_params,
- (snd_pcm_uframes_t)
- frag_size, 0);
- check_error(err, "snd_pcm_hw_params_set_period_size_near (input)");
- // post("fragsize b %d", frag_size);
- // set the number of periods - ie numfrags
- // post("nfrags a %d", nfrags);
- err = snd_pcm_hw_params_set_periods_near(alsa_device.inhandle,
- hw_params, nfrags, 0);
- check_error(err, "snd_pcm_hw_params_set_periods_near (input)");
- // set the buffer size
- err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.inhandle,
- hw_params, nfrags * frag_size);
- check_error(err, "snd_pcm_hw_params_set_buffer_size_near (input)");
-
- err = snd_pcm_hw_params(alsa_device.inhandle, hw_params);
- check_error(err, "snd_pcm_hw_params (input)");
-
- snd_pcm_hw_params_free(hw_params);
-
- err = snd_pcm_sw_params_malloc(&sw_params);
- check_error(err, "snd_pcm_sw_params_malloc (input)");
- err = snd_pcm_sw_params_current(alsa_device.inhandle, sw_params);
- check_error(err, "snd_pcm_sw_params_current (input)");
-#if 1
- err = snd_pcm_sw_params_set_start_mode(alsa_device.inhandle, sw_params,
- SND_PCM_START_EXPLICIT);
- check_error(err, "snd_pcm_sw_params_set_start_mode (input)");
- err = snd_pcm_sw_params_set_xrun_mode(alsa_device.inhandle, sw_params,
- SND_PCM_XRUN_NONE);
- check_error(err, "snd_pcm_sw_params_set_xrun_mode (input)");
-#else
- err = snd_pcm_sw_params_set_start_threshold(alsa_device.inhandle,
- sw_params, nfrags * frag_size);
- check_error(err, "snd_pcm_sw_params_set_start_threshold (input)");
- err = snd_pcm_sw_params_set_stop_threshold(alsa_device.inhandle,
- sw_params, 1);
- check_error(err, "snd_pcm_sw_params_set_stop_threshold (input)");
-#endif
-
- err = snd_pcm_sw_params_set_avail_min(alsa_device.inhandle, sw_params,
- frag_size);
- check_error(err, "snd_pcm_sw_params_set_avail_min (input)");
- err = snd_pcm_sw_params(alsa_device.inhandle, sw_params);
- check_error(err, "snd_pcm_sw_params (input)");
-
- snd_pcm_sw_params_free(sw_params);
-
- snd_output_stdio_attach(&out, stderr, 0);
-#if 0
- if (sys_verbose)
- {
- snd_pcm_dump_hw_setup(alsa_device.inhandle, out);
- snd_pcm_dump_sw_setup(alsa_device.inhandle, out);
- }
-#endif
- }
-
- if (outchans)
- {
- int foo;
- if (sys_verbose)
- post("opening sound output...");
- err = snd_pcm_hw_params_malloc(&hw_params);
- check_error(err, "snd_pcm_sw_params (output)");
-
- // get the default params
- err = snd_pcm_hw_params_any(alsa_device.outhandle, hw_params);
- check_error(err, "snd_pcm_hw_params_any (output)");
- // set interleaved access - FIXME deal with other access types
- err = snd_pcm_hw_params_set_access(alsa_device.outhandle, hw_params,
- SND_PCM_ACCESS_RW_INTERLEAVED);
- check_error(err, "snd_pcm_hw_params_set_access (output)");
- // Try to set 32 bit format first
- err = snd_pcm_hw_params_set_format(alsa_device.outhandle, hw_params,
- SND_PCM_FORMAT_S32);
- if (err < 0)
- {
- err = snd_pcm_hw_params_set_format(alsa_device.outhandle,
- hw_params,SND_PCM_FORMAT_S16);
- check_error(err, "snd_pcm_hw_params_set_format (output)");
- /* fprintf(stderr,
- "PD-ALSA: 32 bit format not available - using 16\n"); */
- alsa_samplewidth = 2;
- }
- else
- {
- alsa_samplewidth = 4;
- }
- // set the subformat
- err = snd_pcm_hw_params_set_subformat(alsa_device.outhandle, hw_params,
- SND_PCM_SUBFORMAT_STD);
- check_error(err, "snd_pcm_hw_params_set_subformat (output)");
- // set the number of channels
- tmp_uint = outchans;
- err = snd_pcm_hw_params_set_channels_min(alsa_device.outhandle,
- hw_params, &tmp_uint);
- check_error(err, "snd_pcm_hw_params_set_channels (output)");
- if (tmp_uint != (unsigned)outchans)
- post("alsa: set output channels to %d", tmp_uint);
- outchans = tmp_uint;
- // set the sampling rate
- err = snd_pcm_hw_params_set_rate_min(alsa_device.outhandle, hw_params,
- &srate, 0);
- check_error(err, "snd_pcm_hw_params_set_rate_min (output)");
-#if 0
- err = snd_pcm_hw_params_get_rate(hw_params, &subunitdir);
- post("output sample rate %d", err);
-#endif
- // set the period - ie frag size
-#if 0
- post("output period was %d, min %d, max %d\n",
- snd_pcm_hw_params_get_period_size(hw_params, 0),
- snd_pcm_hw_params_get_period_size_min(hw_params, 0),
- snd_pcm_hw_params_get_period_size_max(hw_params, 0));
-#endif
- // post("fragsize c %d", frag_size);
- err = snd_pcm_hw_params_set_period_size_near(alsa_device.outhandle,
- hw_params,
- (snd_pcm_uframes_t)
- frag_size, 0);
- // post("fragsize d %d", frag_size);
- check_error(err, "snd_pcm_hw_params_set_period_size_near (output)");
- // set the number of periods - ie numfrags
- err = snd_pcm_hw_params_set_periods_near(alsa_device.outhandle,
- hw_params, nfrags, 0);
- check_error(err, "snd_pcm_hw_params_set_periods_near (output)");
- // set the buffer size
- err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.outhandle,
- hw_params, nfrags * frag_size);
-
- check_error(err, "snd_pcm_hw_params_set_buffer_size_near (output)");
-
- err = snd_pcm_hw_params(alsa_device.outhandle, hw_params);
- check_error(err, "snd_pcm_hw_params (output)");
-
- snd_pcm_hw_params_free(hw_params);
-
- err = snd_pcm_sw_params_malloc(&sw_params);
- check_error(err, "snd_pcm_sw_params_malloc (output)");
- err = snd_pcm_sw_params_current(alsa_device.outhandle, sw_params);
- check_error(err, "snd_pcm_sw_params_current (output)");
-#if 1
- err = snd_pcm_sw_params_set_start_mode(alsa_device.outhandle,
- sw_params,
- SND_PCM_START_EXPLICIT);
- check_error(err, "snd_pcm_sw_params_set_start_mode (output)");
- err = snd_pcm_sw_params_set_xrun_mode(alsa_device.outhandle, sw_params,
- SND_PCM_XRUN_NONE);
- check_error(err, "snd_pcm_sw_params_set_xrun_mode (output)");
-#else
- err = snd_pcm_sw_params_set_start_threshold(alsa_device.inhandle,
- sw_params, nfrags * frag_size);
- check_error(err, "snd_pcm_sw_params_set_start_threshold (output)");
- err = snd_pcm_sw_params_set_stop_threshold(alsa_device.inhandle,
- sw_params, 1);
- check_error(err, "snd_pcm_sw_params_set_stop_threshold (output)");
-#endif
-
- err = snd_pcm_sw_params_set_avail_min(alsa_device.outhandle, sw_params,
- frag_size);
- check_error(err, "snd_pcm_sw_params_set_avail_min (output)");
- err = snd_pcm_sw_params(alsa_device.outhandle, sw_params);
- check_error(err, "snd_pcm_sw_params (output)");
-
- snd_pcm_sw_params_free(sw_params);
-
- snd_output_stdio_attach(&out, stderr, 0);
-#if 0
- if (sys_verbose)
- {
- snd_pcm_dump_hw_setup(alsa_device.outhandle, out);
- snd_pcm_dump_sw_setup(alsa_device.outhandle, out);
- }
-#endif
- }
-
- linux_setsr(srate);
- linux_setch(inchans, outchans);
-
- if (inchans)
- snd_pcm_prepare(alsa_device.inhandle);
- if (outchans)
- snd_pcm_prepare(alsa_device.outhandle);
-
- // if duplex we can link the channels so they start together
- if (inchans && outchans)
- snd_pcm_link(alsa_device.inhandle, alsa_device.outhandle);
-
- // set up the buffer
- if (outchans > inchans)
- alsa_buf = (short *)calloc(sizeof(char) * alsa_samplewidth, DACBLKSIZE
- * outchans);
- else
- alsa_buf = (short *)calloc(sizeof(char) * alsa_samplewidth, DACBLKSIZE
- * inchans);
- // fill the buffer with silence
- if (outchans)
- {
- i = nfrags + 1;
- while (i--)
- snd_pcm_writei(alsa_device.outhandle, alsa_buf, frag_size);
- }
-
- // set up the status variables
- err = snd_pcm_status_malloc(&in_status);
- check_error(err, "snd_pcm_status_malloc");
- err = snd_pcm_status_malloc(&out_status);
- check_error(err, "snd_pcm_status_malloc");
-
- // start the device
-#if 1
- if (outchans)
- {
- err = snd_pcm_start(alsa_device.outhandle);
- check_error(err, "snd_pcm_start");
- }
- else if (inchans)
- {
- err = snd_pcm_start(alsa_device.inhandle);
- check_error(err, "snd_pcm_start");
- }
-#endif
-
- return 0;
-}
-
-void alsa_close_audio(void)
-{
- int err;
- if (linux_inchannels)
- {
- err = snd_pcm_close(alsa_device.inhandle);
- check_error(err, "snd_pcm_close (input)");
- }
- if (linux_outchannels)
- {
- err = snd_pcm_close(alsa_device.outhandle);
- check_error(err, "snd_pcm_close (output)");
- }
-}
-
-// #define DEBUG_ALSA_XFER
-
-int alsa_send_dacs(void)
-{
- static int16_t *sp;
- static int xferno = 0;
- static int callno = 0;
- static double timenow;
- double timelast;
- t_sample *fp, *fp1, *fp2;
- int i, j, k, err, devno = 0;
- int inputcount = 0, outputcount = 0, inputlate = 0, outputlate = 0;
- int result;
- int inchannels = linux_inchannels;
- int outchannels = linux_outchannels;
- unsigned int intransfersize = DACBLKSIZE;
- unsigned int outtransfersize = DACBLKSIZE;
-
- // get the status
- if (!inchannels && !outchannels)
- {
- return SENDDACS_NO;
- }
-
- timelast = timenow;
- timenow = sys_getrealtime();
-
-#ifdef DEBUG_ALSA_XFER
- if (timenow - timelast > 0.050)
- fprintf(stderr, "(%d)",
- (int)(1000 * (timenow - timelast))), fflush(stderr);
-#endif
-
- callno++;
-
- if (inchannels)
- {
- snd_pcm_status(alsa_device.inhandle, in_status);
- if (snd_pcm_status_get_avail(in_status) < intransfersize)
- return SENDDACS_NO;
- }
- if (outchannels)
- {
- snd_pcm_status(alsa_device.outhandle, out_status);
- if (snd_pcm_status_get_avail(out_status) < outtransfersize)
- return SENDDACS_NO;
- }
-
- /* do output */
- if (outchannels)
- {
- fp = sys_soundout;
- if (alsa_samplewidth == 4)
- {
- for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
- {
- float s1 = *fp2 * INT32_MAX;
- ((t_alsa_sample32 *)alsa_buf)[j] = CLIP32(s1);
- }
- }
- }
- else
- {
- for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += outchannels, fp2++)
- {
- int s = *fp2 * 32767.;
- if (s > 32767)
- s = 32767;
- else if (s < -32767)
- s = -32767;
- ((t_alsa_sample16 *)alsa_buf)[j] = s;
- }
- }
- }
-
- result = snd_pcm_writei(alsa_device.outhandle, alsa_buf,
- outtransfersize);
- if (result != (int)outtransfersize)
- {
- #ifdef DEBUG_ALSA_XFER
- if (result >= 0 || errno == EAGAIN)
- fprintf(stderr, "ALSA: write returned %d of %d\n",
- result, outtransfersize);
- else fprintf(stderr, "ALSA: write: %s\n",
- snd_strerror(errno));
- fprintf(stderr,
- "inputcount %d, outputcount %d, outbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * outchannels);
- #endif
- sys_log_error(ERR_DACSLEPT);
- return (SENDDACS_NO);
- }
-
- /* zero out the output buffer */
- memset(sys_soundout, 0, DACBLKSIZE * sizeof(*sys_soundout) *
- linux_outchannels);
- if (sys_getrealtime() - timenow > 0.002)
- {
- #ifdef DEBUG_ALSA_XFER
- fprintf(stderr, "output %d took %d msec\n",
- callno, (int)(1000 * (timenow - timelast))), fflush(stderr);
- #endif
- timenow = sys_getrealtime();
- sys_log_error(ERR_DACSLEPT);
- }
- }
- /* do input */
- if (linux_inchannels)
- {
- result = snd_pcm_readi(alsa_device.inhandle, alsa_buf, intransfersize);
- if (result < (int)intransfersize)
- {
-#ifdef DEBUG_ALSA_XFER
- if (result < 0)
- fprintf(stderr,
- "snd_pcm_read %d %d: %s\n",
- callno, xferno, snd_strerror(errno));
- else fprintf(stderr,
- "snd_pcm_read %d %d returned only %d\n",
- callno, xferno, result);
- fprintf(stderr,
- "inputcount %d, outputcount %d, inbufsize %d\n",
- inputcount, outputcount,
- (ALSA_EXTRABUFFER + linux_advance_samples)
- * alsa_samplewidth * inchannels);
-#endif
- sys_log_error(ERR_ADCSLEPT);
- return (SENDDACS_NO);
- }
- fp = sys_soundin;
- if (alsa_samplewidth == 4)
- {
- for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--;
- j += inchannels, fp2++)
- *fp2 = (float) ((t_alsa_sample32 *)alsa_buf)[j]
- * (1./ INT32_MAX);
- }
- }
- else
- {
- for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DACBLKSIZE)
- {
- for (j = i, k = DACBLKSIZE, fp2 = fp1; k--; j += inchannels,
- fp2++)
- *fp2 = (float) ((t_alsa_sample16 *)alsa_buf)[j]
- * 3.051850e-05;
- }
- }
- }
- xferno++;
- if (sys_getrealtime() - timenow > 0.002)
- {
-#ifdef DEBUG_ALSA_XFER
- fprintf(stderr, "routine took %d msec\n",
- (int)(1000 * (sys_getrealtime() - timenow)));
-#endif
- sys_log_error(ERR_ADCSLEPT);
- }
- return SENDDACS_YES;
-}
-
-void alsa_resync( void)
-{
- int i, result;
- if (linux_whichapi != API_ALSA)
- {
- error("restart-audio: implemented for ALSA only.");
- return;
- }
- memset(alsa_buf, 0,
- sizeof(char) * alsa_samplewidth * DACBLKSIZE * linux_outchannels);
- for (i = 0; i < 1000000; i++)
- {
- result = snd_pcm_writei(alsa_device.outhandle, alsa_buf,
- DACBLKSIZE);
- if (result != (int)DACBLKSIZE)
- break;
- }
- post("%d written", i);
-}
-
-
-#endif /* ALSA01 */
-
-/***************************************************
- * Code using the RME_9652 API
- */
-
- /*
- trying native device for future use of native memory map:
- because of busmaster if you dont use the dac, you dont need
- CPU Power und also no nearly no CPU-Power is used in device
-
- since always all DAs and ADs are synced (else they wouldnt work)
- we use linux_dacs[0], linux_adcs[0]
- */
-
-#ifdef RME_HAMMERFALL
-
-#define RME9652_MAX_CHANNELS 26
-
-#define RME9652_CH_PER_NATIVE_DEVICE 1
-
-static int rme9652_dac_devices[RME9652_MAX_CHANNELS];
-static int rme9652_adc_devices[RME9652_MAX_CHANNELS];
-
-static char rme9652_dsp_dac[] = "/dev/rme9652/C0da%d";
-static char rme9652_dsp_adc[] = "/dev/rme9652/C0ad%d";
-
-static int num_of_rme9652_dac = 0;
-static int num_of_rme9652_adc = 0;
-
-static int rme_soundindevonset = 1;
-static int rme_soundoutdevonset = 1;
-
-void rme_soundindev(int which)
-{
- rme_soundindevonset = which;
-}
-
-void rme_soundoutdev(int which)
-{
- rme_soundoutdevonset = which;
-}
-
-void rme9652_configure(int dev, int fd,int srate, int dac) {
- int orig, param, nblk;
- audio_buf_info ainfo;
- orig = param = srate;
-
- /* samplerate */
-
- fprintf(stderr,"RME9652: configuring %d, fd=%d, sr=%d\n, dac=%d\n",
- dev,fd,srate,dac);
-
- if (ioctl(fd,SNDCTL_DSP_SPEED,&param) == -1)
- fprintf(stderr,"RME9652: Could not set sampling rate for device\n");
- else if( orig != param )
- fprintf(stderr,"RME9652: sampling rate: wanted %d, got %d\n",
- orig, param );
-
- // setting the correct samplerate (could be different than expected)
- srate = param;
-
-
- /* setting resolution */
-
- /* use ctrlpanel to change, experiment, channels 1 */
-
- orig = param = AFMT_S16_NE;
- if (ioctl(fd,SNDCTL_DSP_SETFMT,&param) == -1)
- fprintf(stderr,"RME9652: Could not set DSP format\n");
- else if( orig != param )
- fprintf(stderr,"RME9652: DSP format: wanted %d, got %d\n",orig, param );
-
- /* setting channels */
- orig = param = RME9652_CH_PER_NATIVE_DEVICE;
-
- if (ioctl(fd,SNDCTL_DSP_CHANNELS,&param) == -1)
- fprintf(stderr,"RME9652: Could not set channels\n");
- else if( orig != param )
- fprintf(stderr,"RME9652: num channels: wanted %d, got %d\n",orig, param );
-
- if (dac)
- {
-
- /* use "free space" to learn the buffer size. Normally you
- should set this to your own desired value; but this seems not
- to be implemented uniformly across different sound cards. LATER
- we should figure out what to do if the requested scheduler advance
- is greater than this buffer size; for now, we just print something
- out. */
-
- if( ioctl(linux_dacs[0].d_fd, SOUND_PCM_GETOSPACE,&ainfo) < 0 )
- fprintf(stderr,"RME: ioctl on output device %d failed",dev);
-
- linux_dacs[0].d_bufsize = ainfo.bytes;
-
- fprintf(stderr,"RME: ioctl SOUND_PCM_GETOSPACE says %d buffsize\n",
- linux_dacs[0].d_bufsize);
-
-
- if (linux_advance_samples * (RME_SAMPLEWIDTH *
- RME9652_CH_PER_NATIVE_DEVICE)
- > linux_dacs[0].d_bufsize - RME_BYTESPERCHAN)
- {
- fprintf(stderr,
- "RME: requested audio buffer size %d limited to %d\n",
- linux_advance_samples
- * (RME_SAMPLEWIDTH * RME9652_CH_PER_NATIVE_DEVICE),
- linux_dacs[0].d_bufsize);
- linux_advance_samples =
- (linux_dacs[0].d_bufsize - RME_BYTESPERCHAN)
- / (RME_SAMPLEWIDTH *RME9652_CH_PER_NATIVE_DEVICE);
- }
- }
-}
-
-
-int rme9652_open_audio(int inchans, int outchans,int srate)
-{
- int orig;
- int tmp;
- int inchannels = 0,outchannels = 0;
- char devname[20];
- int i;
- char buf[RME_SAMPLEWIDTH*RME9652_CH_PER_NATIVE_DEVICE*DACBLKSIZE];
- int num_devs = 0;
- audio_buf_info ainfo;
-
- linux_nindevs = linux_noutdevs = 0;
-
- if (sys_verbose)
- post("RME open");
- /* First check if we can */
- /* open the write ports */
-
- for (num_devs=0; outchannels < outchans; num_devs++)
- {
- int channels = RME9652_CH_PER_NATIVE_DEVICE;
-
- sprintf(devname, rme9652_dsp_dac, num_devs + rme_soundoutdevonset);
- if ((tmp = open(devname,O_WRONLY)) == -1)
- {
- DEBUG(fprintf(stderr,"RME9652: failed to open %s writeonly\n",
- devname);)
- break;
- }
- DEBUG(fprintf(stderr,"RME9652: out device Nr. %d (%d) on %s\n",
- linux_noutdevs+1,tmp,devname);)
-
- if (outchans > outchannels)
- {
- rme9652_dac_devices[linux_noutdevs] = tmp;
- linux_noutdevs++;
- outchannels += channels;
- }
- else close(tmp);
- }
- if( linux_noutdevs > 0)
- linux_dacs[0].d_fd = rme9652_dac_devices[0];
-
- /* Second check if we can */
- /* open the read ports */
-
- for (num_devs=0; inchannels < inchans; num_devs++)
- {
- int channels = RME9652_CH_PER_NATIVE_DEVICE;
-
- sprintf(devname, rme9652_dsp_adc, num_devs+rme_soundindevonset);
-
- if ((tmp = open(devname,O_RDONLY)) == -1)
- {
- DEBUG(fprintf(stderr,"RME9652: failed to open %s readonly\n",
- devname);)
- break;
- }
- DEBUG(fprintf(stderr,"RME9652: in device Nr. %d (%d) on %s\n",
- linux_nindevs+1,tmp,devname);)
-
- if (inchans > inchannels)
- {
- rme9652_adc_devices[linux_nindevs] = tmp;
- linux_nindevs++;
- inchannels += channels;
- }
- else
- close(tmp);
- }
- if(linux_nindevs > 0)
- linux_adcs[0].d_fd = rme9652_adc_devices[0];
-
- /* configure soundcards */
-
- rme9652_configure(0, linux_adcs[0].d_fd,srate, 0);
- rme9652_configure(0, linux_dacs[0].d_fd,srate, 1);
-
- /* We have to do a read to start the engine. This is
- necessary because sys_send_dacs waits until the input
- buffer is filled and only reads on a filled buffer.
- This is good, because it's a way to make sure that we
- will not block */
-
- if (linux_nindevs)
- {
- fprintf(stderr,("RME9652: starting read engine ... "));
-
-
- for (num_devs=0; num_devs < linux_nindevs; num_devs++)
- read(rme9652_adc_devices[num_devs],
- buf, RME_SAMPLEWIDTH* RME9652_CH_PER_NATIVE_DEVICE*
- DACBLKSIZE);
-
-
- for (num_devs=0; num_devs < linux_noutdevs; num_devs++)
- write(rme9652_dac_devices[num_devs],
- buf, RME_SAMPLEWIDTH* RME9652_CH_PER_NATIVE_DEVICE*
- DACBLKSIZE);
-
- if(linux_noutdevs)
- ioctl(rme9652_dac_devices[0],SNDCTL_DSP_SYNC);
-
- fprintf(stderr,"done\n");
- }
-
- linux_setsr(srate);
- linux_setch(linux_nindevs, linux_noutdevs);
-
- num_of_rme9652_dac = linux_noutdevs;
- num_of_rme9652_adc = linux_nindevs;
-
- if(linux_noutdevs)linux_noutdevs=1;
- if(linux_nindevs)linux_nindevs=1;
-
- /* trick RME9652 behaves as one device fromread write pointers */
- return (0);
-}
-
-void rme9652_close_audio( void)
-{
- int i;
- for (i=0;i<num_of_rme9652_dac;i++)
- close(rme9652_dac_devices[i]);
-
- for (i=0;i<num_of_rme9652_adc;i++)
- close(rme9652_adc_devices[i]);
-}
-
-
-/* query audio devices for "available" data size. */
-/* not needed because oss_calcspace does the same */
-static int rme9652_calcspace(void)
-{
- audio_buf_info ainfo;
-
-
- /* one for all */
-
- if (ioctl(linux_dacs[0].d_fd, SOUND_PCM_GETOSPACE,&ainfo) < 0)
- fprintf(stderr,
- "RME9652: calc ioctl SOUND_PCM_GETOSPACE on output device fd %d failed\n",
- linux_dacs[0].d_fd);
- linux_dacs[0].d_space = ainfo.bytes;
-
- if (ioctl(linux_adcs[0].d_fd, SOUND_PCM_GETISPACE,&ainfo) < 0)
- fprintf(stderr,
- "RME9652: calc ioctl SOUND_PCM_GETISPACE on input device fd %d failed\n",
- rme9652_adc_devices[0]);
-
- linux_adcs[0].d_space = ainfo.bytes;
-
- return 1;
-}
-
-/* this call resyncs audio output and input which will cause discontinuities
-in audio output and/or input. */
-
-static void rme9652_doresync( void)
-{
- if(linux_noutdevs)
- ioctl(rme9652_dac_devices[0],SNDCTL_DSP_SYNC);
-}
-
-static int mycount =0;
-
-int rme9652_send_dacs(void)
-{
- float *fp;
- long fill;
- int i, j, dev;
- /* the maximum number of samples we should have in the ADC buffer */
- t_rme_sample buf[RME9652_CH_PER_NATIVE_DEVICE*DACBLKSIZE], *sp;
-
- double timeref, timenow;
-
- mycount++;
-
- if (!linux_nindevs && !linux_noutdevs) return (0);
-
- rme9652_calcspace();
-
- /* do output */
-
- timeref = sys_getrealtime();
-
- if(linux_noutdevs){
-
- if (linux_dacs[0].d_dropcount)
- linux_dacs[0].d_dropcount--;
- else{
- /* fprintf(stderr,"output %d\n", linux_outchannels);*/
-
- for(j=0;j<linux_outchannels;j++){
-
- t_rme_sample *a,*b,*c,*d;
- float *fp1,*fp2,*fp3,*fp4;
-
- fp1 = sys_soundout + j*DACBLKSIZE-4;
- fp2 = fp1 + 1;
- fp3 = fp1 + 2;
- fp4 = fp1 + 3;
- a = buf-4;
- b=a+1;
- c=a+2;
- d=a+3;
-
- for (i = DACBLKSIZE>>2;i--;)
- {
- float s1 = *(fp1+=4) * INT32_MAX;
- float s2 = *(fp2+=4) * INT32_MAX;
- float s3 = *(fp3+=4) * INT32_MAX;
- float s4 = *(fp4+=4) * INT32_MAX;
-
- *(a+=4) = CLIP32(s1);
- *(b+=4) = CLIP32(s2);
- *(c+=4) = CLIP32(s3);
- *(d+=4) = CLIP32(s4);
- }
-
- linux_dacs_write(rme9652_dac_devices[j],buf,RME_BYTESPERCHAN);
- }
- }
-
- if ((timenow = sys_getrealtime()) - timeref > 0.02)
- sys_log_error(ERR_DACSLEPT);
- timeref = timenow;
- }
-
- memset(sys_soundout, 0,
- linux_outchannels * (sizeof(float) * DACBLKSIZE));
-
- /* do input */
-
- if(linux_nindevs) {
-
- for(j=0;j<linux_inchannels;j++){
-
- linux_adcs_read(rme9652_adc_devices[j], buf, RME_BYTESPERCHAN);
-
- if ((timenow = sys_getrealtime()) - timeref > 0.02)
- sys_log_error(ERR_ADCSLEPT);
- timeref = timenow;
- {
- t_rme_sample *a,*b,*c,*d;
- float *fp1,*fp2,*fp3,*fp4;
-
- fp1 = sys_soundin + j*DACBLKSIZE-4;
- fp2 = fp1 + 1;
- fp3 = fp1 + 2;
- fp4 = fp1 + 3;
- a = buf-4;
- b=a+1;
- c=a+2;
- d=a+3;
-
- for (i = (DACBLKSIZE>>2);i--;)
- {
- *(fp1+=4) = *(a+=4) * (float)(1./INT32_MAX);
- *(fp2+=4) = *(b+=4) * (float)(1./INT32_MAX);
- *(fp3+=4) = *(c+=4) * (float)(1./INT32_MAX);
- *(fp4+=4) = *(d+=4) * (float)(1./INT32_MAX);
- }
- }
- }
- }
- /* fprintf(stderr,"ready \n");*/
-
- return (1);
-}
-
-#endif /* RME_HAMMERFALL */
diff --git a/pd/src/s_mac.c b/pd/src/s_mac.c
deleted file mode 100644
index 941fa93c..00000000
--- a/pd/src/s_mac.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/* Copyright (c) 1997-2001 Guenter Geiger, Miller Puckette, Larry Troxler,
-* Winfried Ritsch, Karl MacMillan, and others.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-/* this file implements the sys_ functions profiled in m_imp.h for
- audio and MIDI I/O on Macintosh OS X.
-
- Audio simply calls routines in s_portaudio.c, which in turn call the
- portaudio package. s_portaudio.c is also intended for use from NT.
-
- MIDI is handled by "portmidi".
-*/
-
-
-#include "m_imp.h"
-#include <stdio.h>
-#ifdef UNIX
-#include <unistd.h>
-#endif
-#ifndef MACOSX
-#include <stdlib.h>
-#else
-#include <stdlib.h>
-#include "portaudio.h"
-#include "portmidi.h"
-#include "porttime.h"
-#include "pminternal.h"
-#endif
-#include <string.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <errno.h>
-
-/* Defines */
-#define DEBUG(x) x
-#define DEBUG2(x) {x;}
-
-#define PA_DEFAULTCH 2 /* portaudio specific? */
-#define PA_MAXCH 100
-#define PA_DEFAULTSRATE 44100
-typedef short t_pa_sample;
-#define PA_SAMPLEWIDTH sizeof(t_pa_sample)
-#define PA_BYTESPERCHAN (DACBLKSIZE * PA_SAMPLEWIDTH)
-#define PA_XFERSAMPS (PA_DEFAULTCH*DACBLKSIZE)
-#define PA_XFERSIZE (PA_SAMPLEWIDTH * PA_XFERSAMPS)
-
-static int mac_whichapi = API_PORTAUDIO;
-static int mac_inchannels;
-static int mac_outchannels;
-static int mac_advance_samples; /* scheduler advance in samples */
-static int mac_meters; /* true if we're metering */
-static float mac_inmax; /* max input amplitude */
-static float mac_outmax; /* max output amplitude */
-static int mac_blocksize = 256; /* audio I/O block size in sample frames */
-
- /* exported variables */
-int sys_schedadvance = 50000; /* scheduler advance in microseconds */
-float sys_dacsr;
-int sys_hipriority = 0;
-t_sample *sys_soundout;
-t_sample *sys_soundin;
-
-static PmStream *mac_midiindevlist[MAXMIDIINDEV];
-static PmStream *mac_midioutdevlist[MAXMIDIOUTDEV];
-static int mac_nmidiindev;
-static int mac_nmidioutdev;
-
- /* set channels and sample rate. */
-
-static void mac_setchsr(int chin, int chout, int sr)
-{
- int nblk;
- int inbytes = chin * (DACBLKSIZE*sizeof(float));
- int outbytes = chout * (DACBLKSIZE*sizeof(float));
-
- mac_inchannels = chin;
- mac_outchannels = chout;
- sys_dacsr = sr;
- mac_advance_samples = (sys_schedadvance * sys_dacsr) / (1000000.);
- if (mac_advance_samples < 3 * DACBLKSIZE)
- mac_advance_samples = 3 * DACBLKSIZE;
-
- if (sys_soundin)
- free(sys_soundin);
- sys_soundin = (t_float *)malloc(inbytes);
- memset(sys_soundin, 0, inbytes);
-
- if (sys_soundout)
- free(sys_soundout);
- sys_soundout = (t_float *)malloc(outbytes);
- memset(sys_soundout, 0, outbytes);
-
- if (sys_verbose)
- post("input channels = %d, output channels = %d",
- mac_inchannels, mac_outchannels);
-}
-
-/* ----------------------- public routines ----------------------- */
-
-void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
- int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
- int *choutdev, int rate) /* IOhannes */
-{
- int inchans=
- (nchindev > 0 ? chindev[0] : (nchindev == 0 ? 0 : PA_DEFAULTCH));
- int outchans=
- (nchoutdev > 0 ? choutdev[0] : (nchoutdev == 0 ? 0 : PA_DEFAULTCH));
- int soundindev = (naudioindev <= 0 ? -1 : (audioindev[0]-1));
- int soundoutdev = (naudiooutdev <= 0 ? -1 : (audiooutdev[0]-1));
- int sounddev = (inchans > 0 ? soundindev : soundoutdev);
- if (naudioindev > 1 || nchindev > 1 || naudiooutdev > 1 || nchoutdev > 1)
- post("sorry, only one portaudio device can be open at once.\n");
- /* post("nindev %d, noutdev %d", naudioindev, naudiooutdev);
- post("soundindev %d, soundoutdev %d", soundindev, soundoutdev); */
- if (sys_verbose)
- post("channels in %d, out %d", inchans, outchans);
- if (rate < 1)
- rate = PA_DEFAULTSRATE;
- mac_setchsr(inchans, outchans, rate);
- pa_open_audio(inchans, outchans, rate, sys_soundin, sys_soundout,
- mac_blocksize, mac_advance_samples/mac_blocksize,
- soundindev, soundoutdev);
-}
-
-void sys_close_audio(void)
-{
- pa_close_audio();
-}
-
-
-int sys_send_dacs(void)
-{
- if (mac_meters)
- {
- int i, n;
- float maxsamp;
- for (i = 0, n = mac_inchannels * DACBLKSIZE, maxsamp = mac_inmax;
- i < n; i++)
- {
- float f = sys_soundin[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- mac_inmax = maxsamp;
- for (i = 0, n = mac_outchannels * DACBLKSIZE, maxsamp = mac_outmax;
- i < n; i++)
- {
- float f = sys_soundout[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- mac_outmax = maxsamp;
- }
- return pa_send_dacs();
-}
-
-float sys_getsr(void)
-{
- return (sys_dacsr);
-}
-
-int sys_get_outchannels(void)
-{
- return (mac_outchannels);
-}
-
-int sys_get_inchannels(void)
-{
- return (mac_inchannels);
-}
-
-void sys_audiobuf(int n)
-{
- /* set the size, in milliseconds, of the audio FIFO */
- if (n < 5) n = 5;
- else if (n > 5000) n = 5000;
- sys_schedadvance = n * 1000;
-}
-
-void sys_getmeters(float *inmax, float *outmax)
-{
- if (inmax)
- {
- mac_meters = 1;
- *inmax = mac_inmax;
- *outmax = mac_outmax;
- }
- else
- mac_meters = 0;
- mac_inmax = mac_outmax = 0;
-}
-
-void sys_reportidle(void)
-{
-}
-
-void sys_open_midi(int nmidiin, int *midiinvec,
- int nmidiout, int *midioutvec)
-{
- int i = 0;
- int n = 0;
- PmError err;
-
- Pt_Start(1, 0, 0); /* start a timer with millisecond accuracy */
- mac_nmidiindev = 0;
-
- for (i = 0; i < nmidiin; i++)
- {
- err = Pm_OpenInput(&mac_midiindevlist[mac_nmidiindev], midiinvec[i],
- NULL, 100, NULL, NULL, NULL);
- if (err)
- post("could not open midi input device number %d: %s",
- midiinvec[i], Pm_GetErrorText(err));
- else
- {
- if (sys_verbose)
- post("Midi Input opened.\n");
- mac_nmidiindev++;
- }
- }
-
- mac_nmidioutdev = 0;
- for (i = 0; i < nmidiout; i++)
- {
- err = Pm_OpenOutput(&mac_midioutdevlist[mac_nmidioutdev], midioutvec[i],
- NULL, 0, NULL, NULL, 0);
- if (err)
- post("could not open midi output device number %d: %s",
- midioutvec[i], Pm_GetErrorText(err));
- else
- {
- if (sys_verbose)
- post("Midi Output opened.\n");
- mac_nmidioutdev++;
- }
- }
-}
-
-void sys_close_midi( void)
-{
- int i;
- for (i = 0; i < mac_nmidiindev; i++)
- Pm_Close(mac_midiindevlist[mac_nmidiindev]);
- mac_nmidiindev = 0;
- for (i = 0; i < mac_nmidioutdev; i++)
- Pm_Close(mac_midioutdevlist[mac_nmidioutdev]);
- mac_nmidioutdev = 0;
-}
-
-void sys_putmidimess(int portno, int a, int b, int c)
-{
- PmEvent buffer;
- fprintf(stderr, "put 1 msg %d %d\n", portno, mac_nmidioutdev);
- if (portno >= 0 && portno < mac_nmidioutdev)
- {
- buffer.message = Pm_Message(a, b, c);
- buffer.timestamp = 0;
- fprintf(stderr, "put msg\n");
- Pm_Write(mac_midioutdevlist[portno], &buffer, 1);
- }
-}
-
-void sys_putmidibyte(int portno, int byte)
-{
- post("sorry, no byte-by-byte MIDI output implemented in MAC OSX");
-}
-
-void sys_poll_midi(void)
-{
- int i, nmess;
- PmEvent buffer;
- for (i = 0; i < mac_nmidiindev; i++)
- {
- int nmess = Pm_Read(mac_midiindevlist[i], &buffer, 1);
- if (nmess > 0)
- {
- int status = Pm_MessageStatus(buffer.message);
- int data1 = Pm_MessageData1(buffer.message);
- int data2 = Pm_MessageData2(buffer.message);
- int msgtype = (status >> 4) - 8;
- switch (msgtype)
- {
- case 0:
- case 1:
- case 2:
- case 3:
- case 6:
- sys_midibytein(i, status);
- sys_midibytein(i, data1);
- sys_midibytein(i, data2);
- break;
- case 4:
- case 5:
- sys_midibytein(i, status);
- sys_midibytein(i, data1);
- break;
- case 7:
- sys_midibytein(i, status);
- break;
- }
- }
- }
-}
-
-#if defined(_POSIX_PRIORITY_SCHEDULING) || defined(_POSIX_MEMLOCK)
-#include <sched.h>
-#endif
-
-void sys_set_priority(int higher)
-{
-#ifdef _POSIX_PRIORITY_SCHEDULING
- struct sched_param par;
- int p1 ,p2, p3;
- p1 = sched_get_priority_min(SCHED_FIFO);
- p2 = sched_get_priority_max(SCHED_FIFO);
- p3 = (higher ? p2 - 1 : p2 - 3);
- par.sched_priority = p3;
- if (sched_setscheduler(0,SCHED_FIFO,&par) != -1)
- fprintf(stderr, "priority %d scheduling enabled.\n", p3);
-#else /* no priority scheduling, so renice and wish for something better */
- int retval;
- errno = 0;
- retval = setpriority(PRIO_PROCESS, 0, (higher? 0 : -20));
- if (retval == -1 & errno != 0)
- {
- perror("setpriority");
- fprintf(stderr, "priority boost faled.\n");
- }
-#endif
-
-#ifdef _POSIX_MEMLOCK
- if (mlockall(MCL_FUTURE) != -1)
- fprintf(stderr, "memory locking enabled.\n");
-#endif
-
-}
-
-void sys_listdevs(void )
-{
- pa_listdevs();
-}
-
-void sys_setblocksize(int n)
-{
- if (n < 1)
- n = 1;
- if (n != (1 << ilog2(n)))
- warn("blocksize adjusted to power of 2: %d",
- (n = (1 << ilog2(n))));
- mac_blocksize = n;
-}
-
- /* dummy stuff that shouldn't he here */
-void nt_soundindev(int which)
-{
-}
-
-void nt_soundoutdev(int which)
-{
-}
-
-void nt_midiindev(int which)
-{
-}
-
-void nt_midioutdev(int which)
-{
-}
-
-void nt_noresync(void )
-{
-}
-
-void glob_audio(void *dummy, t_floatarg fadc, t_floatarg fdac)
-{
-}
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index f969f27e..a7820026 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -7,7 +7,7 @@
* 1311:forum::für::umläute:2001
*/
-char pd_version[] = "Pd version 0.37 TEST 4\n";
+char pd_version[] = "Pd version 0.37.0\n";
char pd_compiletime[] = __TIME__;
char pd_compiledate[] = __DATE__;
@@ -36,8 +36,7 @@ int sys_argparse(int argc, char **argv);
void sys_findprogdir(char *progname);
int sys_startgui(const char *guipath);
int sys_rcfile(void);
-int m_scheduler(int nodacs);
-void m_schedsetsr( void);
+int m_scheduler(void);
void sys_addhelppath(char *p);
int sys_debuglevel;
@@ -58,8 +57,28 @@ int sys_nmidiin = 0;
#else
int sys_nmidiin = 1;
#endif
-int sys_midiindevlist[MAXMIDIINDEV] = {DEFMIDIDEV};
-int sys_midioutdevlist[MAXMIDIOUTDEV] = {DEFMIDIDEV};
+int sys_midiindevlist[MAXMIDIINDEV] = {1};
+int sys_midioutdevlist[MAXMIDIOUTDEV] = {1};
+
+static int sys_main_srate = DEFAULTSRATE;
+static int sys_main_advance = DEFAULTADVANCE;
+
+/* IOhannes { */
+
+ /* here the "-1" counts signify that the corresponding vector hasn't been
+ specified in command line arguments; sys_open_audio will detect this
+ and fill things in. */
+int sys_nsoundin = -1;
+int sys_nsoundout = -1;
+int sys_soundindevlist[MAXAUDIOINDEV];
+int sys_soundoutdevlist[MAXAUDIOOUTDEV];
+
+int sys_nchin = -1;
+int sys_nchout = -1;
+int sys_chinlist[MAXAUDIOINDEV];
+int sys_choutlist[MAXAUDIOOUTDEV];
+/* } IOhannes */
+
typedef struct _fontinfo
{
@@ -133,25 +152,6 @@ int sys_defaultfont;
#define DEFAULTFONT 10
#endif
-
-static int inchannels = -1, outchannels = -1;
-static int srate = 44100;
-
-/* IOhannes { */
-#define MAXSOUNDINDEV 4
-#define MAXSOUNDOUTDEV 4
-
-int sys_nsoundin = -1;
-int sys_nsoundout = -1;
-int sys_soundindevlist[MAXSOUNDINDEV] = {-1};
-int sys_soundoutdevlist[MAXSOUNDOUTDEV] = {-1};
-
-int sys_nchin = -1;
-int sys_nchout = -1;
-int sys_chinlist[MAXSOUNDINDEV] = {-1};
-int sys_choutlist[MAXSOUNDOUTDEV] = {-1};
-/* } IOhannes */
-
static void openit(const char *dirname, const char *filename)
{
char dirbuf[MAXPDSTRING], *nameptr;
@@ -248,19 +248,17 @@ int sys_main(int argc, char **argv)
pd_version, pd_compiletime, pd_compiledate);
if (sys_version) /* if we were just asked our version, exit here. */
return (0);
+ if (sys_startgui(sys_guidir->s_name)) /* start the gui */
+ return(1);
/* open audio and MIDI */
sys_open_midi(sys_nmidiin, sys_midiindevlist,
sys_nmidiout, sys_midioutdevlist);
sys_open_audio(sys_nsoundin, sys_soundindevlist, sys_nchin, sys_chinlist,
- sys_nsoundout, sys_soundoutdevlist, sys_nchout, sys_choutlist, srate);
-
- /* tell scheduler the sample rate */
- m_schedsetsr();
- if (sys_startgui(sys_guidir->s_name)) /* start the gui */
- return(1);
+ sys_nsoundout, sys_soundoutdevlist, sys_nchout, sys_choutlist,
+ sys_main_srate, sys_main_advance, 1);
/* run scheduler until it quits */
- return (m_scheduler(!(inchannels || outchannels)));
+ return (m_scheduler());
}
static char *(usagemessage[]) = {
@@ -288,19 +286,24 @@ static char *(usagemessage[]) = {
#ifdef USEAPI_ALSA
"-alsa -- use ALSA audio API\n",
-"-alsadev <n> ----- ALSA device # (count from 1) or name: default hw:0,0\n",
+"-alsadev <n> ----- obsolete: use -audiodev\n",
+#endif
+
+#ifdef USEAPI_JACK
+"-jack -- use JACK audio API\n",
#endif
#ifdef USEAPI_PORTAUDIO
#ifdef MSW
-"-pa -- use Portaudio API (for ASIO)\n",
+"-asio -- use ASIO audio driver (via Portaudio)\n",
+"-pa -- synonym for -asio\n",
#else
"-pa -- use Portaudio API\n",
#endif
#endif
#ifdef USEAPI_MMIO
-"-mmio -- use MMIO audio API\n",
+"-mmio -- use MMIO audio API (default for Windows)\n",
#endif
" (default audio API for this platform: ", API_DEFSTRING, ")\n\n",
@@ -329,7 +332,7 @@ static char *(usagemessage[]) = {
"-rt or -realtime -- use real-time priority (needs root privilege)\n",
#endif
};
-
+
static void sys_parsedevlist(int *np, int *vecp, int max, char *str)
{
int n = 0;
@@ -363,7 +366,7 @@ static int sys_getmultidevchannels(int n, int *devlist)
/* this routine tries to figure out where to find the auxilliary files
Pd will need to run. This is either done by looking at the command line
- invokation for Pd, or if htat fails, by consulting the variable
+ invokation for Pd, or if that fails, by consulting the variable
INSTALL_PREFIX. In MSW, we don't try to use INSTALL_PREFIX. */
void sys_findprogdir(char *progname)
{
@@ -458,19 +461,25 @@ void sys_findprogdir(char *progname)
int sys_argparse(int argc, char **argv)
{
char sbuf[MAXPDSTRING];
+ int i;
+#ifdef MSW
+ int mmio = 1;
+#else
+ int mmio = 0;
+#endif
argc--; argv++;
while ((argc > 0) && **argv == '-')
{
if (!strcmp(*argv, "-r") && argc > 1 &&
- sscanf(argv[1], "%d", &srate) >= 1)
+ sscanf(argv[1], "%d", &sys_main_srate) >= 1)
{
argc -= 2;
argv += 2;
}
else if (!strcmp(*argv, "-inchannels"))
- { /* IOhannes */
- sys_parsedevlist(&sys_nchin, sys_chinlist, MAXSOUNDINDEV, argv[1]);
- inchannels=sys_getmultidevchannels(sys_nchin, sys_chinlist);
+ { /* IOhannes */
+ sys_parsedevlist(&sys_nchin,
+ sys_chinlist, MAXAUDIOINDEV, argv[1]);
if (!sys_nchin)
goto usage;
@@ -478,9 +487,9 @@ int sys_argparse(int argc, char **argv)
argc -= 2; argv += 2;
}
else if (!strcmp(*argv, "-outchannels"))
- { /* IOhannes */
- sys_parsedevlist(&sys_nchout, sys_choutlist,MAXSOUNDOUTDEV, argv[1]);
- outchannels=sys_getmultidevchannels(sys_nchout, sys_choutlist);
+ { /* IOhannes */
+ sys_parsedevlist(&sys_nchout, sys_choutlist,
+ MAXAUDIOOUTDEV, argv[1]);
if (!sys_nchout)
goto usage;
@@ -489,12 +498,10 @@ int sys_argparse(int argc, char **argv)
}
else if (!strcmp(*argv, "-channels"))
{
- sys_parsedevlist(&sys_nchin, sys_chinlist,MAXSOUNDINDEV,
+ sys_parsedevlist(&sys_nchin, sys_chinlist,MAXAUDIOINDEV,
argv[1]);
- inchannels = sys_getmultidevchannels(sys_nchin, sys_chinlist);
- sys_parsedevlist(&sys_nchout, sys_choutlist,MAXSOUNDOUTDEV,
+ sys_parsedevlist(&sys_nchout, sys_choutlist,MAXAUDIOOUTDEV,
argv[1]);
- outchannels = sys_getmultidevchannels(sys_nchout, sys_choutlist);
if (!sys_nchout)
goto usage;
@@ -503,7 +510,7 @@ int sys_argparse(int argc, char **argv)
}
else if (!strcmp(*argv, "-soundbuf") || !strcmp(*argv, "-audiobuf"))
{
- sys_audiobuf(atoi(argv[1]));
+ sys_main_advance = atoi(argv[1]);
argc -= 2; argv += 2;
}
else if (!strcmp(*argv, "-blocksize"))
@@ -520,32 +527,29 @@ int sys_argparse(int argc, char **argv)
{ /* IOhannes */
sys_nsoundout=0;
sys_nchout = 0;
- outchannels =0;
argc--; argv++;
}
else if (!strcmp(*argv, "-noadc"))
{ /* IOhannes */
sys_nsoundin=0;
sys_nchin = 0;
- inchannels =0;
argc--; argv++;
}
else if (!strcmp(*argv, "-nosound") || !strcmp(*argv, "-noaudio"))
{ /* IOhannes */
sys_nsoundin=sys_nsoundout = 0;
sys_nchin = sys_nchout = 0;
- inchannels =outchannels =0;
argc--; argv++;
}
#ifdef USEAPI_OSS
else if (!strcmp(*argv, "-oss"))
{
- sys_set_sound_api(API_OSS);
+ sys_set_audio_api(API_OSS);
argc--; argv++;
}
else if (!strcmp(*argv, "-32bit"))
{
- sys_set_sound_api(API_OSS);
+ sys_set_audio_api(API_OSS);
oss_set32bit();
argc--; argv++;
}
@@ -553,33 +557,51 @@ int sys_argparse(int argc, char **argv)
#ifdef USEAPI_ALSA
else if (!strcmp(*argv, "-alsa"))
{
- sys_set_sound_api(API_ALSA);
+ sys_set_audio_api(API_ALSA);
argc--; argv++;
}
+ /* obsolete flag for setting ALSA device number or name */
else if (!strcmp(*argv, "-alsadev"))
{
+ int devno = 0;
if (argv[1][0] >= '1' && argv[1][0] <= '9')
- {
- char buf[80];
- sprintf(buf, "hw:%d,0", atoi(argv[1]) - 1);
- linux_alsa_devname(buf);
- }
- else linux_alsa_devname(argv[1]);
- sys_set_sound_api(API_ALSA);
+ devno = 1 + 2 * (atoi(argv[1]) - 1);
+ else if (!strncmp(argv[1], "hw:", 3))
+ devno = 1 + 2 * atoi(argv[1]+3);
+ else if (!strncmp(argv[1], "plughw:", 7))
+ devno = 2 + 2 * atoi(argv[1]+7);
+ else goto usage;
+ post("devno %d", devno);
+ sys_nsoundin = sys_nsoundout = 1;
+ sys_soundindevlist[0] = sys_soundoutdevlist[0] = devno;
+ sys_set_audio_api(API_ALSA);
argc -= 2; argv +=2;
}
#endif
+#ifdef USEAPI_JACK
+ else if (!strcmp(*argv, "-jack"))
+ {
+ sys_set_audio_api(API_JACK);
+ argc--; argv++;
+ }
+#endif
#ifdef USEAPI_PORTAUDIO
- else if (!strcmp(*argv, "-pa") || !strcmp(*argv, "-portaudio"))
+ else if (!strcmp(*argv, "-pa") || !strcmp(*argv, "-portaudio")
+#ifdef MSW
+ || !strcmp(*argv, "-asio")
+#endif
+ )
{
- sys_set_sound_api(API_PORTAUDIO);
+ sys_set_audio_api(API_PORTAUDIO);
+ mmio = 0;
argc--; argv++;
}
#endif
#ifdef USEAPI_MMIO
else if (!strcmp(*argv, "-mmio"))
{
- sys_set_sound_api(API_MMIO);
+ sys_set_audio_api(API_MMIO);
+ mmio = 1;
argc--; argv++;
}
#endif
@@ -702,7 +724,7 @@ int sys_argparse(int argc, char **argv)
!strcmp(*argv, "-audioindev"))
{ /* IOhannes */
sys_parsedevlist(&sys_nsoundin, sys_soundindevlist,
- MAXSOUNDINDEV, argv[1]);
+ MAXAUDIOINDEV, argv[1]);
if (!sys_nsoundin)
goto usage;
argc -= 2; argv += 2;
@@ -711,7 +733,7 @@ int sys_argparse(int argc, char **argv)
!strcmp(*argv, "-audiooutdev"))
{ /* IOhannes */
sys_parsedevlist(&sys_nsoundout, sys_soundoutdevlist,
- MAXSOUNDOUTDEV, argv[1]);
+ MAXAUDIOOUTDEV, argv[1]);
if (!sys_nsoundout)
goto usage;
argc -= 2; argv += 2;
@@ -719,9 +741,9 @@ int sys_argparse(int argc, char **argv)
else if (!strcmp(*argv, "-sounddev") || !strcmp(*argv, "-audiodev"))
{
sys_parsedevlist(&sys_nsoundin, sys_soundindevlist,
- MAXSOUNDINDEV, argv[1]);
+ MAXAUDIOINDEV, argv[1]);
sys_parsedevlist(&sys_nsoundout, sys_soundoutdevlist,
- MAXSOUNDOUTDEV, argv[1]);
+ MAXAUDIOOUTDEV, argv[1]);
if (!sys_nsoundout)
goto usage;
argc -= 2; argv += 2;
@@ -740,6 +762,22 @@ int sys_argparse(int argc, char **argv)
for (; argc > 0; argc--, argv++)
sys_openlist = namelist_append(sys_openlist, *argv);
+ /* correct to make audio and MIDI device lists zero based. On
+ MMIO, however, "1" really means the second device (the first one
+ is "mapper" which is was not included when the command args were
+ set up, so we leave it that way for compatibility. */
+ if (!mmio)
+ {
+ for (i = 0; i < sys_nsoundin; i++)
+ sys_soundindevlist[i]--;
+ for (i = 0; i < sys_nsoundout; i++)
+ sys_soundoutdevlist[i]--;
+ }
+ for (i = 0; i < sys_nmidiin; i++)
+ sys_midiindevlist[i]--;
+ for (i = 0; i < sys_nmidiout; i++)
+ sys_midioutdevlist[i]--;
+
return (0);
}
diff --git a/pd/src/s_midi.c b/pd/src/s_midi.c
index 2bba9a45..0382d0b0 100644
--- a/pd/src/s_midi.c
+++ b/pd/src/s_midi.c
@@ -403,3 +403,197 @@ void sys_pollmidiqueue( void)
sys_pollmidioutqueue();
sys_pollmidiinqueue();
}
+
+/******************** dialog window and device listing ********************/
+
+#ifdef USEAPI_OSS
+void midi_oss_init( void);
+#endif
+
+ /* last requested parameters */
+static int midi_nmidiindev;
+static int midi_midiindev[MAXMIDIINDEV];
+static int midi_nmidioutdev;
+static int midi_midioutdev[MAXMIDIOUTDEV];
+
+static void sys_get_midi_params(int *pnmidiindev, int *pmidiindev,
+ int *pnmidioutdev, int *pmidioutdev)
+{
+ int i;
+ *pnmidiindev = midi_nmidiindev;
+ for (i = 0; i < MAXMIDIINDEV; i++)
+ pmidiindev[i] = midi_midiindev[i];
+ *pnmidioutdev = midi_nmidioutdev;
+ for (i = 0; i < MAXMIDIOUTDEV; i++)
+ pmidioutdev[i] = midi_midioutdev[i];
+}
+
+static void sys_save_midi_params(
+ int nmidiindev, int *midiindev,
+ int nmidioutdev, int *midioutdev)
+{
+ int i;
+ midi_nmidiindev = nmidiindev;
+ for (i = 0; i < MAXMIDIINDEV; i++)
+ midi_midiindev[i] = midiindev[i];
+ midi_nmidioutdev = nmidioutdev;
+ for (i = 0; i < MAXMIDIOUTDEV; i++)
+ midi_midioutdev[i] = midioutdev[i];
+}
+
+void sys_open_midi(int nmidiindev, int *midiindev,
+ int nmidioutdev, int *midioutdev)
+{
+#ifdef USEAPI_OSS
+ midi_oss_init();
+#endif
+ sys_do_open_midi(nmidiindev, midiindev, nmidioutdev, midioutdev);
+ sys_save_midi_params(nmidiindev, midiindev,
+ nmidioutdev, midioutdev);
+}
+
+ /* open midi using whatever parameters were last used */
+void sys_reopen_midi( void)
+{
+ int nmidiindev, midiindev[MAXMIDIINDEV];
+ int nmidioutdev, midioutdev[MAXMIDIOUTDEV];
+ sys_get_midi_params(&nmidiindev, midiindev, &nmidioutdev, midioutdev);
+ sys_open_midi(nmidiindev, midiindev, nmidioutdev, midioutdev);
+}
+
+#define MAXNDEV 20
+#define DEVDESCSIZE 80
+
+#ifdef MSW
+#define DEVONSET 0 /* microsoft device list starts at 0 (the "mapper"). */
+#else /* (see also MSW ifdef in sys_parsedevlist(), s_main.c) */
+#define DEVONSET 1 /* To agree with command line flags, normally start at 1 */
+#endif
+
+void sys_listmididevs(void )
+{
+ char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
+ int nindevs = 0, noutdevs = 0, i;
+
+ midi_getdevs(indevlist, &nindevs, outdevlist, &noutdevs,
+ MAXNDEV, DEVDESCSIZE);
+
+ if (!nindevs)
+ post("no midi input devices found");
+ else
+ {
+ post("input devices:");
+ for (i = 0; i < nindevs; i++)
+ post("%d. %s", i+1, indevlist + i * DEVDESCSIZE);
+ }
+ if (!noutdevs)
+ post("no midi output devices found");
+ else
+ {
+ post("output devices:");
+ for (i = 0; i < noutdevs; i++)
+ post("%d. %s", i+DEVONSET, outdevlist + i * DEVDESCSIZE);
+ }
+}
+
+extern t_class *glob_pdobject;
+
+ /* start an midi settings dialog window */
+void glob_midi_properties(t_pd *dummy, t_floatarg flongform)
+{
+ char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)];
+ /* these are the devices you're using: */
+ int nindev, midiindev[MAXMIDIINDEV];
+ int noutdev, midioutdev[MAXMIDIOUTDEV];
+ int midiindev1, midiindev2, midiindev3, midiindev4,
+ midioutdev1, midioutdev2, midioutdev3, midioutdev4;
+
+ /* these are all the devices on your system: */
+ char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
+ int nindevs = 0, noutdevs = 0, i;
+
+ char indevliststring[MAXNDEV*(DEVDESCSIZE+4)+80],
+ outdevliststring[MAXNDEV*(DEVDESCSIZE+4)+80];
+
+ midi_getdevs(indevlist, &nindevs, outdevlist, &noutdevs,
+ MAXNDEV, DEVDESCSIZE);
+
+ strcpy(indevliststring, "{ {none} ");
+ for (i = 0; i < nindevs; i++)
+ {
+ strcat(indevliststring, "\"");
+ strcat(indevliststring, indevlist + i * DEVDESCSIZE);
+ strcat(indevliststring, "\" ");
+ }
+ strcat(indevliststring, "}");
+
+ strcpy(outdevliststring, "{ {none} ");
+ for (i = 0; i < noutdevs; i++)
+ {
+ strcat(outdevliststring, "\"");
+ strcat(outdevliststring, outdevlist + i * DEVDESCSIZE);
+ strcat(outdevliststring, "\" ");
+ }
+ strcat(outdevliststring, "}");
+
+ sys_get_midi_params(&nindev, midiindev, &noutdev, midioutdev);
+
+ if (nindev > 1 || noutdev > 1)
+ flongform = 1;
+
+ midiindev1 = (nindev > 0 && midiindev[0]>= 0 ? midiindev[0]+1 : 0);
+ midiindev2 = (nindev > 1 && midiindev[1]>= 0 ? midiindev[1]+1 : 0);
+ midiindev3 = (nindev > 2 && midiindev[2]>= 0 ? midiindev[2]+1 : 0);
+ midiindev4 = (nindev > 3 && midiindev[3]>= 0 ? midiindev[3]+1 : 0);
+ midioutdev1 = (noutdev > 0 && midioutdev[0]>=0 ? midioutdev[0]+1 : 0);
+ midioutdev2 = (noutdev > 1 && midioutdev[1]>=0 ? midioutdev[1]+1 : 0);
+ midioutdev3 = (noutdev > 2 && midioutdev[2]>=0 ? midioutdev[2]+1 : 0);
+ midioutdev4 = (noutdev > 3 && midioutdev[3]>=0 ? midioutdev[3]+1 : 0);
+
+ sprintf(buf,
+"pdtk_midi_dialog %%s \
+%s %d %d %d %d %s %d %d %d %d \
+%d\n",
+ indevliststring,
+ midiindev1, midiindev2, midiindev3, midiindev4,
+ outdevliststring,
+ midioutdev1, midioutdev2, midioutdev3, midioutdev4,
+ (flongform != 0));
+ gfxstub_deleteforkey(0);
+ gfxstub_new(&glob_pdobject, glob_midi_properties, buf);
+}
+
+ /* new values from dialog window */
+void glob_midi_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
+{
+ int nmidiindev, midiindev[MAXMIDIINDEV];
+ int nmidioutdev, midioutdev[MAXMIDIOUTDEV];
+ int i, nindev, noutdev;
+ int newmidiindev[4], newmidioutdev[4];
+
+ for (i = 0; i < 4; i++)
+ {
+ newmidiindev[i] = atom_getintarg(i, argc, argv);
+ newmidioutdev[i] = atom_getintarg(i+4, argc, argv);
+ }
+
+ for (i = 0, nindev = 0; i < 4; i++)
+ {
+ if (newmidiindev[i] > 0)
+ {
+ newmidiindev[nindev] = newmidiindev[i]-1;
+ nindev++;
+ }
+ }
+ for (i = 0, noutdev = 0; i < 4; i++)
+ {
+ if (newmidioutdev[i] > 0)
+ {
+ newmidioutdev[noutdev] = newmidioutdev[i]-1;
+ noutdev++;
+ }
+ }
+
+ sys_close_midi();
+ sys_open_midi(nindev, newmidiindev, noutdev, newmidioutdev);
+}
diff --git a/pd/src/s_midi_mmio.c b/pd/src/s_midi_mmio.c
new file mode 100644
index 00000000..ec1a75ee
--- /dev/null
+++ b/pd/src/s_midi_mmio.c
@@ -0,0 +1,715 @@
+/* Copyright (c) 1997-1999 Miller Puckette.
+* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+#include "m_pd.h"
+#include "s_stuff.h"
+#include <stdio.h>
+
+#include <windows.h>
+#include <MMSYSTEM.H>
+
+ /* ------------- MIDI time stamping from audio clock ------------ */
+
+#ifdef MIDI_TIMESTAMP
+
+static double msw_hibuftime;
+static double initsystime = -1;
+
+ /* call this whenever we reset audio */
+static void msw_resetmidisync(void)
+{
+ initsystime = clock_getsystime();
+ msw_hibuftime = sys_getrealtime();
+}
+
+ /* call this whenever we're idled waiting for audio to be ready.
+ The routine maintains a high and low water point for the difference
+ between real and DAC time. */
+
+static void msw_midisync(void)
+{
+ double jittersec, diff;
+
+ if (initsystime == -1) msw_resetmidisync();
+ jittersec = (msw_dacjitterbufsallowed > msw_adcjitterbufsallowed ?
+ msw_dacjitterbufsallowed : msw_adcjitterbufsallowed)
+ * REALDACBLKSIZE / sys_getsr();
+ diff = sys_getrealtime() - 0.001 * clock_gettimesince(initsystime);
+ if (diff > msw_hibuftime) msw_hibuftime = diff;
+ if (diff < msw_hibuftime - jittersec)
+ {
+ post("jitter excess %d %f", dac, diff);
+ msw_resetmidisync();
+ }
+}
+
+static double msw_midigettimefor(LARGE_INTEGER timestamp)
+{
+ /* this is broken now... used to work when "timestamp" was derived from
+ QueryPerformanceCounter() instead of the gates approved
+ timeGetSystemTime() call in the MIDI callback routine below. */
+ return (msw_tixtotime(timestamp) - msw_hibuftime);
+}
+#endif /* MIDI_TIMESTAMP */
+
+
+/* ------------------------- MIDI output -------------------------- */
+static void msw_midiouterror(char *s, int err)
+{
+ char t[256];
+ midiOutGetErrorText(err, t, 256);
+ fprintf(stderr, s, t);
+}
+
+static HMIDIOUT hMidiOut[MAXMIDIOUTDEV]; /* output device */
+static int msw_nmidiout; /* number of devices */
+
+static void msw_open_midiout(int nmidiout, int *midioutvec)
+{
+ UINT result, wRtn;
+ int i;
+ int dev;
+ MIDIOUTCAPS midioutcaps;
+ if (nmidiout > MAXMIDIOUTDEV)
+ nmidiout = MAXMIDIOUTDEV;
+
+ dev = 0;
+
+ for (i = 0; i < nmidiout; i++)
+ {
+ MIDIOUTCAPS mocap;
+ int devno = (midioutvec[i] == DEFMIDIDEV ?
+ MIDI_MAPPER : midioutvec[i]-1);
+ result = midiOutOpen(&hMidiOut[dev], devno, 0, 0,
+ CALLBACK_NULL);
+ wRtn = midiOutGetDevCaps(i, (LPMIDIOUTCAPS) &mocap,
+ sizeof(mocap));
+ if (result != MMSYSERR_NOERROR)
+ {
+ fprintf(stderr,"midiOutOpen: %s\n",midioutcaps.szPname);
+ msw_midiouterror("midiOutOpen: %s\n", result);
+ }
+ else
+ {
+ if (sys_verbose)
+ fprintf(stderr,"midiOutOpen: Open %s as Port %d\n",
+ midioutcaps.szPname, dev);
+ dev++;
+ }
+ }
+ msw_nmidiout = dev;
+}
+
+static void msw_close_midiout(void)
+{
+ int i;
+ for (i = 0; i < msw_nmidiout; i++)
+ {
+ midiOutReset(hMidiOut[i]);
+ midiOutClose(hMidiOut[i]);
+ }
+ msw_nmidiout = 0;
+}
+
+/* -------------------------- MIDI input ---------------------------- */
+
+#define INPUT_BUFFER_SIZE 1000 // size of input buffer in events
+
+static void msw_midiinerror(char *s, int err)
+{
+ char t[256];
+ midiInGetErrorText(err, t, 256);
+ fprintf(stderr, s, t);
+}
+
+
+/* Structure to represent a single MIDI event.
+ */
+
+#define EVNT_F_ERROR 0x00000001L
+
+typedef struct evemsw_tag
+{
+ DWORD fdwEvent;
+ DWORD dwDevice;
+ LARGE_INTEGER timestamp;
+ DWORD data;
+} EVENT;
+typedef EVENT FAR *LPEVENT;
+
+/* Structure to manage the circular input buffer.
+ */
+typedef struct circularBuffer_tag
+{
+ HANDLE hSelf; /* handle to this structure */
+ HANDLE hBuffer; /* buffer handle */
+ WORD wError; /* error flags */
+ DWORD dwSize; /* buffer size (in EVENTS) */
+ DWORD dwCount; /* byte count (in EVENTS) */
+ LPEVENT lpStart; /* ptr to start of buffer */
+ LPEVENT lpEnd; /* ptr to end of buffer (last byte + 1) */
+ LPEVENT lpHead; /* ptr to head (next location to fill) */
+ LPEVENT lpTail; /* ptr to tail (next location to empty) */
+} CIRCULARBUFFER;
+typedef CIRCULARBUFFER FAR *LPCIRCULARBUFFER;
+
+
+/* Structure to pass instance data from the application
+ to the low-level callback function.
+ */
+typedef struct callbackInstance_tag
+{
+ HANDLE hSelf;
+ DWORD dwDevice;
+ LPCIRCULARBUFFER lpBuf;
+} CALLBACKINSTANCEDATA;
+typedef CALLBACKINSTANCEDATA FAR *LPCALLBACKINSTANCEDATA;
+
+/* Function prototypes
+ */
+LPCALLBACKINSTANCEDATA FAR PASCAL AllocCallbackInstanceData(void);
+void FAR PASCAL FreeCallbackInstanceData(LPCALLBACKINSTANCEDATA lpBuf);
+
+LPCIRCULARBUFFER AllocCircularBuffer(DWORD dwSize);
+void FreeCircularBuffer(LPCIRCULARBUFFER lpBuf);
+WORD FAR PASCAL GetEvent(LPCIRCULARBUFFER lpBuf, LPEVENT lpEvent);
+
+// Callback instance data pointers
+LPCALLBACKINSTANCEDATA lpCallbackInstanceData[MAXMIDIINDEV];
+
+UINT wNumDevices = 0; // Number of MIDI input devices opened
+BOOL bRecordingEnabled = 1; // Enable/disable recording flag
+int nNumBufferLines = 0; // Number of lines in display buffer
+RECT rectScrollClip; // Clipping rectangle for scrolling
+
+LPCIRCULARBUFFER lpInputBuffer; // Input buffer structure
+EVENT incomingEvent; // Incoming MIDI event structure
+
+MIDIINCAPS midiInCaps[MAXMIDIINDEV]; // Device capabilities structures
+HMIDIIN hMidiIn[MAXMIDIINDEV]; // MIDI input device handles
+
+
+/* AllocCallbackInstanceData - Allocates a CALLBACKINSTANCEDATA
+ * structure. This structure is used to pass information to the
+ * low-level callback function, each time it receives a message.
+ *
+ * Because this structure is accessed by the low-level callback
+ * function, it must be allocated using GlobalAlloc() with the
+ * GMEM_SHARE and GMEM_MOVEABLE flags and page-locked with
+ * GlobalPageLock().
+ *
+ * Params: void
+ *
+ * Return: A pointer to the allocated CALLBACKINSTANCE data structure.
+ */
+LPCALLBACKINSTANCEDATA FAR PASCAL AllocCallbackInstanceData(void)
+{
+ HANDLE hMem;
+ LPCALLBACKINSTANCEDATA lpBuf;
+
+ /* Allocate and lock global memory.
+ */
+ hMem = GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE,
+ (DWORD)sizeof(CALLBACKINSTANCEDATA));
+ if(hMem == NULL)
+ return NULL;
+
+ lpBuf = (LPCALLBACKINSTANCEDATA)GlobalLock(hMem);
+ if(lpBuf == NULL){
+ GlobalFree(hMem);
+ return NULL;
+ }
+
+ /* Page lock the memory.
+ */
+ //GlobalPageLock((HGLOBAL)HIWORD(lpBuf));
+
+ /* Save the handle.
+ */
+ lpBuf->hSelf = hMem;
+
+ return lpBuf;
+}
+
+/* FreeCallbackInstanceData - Frees the given CALLBACKINSTANCEDATA structure.
+ *
+ * Params: lpBuf - Points to the CALLBACKINSTANCEDATA structure to be freed.
+ *
+ * Return: void
+ */
+void FAR PASCAL FreeCallbackInstanceData(LPCALLBACKINSTANCEDATA lpBuf)
+{
+ HANDLE hMem;
+
+ /* Save the handle until we're through here.
+ */
+ hMem = lpBuf->hSelf;
+
+ /* Free the structure.
+ */
+ //GlobalPageUnlock((HGLOBAL)HIWORD(lpBuf));
+ GlobalUnlock(hMem);
+ GlobalFree(hMem);
+}
+
+
+/*
+ * AllocCircularBuffer - Allocates memory for a CIRCULARBUFFER structure
+ * and a buffer of the specified size. Each memory block is allocated
+ * with GlobalAlloc() using GMEM_SHARE and GMEM_MOVEABLE flags, locked
+ * with GlobalLock(), and page-locked with GlobalPageLock().
+ *
+ * Params: dwSize - The size of the buffer, in events.
+ *
+ * Return: A pointer to a CIRCULARBUFFER structure identifying the
+ * allocated display buffer. NULL if the buffer could not be allocated.
+ */
+
+
+LPCIRCULARBUFFER AllocCircularBuffer(DWORD dwSize)
+{
+ HANDLE hMem;
+ LPCIRCULARBUFFER lpBuf;
+ LPEVENT lpMem;
+
+ /* Allocate and lock a CIRCULARBUFFER structure.
+ */
+ hMem = GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE,
+ (DWORD)sizeof(CIRCULARBUFFER));
+ if(hMem == NULL)
+ return NULL;
+
+ lpBuf = (LPCIRCULARBUFFER)GlobalLock(hMem);
+ if(lpBuf == NULL)
+ {
+ GlobalFree(hMem);
+ return NULL;
+ }
+
+ /* Page lock the memory. Global memory blocks accessed by
+ * low-level callback functions must be page locked.
+ */
+#ifndef _WIN32
+ GlobalSmartPageLock((HGLOBAL)HIWORD(lpBuf));
+#endif
+
+ /* Save the memory handle.
+ */
+ lpBuf->hSelf = hMem;
+
+ /* Allocate and lock memory for the actual buffer.
+ */
+ hMem = GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE, dwSize * sizeof(EVENT));
+ if(hMem == NULL)
+ {
+#ifndef _WIN32
+ GlobalSmartPageUnlock((HGLOBAL)HIWORD(lpBuf));
+#endif
+ GlobalUnlock(lpBuf->hSelf);
+ GlobalFree(lpBuf->hSelf);
+ return NULL;
+ }
+
+ lpMem = (LPEVENT)GlobalLock(hMem);
+ if(lpMem == NULL)
+ {
+ GlobalFree(hMem);
+#ifndef _WIN32
+ GlobalSmartPageUnlock((HGLOBAL)HIWORD(lpBuf));
+#endif
+ GlobalUnlock(lpBuf->hSelf);
+ GlobalFree(lpBuf->hSelf);
+ return NULL;
+ }
+
+ /* Page lock the memory. Global memory blocks accessed by
+ * low-level callback functions must be page locked.
+ */
+#ifndef _WIN32
+ GlobalSmartPageLock((HGLOBAL)HIWORD(lpMem));
+#endif
+
+ /* Set up the CIRCULARBUFFER structure.
+ */
+ lpBuf->hBuffer = hMem;
+ lpBuf->wError = 0;
+ lpBuf->dwSize = dwSize;
+ lpBuf->dwCount = 0L;
+ lpBuf->lpStart = lpMem;
+ lpBuf->lpEnd = lpMem + dwSize;
+ lpBuf->lpTail = lpMem;
+ lpBuf->lpHead = lpMem;
+
+ return lpBuf;
+}
+
+/* FreeCircularBuffer - Frees the memory for the given CIRCULARBUFFER
+ * structure and the memory for the buffer it references.
+ *
+ * Params: lpBuf - Points to the CIRCULARBUFFER to be freed.
+ *
+ * Return: void
+ */
+void FreeCircularBuffer(LPCIRCULARBUFFER lpBuf)
+{
+ HANDLE hMem;
+
+ /* Free the buffer itself.
+ */
+#ifndef _WIN32
+ GlobalSmartPageUnlock((HGLOBAL)HIWORD(lpBuf->lpStart));
+#endif
+ GlobalUnlock(lpBuf->hBuffer);
+ GlobalFree(lpBuf->hBuffer);
+
+ /* Free the CIRCULARBUFFER structure.
+ */
+ hMem = lpBuf->hSelf;
+#ifndef _WIN32
+ GlobalSmartPageUnlock((HGLOBAL)HIWORD(lpBuf));
+#endif
+ GlobalUnlock(hMem);
+ GlobalFree(hMem);
+}
+
+/* GetEvent - Gets a MIDI event from the circular input buffer. Events
+ * are removed from the buffer. The corresponding PutEvent() function
+ * is called by the low-level callback function, so it must reside in
+ * the callback DLL. PutEvent() is defined in the CALLBACK.C module.
+ *
+ * Params: lpBuf - Points to the circular buffer.
+ * lpEvent - Points to an EVENT structure that is filled with the
+ * retrieved event.
+ *
+ * Return: Returns non-zero if successful, zero if there are no
+ * events to get.
+ */
+WORD FAR PASCAL GetEvent(LPCIRCULARBUFFER lpBuf, LPEVENT lpEvent)
+{
+ /* If no event available, return */
+ if (!wNumDevices || lpBuf->dwCount <= 0) return (0);
+
+ /* Get the event.
+ */
+ *lpEvent = *lpBuf->lpTail;
+
+ /* Decrement the byte count, bump the tail pointer.
+ */
+ --lpBuf->dwCount;
+ ++lpBuf->lpTail;
+
+ /* Wrap the tail pointer, if necessary.
+ */
+ if(lpBuf->lpTail >= lpBuf->lpEnd)
+ lpBuf->lpTail = lpBuf->lpStart;
+
+ return 1;
+}
+
+/* PutEvent - Puts an EVENT in a CIRCULARBUFFER. If the buffer is full,
+ * it sets the wError element of the CIRCULARBUFFER structure
+ * to be non-zero.
+ *
+ * Params: lpBuf - Points to the CIRCULARBUFFER.
+ * lpEvent - Points to the EVENT.
+ *
+ * Return: void
+*/
+
+void FAR PASCAL PutEvent(LPCIRCULARBUFFER lpBuf, LPEVENT lpEvent)
+{
+ /* If the buffer is full, set an error and return.
+ */
+ if(lpBuf->dwCount >= lpBuf->dwSize){
+ lpBuf->wError = 1;
+ return;
+ }
+
+ /* Put the event in the buffer, bump the head pointer and the byte count.
+ */
+ *lpBuf->lpHead = *lpEvent;
+
+ ++lpBuf->lpHead;
+ ++lpBuf->dwCount;
+
+ /* Wrap the head pointer, if necessary.
+ */
+ if(lpBuf->lpHead >= lpBuf->lpEnd)
+ lpBuf->lpHead = lpBuf->lpStart;
+}
+
+/* midiInputHandler - Low-level callback function to handle MIDI input.
+ * Installed by midiInOpen(). The input handler takes incoming
+ * MIDI events and places them in the circular input buffer. It then
+ * notifies the application by posting a MM_MIDIINPUT message.
+ *
+ * This function is accessed at interrupt time, so it should be as
+ * fast and efficient as possible. You can't make any
+ * Windows calls here, except PostMessage(). The only Multimedia
+ * Windows call you can make are timeGetSystemTime(), midiOutShortMsg().
+ *
+ *
+ * Param: hMidiIn - Handle for the associated input device.
+ * wMsg - One of the MIM_***** messages.
+ * dwInstance - Points to CALLBACKINSTANCEDATA structure.
+ * dwParam1 - MIDI data.
+ * dwParam2 - Timestamp (in milliseconds)
+ *
+ * Return: void
+ */
+void FAR PASCAL midiInputHandler(
+HMIDIIN hMidiIn,
+WORD wMsg,
+DWORD dwInstance,
+DWORD dwParam1,
+DWORD dwParam2)
+{
+ EVENT event;
+
+ switch(wMsg)
+ {
+ case MIM_OPEN:
+ break;
+
+ /* The only error possible is invalid MIDI data, so just pass
+ * the invalid data on so we'll see it.
+ */
+ case MIM_ERROR:
+ case MIM_DATA:
+ event.fdwEvent = (wMsg == MIM_ERROR) ? EVNT_F_ERROR : 0;
+ event.dwDevice = ((LPCALLBACKINSTANCEDATA)dwInstance)->dwDevice;
+ event.data = dwParam1;
+#ifdef MIDI_TIMESTAMP
+ event.timestamp = timeGetSystemTime();
+#endif
+ /* Put the MIDI event in the circular input buffer.
+ */
+
+ PutEvent(((LPCALLBACKINSTANCEDATA)dwInstance)->lpBuf,
+ (LPEVENT) &event);
+
+ break;
+
+ default:
+ break;
+ }
+}
+
+void msw_open_midiin(int nmidiin, int *midiinvec)
+{
+ UINT wRtn;
+ char szErrorText[256];
+ unsigned int i;
+ unsigned int ndev = 0;
+ /* Allocate a circular buffer for low-level MIDI input. This buffer
+ * is filled by the low-level callback function and emptied by the
+ * application.
+ */
+ lpInputBuffer = AllocCircularBuffer((DWORD)(INPUT_BUFFER_SIZE));
+ if (lpInputBuffer == NULL)
+ {
+ printf("Not enough memory available for input buffer.\n");
+ return;
+ }
+
+ /* Open all MIDI input devices after allocating and setting up
+ * instance data for each device. The instance data is used to
+ * pass buffer management information between the application and
+ * the low-level callback function. It also includes a device ID,
+ * a handle to the MIDI Mapper, and a handle to the application's
+ * display window, so the callback can notify the window when input
+ * data is available. A single callback function is used to service
+ * all opened input devices.
+ */
+ for (i=0; (i<(unsigned)nmidiin) && (i<MAXMIDIINDEV); i++)
+ {
+ if ((lpCallbackInstanceData[ndev] = AllocCallbackInstanceData()) == NULL)
+ {
+ printf("Not enough memory available.\n");
+ FreeCircularBuffer(lpInputBuffer);
+ return;
+ }
+ lpCallbackInstanceData[i]->dwDevice = i;
+ lpCallbackInstanceData[i]->lpBuf = lpInputBuffer;
+
+ wRtn = midiInOpen((LPHMIDIIN)&hMidiIn[ndev],
+ midiinvec[i] - 1,
+ (DWORD)midiInputHandler,
+ (DWORD)lpCallbackInstanceData[ndev],
+ CALLBACK_FUNCTION);
+ if (wRtn)
+ {
+ FreeCallbackInstanceData(lpCallbackInstanceData[ndev]);
+ msw_midiinerror("midiInOpen: %s\n", wRtn);
+ }
+ else ndev++;
+ }
+
+ /* Start MIDI input.
+ */
+ for (i=0; i<ndev; i++)
+ {
+ if (hMidiIn[i])
+ midiInStart(hMidiIn[i]);
+ }
+ wNumDevices = ndev;
+}
+
+static void msw_close_midiin(void)
+{
+ unsigned int i;
+ /* Stop, reset, close MIDI input. Free callback instance data.
+ */
+
+ for (i=0; (i<wNumDevices) && (i<MAXMIDIINDEV); i++)
+ {
+ if (hMidiIn[i])
+ {
+ if (sys_verbose)
+ post("closing MIDI input %d...", i);
+ midiInStop(hMidiIn[i]);
+ midiInReset(hMidiIn[i]);
+ midiInClose(hMidiIn[i]);
+ FreeCallbackInstanceData(lpCallbackInstanceData[i]);
+ }
+ }
+
+ /* Free input buffer.
+ */
+ if (lpInputBuffer)
+ FreeCircularBuffer(lpInputBuffer);
+
+ if (sys_verbose)
+ post("...done");
+ wNumDevices = 0;
+}
+
+/* ------------------- public routines -------------------------- */
+
+void sys_putmidimess(int portno, int a, int b, int c)
+{
+ DWORD foo;
+ MMRESULT res;
+ if (portno >= 0 && portno < msw_nmidiout)
+ {
+ foo = (a & 0xff) | ((b & 0xff) << 8) | ((c & 0xff) << 16);
+ res = midiOutShortMsg(hMidiOut[portno], foo);
+ if (res != MMSYSERR_NOERROR)
+ post("MIDI out error %d", res);
+ }
+}
+
+void sys_putmidibyte(int portno, int byte)
+{
+ MMRESULT res;
+ if (portno >= 0 && portno < msw_nmidiout)
+ {
+ res = midiOutShortMsg(hMidiOut[portno], byte);
+ if (res != MMSYSERR_NOERROR)
+ post("MIDI out error %d", res);
+ }
+}
+
+void sys_poll_midi(void)
+{
+ static EVENT msw_nextevent;
+ static int msw_isnextevent;
+ static double msw_nexteventtime;
+
+ while (1)
+ {
+ if (!msw_isnextevent)
+ {
+ if (!GetEvent(lpInputBuffer, &msw_nextevent)) break;
+ msw_isnextevent = 1;
+#ifdef MIDI_TIMESTAMP
+ msw_nexteventtime = msw_midigettimefor(&foo.timestamp);
+#endif
+ }
+#ifdef MIDI_TIMESTAMP
+ if (0.001 * clock_gettimesince(initsystime) >= msw_nexteventtime)
+#endif
+ {
+ int msgtype = ((msw_nextevent.data & 0xf0) >> 4) - 8;
+ int commandbyte = msw_nextevent.data & 0xff;
+ int byte1 = (msw_nextevent.data >> 8) & 0xff;
+ int byte2 = (msw_nextevent.data >> 16) & 0xff;
+ int portno = msw_nextevent.dwDevice;
+ switch (msgtype)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 6:
+ sys_midibytein(portno, commandbyte);
+ sys_midibytein(portno, byte1);
+ sys_midibytein(portno, byte2);
+ break;
+ case 4:
+ case 5:
+ sys_midibytein(portno, commandbyte);
+ sys_midibytein(portno, byte1);
+ break;
+ case 7:
+ sys_midibytein(portno, commandbyte);
+ break;
+ }
+ msw_isnextevent = 0;
+ }
+ }
+}
+
+void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
+{
+ if (nmidiout)
+ msw_open_midiout(nmidiout, midioutvec);
+ if (nmidiin)
+ {
+ post(
+ "midi input enabled; warning, don't close the DOS window directly!");
+ msw_open_midiin(nmidiin, midiinvec);
+ }
+ else post("not using MIDI input (use 'pd -midiindev 1' to override)");
+}
+
+void sys_close_midi( void)
+{
+ msw_close_midiin();
+ msw_close_midiout();
+}
+
+
+/* list the audio and MIDI device names */
+void sys_listmididevs(void)
+{
+ UINT wRtn, ndevices;
+ unsigned int i;
+
+ /* for MIDI and audio in and out, get the number of devices.
+ Then get the capabilities of each device and print its description. */
+
+ ndevices = midiInGetNumDevs();
+ for (i = 0; i < ndevices; i++)
+ {
+ MIDIINCAPS micap;
+ wRtn = midiInGetDevCaps(i, (LPMIDIINCAPS) &micap,
+ sizeof(micap));
+ if (wRtn) msw_midiinerror("midiInGetDevCaps: %s\n", wRtn);
+ else fprintf(stderr,
+ "MIDI input device #%d: %s\n", i+1, micap.szPname);
+ }
+
+ ndevices = midiOutGetNumDevs();
+ for (i = 0; i < ndevices; i++)
+ {
+ MIDIOUTCAPS mocap;
+ wRtn = midiOutGetDevCaps(i, (LPMIDIOUTCAPS) &mocap,
+ sizeof(mocap));
+ if (wRtn) msw_midiouterror("midiOutGetDevCaps: %s\n", wRtn);
+ else fprintf(stderr,
+ "MIDI output device #%d: %s\n", i+1, mocap.szPname);
+ }
+
+}
diff --git a/pd/src/s_midi_oss.c b/pd/src/s_midi_oss.c
index 9233f09a..4d77e412 100644
--- a/pd/src/s_midi_oss.c
+++ b/pd/src/s_midi_oss.c
@@ -31,7 +31,8 @@ static void oss_midiout(int fd, int n)
#define O_MIDIFLAG O_NDELAY
-void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
+void sys_do_open_midi(int nmidiin, int *midiinvec,
+ int nmidiout, int *midioutvec)
{
int i;
for (i = 0; i < nmidiout; i++)
@@ -41,13 +42,13 @@ void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
int fd = -1, j, outdevindex = -1;
char namebuf[80];
int devno = midiinvec[i];
-
+
for (j = 0; j < nmidiout; j++)
if (midioutvec[j] == midiinvec[i])
outdevindex = j;
/* try to open the device for read/write. */
- if (devno == 1 && fd < 0 && outdevindex >= 0)
+ if (devno == 0 && fd < 0 && outdevindex >= 0)
{
sys_setalarm(1000000);
fd = open("/dev/midi", O_RDWR | O_MIDIFLAG);
@@ -60,7 +61,7 @@ void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
if (fd < 0 && outdevindex >= 0)
{
sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%2.2d", devno-1);
+ sprintf(namebuf, "/dev/midi%2.2d", devno);
fd = open(namebuf, O_RDWR | O_MIDIFLAG);
if (sys_verbose)
fprintf(stderr,
@@ -72,7 +73,7 @@ void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
if (fd < 0 && outdevindex >= 0)
{
sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%d", devno-1);
+ sprintf(namebuf, "/dev/midi%d", devno);
fd = open(namebuf, O_RDWR | O_MIDIFLAG);
if (sys_verbose)
fprintf(stderr, "device %d: tried %s READ/WRITE; returned %d\n",
@@ -91,7 +92,7 @@ void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
if (fd < 0)
{
sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%2.2d", devno-1);
+ sprintf(namebuf, "/dev/midi%2.2d", devno);
fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
if (sys_verbose)
fprintf(stderr, "device %d: tried %s READONLY; returned %d\n",
@@ -100,7 +101,7 @@ void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
if (fd < 0)
{
sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%d", devno-1);
+ sprintf(namebuf, "/dev/midi%d", devno);
fd = open(namebuf, O_RDONLY | O_MIDIFLAG);
if (sys_verbose)
fprintf(stderr, "device %d: tried %s READONLY; returned %d\n",
@@ -126,7 +127,7 @@ void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
if (fd < 0)
{
sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%2.2d", devno-1);
+ sprintf(namebuf, "/dev/midi%2.2d", devno);
fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
if (sys_verbose)
fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n",
@@ -135,7 +136,7 @@ void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
if (fd < 0)
{
sys_setalarm(1000000);
- sprintf(namebuf, "/dev/midi%d", devno-1);
+ sprintf(namebuf, "/dev/midi%d", devno);
fd = open(namebuf, O_WRONLY | O_MIDIFLAG);
if (sys_verbose)
fprintf(stderr, "device %d: tried %s WRITEONLY; returned %d\n",
@@ -149,6 +150,8 @@ void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
if (oss_nmidiin < nmidiin || oss_nmidiout < nmidiout || sys_verbose)
post("opened %d MIDI input device(s) and %d MIDI output device(s).",
oss_nmidiin, oss_nmidiout);
+
+ sys_setalarm(0);
}
#define md_msglen(x) (((x)<0xC0)?2:((x)<0xE0)?1:((x)<0xF0)?2:\
@@ -263,7 +266,94 @@ void sys_close_midi()
oss_nmidiin = oss_nmidiout = 0;
}
-void sys_listmididevs(void)
+#define NSEARCH 10
+static int oss_nmidiindevs, oss_nmidioutdevs, oss_initted;
+
+void midi_oss_init(void)
{
- /* LATER figure out how to detect MIDI devs */
+ int i;
+ if (oss_initted)
+ return;
+ oss_initted = 1;
+ for (i = 0; i < NSEARCH; i++)
+ {
+ int fd;
+ char namebuf[80];
+
+ oss_nmidiindevs = i;
+ /* try to open the device for reading */
+ if (i == 0)
+ {
+ fd = open("/dev/midi", O_RDONLY | O_NDELAY);
+ if (fd >= 0)
+ {
+ close(fd);
+ continue;
+ }
+ }
+ sprintf(namebuf, "/dev/midi%2.2d", i);
+ fd = open(namebuf, O_RDONLY | O_NDELAY);
+ if (fd >= 0)
+ {
+ close(fd);
+ continue;
+ }
+ sprintf(namebuf, "/dev/midi%d", i);
+ fd = open(namebuf, O_RDONLY | O_NDELAY);
+ if (fd >= 0)
+ {
+ close(fd);
+ continue;
+ }
+ break;
+ }
+ for (i = 0; i < NSEARCH; i++)
+ {
+ int fd;
+ char namebuf[80];
+
+ oss_nmidioutdevs = i;
+ /* try to open the device for writing */
+ if (i == 0)
+ {
+ fd = open("/dev/midi", O_WRONLY | O_NDELAY);
+ if (fd >= 0)
+ {
+ close(fd);
+ continue;
+ }
+ }
+ sprintf(namebuf, "/dev/midi%2.2d", i);
+ fd = open(namebuf, O_WRONLY | O_NDELAY);
+ if (fd >= 0)
+ {
+ close(fd);
+ continue;
+ }
+ sprintf(namebuf, "/dev/midi%d", i);
+ fd = open(namebuf, O_WRONLY | O_NDELAY);
+ if (fd >= 0)
+ {
+ close(fd);
+ continue;
+ }
+ break;
+ }
+}
+
+void midi_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int maxndev, int devdescsize)
+{
+ int i, ndev;
+ if ((ndev = oss_nmidiindevs) > maxndev)
+ ndev = maxndev;
+ for (i = 0; i < ndev; i++)
+ sprintf(indevlist + i * devdescsize, "OSS MIDI device #%d", i+1);
+ *nindevs = ndev;
+
+ if ((ndev = oss_nmidioutdevs) > maxndev)
+ ndev = maxndev;
+ for (i = 0; i < ndev; i++)
+ sprintf(outdevlist + i * devdescsize, "OSS MIDI device #%d", i+1);
+ *noutdevs = ndev;
}
diff --git a/pd/src/s_midi_pm.c b/pd/src/s_midi_pm.c
index afd8ad1a..59959e83 100644
--- a/pd/src/s_midi_pm.c
+++ b/pd/src/s_midi_pm.c
@@ -28,15 +28,14 @@ static PmStream *mac_midioutdevlist[MAXMIDIOUTDEV];
static int mac_nmidiindev;
static int mac_nmidioutdev;
-void sys_open_midi(int nmidiin, int *midiinvec,
+void sys_do_open_midi(int nmidiin, int *midiinvec,
int nmidiout, int *midioutvec)
{
- int i = 0;
+ int i = 0, j, devno;
int n = 0;
PmError err;
Pt_Start(1, 0, 0); /* start a timer with millisecond accuracy */
- mac_nmidiindev = 0;
/* protect the unwary from having MIDI inputs open; they're
bad news if you close Pd's terminal window. see sys_nmidiin
@@ -50,62 +49,85 @@ void sys_open_midi(int nmidiin, int *midiinvec,
else post("not using MIDI input (use 'pd -midiindev 1' to override)");
#endif
+ mac_nmidiindev = 0;
for (i = 0; i < nmidiin; i++)
{
- if (midiinvec[i] == DEFMIDIDEV)
- midiinvec[i] = Pm_GetDefaultInputDeviceID();
- err = Pm_OpenInput(&mac_midiindevlist[mac_nmidiindev], midiinvec[i],
- NULL, 100, NULL, NULL, NULL);
- if (err)
- post("could not open midi input device number %d: %s",
- midiinvec[i], Pm_GetErrorText(err));
- else
+ for (j = 0, devno = 0; j < Pm_CountDevices(); j++)
{
- if (sys_verbose)
- post("Midi Input opened.\n");
- mac_nmidiindev++;
- }
- }
+ const PmDeviceInfo *info = Pm_GetDeviceInfo(j);
+ if (info->input)
+ {
+ if (devno == midiinvec[i])
+ {
+ err = Pm_OpenInput(&mac_midiindevlist[mac_nmidiindev],
+ j, NULL, 100, NULL, NULL, NULL);
+ if (err)
+ post("could not open midi input %d (%s): %s",
+ j, info->name, Pm_GetErrorText(err));
+
+ else
+ {
+ if (sys_verbose)
+ post("Midi Input (%s) opened.",
+ info->name);
+ mac_nmidiindev++;
+ }
+ }
+ devno++;
+ }
+ }
+ }
mac_nmidioutdev = 0;
for (i = 0; i < nmidiout; i++)
{
- if (midioutvec[i] == DEFMIDIDEV)
- midioutvec[i] = Pm_GetDefaultOutputDeviceID();
- err = Pm_OpenOutput(&mac_midioutdevlist[mac_nmidioutdev], midioutvec[i],
- NULL, 0, NULL, NULL, 0);
- if (err)
- post("could not open midi output device number %d: %s",
- midioutvec[i], Pm_GetErrorText(err));
- else
+ for (j = 0, devno = 0; j < Pm_CountDevices(); j++)
{
- if (sys_verbose)
- post("Midi Output opened.\n");
- mac_nmidioutdev++;
- }
- }
+ const PmDeviceInfo *info = Pm_GetDeviceInfo(j);
+ if (info->output)
+ {
+ if (devno == midioutvec[i])
+ {
+ err = Pm_OpenOutput(
+ &mac_midioutdevlist[mac_nmidioutdev],
+ j, NULL, 0, NULL, NULL, 0);
+ if (err)
+ post("could not open midi output %d (%s): %s",
+ j, info->name, Pm_GetErrorText(err));
+ else
+ {
+ if (sys_verbose)
+ post("Midi Output (%s) opened.",
+ info->name);
+ mac_nmidioutdev++;
+ }
+ }
+ devno++;
+ }
+ }
+ }
}
void sys_close_midi( void)
{
int i;
for (i = 0; i < mac_nmidiindev; i++)
- Pm_Close(mac_midiindevlist[mac_nmidiindev]);
+ Pm_Close(mac_midiindevlist[i]);
mac_nmidiindev = 0;
for (i = 0; i < mac_nmidioutdev; i++)
- Pm_Close(mac_midioutdevlist[mac_nmidioutdev]);
+ Pm_Close(mac_midioutdevlist[i]);
mac_nmidioutdev = 0;
}
void sys_putmidimess(int portno, int a, int b, int c)
{
PmEvent buffer;
- fprintf(stderr, "put 1 msg %d %d\n", portno, mac_nmidioutdev);
+ /* fprintf(stderr, "put 1 msg %d %d\n", portno, mac_nmidioutdev); */
if (portno >= 0 && portno < mac_nmidioutdev)
{
buffer.message = Pm_Message(a, b, c);
buffer.timestamp = 0;
- fprintf(stderr, "put msg\n");
+ /* fprintf(stderr, "put msg\n"); */
Pm_Write(mac_midioutdevlist[portno], &buffer, 1);
}
}
@@ -152,9 +174,10 @@ void sys_poll_midi(void)
}
}
+#if 0
void sys_listmididevs(void) /* lifted from pa_devs.c in portaudio */
{
- int i,j;
+ int i,j;
for (i = 0; i < Pm_CountDevices(); i++)
{
const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
@@ -164,3 +187,28 @@ void sys_listmididevs(void) /* lifted from pa_devs.c in portaudio */
printf("\n");
}
}
+#endif
+
+void midi_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int maxndev, int devdescsize)
+{
+ int i, nindev = 0, noutdev = 0;
+ for (i = 0; i < Pm_CountDevices(); i++)
+ {
+ const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
+ /* post("%d: %s, %s (%d,%d)", i, info->interf, info->name,
+ info->input, info->output); */
+ if (info->input && nindev < maxndev)
+ {
+ strcpy(indevlist + nindev * devdescsize, info->name);
+ nindev++;
+ }
+ if (info->output && noutdev < maxndev)
+ {
+ strcpy(outdevlist + noutdev * devdescsize, info->name);
+ noutdev++;
+ }
+ }
+ *nindevs = nindev;
+ *noutdevs = noutdev;
+}
diff --git a/pd/src/s_nt.c b/pd/src/s_nt.c
deleted file mode 100644
index 99346e7c..00000000
--- a/pd/src/s_nt.c
+++ /dev/null
@@ -1,1586 +0,0 @@
-/* Copyright (c) 1997-1999 Miller Puckette.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-/* modified 2/98 by Winfried Ritsch to deal with up to 4 synchronized
-"wave" devices, which is how ADAT boards appear to the WAVE API. */
-
-#include "m_imp.h"
-#include <stdio.h>
-
-#include <windows.h>
-
-#include <MMSYSTEM.H>
-
-/* ------------------------- audio -------------------------- */
-
-static void nt_close_midiin(void);
-
-static void postflags(void);
-
-#define NAPORTS 16 /* wini hack for multiple ADDA devices */
-#define NT_MAXCH (2 * NAPORTS)
-#define CHANNELS_PER_DEVICE 2
-#define DEFAULTCHANS 2
-#define DEFAULTSRATE 44100
-#define SAMPSIZE 2
-
-#define REALDACBLKSIZE (4 * DACBLKSIZE) /* larger underlying bufsize */
-
-#define MAXBUFFER 100 /* number of buffers in use at maximum advance */
-#define DEFBUFFER 30 /* default is about 30x6 = 180 msec! */
-static int nt_naudiobuffer = DEFBUFFER;
-static int nt_advance_samples;
-
-float sys_dacsr = DEFAULTSRATE;
-
-static int nt_whichapi = API_MMIO;
-static int nt_meters; /* true if we're metering */
-static float nt_inmax; /* max input amplitude */
-static float nt_outmax; /* max output amplitude */
-static int nt_nwavein, nt_nwaveout; /* number of WAVE devices in and out */
-static int nt_blocksize = 0; /* audio I/O block size in sample frames */
-int sys_schedadvance = 20000; /* scheduler advance in microseconds */
-
-typedef struct _sbuf
-{
- HANDLE hData;
- HPSTR lpData; // pointer to waveform data memory
- HANDLE hWaveHdr;
- WAVEHDR *lpWaveHdr; // pointer to header structure
-} t_sbuf;
-
-t_sbuf ntsnd_outvec[NAPORTS][MAXBUFFER]; /* circular buffer array */
-HWAVEOUT ntsnd_outdev[NAPORTS]; /* output device */
-static int ntsnd_outphase[NAPORTS]; /* index of next buffer to send */
-
-t_sbuf ntsnd_invec[NAPORTS][MAXBUFFER]; /* circular buffer array */
-HWAVEIN ntsnd_indev[NAPORTS]; /* input device */
-static int ntsnd_inphase[NAPORTS]; /* index of next buffer to read */
-int sys_hipriority = 0;
-
-static void nt_waveinerror(char *s, int err)
-{
- char t[256];
- waveInGetErrorText(err, t, 256);
- fprintf(stderr, s, t);
-}
-
-static void nt_waveouterror(char *s, int err)
-{
- char t[256];
- waveOutGetErrorText(err, t, 256);
- fprintf(stderr, s, t);
-}
-
-static void wave_prep(t_sbuf *bp)
-{
- WAVEHDR *wh;
- short *sp;
- int i;
- /*
- * Allocate and lock memory for the waveform data. The memory
- * for waveform data must be globally allocated with
- * GMEM_MOVEABLE and GMEM_SHARE flags.
- */
-
- if (!(bp->hData =
- GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE,
- (DWORD) (CHANNELS_PER_DEVICE * REALDACBLKSIZE * SAMPSIZE))))
- printf("alloc 1 failed\n");
-
- if (!(bp->lpData =
- (HPSTR) GlobalLock(bp->hData)))
- printf("lock 1 failed\n");
-
- /* Allocate and lock memory for the header. */
-
- if (!(bp->hWaveHdr =
- GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (DWORD) sizeof(WAVEHDR))))
- printf("alloc 2 failed\n");
-
- if (!(wh = bp->lpWaveHdr =
- (WAVEHDR *) GlobalLock(bp->hWaveHdr)))
- printf("lock 2 failed\n");
-
- for (i = CHANNELS_PER_DEVICE * REALDACBLKSIZE,
- sp = (short *)bp->lpData; i--; )
- *sp++ = 0;
-
- wh->lpData = bp->lpData;
- wh->dwBufferLength = (CHANNELS_PER_DEVICE * REALDACBLKSIZE * SAMPSIZE);
- wh->dwFlags = 0;
- wh->dwLoops = 0L;
- wh->lpNext = 0;
- wh->reserved = 0;
-}
-
-static int nt_inalloc[NAPORTS], nt_outalloc[NAPORTS];
-static UINT nt_whichdac = WAVE_MAPPER, nt_whichadc = WAVE_MAPPER;
-
-int mmio_open_audio(void)
-{
- PCMWAVEFORMAT form;
- int i;
- UINT mmresult;
- int nad, nda;
-
- if (sys_verbose)
- post("%d devices in, %d devices out",
- nt_nwavein, nt_nwaveout);
-
- form.wf.wFormatTag = WAVE_FORMAT_PCM;
- form.wf.nChannels = CHANNELS_PER_DEVICE;
- form.wf.nSamplesPerSec = sys_dacsr;
- form.wf.nAvgBytesPerSec = sys_dacsr * (CHANNELS_PER_DEVICE * SAMPSIZE);
- form.wf.nBlockAlign = CHANNELS_PER_DEVICE * SAMPSIZE;
- form.wBitsPerSample = 8 * SAMPSIZE;
-
- for (nad=0; nad < nt_nwavein; nad++)
- {
- /* Open waveform device(s), sucessively numbered, for input */
-
- mmresult = waveInOpen(&ntsnd_indev[nad], nt_whichadc+nad,
- (WAVEFORMATEX *)(&form), 0L, 0L, CALLBACK_NULL);
-
- if (sys_verbose)
- printf("opened adc device %d with return %d\n",
- nt_whichadc+nad,mmresult);
-
- if (mmresult != MMSYSERR_NOERROR)
- {
- nt_waveinerror("waveInOpen: %s\n", mmresult);
- nt_nwavein = nad; /* nt_nwavein = 0 wini */
- }
- else
- {
- if (!nt_inalloc[nad])
- {
- for (i = 0; i < nt_naudiobuffer; i++)
- wave_prep(&ntsnd_invec[nad][i]);
- nt_inalloc[nad] = 1;
- }
- for (i = 0; i < nt_naudiobuffer; i++)
- {
- mmresult = waveInPrepareHeader(ntsnd_indev[nad],
- ntsnd_invec[nad][i].lpWaveHdr, sizeof(WAVEHDR));
- if (mmresult != MMSYSERR_NOERROR)
- nt_waveinerror("waveinprepareheader: %s\n", mmresult);
- mmresult = waveInAddBuffer(ntsnd_indev[nad],
- ntsnd_invec[nad][i].lpWaveHdr, sizeof(WAVEHDR));
- if (mmresult != MMSYSERR_NOERROR)
- nt_waveinerror("waveInAddBuffer: %s\n", mmresult);
- }
- }
- }
- /* quickly start them all together */
- for(nad=0; nad < nt_nwavein; nad++)
- waveInStart(ntsnd_indev[nad]);
-
- for(nda=0; nda < nt_nwaveout; nda++)
- {
-
- /* Open a waveform device for output in sucessiv device numbering*/
- mmresult = waveOutOpen(&ntsnd_outdev[nda], nt_whichdac + nda,
- (WAVEFORMATEX *)(&form), 0L, 0L, CALLBACK_NULL);
-
- if (sys_verbose)
- fprintf(stderr,"opened dac device %d, with return %d\n",
- nt_whichdac +nda, mmresult);
-
- if (mmresult != MMSYSERR_NOERROR)
- {
- fprintf(stderr,"Wave out open device %d + %d\n",nt_whichdac,nda);
- nt_waveouterror("waveOutOpen device: %s\n", mmresult);
- nt_nwaveout = nda;
- }
- else
- {
- if (!(nt_outalloc[nda]))
- {
- for (i = 0; i < nt_naudiobuffer; i++)
- {
- wave_prep(&ntsnd_outvec[nda][i]);
- /* set DONE flag as if we had queued them */
- ntsnd_outvec[nda][i].lpWaveHdr->dwFlags = WHDR_DONE;
- }
- nt_outalloc[nda] = 1;
- }
- }
- }
-
- return (0);
-}
-
-void mmio_close_audio( void)
-{
- int errcode;
- int nda, nad;
- if (sys_verbose)
- post("closing audio...");
-
- for (nda=0; nda < nt_nwaveout; nda++) /*if (nt_nwaveout) wini */
- {
- errcode = waveOutReset(ntsnd_outdev[nda]);
- if (errcode != MMSYSERR_NOERROR)
- printf("error resetting output %d: %d\n", nda, errcode);
- errcode = waveOutClose(ntsnd_outdev[nda]);
- if (errcode != MMSYSERR_NOERROR)
- printf("error closing output %d: %d\n",nda , errcode);
- }
- nt_nwaveout = 0;
-
- for(nad=0; nad < nt_nwavein;nad++) /* if (nt_nwavein) wini */
- {
- errcode = waveInReset(ntsnd_indev[nad]);
- if (errcode != MMSYSERR_NOERROR)
- printf("error resetting input: %d\n", errcode);
- errcode = waveInClose(ntsnd_indev[nad]);
- if (errcode != MMSYSERR_NOERROR)
- printf("error closing input: %d\n", errcode);
- }
- nt_nwavein = 0;
-}
-
-
-#define ADCJITTER 10 /* We tolerate X buffers of jitter by default */
-#define DACJITTER 10
-
-static int nt_adcjitterbufsallowed = ADCJITTER;
-static int nt_dacjitterbufsallowed = DACJITTER;
-
- /* ------------- MIDI time stamping from audio clock ------------ */
-
-#ifdef MIDI_TIMESTAMP
-
-static double nt_hibuftime;
-static double initsystime = -1;
-
- /* call this whenever we reset audio */
-static void nt_resetmidisync(void)
-{
- initsystime = clock_getsystime();
- nt_hibuftime = sys_getrealtime();
-}
-
- /* call this whenever we're idled waiting for audio to be ready.
- The routine maintains a high and low water point for the difference
- between real and DAC time. */
-
-static void nt_midisync(void)
-{
- double jittersec, diff;
-
- if (initsystime == -1) nt_resetmidisync();
- jittersec = (nt_dacjitterbufsallowed > nt_adcjitterbufsallowed ?
- nt_dacjitterbufsallowed : nt_adcjitterbufsallowed)
- * REALDACBLKSIZE / sys_getsr();
- diff = sys_getrealtime() - 0.001 * clock_gettimesince(initsystime);
- if (diff > nt_hibuftime) nt_hibuftime = diff;
- if (diff < nt_hibuftime - jittersec)
- {
- post("jitter excess %d %f", dac, diff);
- nt_resetmidisync();
- }
-}
-
-static double nt_midigettimefor(LARGE_INTEGER timestamp)
-{
- /* this is broken now... used to work when "timestamp" was derived from
- QueryPerformanceCounter() instead of the gates approved
- timeGetSystemTime() call in the MIDI callback routine below. */
- return (nt_tixtotime(timestamp) - nt_hibuftime);
-}
-#endif /* MIDI_TIMESTAMP */
-
-
-static int nt_fill = 0;
-#define WRAPFWD(x) ((x) >= nt_naudiobuffer ? (x) - nt_naudiobuffer: (x))
-#define WRAPBACK(x) ((x) < 0 ? (x) + nt_naudiobuffer: (x))
-#define MAXRESYNC 500
-
-#if 0 /* this is used for debugging */
-static void nt_printaudiostatus(void)
-{
- int nad, nda;
- for (nad = 0; nad < nt_nwavein; nad++)
- {
- int phase = ntsnd_inphase[nad];
- int phase2 = phase, phase3 = WRAPFWD(phase2), count, ntrans = 0;
- int firstphasedone = -1, firstphasebusy = -1;
- for (count = 0; count < nt_naudiobuffer; count++)
- {
- int donethis =
- (ntsnd_invec[nad][phase2].lpWaveHdr->dwFlags & WHDR_DONE);
- int donenext =
- (ntsnd_invec[nad][phase3].lpWaveHdr->dwFlags & WHDR_DONE);
- if (donethis && !donenext)
- {
- if (firstphasebusy >= 0) goto multipleadc;
- firstphasebusy = count;
- }
- if (!donethis && donenext)
- {
- if (firstphasedone >= 0) goto multipleadc;
- firstphasedone = count;
- }
- phase2 = phase3;
- phase3 = WRAPFWD(phase2 + 1);
- }
- post("nad %d phase %d busy %d done %d", nad, phase, firstphasebusy,
- firstphasedone);
- continue;
- multipleadc:
- startpost("nad %d phase %d: oops:", nad, phase);
- for (count = 0; count < nt_naudiobuffer; count++)
- {
- char buf[80];
- sprintf(buf, " %d",
- (ntsnd_invec[nad][count].lpWaveHdr->dwFlags & WHDR_DONE));
- poststring(buf);
- }
- endpost();
- }
- for (nda = 0; nda < nt_nwaveout; nda++)
- {
- int phase = ntsnd_outphase[nad];
- int phase2 = phase, phase3 = WRAPFWD(phase2), count, ntrans = 0;
- int firstphasedone = -1, firstphasebusy = -1;
- for (count = 0; count < nt_naudiobuffer; count++)
- {
- int donethis =
- (ntsnd_outvec[nda][phase2].lpWaveHdr->dwFlags & WHDR_DONE);
- int donenext =
- (ntsnd_outvec[nda][phase3].lpWaveHdr->dwFlags & WHDR_DONE);
- if (donethis && !donenext)
- {
- if (firstphasebusy >= 0) goto multipledac;
- firstphasebusy = count;
- }
- if (!donethis && donenext)
- {
- if (firstphasedone >= 0) goto multipledac;
- firstphasedone = count;
- }
- phase2 = phase3;
- phase3 = WRAPFWD(phase2 + 1);
- }
- if (firstphasebusy < 0) post("nda %d phase %d all %d",
- nda, phase, (ntsnd_outvec[nad][0].lpWaveHdr->dwFlags & WHDR_DONE));
- else post("nda %d phase %d busy %d done %d", nda, phase, firstphasebusy,
- firstphasedone);
- continue;
- multipledac:
- startpost("nda %d phase %d: oops:", nda, phase);
- for (count = 0; count < nt_naudiobuffer; count++)
- {
- char buf[80];
- sprintf(buf, " %d",
- (ntsnd_outvec[nad][count].lpWaveHdr->dwFlags & WHDR_DONE));
- poststring(buf);
- }
- endpost();
- }
-}
-#endif /* 0 */
-
-/* this is a hack to avoid ever resyncing audio pointers in case for whatever
-reason the sync testing below gives false positives. */
-
-static int nt_resync_cancelled;
-
-void nt_noresync( void)
-{
- nt_resync_cancelled = 1;
-}
-
-static void nt_resyncaudio(void)
-{
- UINT mmresult;
- int nad, nda, count;
- if (nt_resync_cancelled)
- return;
- /* for each open input device, eat all buffers which are marked
- ready. The next one will thus be "busy". */
- post("resyncing audio");
- for (nad = 0; nad < nt_nwavein; nad++)
- {
- int phase = ntsnd_inphase[nad];
- for (count = 0; count < MAXRESYNC; count++)
- {
- WAVEHDR *inwavehdr = ntsnd_invec[nad][phase].lpWaveHdr;
- if (!(inwavehdr->dwFlags & WHDR_DONE)) break;
- if (inwavehdr->dwFlags & WHDR_PREPARED)
- waveInUnprepareHeader(ntsnd_indev[nad],
- inwavehdr, sizeof(WAVEHDR));
- inwavehdr->dwFlags = 0L;
- waveInPrepareHeader(ntsnd_indev[nad], inwavehdr, sizeof(WAVEHDR));
- mmresult = waveInAddBuffer(ntsnd_indev[nad], inwavehdr,
- sizeof(WAVEHDR));
- if (mmresult != MMSYSERR_NOERROR)
- nt_waveinerror("waveInAddBuffer: %s\n", mmresult);
- ntsnd_inphase[nad] = phase = WRAPFWD(phase + 1);
- }
- if (count == MAXRESYNC) post("resync error 1");
- }
- /* Each output buffer which is "ready" is filled with zeros and
- queued. */
- for (nda = 0; nda < nt_nwaveout; nda++)
- {
- int phase = ntsnd_outphase[nda];
- for (count = 0; count < MAXRESYNC; count++)
- {
- WAVEHDR *outwavehdr = ntsnd_outvec[nda][phase].lpWaveHdr;
- if (!(outwavehdr->dwFlags & WHDR_DONE)) break;
- if (outwavehdr->dwFlags & WHDR_PREPARED)
- waveOutUnprepareHeader(ntsnd_outdev[nda],
- outwavehdr, sizeof(WAVEHDR));
- outwavehdr->dwFlags = 0L;
- memset((char *)(ntsnd_outvec[nda][phase].lpData),
- 0, (CHANNELS_PER_DEVICE * REALDACBLKSIZE * SAMPSIZE));
- waveOutPrepareHeader(ntsnd_outdev[nda], outwavehdr,
- sizeof(WAVEHDR));
- mmresult = waveOutWrite(ntsnd_outdev[nda], outwavehdr,
- sizeof(WAVEHDR));
- if (mmresult != MMSYSERR_NOERROR)
- nt_waveouterror("waveOutAddBuffer: %s\n", mmresult);
- ntsnd_outphase[nda] = phase = WRAPFWD(phase + 1);
- }
- if (count == MAXRESYNC) post("resync error 2");
- }
-
-#ifdef MIDI_TIMESTAMP
- nt_resetmidisync();
-#endif
-
-}
-
-#define LATE 0
-#define RESYNC 1
-#define NOTHING 2
-static int nt_errorcount;
-static int nt_resynccount;
-static double nt_nextreporttime = -1;
-
-void nt_logerror(int which)
-{
-#if 0
- post("error %d %d", count, which);
- if (which < NOTHING) nt_errorcount++;
- if (which == RESYNC) nt_resynccount++;
- if (sys_getrealtime() > nt_nextreporttime)
- {
- post("%d audio I/O error%s", nt_errorcount,
- (nt_errorcount > 1 ? "s" : ""));
- if (nt_resynccount) post("DAC/ADC sync error");
- nt_errorcount = nt_resynccount = 0;
- nt_nextreporttime = sys_getrealtime() - 5;
- }
-#endif
-}
-
-/* system buffer with t_sample types for one tick */
-t_sample *sys_soundout;
-t_sample *sys_soundin;
-float sys_dacsr;
-
-int mmio_send_dacs(void)
-{
- HMMIO hmmio;
- UINT mmresult;
- HANDLE hFormat;
- int i, j;
- short *sp1, *sp2;
- float *fp1, *fp2;
- int nextfill, doxfer = 0;
- int nda, nad;
- if (!nt_nwavein && !nt_nwaveout) return (0);
-
-
- if (nt_meters)
- {
- int i, n;
- float maxsamp;
- for (i = 0, n = 2 * nt_nwavein * DACBLKSIZE, maxsamp = nt_inmax;
- i < n; i++)
- {
- float f = sys_soundin[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- nt_inmax = maxsamp;
- for (i = 0, n = 2 * nt_nwaveout * DACBLKSIZE, maxsamp = nt_outmax;
- i < n; i++)
- {
- float f = sys_soundout[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- nt_outmax = maxsamp;
- }
-
- /* the "fill pointer" nt_fill controls where in the next
- I/O buffers we will write and/or read. If it's zero, we
- first check whether the buffers are marked "done". */
-
- if (!nt_fill)
- {
- for (nad = 0; nad < nt_nwavein; nad++)
- {
- int phase = ntsnd_inphase[nad];
- WAVEHDR *inwavehdr = ntsnd_invec[nad][phase].lpWaveHdr;
- if (!(inwavehdr->dwFlags & WHDR_DONE)) goto idle;
- }
- for (nda = 0; nda < nt_nwaveout; nda++)
- {
- int phase = ntsnd_outphase[nda];
- WAVEHDR *outwavehdr =
- ntsnd_outvec[nda][phase].lpWaveHdr;
- if (!(outwavehdr->dwFlags & WHDR_DONE)) goto idle;
- }
- for (nad = 0; nad < nt_nwavein; nad++)
- {
- int phase = ntsnd_inphase[nad];
- WAVEHDR *inwavehdr =
- ntsnd_invec[nad][phase].lpWaveHdr;
- if (inwavehdr->dwFlags & WHDR_PREPARED)
- waveInUnprepareHeader(ntsnd_indev[nad],
- inwavehdr, sizeof(WAVEHDR));
- }
- for (nda = 0; nda < nt_nwaveout; nda++)
- {
- int phase = ntsnd_outphase[nda];
- WAVEHDR *outwavehdr = ntsnd_outvec[nda][phase].lpWaveHdr;
- if (outwavehdr->dwFlags & WHDR_PREPARED)
- waveOutUnprepareHeader(ntsnd_outdev[nda],
- outwavehdr, sizeof(WAVEHDR));
- }
- }
-
- /* Convert audio output to fixed-point and put it in the output
- buffer. */
- for (nda = 0, fp1 = sys_soundout; nda < nt_nwaveout; nda++)
- {
- int phase = ntsnd_outphase[nda];
-
- for (i = 0, sp1 = (short *)(ntsnd_outvec[nda][phase].lpData) +
- CHANNELS_PER_DEVICE * nt_fill;
- i < 2; i++, fp1 += DACBLKSIZE, sp1++)
- {
- for (j = 0, fp2 = fp1, sp2 = sp1; j < DACBLKSIZE;
- j++, fp2++, sp2 += CHANNELS_PER_DEVICE)
- {
- int x1 = 32767.f * *fp2;
- if (x1 > 32767) x1 = 32767;
- else if (x1 < -32767) x1 = -32767;
- *sp2 = x1;
- }
- }
- }
- memset(sys_soundout, 0,
- (DACBLKSIZE*sizeof(t_sample)*CHANNELS_PER_DEVICE)*nt_nwaveout);
-
- /* vice versa for the input buffer */
-
- for (nad = 0, fp1 = sys_soundin; nad < nt_nwavein; nad++)
- {
- int phase = ntsnd_inphase[nad];
-
- for (i = 0, sp1 = (short *)(ntsnd_invec[nad][phase].lpData) +
- CHANNELS_PER_DEVICE * nt_fill;
- i < 2; i++, fp1 += DACBLKSIZE, sp1++)
- {
- for (j = 0, fp2 = fp1, sp2 = sp1; j < DACBLKSIZE;
- j++, fp2++, sp2 += CHANNELS_PER_DEVICE)
- {
- *fp2 = ((float)(1./32767.)) * (float)(*sp2);
- }
- }
- }
-
- nt_fill = nt_fill + DACBLKSIZE;
- if (nt_fill == REALDACBLKSIZE)
- {
- nt_fill = 0;
-
- for (nad = 0; nad < nt_nwavein; nad++)
- {
- int phase = ntsnd_inphase[nad];
- HWAVEIN device = ntsnd_indev[nad];
- WAVEHDR *inwavehdr = ntsnd_invec[nad][phase].lpWaveHdr;
- waveInPrepareHeader(device, inwavehdr, sizeof(WAVEHDR));
- mmresult = waveInAddBuffer(device, inwavehdr, sizeof(WAVEHDR));
- if (mmresult != MMSYSERR_NOERROR)
- nt_waveinerror("waveInAddBuffer: %s\n", mmresult);
- ntsnd_inphase[nad] = WRAPFWD(phase + 1);
- }
- for (nda = 0; nda < nt_nwaveout; nda++)
- {
- int phase = ntsnd_outphase[nda];
- HWAVEOUT device = ntsnd_outdev[nda];
- WAVEHDR *outwavehdr = ntsnd_outvec[nda][phase].lpWaveHdr;
- waveOutPrepareHeader(device, outwavehdr, sizeof(WAVEHDR));
- mmresult = waveOutWrite(device, outwavehdr, sizeof(WAVEHDR));
- if (mmresult != MMSYSERR_NOERROR)
- nt_waveouterror("waveOutWrite: %s\n", mmresult);
- ntsnd_outphase[nda] = WRAPFWD(phase + 1);
- }
-
- /* check for DAC underflow or ADC overflow. */
- for (nad = 0; nad < nt_nwavein; nad++)
- {
- int phase = WRAPBACK(ntsnd_inphase[nad] - 2);
- WAVEHDR *inwavehdr = ntsnd_invec[nad][phase].lpWaveHdr;
- if (inwavehdr->dwFlags & WHDR_DONE) goto late;
- }
- for (nda = 0; nda < nt_nwaveout; nda++)
- {
- int phase = WRAPBACK(ntsnd_outphase[nda] - 2);
- WAVEHDR *outwavehdr = ntsnd_outvec[nda][phase].lpWaveHdr;
- if (outwavehdr->dwFlags & WHDR_DONE) goto late;
- }
- }
- return (1);
-
-late:
-
- nt_logerror(LATE);
- nt_resyncaudio();
- return (1);
-
-idle:
-
- /* If more than nt_adcjitterbufsallowed ADC buffers are ready
- on any input device, resynchronize */
-
- for (nad = 0; nad < nt_nwavein; nad++)
- {
- int phase = ntsnd_inphase[nad];
- WAVEHDR *inwavehdr =
- ntsnd_invec[nad]
- [WRAPFWD(phase + nt_adcjitterbufsallowed)].lpWaveHdr;
- if (inwavehdr->dwFlags & WHDR_DONE)
- {
- nt_resyncaudio();
- return (0);
- }
- }
-
- /* test dac sync the same way */
- for (nda = 0; nda < nt_nwaveout; nda++)
- {
- int phase = ntsnd_outphase[nda];
- WAVEHDR *outwavehdr =
- ntsnd_outvec[nda]
- [WRAPFWD(phase + nt_dacjitterbufsallowed)].lpWaveHdr;
- if (outwavehdr->dwFlags & WHDR_DONE)
- {
- nt_resyncaudio();
- return (0);
- }
- }
-#ifdef MIDI_TIMESTAMP
- nt_midisync();
-#endif
- return (0);
-}
-
-
-static void nt_setchsr(int inchannels, int outchannels, int sr)
-{
- int inbytes = inchannels * (DACBLKSIZE*sizeof(float));
- int outbytes = outchannels * (DACBLKSIZE*sizeof(float));
-
- if (nt_nwavein)
- free(sys_soundin);
- if (nt_nwaveout)
- free(sys_soundout);
-
- nt_nwavein = inchannels/CHANNELS_PER_DEVICE;
- nt_nwaveout = outchannels/CHANNELS_PER_DEVICE;
- sys_dacsr = sr;
-
- sys_soundin = (t_float *)malloc(inbytes);
- memset(sys_soundin, 0, inbytes);
-
- sys_soundout = (t_float *)malloc(outbytes);
- memset(sys_soundout, 0, outbytes);
-
- nt_advance_samples = (sys_schedadvance * sys_dacsr) / (1000000.);
- if (nt_advance_samples < 3 * DACBLKSIZE)
- nt_advance_samples = 3 * DACBLKSIZE;
-}
-
-/* ------------------------- MIDI output -------------------------- */
-static void nt_midiouterror(char *s, int err)
-{
- char t[256];
- midiOutGetErrorText(err, t, 256);
- fprintf(stderr, s, t);
-}
-
-static HMIDIOUT hMidiOut[MAXMIDIOUTDEV]; /* output device */
-static int nt_nmidiout; /* number of devices */
-
-static void nt_open_midiout(int nmidiout, int *midioutvec)
-{
- UINT result, wRtn;
- int i;
- int dev;
- MIDIOUTCAPS midioutcaps;
- if (nmidiout > MAXMIDIOUTDEV)
- nmidiout = MAXMIDIOUTDEV;
-
- dev = 0;
-
- for (i = 0; i < nmidiout; i++)
- {
- MIDIOUTCAPS mocap;
- result = midiOutOpen(&hMidiOut[dev], midioutvec[i]-1, 0, 0,
- CALLBACK_NULL);
- wRtn = midiOutGetDevCaps(i, (LPMIDIOUTCAPS) &mocap,
- sizeof(mocap));
- if (result != MMSYSERR_NOERROR)
- {
- fprintf(stderr,"midiOutOpen: %s\n",midioutcaps.szPname);
- nt_midiouterror("midiOutOpen: %s\n", result);
- }
- else
- {
- if (sys_verbose)
- fprintf(stderr,"midiOutOpen: Open %s as Port %d\n",
- midioutcaps.szPname, dev);
- dev++;
- }
- }
- nt_nmidiout = dev;
-}
-
-void sys_putmidimess(int portno, int a, int b, int c)
-{
- DWORD foo;
- MMRESULT res;
- if (portno >= 0 && portno < nt_nmidiout)
- {
- foo = (a & 0xff) | ((b & 0xff) << 8) | ((c & 0xff) << 16);
- res = midiOutShortMsg(hMidiOut[portno], foo);
- if (res != MMSYSERR_NOERROR)
- post("MIDI out error %d", res);
- }
-}
-
-void sys_putmidibyte(int portno, int byte)
-{
- MMRESULT res;
- if (portno >= 0 && portno < nt_nmidiout)
- {
- res = midiOutShortMsg(hMidiOut[portno], byte);
- if (res != MMSYSERR_NOERROR)
- post("MIDI out error %d", res);
- }
-}
-
-static void nt_close_midiout(void)
-{
- int i;
- for (i = 0; i < nt_nmidiout; i++)
- {
- midiOutReset(hMidiOut[i]);
- midiOutClose(hMidiOut[i]);
- }
- nt_nmidiout = 0;
-}
-
-/* -------------------------- MIDI input ---------------------------- */
-
-#define INPUT_BUFFER_SIZE 1000 // size of input buffer in events
-
-static void nt_midiinerror(char *s, int err)
-{
- char t[256];
- midiInGetErrorText(err, t, 256);
- fprintf(stderr, s, t);
-}
-
-
-/* Structure to represent a single MIDI event.
- */
-
-#define EVNT_F_ERROR 0x00000001L
-
-typedef struct event_tag
-{
- DWORD fdwEvent;
- DWORD dwDevice;
- LARGE_INTEGER timestamp;
- DWORD data;
-} EVENT;
-typedef EVENT FAR *LPEVENT;
-
-/* Structure to manage the circular input buffer.
- */
-typedef struct circularBuffer_tag
-{
- HANDLE hSelf; /* handle to this structure */
- HANDLE hBuffer; /* buffer handle */
- WORD wError; /* error flags */
- DWORD dwSize; /* buffer size (in EVENTS) */
- DWORD dwCount; /* byte count (in EVENTS) */
- LPEVENT lpStart; /* ptr to start of buffer */
- LPEVENT lpEnd; /* ptr to end of buffer (last byte + 1) */
- LPEVENT lpHead; /* ptr to head (next location to fill) */
- LPEVENT lpTail; /* ptr to tail (next location to empty) */
-} CIRCULARBUFFER;
-typedef CIRCULARBUFFER FAR *LPCIRCULARBUFFER;
-
-
-/* Structure to pass instance data from the application
- to the low-level callback function.
- */
-typedef struct callbackInstance_tag
-{
- HANDLE hSelf;
- DWORD dwDevice;
- LPCIRCULARBUFFER lpBuf;
-} CALLBACKINSTANCEDATA;
-typedef CALLBACKINSTANCEDATA FAR *LPCALLBACKINSTANCEDATA;
-
-/* Function prototypes
- */
-LPCALLBACKINSTANCEDATA FAR PASCAL AllocCallbackInstanceData(void);
-void FAR PASCAL FreeCallbackInstanceData(LPCALLBACKINSTANCEDATA lpBuf);
-
-LPCIRCULARBUFFER AllocCircularBuffer(DWORD dwSize);
-void FreeCircularBuffer(LPCIRCULARBUFFER lpBuf);
-WORD FAR PASCAL GetEvent(LPCIRCULARBUFFER lpBuf, LPEVENT lpEvent);
-
-// Callback instance data pointers
-LPCALLBACKINSTANCEDATA lpCallbackInstanceData[MAXMIDIINDEV];
-
-UINT wNumDevices = 0; // Number of MIDI input devices opened
-BOOL bRecordingEnabled = 1; // Enable/disable recording flag
-int nNumBufferLines = 0; // Number of lines in display buffer
-RECT rectScrollClip; // Clipping rectangle for scrolling
-
-LPCIRCULARBUFFER lpInputBuffer; // Input buffer structure
-EVENT incomingEvent; // Incoming MIDI event structure
-
-MIDIINCAPS midiInCaps[MAXMIDIINDEV]; // Device capabilities structures
-HMIDIIN hMidiIn[MAXMIDIINDEV]; // MIDI input device handles
-
-
-/* AllocCallbackInstanceData - Allocates a CALLBACKINSTANCEDATA
- * structure. This structure is used to pass information to the
- * low-level callback function, each time it receives a message.
- *
- * Because this structure is accessed by the low-level callback
- * function, it must be allocated using GlobalAlloc() with the
- * GMEM_SHARE and GMEM_MOVEABLE flags and page-locked with
- * GlobalPageLock().
- *
- * Params: void
- *
- * Return: A pointer to the allocated CALLBACKINSTANCE data structure.
- */
-LPCALLBACKINSTANCEDATA FAR PASCAL AllocCallbackInstanceData(void)
-{
- HANDLE hMem;
- LPCALLBACKINSTANCEDATA lpBuf;
-
- /* Allocate and lock global memory.
- */
- hMem = GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE,
- (DWORD)sizeof(CALLBACKINSTANCEDATA));
- if(hMem == NULL)
- return NULL;
-
- lpBuf = (LPCALLBACKINSTANCEDATA)GlobalLock(hMem);
- if(lpBuf == NULL){
- GlobalFree(hMem);
- return NULL;
- }
-
- /* Page lock the memory.
- */
- //GlobalPageLock((HGLOBAL)HIWORD(lpBuf));
-
- /* Save the handle.
- */
- lpBuf->hSelf = hMem;
-
- return lpBuf;
-}
-
-/* FreeCallbackInstanceData - Frees the given CALLBACKINSTANCEDATA structure.
- *
- * Params: lpBuf - Points to the CALLBACKINSTANCEDATA structure to be freed.
- *
- * Return: void
- */
-void FAR PASCAL FreeCallbackInstanceData(LPCALLBACKINSTANCEDATA lpBuf)
-{
- HANDLE hMem;
-
- /* Save the handle until we're through here.
- */
- hMem = lpBuf->hSelf;
-
- /* Free the structure.
- */
- //GlobalPageUnlock((HGLOBAL)HIWORD(lpBuf));
- GlobalUnlock(hMem);
- GlobalFree(hMem);
-}
-
-
-/*
- * AllocCircularBuffer - Allocates memory for a CIRCULARBUFFER structure
- * and a buffer of the specified size. Each memory block is allocated
- * with GlobalAlloc() using GMEM_SHARE and GMEM_MOVEABLE flags, locked
- * with GlobalLock(), and page-locked with GlobalPageLock().
- *
- * Params: dwSize - The size of the buffer, in events.
- *
- * Return: A pointer to a CIRCULARBUFFER structure identifying the
- * allocated display buffer. NULL if the buffer could not be allocated.
- */
-
-
-LPCIRCULARBUFFER AllocCircularBuffer(DWORD dwSize)
-{
- HANDLE hMem;
- LPCIRCULARBUFFER lpBuf;
- LPEVENT lpMem;
-
- /* Allocate and lock a CIRCULARBUFFER structure.
- */
- hMem = GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE,
- (DWORD)sizeof(CIRCULARBUFFER));
- if(hMem == NULL)
- return NULL;
-
- lpBuf = (LPCIRCULARBUFFER)GlobalLock(hMem);
- if(lpBuf == NULL)
- {
- GlobalFree(hMem);
- return NULL;
- }
-
- /* Page lock the memory. Global memory blocks accessed by
- * low-level callback functions must be page locked.
- */
-#ifndef _WIN32
- GlobalSmartPageLock((HGLOBAL)HIWORD(lpBuf));
-#endif
-
- /* Save the memory handle.
- */
- lpBuf->hSelf = hMem;
-
- /* Allocate and lock memory for the actual buffer.
- */
- hMem = GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE, dwSize * sizeof(EVENT));
- if(hMem == NULL)
- {
-#ifndef _WIN32
- GlobalSmartPageUnlock((HGLOBAL)HIWORD(lpBuf));
-#endif
- GlobalUnlock(lpBuf->hSelf);
- GlobalFree(lpBuf->hSelf);
- return NULL;
- }
-
- lpMem = (LPEVENT)GlobalLock(hMem);
- if(lpMem == NULL)
- {
- GlobalFree(hMem);
-#ifndef _WIN32
- GlobalSmartPageUnlock((HGLOBAL)HIWORD(lpBuf));
-#endif
- GlobalUnlock(lpBuf->hSelf);
- GlobalFree(lpBuf->hSelf);
- return NULL;
- }
-
- /* Page lock the memory. Global memory blocks accessed by
- * low-level callback functions must be page locked.
- */
-#ifndef _WIN32
- GlobalSmartPageLock((HGLOBAL)HIWORD(lpMem));
-#endif
-
- /* Set up the CIRCULARBUFFER structure.
- */
- lpBuf->hBuffer = hMem;
- lpBuf->wError = 0;
- lpBuf->dwSize = dwSize;
- lpBuf->dwCount = 0L;
- lpBuf->lpStart = lpMem;
- lpBuf->lpEnd = lpMem + dwSize;
- lpBuf->lpTail = lpMem;
- lpBuf->lpHead = lpMem;
-
- return lpBuf;
-}
-
-/* FreeCircularBuffer - Frees the memory for the given CIRCULARBUFFER
- * structure and the memory for the buffer it references.
- *
- * Params: lpBuf - Points to the CIRCULARBUFFER to be freed.
- *
- * Return: void
- */
-void FreeCircularBuffer(LPCIRCULARBUFFER lpBuf)
-{
- HANDLE hMem;
-
- /* Free the buffer itself.
- */
-#ifndef _WIN32
- GlobalSmartPageUnlock((HGLOBAL)HIWORD(lpBuf->lpStart));
-#endif
- GlobalUnlock(lpBuf->hBuffer);
- GlobalFree(lpBuf->hBuffer);
-
- /* Free the CIRCULARBUFFER structure.
- */
- hMem = lpBuf->hSelf;
-#ifndef _WIN32
- GlobalSmartPageUnlock((HGLOBAL)HIWORD(lpBuf));
-#endif
- GlobalUnlock(hMem);
- GlobalFree(hMem);
-}
-
-/* GetEvent - Gets a MIDI event from the circular input buffer. Events
- * are removed from the buffer. The corresponding PutEvent() function
- * is called by the low-level callback function, so it must reside in
- * the callback DLL. PutEvent() is defined in the CALLBACK.C module.
- *
- * Params: lpBuf - Points to the circular buffer.
- * lpEvent - Points to an EVENT structure that is filled with the
- * retrieved event.
- *
- * Return: Returns non-zero if successful, zero if there are no
- * events to get.
- */
-WORD FAR PASCAL GetEvent(LPCIRCULARBUFFER lpBuf, LPEVENT lpEvent)
-{
- /* If no event available, return */
- if (!wNumDevices || lpBuf->dwCount <= 0) return (0);
-
- /* Get the event.
- */
- *lpEvent = *lpBuf->lpTail;
-
- /* Decrement the byte count, bump the tail pointer.
- */
- --lpBuf->dwCount;
- ++lpBuf->lpTail;
-
- /* Wrap the tail pointer, if necessary.
- */
- if(lpBuf->lpTail >= lpBuf->lpEnd)
- lpBuf->lpTail = lpBuf->lpStart;
-
- return 1;
-}
-
-/* PutEvent - Puts an EVENT in a CIRCULARBUFFER. If the buffer is full,
- * it sets the wError element of the CIRCULARBUFFER structure
- * to be non-zero.
- *
- * Params: lpBuf - Points to the CIRCULARBUFFER.
- * lpEvent - Points to the EVENT.
- *
- * Return: void
-*/
-
-void FAR PASCAL PutEvent(LPCIRCULARBUFFER lpBuf, LPEVENT lpEvent)
-{
- /* If the buffer is full, set an error and return.
- */
- if(lpBuf->dwCount >= lpBuf->dwSize){
- lpBuf->wError = 1;
- return;
- }
-
- /* Put the event in the buffer, bump the head pointer and the byte count.
- */
- *lpBuf->lpHead = *lpEvent;
-
- ++lpBuf->lpHead;
- ++lpBuf->dwCount;
-
- /* Wrap the head pointer, if necessary.
- */
- if(lpBuf->lpHead >= lpBuf->lpEnd)
- lpBuf->lpHead = lpBuf->lpStart;
-}
-
-/* midiInputHandler - Low-level callback function to handle MIDI input.
- * Installed by midiInOpen(). The input handler takes incoming
- * MIDI events and places them in the circular input buffer. It then
- * notifies the application by posting a MM_MIDIINPUT message.
- *
- * This function is accessed at interrupt time, so it should be as
- * fast and efficient as possible. You can't make any
- * Windows calls here, except PostMessage(). The only Multimedia
- * Windows call you can make are timeGetSystemTime(), midiOutShortMsg().
- *
- *
- * Param: hMidiIn - Handle for the associated input device.
- * wMsg - One of the MIM_***** messages.
- * dwInstance - Points to CALLBACKINSTANCEDATA structure.
- * dwParam1 - MIDI data.
- * dwParam2 - Timestamp (in milliseconds)
- *
- * Return: void
- */
-void FAR PASCAL midiInputHandler(
-HMIDIIN hMidiIn,
-WORD wMsg,
-DWORD dwInstance,
-DWORD dwParam1,
-DWORD dwParam2)
-{
- EVENT event;
-
- switch(wMsg)
- {
- case MIM_OPEN:
- break;
-
- /* The only error possible is invalid MIDI data, so just pass
- * the invalid data on so we'll see it.
- */
- case MIM_ERROR:
- case MIM_DATA:
- event.fdwEvent = (wMsg == MIM_ERROR) ? EVNT_F_ERROR : 0;
- event.dwDevice = ((LPCALLBACKINSTANCEDATA)dwInstance)->dwDevice;
- event.data = dwParam1;
-#ifdef MIDI_TIMESTAMP
- event.timestamp = timeGetSystemTime();
-#endif
- /* Put the MIDI event in the circular input buffer.
- */
-
- PutEvent(((LPCALLBACKINSTANCEDATA)dwInstance)->lpBuf,
- (LPEVENT) &event);
-
- break;
-
- default:
- break;
- }
-}
-
-void nt_open_midiin(int nmidiin, int *midiinvec)
-{
- UINT wRtn;
- char szErrorText[256];
- unsigned int i;
- unsigned int ndev = 0;
- /* Allocate a circular buffer for low-level MIDI input. This buffer
- * is filled by the low-level callback function and emptied by the
- * application.
- */
- lpInputBuffer = AllocCircularBuffer((DWORD)(INPUT_BUFFER_SIZE));
- if (lpInputBuffer == NULL)
- {
- printf("Not enough memory available for input buffer.\n");
- return;
- }
-
- /* Open all MIDI input devices after allocating and setting up
- * instance data for each device. The instance data is used to
- * pass buffer management information between the application and
- * the low-level callback function. It also includes a device ID,
- * a handle to the MIDI Mapper, and a handle to the application's
- * display window, so the callback can notify the window when input
- * data is available. A single callback function is used to service
- * all opened input devices.
- */
- for (i=0; (i<(unsigned)nmidiin) && (i<MAXMIDIINDEV); i++)
- {
- if ((lpCallbackInstanceData[ndev] = AllocCallbackInstanceData()) == NULL)
- {
- printf("Not enough memory available.\n");
- FreeCircularBuffer(lpInputBuffer);
- return;
- }
- lpCallbackInstanceData[i]->dwDevice = i;
- lpCallbackInstanceData[i]->lpBuf = lpInputBuffer;
-
- wRtn = midiInOpen((LPHMIDIIN)&hMidiIn[ndev],
- midiinvec[i] - 1,
- (DWORD)midiInputHandler,
- (DWORD)lpCallbackInstanceData[ndev],
- CALLBACK_FUNCTION);
- if (wRtn)
- {
- FreeCallbackInstanceData(lpCallbackInstanceData[ndev]);
- nt_midiinerror("midiInOpen: %s\n", wRtn);
- }
- else ndev++;
- }
-
- /* Start MIDI input.
- */
- for (i=0; i<ndev; i++)
- {
- if (hMidiIn[i])
- midiInStart(hMidiIn[i]);
- }
- wNumDevices = ndev;
-}
-
-static void nt_close_midiin(void)
-{
- unsigned int i;
- /* Stop, reset, close MIDI input. Free callback instance data.
- */
-
- for (i=0; (i<wNumDevices) && (i<MAXMIDIINDEV); i++)
- {
- if (hMidiIn[i])
- {
- if (sys_verbose)
- post("closing MIDI input %d...", i);
- midiInStop(hMidiIn[i]);
- midiInReset(hMidiIn[i]);
- midiInClose(hMidiIn[i]);
- FreeCallbackInstanceData(lpCallbackInstanceData[i]);
- }
- }
-
- /* Free input buffer.
- */
- if (lpInputBuffer)
- FreeCircularBuffer(lpInputBuffer);
-
- if (sys_verbose)
- post("...done");
- wNumDevices = 0;
-}
-
-void inmidi_noteon(int portno, int channel, int pitch, int velo);
-void inmidi_controlchange(int portno, int channel, int ctlnumber, int value);
-void inmidi_programchange(int portno, int channel, int value);
-void inmidi_pitchbend(int portno, int channel, int value);
-void inmidi_aftertouch(int portno, int channel, int value);
-void inmidi_polyaftertouch(int portno, int channel, int pitch, int value);
-void inmidi_realtimein(int portno, int rtmsg);
-
-void sys_poll_midi(void)
-{
- static EVENT nt_nextevent;
- static int nt_isnextevent;
- static double nt_nexteventtime;
-
- while (1)
- {
- if (!nt_isnextevent)
- {
- if (!GetEvent(lpInputBuffer, &nt_nextevent)) break;
- nt_isnextevent = 1;
-#ifdef MIDI_TIMESTAMP
- nt_nexteventtime = nt_midigettimefor(&foo.timestamp);
-#endif
- }
-#ifdef MIDI_TIMESTAMP
- if (0.001 * clock_gettimesince(initsystime) >= nt_nexteventtime)
-#endif
- {
- int msgtype = ((nt_nextevent.data & 0xf0) >> 4) - 8;
- int commandbyte = nt_nextevent.data & 0xff;
- int byte1 = (nt_nextevent.data >> 8) & 0xff;
- int byte2 = (nt_nextevent.data >> 16) & 0xff;
- int portno = nt_nextevent.dwDevice;
- switch (msgtype)
- {
- case 0:
- case 1:
- case 2:
- case 3:
- case 6:
- sys_midibytein(portno, commandbyte);
- sys_midibytein(portno, byte1);
- sys_midibytein(portno, byte2);
- break;
- case 4:
- case 5:
- sys_midibytein(portno, commandbyte);
- sys_midibytein(portno, byte1);
- break;
- case 7:
- sys_midibytein(portno, commandbyte);
- break;
- }
- nt_isnextevent = 0;
- }
- }
-}
-
-/* ------------------- public routines -------------------------- */
-
-void sys_open_audio(int naudioindev, int *audioindev,
- int nchindev, int *chindev, int naudiooutdev, int *audiooutdev,
- int nchoutdev, int *choutdev, int rate) /* IOhannes */
-{
- int inchans, outchans;
- if (nchindev < 0)
- inchans = (nchindev < 1 ? -1 : chindev[0]);
- else
- {
- int i = nchindev;
- int *l = chindev;
- inchans = 0;
- while (i--)
- inchans += *l++;
- }
- if (nchoutdev<0)
- outchans = (nchoutdev < 1 ? -1 : choutdev[0]);
- else
- {
- int i = nchoutdev;
- int *l = choutdev;
- outchans = 0;
- while (i--)
- outchans += *l++;
- }
- if (inchans < 0)
- inchans = DEFAULTCHANS;
- if (outchans < 0)
- outchans = DEFAULTCHANS;
- if (inchans & 1)
- {
- post("input channels rounded up to even number");
- inchans += 1;
- }
- if (outchans & 1)
- {
- post("output channels rounded up to even number");
- outchans += 1;
- }
- if (inchans > NT_MAXCH)
- inchans = NT_MAXCH;
- if (outchans > NT_MAXCH)
- outchans = NT_MAXCH;
- if (sys_verbose)
- post("channels in %d, out %d", inchans, outchans);
- if (rate < 1)
- rate = DEFAULTSRATE;
- nt_setchsr(inchans, outchans, rate);
- if (nt_whichapi == API_PORTAUDIO)
- {
- int blocksize = (nt_blocksize ? nt_blocksize : 256);
- if (blocksize != (1 << ilog2(blocksize)))
- post("warning: blocksize adjusted to power of 2: %d",
- (blocksize = (1 << ilog2(blocksize))));
- pa_open_audio(inchans, outchans, rate, sys_soundin, sys_soundout,
- blocksize, nt_advance_samples/blocksize,
- (naudioindev < 1 ? -1 : audioindev[0]),
- (naudiooutdev < 1 ? -1 : audiooutdev[0]));
- }
- else
- {
- nt_nwavein = inchans / 2;
- nt_nwaveout = outchans / 2;
- nt_whichdac = (naudiooutdev < 1 ? (nt_nwaveout > 1 ? 0 : -1) : audiooutdev[0] - 1);
- nt_whichadc = (naudioindev < 1 ? (nt_nwavein > 1 ? 0 : -1) : audioindev[0] - 1);
- if (naudiooutdev > 1 || naudioindev > 1)
- post("separate audio device choice not supported; using sequential devices.");
- if (nt_blocksize)
- post("warning: blocksize not settable for MMIO, just ASIO");
- mmio_open_audio();
- }
-}
-
-void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
-{
- if (nmidiout)
- nt_open_midiout(nmidiout, midioutvec);
- if (nmidiin)
- {
- post(
- "midi input enabled; warning, don't close the DOS window directly!");
- nt_open_midiin(nmidiin, midiinvec);
- }
- else post("not using MIDI input (use 'pd -midiindev 1' to override)");
-}
-
-float sys_getsr(void)
-{
- return (sys_dacsr);
-}
-
-int sys_get_inchannels(void)
-{
- return (2 * nt_nwavein);
-}
-
-int sys_get_outchannels(void)
-{
- return (2 * nt_nwaveout);
-}
-
-void sys_audiobuf(int n)
-{
- /* set the size, in msec, of the audio FIFO. It's incorrect to
- calculate this on the basis of 44100 sample rate; really, the
- work should have been done in nt_setchsr(). */
- int nbuf = n * (44100./(REALDACBLKSIZE * 1000.));
- if (nbuf >= MAXBUFFER)
- {
- fprintf(stderr, "pd: audio buffering maxed out to %d\n",
- (int)(MAXBUFFER * ((REALDACBLKSIZE * 1000.)/44100.)));
- nbuf = MAXBUFFER;
- }
- else if (nbuf < 4) nbuf = 4;
- fprintf(stderr, "%d audio buffers\n", nbuf);
- nt_naudiobuffer = nbuf;
- if (nt_adcjitterbufsallowed > nbuf - 2)
- nt_adcjitterbufsallowed = nbuf - 2;
- if (nt_dacjitterbufsallowed > nbuf - 2)
- nt_dacjitterbufsallowed = nbuf - 2;
- sys_schedadvance = 1000 * n;
-}
-
-void sys_getmeters(float *inmax, float *outmax)
-{
- if (inmax)
- {
- nt_meters = 1;
- *inmax = nt_inmax;
- *outmax = nt_outmax;
- }
- else
- nt_meters = 0;
- nt_inmax = nt_outmax = 0;
-}
-
-void sys_reportidle(void)
-{
-}
-
-int sys_send_dacs(void)
-{
- if (nt_whichapi == API_PORTAUDIO)
- return (pa_send_dacs());
- else return (mmio_send_dacs());
-}
-
-void sys_close_audio( void)
-{
- if (nt_whichapi == API_PORTAUDIO)
- pa_close_audio();
- else mmio_close_audio();
-}
-
-void sys_close_midi( void)
-{
- nt_close_midiin();
- nt_close_midiout();
-}
-
-void sys_setblocksize(int n)
-{
- if (n < 1)
- n = 1;
- nt_blocksize = n;
-}
-
-/* ----------- public routines which are only defined for MSW/NT ---------- */
-
-/* select between MMIO and ASIO audio APIs */
-void nt_set_sound_api(int which)
-{
- nt_whichapi = which;
- if (sys_verbose)
- post("nt_whichapi %d", nt_whichapi);
-}
-
-/* list the audio and MIDI device names */
-void sys_listdevs(void)
-{
- UINT wRtn, ndevices;
- unsigned int i;
-
- /* for MIDI and audio in and out, get the number of devices.
- Then get the capabilities of each device and print its description. */
-
- ndevices = midiInGetNumDevs();
- for (i = 0; i < ndevices; i++)
- {
- MIDIINCAPS micap;
- wRtn = midiInGetDevCaps(i, (LPMIDIINCAPS) &micap,
- sizeof(micap));
- if (wRtn) nt_midiinerror("midiInGetDevCaps: %s\n", wRtn);
- else fprintf(stderr,
- "MIDI input device #%d: %s\n", i+1, micap.szPname);
- }
-
- ndevices = midiOutGetNumDevs();
- for (i = 0; i < ndevices; i++)
- {
- MIDIOUTCAPS mocap;
- wRtn = midiOutGetDevCaps(i, (LPMIDIOUTCAPS) &mocap,
- sizeof(mocap));
- if (wRtn) nt_midiouterror("midiOutGetDevCaps: %s\n", wRtn);
- else fprintf(stderr,
- "MIDI output device #%d: %s\n", i+1, mocap.szPname);
- }
-
- if (nt_whichapi == API_PORTAUDIO)
- {
- pa_listdevs();
- return;
- }
- ndevices = waveInGetNumDevs();
- for (i = 0; i < ndevices; i++)
- {
- WAVEINCAPS wicap;
- wRtn = waveInGetDevCaps(i, (LPWAVEINCAPS) &wicap,
- sizeof(wicap));
- if (wRtn) nt_waveinerror("waveInGetDevCaps: %s\n", wRtn);
- else fprintf(stderr,
- "audio input device #%d: %s\n", i+1, wicap.szPname);
- }
-
- ndevices = waveOutGetNumDevs();
- for (i = 0; i < ndevices; i++)
- {
- WAVEOUTCAPS wocap;
- wRtn = waveOutGetDevCaps(i, (LPWAVEOUTCAPS) &wocap,
- sizeof(wocap));
- if (wRtn) nt_waveouterror("waveOutGetDevCaps: %s\n", wRtn);
- else fprintf(stderr,
- "audio output device #%d: %s\n", i+1, wocap.szPname);
- }
-}
-
-void nt_soundindev(int which)
-{
- nt_whichadc = which - 1;
-}
-
-void nt_soundoutdev(int which)
-{
- nt_whichdac = which - 1;
-}
-
-void glob_audio(void *dummy, t_floatarg fadc, t_floatarg fdac)
-{
- int adc = fadc, dac = fdac;
- if (!dac && !adc)
- post("%d channels in, %d channels out",
- 2 * nt_nwavein, 2 * nt_nwaveout);
- else
- {
- sys_close_audio();
- sys_open_audio(1, 0, 1, 0, /* dummy parameters */
- 1, &adc, 1, &dac, sys_dacsr);
- }
-}
-
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index 58d33db7..456be94f 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -212,32 +212,15 @@ int open_via_path(const char *dir, const char *name, const char* ext,
return (-1);
}
- /* LATER make this use open_via_path above. */
-void open_via_helppath(const char *name, const char *dir)
+static int do_open_via_helppath(const char *realname, t_namelist *listp)
{
- t_namelist *nl, thislist, *listp;
+ t_namelist *nl;
int fd = -1;
- char dirresult[MAXPDSTRING], realdir[MAXPDSTRING], dirbuf2[MAXPDSTRING],
- realname[MAXPDSTRING];
-
- /* if directory is supplied, put it at head of search list. */
- if (*dir)
- {
- thislist.nl_string = dirbuf2;
- thislist.nl_next = pd_helppath;
- strncpy(dirbuf2, dir, MAXPDSTRING);
- dirbuf2[MAXPDSTRING-1] = 0;
- sys_unbashfilename(dirbuf2, dirbuf2);
- listp = &thislist;
- }
- else listp = pd_helppath;
- strcpy(realname, "help-");
- strncat(realname, name, MAXPDSTRING-5);
- realname[MAXPDSTRING-1] = 0;
+ char dirresult[MAXPDSTRING], realdir[MAXPDSTRING];
for (nl = listp; nl; nl = nl->nl_next)
{
strcpy(dirresult, nl->nl_string);
- strcpy(realdir,dirresult);
+ strcpy(realdir, dirresult);
if (*dirresult && dirresult[strlen(dirresult)-1] != '/')
strcat(dirresult, "/");
strcat(dirresult, realname);
@@ -267,7 +250,7 @@ void open_via_helppath(const char *name, const char *dir)
sys_unbashfilename(dirresult, dirresult);
close (fd);
glob_evalfile(0, gensym((char*)realname), gensym(realdir));
- return;
+ return (1);
}
}
else
@@ -275,12 +258,54 @@ void open_via_helppath(const char *name, const char *dir)
if (sys_verbose) post("tried %s and failed", dirresult);
}
}
- post("sorry, couldn't find help for \"%s\"", name);
+ return (0);
+}
+
+ /* LATER make this use open_via_path above. We expect the ".pd"
+ suffix here, even though we have to tear it back off for one of the
+ search attempts. */
+void open_via_helppath(const char *name, const char *dir)
+{
+ t_namelist *nl, thislist, *listp;
+ int fd = -1;
+ char dirbuf2[MAXPDSTRING], realname[MAXPDSTRING];
+
+ /* if directory is supplied, put it at head of search list. */
+ if (*dir)
+ {
+ thislist.nl_string = dirbuf2;
+ thislist.nl_next = pd_helppath;
+ strncpy(dirbuf2, dir, MAXPDSTRING);
+ dirbuf2[MAXPDSTRING-1] = 0;
+ sys_unbashfilename(dirbuf2, dirbuf2);
+ listp = &thislist;
+ }
+ else listp = pd_helppath;
+ /* 1. "objectname-help.pd" */
+ strncpy(realname, name, MAXPDSTRING-10);
+ realname[MAXPDSTRING-10] = 0;
+ if (strlen(realname) > 3 && !strcmp(realname+strlen(realname)-3, ".pd"))
+ realname[strlen(realname)-3] = 0;
+ strcat(realname, "-help.pd");
+ if (do_open_via_helppath(realname, listp))
+ return;
+ /* 2. "help-objectname.pd" */
+ strcpy(realname, "help-");
+ strncat(realname, name, MAXPDSTRING-10);
+ realname[MAXPDSTRING-1] = 0;
+ if (do_open_via_helppath(realname, listp))
+ return;
+ /* 3. "objectname.pd" */
+ if (do_open_via_helppath(name, listp))
+ return;
+ post("sorry, couldn't find help patch for \"%s\"", name);
return;
}
-/* Startup file reading for linux and MACOSX */
+/* Startup file reading for linux and MACOSX. This should be replaced by
+a better mechanism. This should be integrated with the audio, MIDI, and
+path dialog system. */
#ifdef UNIX
@@ -297,13 +322,13 @@ int sys_rcfile(void)
int rcargc;
char* rcargv[NUMARGS];
char* buffer;
- char fname[MAXPDSTRING], buf[1000];
+ char fname[MAXPDSTRING], buf[1000], *home = getenv("HOME");
/* parse a startup file */
*fname = '\0';
- strncat(fname, getenv("HOME"), MAXPDSTRING-10);
+ strncat(fname, home? home : ".", MAXPDSTRING-10);
strcat(fname, "/");
strcat(fname, STARTUPNAME);
@@ -352,4 +377,34 @@ int sys_rcfile(void)
}
#endif /* UNIX */
+ /* start an audio settings dialog window */
+void glob_start_path_dialog(t_pd *dummy, t_floatarg flongform)
+{
+ char buf[MAXPDSTRING];
+ int i;
+ t_namelist *nl;
+
+ for (nl = pd_path, i = 0; nl && i < 10; nl = nl->nl_next, i++)
+ sys_vgui("pd_set pd_path%d \"%s\"\n", i, nl->nl_string);
+ for (; i < 10; i++)
+ sys_vgui("pd_set pd_path%d \"\"\n", i);
+
+ sprintf(buf, "pdtk_path_dialog %%s\n");
+ gfxstub_new(&glob_pdobject, glob_start_path_dialog, buf);
+}
+
+ /* new values from dialog window */
+void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
+{
+ int i;
+ namelist_free(pd_path);
+ pd_path = 0;
+ for (i = 0; i < argc; i++)
+ {
+ t_symbol *s = atom_getsymbolarg(i, argc, argv);
+ if (*s->s_name)
+ sys_addpath(s->s_name);
+ }
+}
+
diff --git a/pd/src/s_portaudio.c b/pd/src/s_portaudio.c
deleted file mode 100644
index 73dd55ab..00000000
--- a/pd/src/s_portaudio.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* Copyright (c) 2001 Miller Puckette and others.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-/* this file calls Ross Bencina's and Phil Burk's Portaudio package. It's
- the main way in for Mac OS and, with Michael Casey's help, also into
- ASIO in Windows. */
-
-/* dolist.
- write a version of OpenAudioStream to take nchannels param
- how do we specify latency?
- listing devices?
- choosing devices?
-*/
-
-#include "m_imp.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include "pablio_pd.h"
-#include "portaudio.h"
-#ifndef NT
-#include "portmidi.h"
-#include "porttime.h"
-#include "pminternal.h"
-#endif
-
- /* public interface declared in m_imp.h */
-
- /* implementation */
-static PABLIO_Stream *pa_stream;
-static int pa_inchans, pa_outchans;
-static float *pa_soundin, *pa_soundout;
-
-#define MAX_PA_CHANS 32
-#define MAX_SAMPLES_PER_FRAME MAX_PA_CHANS * DACBLKSIZE
-
-int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin,
- t_sample *soundout, int framesperbuf, int nbuffers,
- int indeviceno, int outdeviceno)
-{
- PaError err;
- /* post("in %d out %d rate %d device %d", inchans, outchans, rate, deviceno); */
- if (inchans != 0 && outchans != 0 && inchans != outchans)
- error("portaudio: number of input and output channels must match");
- if (sys_verbose)
- post("portaudio: opening for %d channels in, %d out",
- inchans, outchans);
- if (inchans > MAX_PA_CHANS)
- {
- post("input channels reduced to maximum %d", MAX_PA_CHANS);
- inchans = MAX_PA_CHANS;
- }
- if (outchans > MAX_PA_CHANS)
- {
- post("output channels reduced to maximum %d", MAX_PA_CHANS);
- outchans = MAX_PA_CHANS;
- }
-
- if (inchans && outchans)
- err = OpenAudioStream( &pa_stream, rate, paFloat32,
- PABLIO_READ_WRITE, inchans, framesperbuf, nbuffers, indeviceno, outdeviceno);
- else if (inchans)
- err = OpenAudioStream( &pa_stream, rate, paFloat32,
- PABLIO_READ, inchans, framesperbuf, nbuffers, indeviceno, outdeviceno);
- else if (outchans)
- err = OpenAudioStream( &pa_stream, rate, paFloat32,
- PABLIO_WRITE, outchans, framesperbuf, nbuffers, indeviceno, outdeviceno);
- else err = 0;
- if ( err != paNoError )
- {
- fprintf( stderr, "Error number %d occured opening portaudio stream\n",
- err);
- fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
- Pa_Terminate();
- return (1);
- }
- else if (sys_verbose)
- post("... opened OK.");
- pa_inchans = inchans;
- pa_outchans = outchans;
- pa_soundin = soundin;
- pa_soundout = soundout;
- return (0);
-}
-
-void pa_close_audio( void)
-{
- if (pa_inchans || pa_outchans)
- CloseAudioStream( pa_stream );
- pa_inchans = pa_outchans = 0;
-}
-
-int pa_send_dacs(void)
-{
- float samples[MAX_SAMPLES_PER_FRAME], *fp1, *fp2;
- int i, j;
- double timebefore;
-
- timebefore = sys_getrealtime();
- if (pa_inchans)
- {
- ReadAudioStream(pa_stream, samples, DACBLKSIZE);
- for (j = 0, fp1 = pa_soundin; j < pa_inchans; j++, fp1 += DACBLKSIZE)
- for (i = 0, fp2 = samples + j; i < DACBLKSIZE; i++,
- fp2 += pa_inchans)
- {
- fp1[i] = *fp2;
- }
- }
- if (pa_outchans)
- {
- for (j = 0, fp1 = pa_soundout; j < pa_outchans; j++, fp1 += DACBLKSIZE)
- for (i = 0, fp2 = samples + j; i < DACBLKSIZE; i++,
- fp2 += pa_outchans)
- {
- *fp2 = fp1[i];
- fp1[i] = 0;
- }
- WriteAudioStream(pa_stream, samples, DACBLKSIZE);
- }
-
- if (sys_getrealtime() > timebefore + 0.002)
- return (SENDDACS_SLEPT);
- else return (SENDDACS_YES);
-}
-
-
-void pa_listdevs(void) /* lifted from pa_devs.c in portaudio */
-{
- int i,j;
- int numDevices;
- const PaDeviceInfo *pdi;
- PaError err;
- Pa_Initialize();
- numDevices = Pa_CountDevices();
- if( numDevices < 0 )
- {
- fprintf(stderr, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices );
- err = numDevices;
- goto error;
- }
- fprintf(stderr, "Number of devices = %d\n", numDevices );
- for( i=0; i<numDevices; i++ )
- {
- pdi = Pa_GetDeviceInfo( i );
- fprintf(stderr, "---------------------------------------------- #%d",
- i+1 );
- if( i == Pa_GetDefaultInputDeviceID() ) fprintf(stderr, " DefaultInput");
- if( i == Pa_GetDefaultOutputDeviceID() ) fprintf(stderr, " DefaultOutput");
- fprintf(stderr, "\nName = %s\n", pdi->name );
- fprintf(stderr, "Max Inputs = %d", pdi->maxInputChannels );
- fprintf(stderr, ", Max Outputs = %d\n", pdi->maxOutputChannels );
- if( pdi->numSampleRates == -1 )
- {
- fprintf(stderr, "Sample Rate Range = %f to %f\n", pdi->sampleRates[0], pdi->sampleRates[1] );
- }
- else
- {
- fprintf(stderr, "Sample Rates =");
- for( j=0; j<pdi->numSampleRates; j++ )
- {
- fprintf(stderr, " %8.2f,", pdi->sampleRates[j] );
- }
- fprintf(stderr, "\n");
- }
- fprintf(stderr, "Native Sample Formats = ");
- if( pdi->nativeSampleFormats & paInt8 ) fprintf(stderr, "paInt8, ");
- if( pdi->nativeSampleFormats & paUInt8 ) fprintf(stderr, "paUInt8, ");
- if( pdi->nativeSampleFormats & paInt16 ) fprintf(stderr, "paInt16, ");
- if( pdi->nativeSampleFormats & paInt32 ) fprintf(stderr, "paInt32, ");
- if( pdi->nativeSampleFormats & paFloat32 ) fprintf(stderr, "paFloat32, ");
- if( pdi->nativeSampleFormats & paInt24 ) fprintf(stderr, "paInt24, ");
- if( pdi->nativeSampleFormats & paPackedInt24 ) fprintf(stderr, "paPackedInt24, ");
- fprintf(stderr, "\n");
- }
-
- fprintf(stderr, "----------------------------------------------\n");
- goto midi;
-
-error:
- fprintf( stderr, "An error occured while using the portaudio stream\n" );
- fprintf( stderr, "Error number: %d\n", err );
- fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
-
- /* and MIDI */
-midi: ;
-#ifndef NT
- for (i = 0; i < Pm_CountDevices(); i++)
- {
- const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
- printf("%d: %s, %s", i, info->interf, info->name);
- if (info->input) printf(" (input)");
- if (info->output) printf(" (output)");
- printf("\n");
- }
-#endif
-}
diff --git a/pd/src/s_sgi.c b/pd/src/s_sgi.c
deleted file mode 100644
index 82a23dfb..00000000
--- a/pd/src/s_sgi.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* Copyright (c) 1997-1999 Miller Puckette.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-#include "m_imp.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#ifdef HAVE_BSTRING_H
-#include <bstring.h>
-#endif
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include <dmedia/audio.h>
-#include <sys/fpu.h>
-#include <dmedia/midi.h>
-int mdInit(void); /* prototype was messed up in midi.h */
-/* #include "sys/select.h" */
-
-static ALport iport;
-static ALport oport;
-static ALconfig sgi_config;
-#define DEFAULTCHANS 2
-#define SGI_MAXCH 8
-static int sys_inchannels, sys_outchannels;
-static int sys_audiobufsamps;
-int sys_schedadvance = 50000; /* scheduler advance in microseconds */
- /* (this is set ridiculously high until we can get the real-time
- scheduling act together.) */
-int sys_hipriority = 0;
-static int sgi_meters; /* true if we're metering */
-static float sgi_inmax; /* max input amplitude */
-static float sgi_outmax; /* max output amplitude */
-
-
- /*
- set the special "flush zero" but (FS, bit 24) in the
- Control Status Register of the FPU of R4k and beyond
- so that the result of any underflowing operation will
- be clamped to zero, and no exception of any kind will
- be generated on the CPU.
-
- thanks to cpirazzi@cp.esd.sgi.com (Chris Pirazzi).
- */
-
-static void sgi_flush_all_underflows_to_zero(void)
-{
- union fpc_csr f;
- f.fc_word = get_fpc_csr();
- f.fc_struct.flush = 1;
- set_fpc_csr(f.fc_word);
-}
-
-static void sgi_setchsr(int inchans, int outchans, int sr)
-{
- int inbytes = inchans * (DACBLKSIZE*sizeof(float));
- int outbytes = outchans * (DACBLKSIZE*sizeof(float));
-
- sys_audiobufsamps = 64 * (int)(((float)sys_schedadvance)* sr / 64000000.);
- sys_inchannels = inchans;
- sys_outchannels = outchans;
- sys_dacsr = sr;
-
- if (sys_soundin)
- free(sys_soundin);
- sys_soundin = (t_float *)malloc(inbytes);
- memset(sys_soundin, 0, inbytes);
-
- if (sys_soundout)
- free(sys_soundout);
- sys_soundout = (t_float *)malloc(outbytes);
- memset(sys_soundout, 0, outbytes);
-
- memset(sys_soundout, 0, sys_outchannels * (DACBLKSIZE*sizeof(float)));
- memset(sys_soundin, 0, sys_inchannels * (DACBLKSIZE*sizeof(float)));
-}
-
-static void sgi_open_audio(void)
-{
- long pvbuf[4];
- long pvbuflen;
- /* get current sample rate -- should use this to set logical SR */
- pvbuf[0] = AL_INPUT_RATE;
- pvbuf[2] = AL_OUTPUT_RATE;
- pvbuflen = 4;
-
- ALgetparams(AL_DEFAULT_DEVICE, pvbuf, pvbuflen);
-
- if (sys_inchannels && pvbuf[1] != sys_dacsr)
- post("warning: input sample rate (%d) doesn't match mine (%f)\n",
- pvbuf[1], sys_dacsr);
-
- if (sys_outchannels && pvbuf[3] != sys_dacsr)
- post("warning: output sample rate (%d) doesn't match mine (%f)\n",
- pvbuf[3], sys_dacsr);
-
- pvbuf[3] = pvbuf[1];
- ALsetparams(AL_DEFAULT_DEVICE, pvbuf, pvbuflen);
-
- sgi_config = ALnewconfig();
-
- ALsetsampfmt(sgi_config, AL_SAMPFMT_FLOAT);
-
- if (sys_outchannels)
- {
- ALsetchannels(sgi_config, sys_outchannels);
- ALsetqueuesize(sgi_config, sys_audiobufsamps * sys_outchannels);
- oport = ALopenport("the ouput port", "w", sgi_config);
- if (!oport)
- fprintf(stderr,"Pd: failed to open audio write port\n");
- }
- else oport = 0;
- if (sys_inchannels)
- {
- ALsetchannels(sgi_config, sys_inchannels);
- ALsetqueuesize(sgi_config, sys_audiobufsamps * sys_inchannels);
- iport = ALopenport("the input port", "r", sgi_config);
- if (!iport)
- fprintf(stderr,"Pd: failed to open audio read port\n");
- }
- else iport = 0;
-}
-
-void sys_close_audio( void)
-{
- if (iport) ALcloseport(iport);
- if (oport) ALcloseport(oport);
-}
-
-void sys_close_midi( void)
-{
- /* ??? */
-}
-
-t_sample *sys_soundout;
-t_sample *sys_soundin;
-float sys_dacsr;
-
-int sys_send_dacs(void)
-{
- float buf[SGI_MAXCH * DACBLKSIZE], *fp1, *fp2, *fp3, *fp4;
- long outfill, infill;
- int outchannels = sys_outchannels, inchannels = sys_inchannels;
- int i, nwait = 0, channel;
- int outblk = DACBLKSIZE * outchannels;
- int inblk = DACBLKSIZE * inchannels;
- outfill = ALgetfillable(oport);
- if (sgi_meters)
- {
- int i, n;
- float maxsamp;
- for (i = 0, n = sys_inchannels * DACBLKSIZE, maxsamp = sgi_inmax;
- i < n; i++)
- {
- float f = sys_soundin[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- sgi_inmax = maxsamp;
- for (i = 0, n = sys_outchannels * DACBLKSIZE, maxsamp = sgi_outmax;
- i < n; i++)
- {
- float f = sys_soundout[i];
- if (f > maxsamp) maxsamp = f;
- else if (-f > maxsamp) maxsamp = -f;
- }
- sgi_outmax = maxsamp;
- }
-
- if (outfill <= outblk)
- {
- while ((infill = ALgetfilled(iport)) > 2*inblk)
- {
- if (sys_verbose) post("drop ADC buf");
- ALreadsamps(iport, buf, inblk);
- return (0);
- }
- }
- if (outchannels)
- {
- for (channel = 0, fp1 = buf, fp2 = sys_soundout;
- channel < outchannels; channel++, fp1++, fp2 += DACBLKSIZE)
- {
- for (i = 0, fp3 = fp1, fp4 = fp2; i < DACBLKSIZE;
- i++, fp3 += outchannels, fp4++)
- *fp3 = *fp4, *fp4 = 0;
- }
- ALwritesamps(oport, buf, outchannels* DACBLKSIZE);
- }
- if (inchannels)
- {
- if (infill > inblk)
- ALreadsamps(iport, buf, inchannels* DACBLKSIZE);
- else
- {
- if (sys_verbose) post("extra ADC buf");
- memset(buf, 0, inblk*sizeof(float));
- }
- for (channel = 0, fp1 = buf, fp2 = sys_soundin;
- channel < inchannels; channel++, fp1++, fp2 += DACBLKSIZE)
- {
- for (i = 0, fp3 = fp1, fp4 = fp2; i < DACBLKSIZE;
- i++, fp3 += inchannels, fp4++)
- *fp4 = *fp3;
- }
- }
- return (1);
-}
-
-/* ------------------------- MIDI -------------------------- */
-
-#define NPORT 2
-
-static MDport sgi_inport[NPORT];
-static MDport sgi_outport[NPORT];
-
-void sgi_open_midi(int midiin, int midiout)
-{
- int i;
- int sgi_nports = mdInit();
- if (sgi_nports < 0) sgi_nports = 0;
- else if (sgi_nports > NPORT) sgi_nports = NPORT;
- if (sys_verbose)
- {
- if (!sgi_nports)
- {
- post("no serial ports are configured for MIDI;");
- post("if you want to use MIDI, try exiting Pd, typing");
- post("'startmidi -d /dev/ttyd2' to a shell, and restarting Pd.");
- }
- else if (sgi_nports == 1)
- post("Found one MIDI port on %s", mdGetName(0));
- else if (sgi_nports == 2)
- post("Found MIDI ports on %s and %s",
- mdGetName(0), mdGetName(1));
- }
- if (midiin)
- {
- for (i = 0; i < sgi_nports; i++)
- {
- if (!(sgi_inport[i] = mdOpenInPort(mdGetName(i))))
- error("MIDI input port %d: open failed", i+1);;
- }
- }
- if (midiout)
- {
- for (i = 0; i < sgi_nports; i++)
- {
- if (!(sgi_outport[i] = mdOpenOutPort(mdGetName(i))))
- error("MIDI output port %d: open failed", i+1);;
- }
- }
- return;
-}
-
-void sys_putmidimess(int portno, int a, int b, int c)
-{
- MDevent mdv;
- if (portno >= NPORT || portno < 0 || !sgi_outport[portno]) return;
- mdv.msg[0] = a;
- mdv.msg[1] = b;
- mdv.msg[2] = c;
- mdv.msg[3] = 0;
- mdv.sysexmsg = 0;
- mdv.stamp = 0;
- mdv.msglen = 0;
- if (mdSend(sgi_outport[portno], &mdv, 1) < 0)
- error("MIDI output error\n");
- post("msg out %d %d %d", a, b, c);
-}
-
-void sys_putmidibyte(int portno, int foo)
-{
- error("MIDI raw byte output not available on SGI");
-}
-
-void inmidi_noteon(int portno, int channel, int pitch, int velo);
-void inmidi_controlchange(int portno, int channel, int ctlnumber, int value);
-void inmidi_programchange(int portno, int channel, int value);
-void inmidi_pitchbend(int portno, int channel, int value);
-void inmidi_aftertouch(int portno, int channel, int value);
-void inmidi_polyaftertouch(int portno, int channel, int pitch, int value);
-
-void sys_poll_midi(void)
-{
- int i;
- MDport *mp;
- for (i = 0, mp = sgi_inport; i < NPORT; i++, mp++)
- {
- int ret, status, b1, b2, nfds;
- MDevent mdv;
- fd_set inports;
- struct timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- if (!*mp) continue;
- FD_ZERO(&inports);
- FD_SET(mdGetFd(*mp), &inports);
-
- if (select(mdGetFd(*mp)+1 , &inports, 0, 0, &timeout) < 0)
- perror("midi select");
- if (FD_ISSET(mdGetFd(*mp),&inports))
- {
- if (mdReceive(*mp, &mdv, 1) < 0)
- error("failure receiving message\n");
- else if (mdv.msg[0] == MD_SYSEX) mdFree(mdv.sysexmsg);
-
- else
- {
- int status = mdv.msg[0];
- int channel = (status & 0xf) + 1;
- int b1 = mdv.msg[1];
- int b2 = mdv.msg[2];
- switch(status & 0xf0)
- {
- case MD_NOTEOFF:
- inmidi_noteon(i, channel, b1, 0);
- break;
- case MD_NOTEON:
- inmidi_noteon(i, channel, b1, b2);
- break;
- case MD_POLYKEYPRESSURE:
- inmidi_polyaftertouch(i, channel, b1, b2);
- break;
- case MD_CONTROLCHANGE:
- inmidi_controlchange(i, channel, b1, b2);
- break;
- case MD_PITCHBENDCHANGE:
- inmidi_pitchbend(i, channel, ((b2 << 7) + b1));
- break;
- case MD_PROGRAMCHANGE:
- inmidi_programchange(i, channel, b1);
- break;
- case MD_CHANNELPRESSURE:
- inmidi_aftertouch(i, channel, b1);
- break;
- }
- }
- }
- }
-}
-
- /* public routines */
-
-void sys_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev,
- int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev,
- int rate) /* IOhannes */
-{
- int inchans=0;
- int outchans=0;
- if (nchindev<0)inchans == -1;
- else {
- int i=nchindev;
- int *l=chindev;
- while(i--)inchans+=*l++;
- }
- if (nchoutdev<0)outchans == -1;
- else {
- int i=nchoutdev;
- int *l=choutdev;
- while(i--)outchans+=*l++;
- }
-
- if (inchans < 0) inchans = DEFAULTCHANS;
- if (outchans < 0) outchans = DEFAULTCHANS;
- if (inchans > SGI_MAXCH) inchans = SGI_MAXCH;
- if (outchans > SGI_MAXCH) outchans = SGI_MAXCH;
-
- sgi_setchsr(inchans, outchans, rate);
- sgi_flush_all_underflows_to_zero();
- sgi_open_audio();
-}
-
-void sys_open_midi(int nmidiin, int *midiinvec,
- int nmidiout, int *midioutvec)
-{
- sgi_open_midi(nmidiin!=0, nmidiout!=0);
-}
-
-float sys_getsr(void)
-{
- return (sys_dacsr);
-}
-
-void sys_audiobuf(int n)
-{
- /* set the size, in milliseconds, of the audio FIFO */
- if (n < 5) n = 5;
- else if (n > 5000) n = 5000;
- fprintf(stderr, "audio buffer set to %d milliseconds\n", n);
- sys_schedadvance = n * 1000;
-}
-
-void sys_getmeters(float *inmax, float *outmax)
-{
- if (inmax)
- {
- sgi_meters = 1;
- *inmax = sgi_inmax;
- *outmax = sgi_outmax;
- }
- else
- sgi_meters = 0;
- sgi_inmax = sgi_outmax = 0;
-}
-
-void sys_reportidle(void)
-{
-}
-
-int sys_get_inchannels(void)
-{
- return (sys_inchannels);
-}
-
-int sys_get_outchannels(void)
-{
- return (sys_outchannels);
-}
-
-void sys_set_priority(int foo)
-{
- fprintf(stderr,
- "warning: priority boosting in IRIX not implemented yet\n");
-}
-
-void sys_setblocksize(int n)
-{
- fprintf(stderr,
- "warning: blocksize not settable in IRIX\n");
-}
diff --git a/pd/src/s_stuff.h b/pd/src/s_stuff.h
index c8ac47f8..7a827b8b 100644
--- a/pd/src/s_stuff.h
+++ b/pd/src/s_stuff.h
@@ -54,12 +54,18 @@ extern int sys_sleepgrain;
void sys_open_audio(int naudioindev, int *audioindev,
int nchindev, int *chindev,
int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev,
- int srate); /* IOhannes */
+ int srate, int advance, int enable);
void sys_close_audio(void);
-void sys_open_midi(int nmidiin, int *midiinvec,
+ /* s_midi.c */
+void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec);
+
+ /* implemented in the system dependent MIDI code (s_midi_pm.c, etc. ) */
+void sys_do_open_midi(int nmidiin, int *midiinvec,
int nmidiout, int *midioutvec);
void sys_close_midi(void);
+void midi_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int maxndev, int devdescsize);
int sys_send_dacs(void);
void sys_reportidle(void);
@@ -90,6 +96,7 @@ EXTERN void sys_log_error(int type);
#define ERR_DACSLEPT 2
#define ERR_RESYNC 3
#define ERR_DATALATE 4
+void sched_set_using_dacs(int flag);
/* s_inter.c */
@@ -122,6 +129,7 @@ void sys_setvirtualalarm( void);
#define API_OSS 2
#define API_MMIO 3
#define API_PORTAUDIO 4
+#define API_JACK 5
#ifdef __linux__
#define API_DEFAULT API_OSS
@@ -135,9 +143,19 @@ void sys_setvirtualalarm( void);
#define API_DEFAULT API_PORTAUDIO
#define API_DEFSTRING "portaudio"
#endif
-#define DEFAULTAUDIODEV -1
+#define DEFAULTAUDIODEV 0
+
+#define MAXAUDIOINDEV 4
+#define MAXAUDIOOUTDEV 4
-#define DEFMIDIDEV -1
+#define DEFMIDIDEV 0
+
+#define DEFAULTSRATE 44100
+#ifdef MSW
+#define DEFAULTADVANCE 70
+#else
+#define DEFAULTADVANCE 50
+#endif
int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin,
t_sample *soundout, int framesperbuf, int nbuffers,
@@ -146,6 +164,9 @@ void pa_close_audio(void);
int pa_send_dacs(void);
void sys_reportidle(void);
void pa_listdevs(void);
+void pa_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize);
int oss_open_audio(int naudioindev, int *audioindev, int nchindev,
int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
@@ -153,13 +174,25 @@ int oss_open_audio(int naudioindev, int *audioindev, int nchindev,
void oss_close_audio(void);
int oss_send_dacs(void);
void oss_reportidle(void);
-void oss_listdevs(void);
+void oss_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize);
-int alsa_open_audio(int wantinchans, int wantoutchans, int srate);
+int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
+ int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
+ int *choutdev, int rate);
void alsa_close_audio(void);
int alsa_send_dacs(void);
void alsa_reportidle(void);
-void alsa_listdevs(void);
+void alsa_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize);
+
+int jack_open_audio(int wantinchans, int wantoutchans, int srate);
+void jack_close_audio(void);
+int jack_send_dacs(void);
+void jack_reportidle(void);
+void jack_listdevs(void);
void mmio_open_audio(int naudioindev, int *audioindev,
int nchindev, int *chindev, int naudiooutdev, int *audiooutdev,
@@ -167,13 +200,16 @@ void mmio_open_audio(int naudioindev, int *audioindev,
void mmio_close_audio( void);
void mmio_reportidle(void);
int mmio_send_dacs(void);
-void mmio_listdevs(void);
+void mmio_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize);
void sys_listmididevs(void);
-void sys_set_sound_api(int whichapi);
+void sys_set_audio_api(int whichapi);
+void sys_get_audio_apis(char *buf);
extern int sys_audioapi;
+void sys_set_audio_state(int onoff);
/* API dependent audio flags and settings */
void oss_set32bit( void);
void linux_alsa_devname(char *devname);
-
diff --git a/pd/src/s_unix.c b/pd/src/s_unix.c
deleted file mode 100644
index 85282f3b..00000000
--- a/pd/src/s_unix.c
+++ /dev/null
@@ -1,454 +0,0 @@
-/* Copyright (c) 1997-1999 Miller Puckette and others.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-/* this file is misnamed. It seems to handle clock functions and MIDI I/O;
-probably should be called "s_midi.c" */
-
-#include "m_imp.h"
-#ifdef UNIX
-#include <unistd.h>
-#include <sys/time.h>
-#ifdef HAVE_BSTRING_H
-#include <bstring.h>
-#endif
-#endif
-#ifdef NT
-#include <winsock.h>
-#include <sys/types.h>
-#include <sys/timeb.h>
-#include <wtypes.h>
-#endif
-#include <string.h>
-#include <stdio.h>
-#include <signal.h>
-
-#ifdef NT
-static LARGE_INTEGER nt_inittime;
-static double nt_freq = 0;
-
-static void sys_initntclock(void)
-{
- LARGE_INTEGER f1;
- LARGE_INTEGER now;
- QueryPerformanceCounter(&now);
- if (!QueryPerformanceFrequency(&f1))
- {
- fprintf(stderr, "pd: QueryPerformanceFrequency failed\n");
- f1.QuadPart = 1;
- }
- nt_freq = f1.QuadPart;
- nt_inittime = now;
-}
-
-#if 0
- /* this is a version you can call if you did the QueryPerformanceCounter
- call yourself. Necessary for time tagging incoming MIDI at interrupt
- level, for instance; but we're not doing that just now. */
-
-double nt_tixtotime(LARGE_INTEGER *dumbass)
-{
- if (nt_freq == 0) sys_initntclock();
- return (((double)(dumbass->QuadPart - nt_inittime.QuadPart)) / nt_freq);
-}
-#endif
-#endif /* NT */
-
-double sys_getrealtime(void) /* get "real time" in seconds */
-{
-#ifdef UNIX
- static struct timeval then;
- struct timeval now;
- gettimeofday(&now, 0);
- if (then.tv_sec == 0 && then.tv_usec == 0) then = now;
- return ((now.tv_sec - then.tv_sec) +
- (1./1000000.) * (now.tv_usec - then.tv_usec));
-#endif
-#ifdef NT
- LARGE_INTEGER now;
- QueryPerformanceCounter(&now);
- if (nt_freq == 0) sys_initntclock();
- return (((double)(now.QuadPart - nt_inittime.QuadPart)) / nt_freq);
-#endif
-}
-
-typedef struct _midiqelem
-{
- double q_time;
- int q_portno;
- unsigned char q_onebyte;
- unsigned char q_byte1;
- unsigned char q_byte2;
- unsigned char q_byte3;
-} t_midiqelem;
-
-#define MIDIQSIZE 1024
-
-t_midiqelem midi_outqueue[MIDIQSIZE];
-int midi_outhead, midi_outtail;
-t_midiqelem midi_inqueue[MIDIQSIZE];
-int midi_inhead, midi_intail;
-static double sys_midiinittime;
-
- /* this is our current estimate for at what "system" real time the
- current logical time's output should occur. */
-static double sys_dactimeminusrealtime;
- /* same for input, should be schduler advance earlier. */
-static double sys_adctimeminusrealtime;
-
-static double sys_newdactimeminusrealtime = -1e20;
-static double sys_newadctimeminusrealtime = -1e20;
-static double sys_whenupdate;
-
-void sys_initmidiqueue( void)
-{
- sys_midiinittime = clock_getlogicaltime();
- sys_dactimeminusrealtime = sys_adctimeminusrealtime = 0;
-}
-
- /* this is called from the OS dependent code from time to time when we
- think we know the delay (outbuftime) in seconds, at which the last-output
- audio sample will go out the door. */
-void sys_setmiditimediff(double inbuftime, double outbuftime)
-{
- double dactimeminusrealtime =
- .001 * clock_gettimesince(sys_midiinittime)
- - outbuftime - sys_getrealtime();
- double adctimeminusrealtime =
- .001 * clock_gettimesince(sys_midiinittime)
- + inbuftime - sys_getrealtime();
- if (dactimeminusrealtime > sys_newdactimeminusrealtime)
- sys_newdactimeminusrealtime = dactimeminusrealtime;
- if (adctimeminusrealtime > sys_newadctimeminusrealtime)
- sys_newadctimeminusrealtime = adctimeminusrealtime;
- if (sys_getrealtime() > sys_whenupdate)
- {
- sys_dactimeminusrealtime = sys_newdactimeminusrealtime;
- sys_adctimeminusrealtime = sys_newadctimeminusrealtime;
- sys_newdactimeminusrealtime = -1e20;
- sys_newadctimeminusrealtime = -1e20;
- sys_whenupdate = sys_getrealtime() + 1;
- }
-}
-
- /* return the logical time of the DAC sample we believe is currently
- going out, based on how much "system time" has elapsed since the
- last time sys_setmiditimediff got called. */
-static double sys_getmidioutrealtime( void)
-{
- return (sys_getrealtime() + sys_dactimeminusrealtime);
-}
-
-static double sys_getmidiinrealtime( void)
-{
- return (sys_getrealtime() + sys_adctimeminusrealtime);
-}
-
-static void sys_putnext( void)
-{
- int portno = midi_outqueue[midi_outtail].q_portno;
- if (midi_outqueue[midi_outtail].q_onebyte)
- sys_putmidibyte(portno, midi_outqueue[midi_outtail].q_byte1);
- else sys_putmidimess(portno, midi_outqueue[midi_outtail].q_byte1,
- midi_outqueue[midi_outtail].q_byte2,
- midi_outqueue[midi_outtail].q_byte3);
- midi_outtail = (midi_outtail + 1 == MIDIQSIZE ? 0 : midi_outtail + 1);
-}
-
-/* #define TEST_DEJITTER */
-
-void sys_pollmidioutqueue( void)
-{
-#ifdef TEST_DEJITTER
- static int db = 0;
-#endif
- double midirealtime = sys_getmidioutrealtime();
-#ifdef TEST_DEJITTER
- if (midi_outhead == midi_outtail)
- db = 0;
-#endif
- while (midi_outhead != midi_outtail)
- {
-#ifdef TEST_DEJITTER
- if (!db)
- {
- post("out: del %f, midiRT %f logicaltime %f, RT %f dacminusRT %f",
- (midi_outqueue[midi_outtail].q_time - midirealtime),
- midirealtime, .001 * clock_gettimesince(sys_midiinittime),
- sys_getrealtime(), sys_dactimeminusrealtime);
- db = 1;
- }
-#endif
- if (midi_outqueue[midi_outtail].q_time <= midirealtime)
- sys_putnext();
- else break;
- }
-}
-
-static void sys_queuemidimess(int portno, int onebyte, int a, int b, int c)
-{
- t_midiqelem *midiqelem;
- int newhead = midi_outhead +1;
- if (newhead == MIDIQSIZE)
- newhead = 0;
- /* if FIFO is full flush an element to make room */
- if (newhead == midi_outtail)
- sys_putnext();
- midi_outqueue[midi_outhead].q_portno = portno;
- midi_outqueue[midi_outhead].q_onebyte = onebyte;
- midi_outqueue[midi_outhead].q_byte1 = a;
- midi_outqueue[midi_outhead].q_byte2 = b;
- midi_outqueue[midi_outhead].q_byte3 = c;
- midi_outqueue[midi_outhead].q_time =
- .001 * clock_gettimesince(sys_midiinittime);
- midi_outhead = newhead;
- sys_pollmidioutqueue();
-}
-
-#define MIDI_NOTEON 144
-#define MIDI_POLYAFTERTOUCH 160
-#define MIDI_CONTROLCHANGE 176
-#define MIDI_PROGRAMCHANGE 192
-#define MIDI_AFTERTOUCH 208
-#define MIDI_PITCHBEND 224
-
-void outmidi_noteon(int portno, int channel, int pitch, int velo)
-{
- if (pitch < 0) pitch = 0;
- else if (pitch > 127) pitch = 127;
- if (velo < 0) velo = 0;
- else if (velo > 127) velo = 127;
- sys_queuemidimess(portno, 0, MIDI_NOTEON + (channel & 0xf), pitch, velo);
-}
-
-void outmidi_controlchange(int portno, int channel, int ctl, int value)
-{
- if (ctl < 0) ctl = 0;
- else if (ctl > 127) ctl = 127;
- if (value < 0) value = 0;
- else if (value > 127) value = 127;
- sys_queuemidimess(portno, 0, MIDI_CONTROLCHANGE + (channel & 0xf),
- ctl, value);
-}
-
-void outmidi_programchange(int portno, int channel, int value)
-{
- if (value < 0) value = 0;
- else if (value > 127) value = 127;
- sys_queuemidimess(portno, 0,
- MIDI_PROGRAMCHANGE + (channel & 0xf), value, 0);
-}
-
-void outmidi_pitchbend(int portno, int channel, int value)
-{
- if (value < 0) value = 0;
- else if (value > 16383) value = 16383;
- sys_queuemidimess(portno, 0, MIDI_PITCHBEND + (channel & 0xf),
- (value & 127), ((value>>7) & 127));
-}
-
-void outmidi_aftertouch(int portno, int channel, int value)
-{
- if (value < 0) value = 0;
- else if (value > 127) value = 127;
- sys_queuemidimess(portno, 0, MIDI_AFTERTOUCH + (channel & 0xf), value, 0);
-}
-
-void outmidi_polyaftertouch(int portno, int channel, int pitch, int value)
-{
- if (pitch < 0) pitch = 0;
- else if (pitch > 127) pitch = 127;
- if (value < 0) value = 0;
- else if (value > 127) value = 127;
- sys_queuemidimess(portno, 0, MIDI_POLYAFTERTOUCH + (channel & 0xf),
- pitch, value);
-}
-
-void outmidi_mclk(int portno)
-{
- sys_queuemidimess(portno, 1, 0xf8, 0,0);
-}
-
-/* ------------------------- MIDI input queue handling ------------------ */
-typedef struct midiparser
-{
- int mp_status;
- int mp_sysex;
- int mp_gotbyte1;
- int mp_byte1;
-} t_midiparser;
-
-#define MIDINOTEOFF 0x80
-#define MIDINOTEON 0x90
-#define MIDIPOLYTOUCH 0xa0
-#define MIDICONTROLCHANGE 0xb0
-#define MIDIPROGRAMCHANGE 0xc0
-#define MIDICHANNELTOUCH 0xd0
-#define MIDIPITCHBEND 0xe0
- /* functions in x_midi.c */
-void inmidi_realtimein(int portno, int cmd);
-void inmidi_byte(int portno, int byte);
-void inmidi_sysex(int portno, int byte);
-void inmidi_noteon(int portno, int channel, int pitch, int velo);
-void inmidi_controlchange(int portno, int channel, int ctlnumber, int value);
-void inmidi_programchange(int portno, int channel, int value);
-void inmidi_pitchbend(int portno, int channel, int value);
-void inmidi_aftertouch(int portno, int channel, int value);
-void inmidi_polyaftertouch(int portno, int channel, int pitch, int value);
-
-static void sys_dispatchnextmidiin( void)
-{
- static t_midiparser parser[MAXMIDIINDEV], *parserp;
- int portno = midi_inqueue[midi_intail].q_portno,
- byte = midi_inqueue[midi_intail].q_byte1;
- if (!midi_inqueue[midi_intail].q_onebyte)
- bug("sys_dispatchnextmidiin");
- if (portno < 0 || portno >= MAXMIDIINDEV)
- bug("sys_dispatchnextmidiin 2");
- parserp = parser + portno;
- outlet_setstacklim();
-
- if (byte >= 0xf8)
- inmidi_realtimein(portno, byte);
- else
- {
- inmidi_byte(portno, byte);
- if (byte < 0xf0)
- {
- if (byte & 0x80)
- {
- parserp->mp_status = byte;
- parserp->mp_gotbyte1 = 0;
- }
- else
- {
- int cmd = (parserp->mp_status & 0xf0);
- int chan = (parserp->mp_status & 0xf);
- int byte1 = parserp->mp_byte1, gotbyte1 = parserp->mp_gotbyte1;
- switch (cmd)
- {
- case MIDINOTEOFF:
- if (gotbyte1)
- inmidi_noteon(portno, chan, byte1, 0),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- case MIDINOTEON:
- if (gotbyte1)
- inmidi_noteon(portno, chan, byte1, byte),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- case MIDIPOLYTOUCH:
- if (gotbyte1)
- inmidi_polyaftertouch(portno, chan, byte1, byte),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- case MIDICONTROLCHANGE:
- if (gotbyte1)
- inmidi_controlchange(portno, chan, byte1, byte),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- case MIDIPROGRAMCHANGE:
- inmidi_programchange(portno, chan, byte);
- break;
- case MIDICHANNELTOUCH:
- inmidi_aftertouch(portno, chan, byte);
- break;
- case MIDIPITCHBEND:
- if (gotbyte1)
- inmidi_pitchbend(portno, chan, ((byte << 7) + byte1)),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- }
- }
- }
- }
- midi_intail = (midi_intail + 1 == MIDIQSIZE ? 0 : midi_intail + 1);
-}
-
-void sys_pollmidiinqueue( void)
-{
-#ifdef TEST_DEJITTER
- static int db = 0;
-#endif
- double logicaltime = .001 * clock_gettimesince(sys_midiinittime);
-#ifdef TEST_DEJITTER
- if (midi_inhead == midi_intail)
- db = 0;
-#endif
- while (midi_inhead != midi_intail)
- {
-#ifdef TEST_DEJITTER
- if (!db)
- {
- post("in del %f, logicaltime %f, RT %f adcminusRT %f",
- (midi_inqueue[midi_intail].q_time - logicaltime),
- logicaltime, sys_getrealtime(), sys_adctimeminusrealtime);
- db = 1;
- }
-#endif
-#if 0
- if (midi_inqueue[midi_intail].q_time <= logicaltime - 0.007)
- post("late %f",
- 1000 * (logicaltime - midi_inqueue[midi_intail].q_time));
-#endif
- if (midi_inqueue[midi_intail].q_time <= logicaltime)
- {
-#if 0
- post("diff %f",
- 1000* (logicaltime - midi_inqueue[midi_intail].q_time));
-#endif
- sys_dispatchnextmidiin();
- }
- else break;
- }
-}
-
- /* this should be called from the system dependent MIDI code when a byte
- comes in, as a result of our calling sys_poll_midi. We stick it on a
- timetag queue and dispatch it at the appropriate logical time. */
-
-
-void sys_midibytein(int portno, int byte)
-{
- static int warned = 0;
- t_midiqelem *midiqelem;
- int newhead = midi_inhead +1;
- if (newhead == MIDIQSIZE)
- newhead = 0;
- /* if FIFO is full flush an element to make room */
- if (newhead == midi_intail)
- {
- if (!warned)
- {
- post("warning: MIDI timing FIFO overflowed");
- warned = 1;
- }
- sys_dispatchnextmidiin();
- }
- midi_inqueue[midi_inhead].q_portno = portno;
- midi_inqueue[midi_inhead].q_onebyte = 1;
- midi_inqueue[midi_inhead].q_byte1 = byte;
- midi_inqueue[midi_inhead].q_time = sys_getmidiinrealtime();
- midi_inhead = newhead;
- sys_pollmidiinqueue();
-}
-
-void sys_pollmidiqueue( void)
-{
-#if 0
- static double lasttime;
- double newtime = sys_getrealtime();
- if (newtime - lasttime > 0.007)
- post("delay %d", (int)(1000 * (newtime - lasttime)));
- lasttime = newtime;
-#endif
- sys_poll_midi(); /* OS dependent poll for MIDI input */
- sys_pollmidioutqueue();
- sys_pollmidiinqueue();
-}
-
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index b879843a..ef10c80b 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -1,4 +1,4 @@
-set pd_nt 0
+set pd_nt 1
# (The above is 0 for unix, 1 for microsoft, and 2 for Mac OSX. The first
# line is automatically munged by the relevant makefiles.)
@@ -36,19 +36,30 @@ if {$pd_nt == 2} {
set pd_tearoff 0
}
+# hack so you can easily test-run this script in linux... define pd_guidir
+# (which is normally defined at startup in pd under linux...)
+
+if {$pd_nt == 0} {
+ if {! [info exists pd_guidir]} {
+ global pd_guidir
+ puts stderr {setting pd_guidir to '.'}
+ set pd_guidir .
+ }
+}
+
# it's unfortunate but we seem to have to turn off global bindings
# for Text objects to get control-s and control-t to do what we want for
# "text" dialogs below. Also we have to get rid of tab's changing the focus.
bind all <Key-Tab> ""
-bind all <Shift-Key-Tab> ""
+bind all <<PrevWindow>> ""
bind Text <Control-t> {}
bind Text <Control-s> {}
# puts stderr [bind all]
################## set up main window #########################
menu .mbar
-canvas .dummy -height 2p -width 9c
+canvas .dummy -height 2p -width 6c
frame .controls
pack .controls .dummy -side top -fill x
@@ -60,11 +71,11 @@ menu .mbar.windows -postcommand [concat pdtk_fixwindowmenu] -tearoff $pd_tearoff
menu .mbar.audio -tearoff $pd_tearoff
if {$pd_nt != 2} {
.mbar add cascade -label "Windows" -menu .mbar.windows
- .mbar add cascade -label "Audio" -menu .mbar.audio
+ .mbar add cascade -label "Media" -menu .mbar.audio
} else {
# Perhaps this is silly, but Mac HIG want "Window Help" as the last menus
- .mbar add cascade -label "Audio" -menu .mbar.audio
- .mbar add cascade -label "Window" -menu .mbar.windows
+ .mbar add cascade -label "Media" -menu .mbar.audio
+ .mbar add cascade -label "Windows" -menu .mbar.windows
}
menu .mbar.help -tearoff $pd_tearoff
.mbar add cascade -label "Help" -menu .mbar.help
@@ -272,7 +283,8 @@ set help_directory $pd_guidir/doc
proc menu_documentation {} {
global help_directory
-
+ global pd_nt
+
set filename [tk_getOpenFile -defaultextension .pd \
-filetypes { {{documentation} {.pd .txt .htm}} } \
-initialdir $help_directory]
@@ -282,7 +294,6 @@ proc menu_documentation {} {
menu_opentext $filename
} elseif {[string first .htm $filename] >= 0} {
if {$pd_nt == 0} {
-#I wish I could get this to run in the background; the "&" doesn't do it:
exec sh -c \
[format "mozilla file:%s || netscape file:%s &\n" \
$filename $filename]
@@ -291,9 +302,8 @@ proc menu_documentation {} {
exec sh -c \
[format "open %s" $filename]
} else {
- tk_messageBox -message \
- {sorry -- can't open htm files yet; open this manually} \
- -type ok
+ exec rundll32 url.dll,FileProtocolHandler \
+ [format "file:%s" $filename] &
}
} else {
set help_directory [string range $filename 0 \
@@ -319,6 +329,38 @@ proc menu_doc_open {subdir basename} {
}
}
+############# routine to add audio and help menus ###############
+
+proc menu_addstd {mbar} {
+ global pd_apilist
+# the "Audio" menu
+ $mbar.audio add command -label {audio ON} -accelerator [accel_munge "Ctrl+/"] \
+ -command {menu_audio 1}
+ $mbar.audio add command -label {audio OFF} -accelerator [accel_munge "Ctrl+."] \
+ -command {menu_audio 0}
+ for {set x 0} {$x<[llength $pd_apilist]} {incr x} {
+ $mbar.audio add radiobutton -label [lindex [lindex $pd_apilist $x] 0] \
+ -command {menu_audio 0} -variable pd_whichapi \
+ -value [lindex [lindex $pd_apilist $x] 1]\
+ -command {pd [concat pd audio-setapi $pd_whichapi \;]}
+ }
+ $mbar.audio add command -label {Audio settings...} \
+ -command {pd pd audio-properties \;}
+
+ $mbar.audio add command -label {MIDI settings...} \
+ -command {pd pd midi-properties \;}
+ $mbar.audio add command -label {Test Audio and MIDI} \
+ -command {menu_doc_open doc/7.stuff/tools testtone.pd}
+ $mbar.audio add command -label {Load Meter} \
+ -command {menu_doc_open doc/7.stuff/tools load-meter.pd}
+
+# the "Help" menu
+ $mbar.help add command -label {About Pd} \
+ -command {menu_doc_open doc/1.manual 1.introduction.txt}
+ $mbar.help add command -label {Pure Documentation...} \
+ -command {menu_documentation}
+}
+
#################### the "File" menu for the Pd window ##############
.mbar.file add command -label New -command {menu_new} \
@@ -328,6 +370,8 @@ proc menu_doc_open {subdir basename} {
.mbar.file add separator
.mbar.file add command -label Message -command {menu_send} \
-accelerator [accel_munge "Ctrl+m"]
+.mbar.file add command -label Path... \
+ -command {pd pd start-path-dialog \;}
.mbar.file add separator
.mbar.file add command -label Quit -command {menu_quit} \
-accelerator [accel_munge "Ctrl+q"]
@@ -335,22 +379,6 @@ proc menu_doc_open {subdir basename} {
#################### the "Find" menu for the Pd window ##############
.mbar.find add command -label {last error?} -command {menu_finderror}
-#################### the "Audio" menu for the Pd window ##############
-.mbar.audio add command -label On -accelerator [accel_munge "Ctrl+/"] \
- -command {menu_audio 1}
-.mbar.audio add command -label Off -accelerator [accel_munge "Ctrl+."] \
- -command {menu_audio 0}
-
-#################### the "Help" menu for the Pd window ##############
-.mbar.help add command -label {About Pd} \
- -command {menu_doc_open doc/1.manual 1.introduction.txt}
-.mbar.help add command -label {Test Audio and MIDI} \
- -command {menu_doc_open doc/7.stuff/tools testtone.pd}
-.mbar.help add command -label {Load Meter} \
- -command {menu_doc_open doc/7.stuff/tools load-meter.pd}
-.mbar.help add command -label {Pure Documentation...} \
- -command {menu_documentation}
-
########### functions for menu functions on document windows ########
proc menu_save {name} {
@@ -660,6 +688,9 @@ proc pdtk_canvas_new {name width height geometry editable} {
$name.m.file add command -label Message -command {menu_send} \
-accelerator [accel_munge "Ctrl+m"]
+ $name.m.file add command -label Path... \
+ -command {pd pd start-path-dialog \;}
+
$name.m.file add separator
$name.m.file add command -label Close \
-command [concat menu_close $name] \
@@ -812,8 +843,6 @@ proc pdtk_canvas_new {name width height geometry editable} {
$name.m.put add command -label Array \
-command [concat menu_array $name]
-
-
# the find menu
menu $name.m.find -tearoff $pd_tearoff
$name.m add cascade -label Find -menu $name.m.find
@@ -839,30 +868,19 @@ proc pdtk_canvas_new {name width height geometry editable} {
# the audio menu
menu $name.m.audio -tearoff $pd_tearoff
- $name.m.audio add command -label On -accelerator [accel_munge "Ctrl+/"] \
- -command {menu_audio 1}
- $name.m.audio add command -label Off -accelerator [accel_munge "Ctrl+."] \
- -command {menu_audio 0}
-
if {$pd_nt != 2} {
$name.m add cascade -label Windows -menu $name.m.windows
- $name.m add cascade -label Audio -menu $name.m.audio
+ $name.m add cascade -label Media -menu $name.m.audio
} else {
- $name.m add cascade -label Audio -menu $name.m.audio
+ $name.m add cascade -label Media -menu $name.m.audio
$name.m add cascade -label Window -menu $name.m.windows
}
# the help menu
menu $name.m.help -tearoff $pd_tearoff
$name.m add cascade -label Help -menu $name.m.help
- $name.m.help add command -label {Getting Started} \
- -command {menu_doc_open doc/1.manual 1.introduction.txt}
- $name.m.help add command -label {Test Audio and MIDI} \
- -command {menu_doc_open doc/7.stuff/tools testtone.pd}
- $name.m.help add command -label {Load Meter} \
- -command {menu_doc_open doc/7.stuff/tools load-meter.pd}
- $name.m.help add command -label {Pure Documentation} \
- -command {menu_documentation}
+
+ menu_addstd $name.m
# the popup menu
menu $name.popup -tearoff false
@@ -911,8 +929,8 @@ proc pdtk_canvas_new {name width height geometry editable} {
bind $name.c <KeyRelease> {pdtk_canvas_keyup %W %K %A}
bind $name.c <Motion> {pdtk_canvas_motion %W %x %y 0}
bind $name.c <Alt-Motion> {pdtk_canvas_motion %W %x %y 4}
- bind $name.c <Map> {pdtk_canvas_map %W %s}
-# bind $name.c <Unmap> {puts stderr map}
+ bind $name.c <Map> {pdtk_canvas_map %W}
+ bind $name.c <Unmap> {pdtk_canvas_unmap %W}
focus $name.c
# puts stderr "all done"
# after 1 [concat raise $name]
@@ -1036,6 +1054,10 @@ proc pdtk_canvas_key {name key iso shift} {
set keynum 8
}
}
+ if {$key == "KP_Delete"} {
+ set key 127
+ set keynum 127
+ }
if {$iso != ""} {
scan $iso %c keynum
pd [canvastosym $name] key 1 $keynum $shift\;
@@ -1115,12 +1137,14 @@ proc pdtk_canvas_motion {name x y mods} {
# "map" event tells us when the canvas becomes visible (arg is "0") or
# invisible (arg is ""). Invisibility means the Window Manager has minimized
# us. We don't get a final "unmap" event when we destroy the window.
-proc pdtk_canvas_map {name arg} {
- if {$arg == "0"} {
- pd [canvastosym $name] map 1 \;
- } else {
- pd [canvastosym $name] map 0 \;
- }
+proc pdtk_canvas_map {name} {
+# puts stderr [concat map $name]
+ pd [canvastosym $name] map 1 \;
+}
+
+proc pdtk_canvas_unmap {name} {
+# puts stderr [concat unmap $name]
+ pd [canvastosym $name] map 0 \;
}
set saveas_dir nowhere
@@ -2267,6 +2291,14 @@ proc pdtk_iemgui_dialog {id mainheader \
label $id.space5 -text ""
pack $id.space5 -side top
+ if {[info tclversion] < 8.4} {
+ bind $id <Key-Tab> {tkTabToWindow [tk_focusNext %W]}
+ bind $id <<PrevWindow>> {tkTabToWindow [tk_focusPrev %W]}
+ } else {
+ bind $id <Key-Tab> {tk::TabToWindow [tk_focusNext %W]}
+ bind $id <<PrevWindow>> {tk::TabToWindow [tk_focusPrev %W]}
+ }
+
bind $id.dim.w_ent <KeyPress-Return> [concat iemgui_ok $id]
bind $id.dim.h_ent <KeyPress-Return> [concat iemgui_ok $id]
bind $id.rng.min_ent <KeyPress-Return> [concat iemgui_ok $id]
@@ -2583,9 +2615,10 @@ proc pdtk_pd_ctrlkey {name key shift} {
# asked pd to open something. Also, get character width and height for
# font sizes 8, 10, 12, 14, 16, and 24.
-proc pdtk_pd_startup {version} {
- global pd_myversion
+proc pdtk_pd_startup {version apilist} {
+ global pd_myversion pd_apilist
set pd_myversion $version
+ set pd_apilist $apilist
set width1 [font measure -*-courier-bold--normal--8-* x]
set height1 [lindex [font metrics -*-courier-bold--normal--8-*] 5]
@@ -2617,6 +2650,11 @@ proc pdtk_pd_startup {version} {
24 $width6 $height6 \
36 $width7 $height7 \
\;];
+
+ # add the audio and help menus to the Pd window. We delayed this
+ # so that we'd know the value of "apilist".
+ menu_addstd .mbar
+
}
##################### DSP ON/OFF, METERS, DIO ERROR ###################
@@ -2759,3 +2797,494 @@ if {$pd_nt == 1} {
polleofloop
}
+####################### audio dialog ##################3
+
+proc audio_apply {id} {
+ global audio_indev1 audio_indev2 audio_indev3 audio_indev4
+ global audio_inchan1 audio_inchan2 audio_inchan3 audio_inchan4
+ global audio_outdev1 audio_outdev2 audio_outdev3 audio_outdev4
+ global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4
+ global audio_sr audio_advance
+
+ pd [concat pd audio-dialog \
+ $audio_indev1 \
+ $audio_indev2 \
+ $audio_indev3 \
+ $audio_indev4 \
+ $audio_inchan1 \
+ $audio_inchan2 \
+ $audio_inchan3 \
+ $audio_inchan4 \
+ $audio_outdev1 \
+ $audio_outdev2 \
+ $audio_outdev3 \
+ $audio_outdev4 \
+ $audio_outchan1 \
+ $audio_outchan2 \
+ $audio_outchan3 \
+ $audio_outchan4 \
+ $audio_sr \
+ $audio_advance \
+ \;]
+}
+
+proc audio_cancel {id} {
+ pd [concat $id cancel \;]
+}
+
+proc audio_ok {id} {
+ audio_apply $id
+ audio_cancel $id
+}
+
+# callback from popup menu
+proc audio_popup_action {buttonname varname devlist index} {
+ global audio_indevlist audio_outdevlist $varname
+ $buttonname configure -text [lindex $devlist $index]
+# puts stderr [concat popup_action $buttonname $varname $index]
+ set $varname $index
+}
+
+# create a popup menu
+proc audio_popup {name buttonname varname devlist} {
+ if [winfo exists $name.popup] {destroy $name.popup}
+ menu $name.popup -tearoff false
+# puts stderr [concat $devlist ]
+ for {set x 0} {$x<[llength $devlist]} {incr x} {
+ $name.popup add command -label [lindex $devlist $x] \
+ -command [list audio_popup_action \
+ $buttonname $varname $devlist $x]
+ }
+ tk_popup $name.popup [winfo pointerx $name] [winfo pointery $name] 0
+}
+
+# start a dialog window to select audio devices and settings. "multi"
+# is 0 if only one device is allowed; 1 if one apiece may be specified for
+# input and output; and 2 if we can select multiple devices. "longform"
+# (which only makes sense if "multi" is 2) asks us to make controls for
+# opening several devices; if not, we get an extra button to turn longform
+# on and restart the dialog.
+
+proc pdtk_audio_dialog {id indevlist indev1 indev2 indev3 indev4 \
+ inchan1 inchan2 inchan3 inchan4 \
+ outdevlist outdev1 outdev2 outdev3 outdev4 \
+ outchan1 outchan2 outchan3 outchan4 sr advance multi longform} {
+ global audio_indev1 audio_indev2 audio_indev3 audio_indev4
+ global audio_inchan1 audio_inchan2 audio_inchan3 audio_inchan4
+ global audio_outdev1 audio_outdev2 audio_outdev3 audio_outdev4
+ global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4
+ global audio_sr audio_advance
+ global audio_indevlist audio_outdevlist
+
+ set audio_indev1 $indev1
+ set audio_indev2 $indev2
+ set audio_indev3 $indev3
+ set audio_indev4 $indev4
+ set audio_inchan1 $inchan1
+ set audio_inchan2 $inchan2
+ set audio_inchan3 $inchan3
+ set audio_inchan4 $inchan4
+ set audio_outdev1 $outdev1
+ set audio_outdev2 $outdev2
+ set audio_outdev3 $outdev3
+ set audio_outdev4 $outdev4
+ set audio_outchan1 $outchan1
+ set audio_outchan2 $outchan2
+ set audio_outchan3 $outchan3
+ set audio_outchan4 $outchan4
+ set audio_sr $sr
+ set audio_advance $advance
+ set audio_indevlist $indevlist
+ set audio_outdevlist $outdevlist
+
+ toplevel $id
+ wm title $id {audio}
+ wm protocol $id WM_DELETE_WINDOW [concat audio_cancel $id]
+
+ frame $id.buttonframe
+ pack $id.buttonframe -side bottom -fill x -pady 2m
+ button $id.buttonframe.cancel -text {Cancel}\
+ -command "audio_cancel $id"
+ button $id.buttonframe.apply -text {Apply}\
+ -command "audio_apply $id"
+ button $id.buttonframe.ok -text {OK}\
+ -command "audio_ok $id"
+ pack $id.buttonframe.cancel -side left -expand 1
+ pack $id.buttonframe.apply -side left -expand 1
+ pack $id.buttonframe.ok -side left -expand 1
+
+ # sample rate and advance
+ frame $id.srf
+ pack $id.srf -side top
+
+ label $id.srf.l1 -text "sample rate:"
+ entry $id.srf.x1 -textvariable audio_sr -width 7
+ label $id.srf.l2 -text "delay (msec):"
+ entry $id.srf.x2 -textvariable audio_advance -width 4
+ pack $id.srf.l1 $id.srf.x1 $id.srf.l2 $id.srf.x2 -side left
+
+ # input device 1
+ frame $id.in1f
+ pack $id.in1f -side top
+
+ label $id.in1f.l1 -text "input device 1:"
+ button $id.in1f.x1 -text [lindex $indevlist $audio_indev1] \
+ -command [list audio_popup $id $id.in1f.x1 audio_indev1 $indevlist]
+ label $id.in1f.l2 -text "channels:"
+ entry $id.in1f.x2 -textvariable audio_inchan1 -width 3
+ pack $id.in1f.l1 $id.in1f.x1 $id.in1f.l2 $id.in1f.x2 -side left
+
+ # input device 2
+ if {$longform && $multi > 1 && [llength $indevlist] > 1} {
+ frame $id.in2f
+ pack $id.in2f -side top
+
+ label $id.in2f.l1 -text "input device 2:"
+ button $id.in2f.x1 -text [lindex $indevlist $audio_indev2] \
+ -command [list audio_popup $id $id.in2f.x1 audio_indev2 $indevlist]
+ label $id.in2f.l2 -text "channels:"
+ entry $id.in2f.x2 -textvariable audio_inchan2 -width 3
+ pack $id.in2f.l1 $id.in2f.x1 $id.in2f.l2 $id.in2f.x2 -side left
+ }
+
+ # input device 3
+ if {$longform && $multi > 1 && [llength $indevlist] > 2} {
+ frame $id.in3f
+ pack $id.in3f -side top
+
+ label $id.in3f.l1 -text "input device 3:"
+ button $id.in3f.x1 -text [lindex $indevlist $audio_indev3] \
+ -command [list audio_popup $id $id.in3f.x1 audio_indev3 $indevlist]
+ label $id.in3f.l2 -text "channels:"
+ entry $id.in3f.x2 -textvariable audio_inchan3 -width 3
+ pack $id.in3f.l1 $id.in3f.x1 $id.in3f.l2 $id.in3f.x2 -side left
+ }
+
+ # input device 4
+ if {$longform && $multi > 1 && [llength $indevlist] > 3} {
+ frame $id.in4f
+ pack $id.in4f -side top
+
+ label $id.in4f.l1 -text "input device 4:"
+ button $id.in4f.x1 -text [lindex $indevlist $audio_indev4] \
+ -command [list audio_popup $id $id.in4f.x1 audio_indev4 $indevlist]
+ label $id.in4f.l2 -text "channels:"
+ entry $id.in4f.x2 -textvariable audio_inchan4 -width 3
+ pack $id.in4f.l1 $id.in4f.x1 $id.in4f.l2 $id.in4f.x2 -side left
+ }
+
+ # output device 1
+ frame $id.out1f
+ pack $id.out1f -side top
+
+ if {$multi == 0} {
+ label $id.out1f.l1 \
+ -text "(output device same as input device) .............. "
+ } else {
+ label $id.out1f.l1 -text "output device 1:"
+ button $id.out1f.x1 -text [lindex $outdevlist $audio_outdev1] \
+ -command \
+ [list audio_popup $id $id.out1f.x1 audio_outdev1 $outdevlist]
+ }
+ label $id.out1f.l2 -text "channels:"
+ entry $id.out1f.x2 -textvariable audio_outchan1 -width 3
+ if {$multi == 0} {
+ pack $id.out1f.l1 $id.out1f.l2 $id.out1f.x2 -side left
+ } else {
+ pack $id.out1f.l1 $id.out1f.x1 $id.out1f.l2 $id.out1f.x2 -side left
+ }
+
+ # output device 2
+ if {$longform && $multi > 1 && [llength $indevlist] > 1} {
+ frame $id.out2f
+ pack $id.out2f -side top
+ label $id.out2f.l1 -text "output device 2:"
+ button $id.out2f.x1 -text [lindex $outdevlist $audio_outdev2] \
+ -command \
+ [list audio_popup $id $id.out2f.x1 audio_outdev2 $outdevlist]
+ label $id.out2f.l2 -text "channels:"
+ entry $id.out2f.x2 -textvariable audio_outchan2 -width 3
+ pack $id.out2f.l1 $id.out2f.x1 $id.out2f.l2 $id.out2f.x2 -side left
+ }
+
+ # output device 3
+ if {$longform && $multi > 1 && [llength $indevlist] > 2} {
+ frame $id.out3f
+ pack $id.out3f -side top
+ label $id.out3f.l1 -text "output device 3:"
+ button $id.out3f.x1 -text [lindex $outdevlist $audio_outdev3] \
+ -command \
+ [list audio_popup $id $id.out3f.x1 audio_outdev3 $outdevlist]
+ label $id.out3f.l2 -text "channels:"
+ entry $id.out3f.x2 -textvariable audio_outchan3 -width 3
+ pack $id.out3f.l1 $id.out3f.x1 $id.out3f.l2 $id.out3f.x2 -side left
+ }
+
+ # output device 4
+ if {$longform && $multi > 1 && [llength $indevlist] > 3} {
+ frame $id.out4f
+ pack $id.out4f -side top
+ label $id.out4f.l1 -text "output device 4:"
+ button $id.out4f.x1 -text [lindex $outdevlist $audio_outdev4] \
+ -command \
+ [list audio_popup $id $id.out4f.x1 audio_outdev4 $outdevlist]
+ label $id.out4f.l2 -text "channels:"
+ entry $id.out4f.x2 -textvariable audio_outchan4 -width 3
+ pack $id.out4f.l1 $id.out4f.x1 $id.out4f.l2 $id.out4f.x2 -side left
+ }
+
+ # if not the "long form" but if "multi" is 2, make a button to
+ # restart with longform set.
+
+ if {$longform == 0 && $multi > 1} {
+ frame $id.longbutton
+ pack $id.longbutton -side top
+ button $id.longbutton.b -text {use multiple devices} \
+ -command {pd pd audio-properties 1 \;}
+ pack $id.longbutton.b
+ }
+ bind $id.srf.x1 <KeyPress-Return> [concat audio_ok $id]
+ bind $id.srf.x2 <KeyPress-Return> [concat audio_ok $id]
+ bind $id.in1f.x2 <KeyPress-Return> [concat audio_ok $id]
+ $id.srf.x1 select from 0
+ $id.srf.x1 select adjust end
+ focus $id.srf.x1
+}
+
+####################### midi dialog ##################3
+
+proc midi_apply {id} {
+ global midi_indev1 midi_indev2 midi_indev3 midi_indev4
+ global midi_outdev1 midi_outdev2 midi_outdev3 midi_outdev4
+
+ pd [concat pd midi-dialog \
+ $midi_indev1 \
+ $midi_indev2 \
+ $midi_indev3 \
+ $midi_indev4 \
+ $midi_outdev1 \
+ $midi_outdev2 \
+ $midi_outdev3 \
+ $midi_outdev4 \
+ \;]
+}
+
+proc midi_cancel {id} {
+ pd [concat $id cancel \;]
+}
+
+proc midi_ok {id} {
+ midi_apply $id
+ midi_cancel $id
+}
+
+# callback from popup menu
+proc midi_popup_action {buttonname varname devlist index} {
+ global midi_indevlist midi_outdevlist $varname
+ $buttonname configure -text [lindex $devlist $index]
+# puts stderr [concat popup_action $buttonname $varname $index]
+ set $varname $index
+}
+
+# create a popup menu
+proc midi_popup {name buttonname varname devlist} {
+ if [winfo exists $name.popup] {destroy $name.popup}
+ menu $name.popup -tearoff false
+# puts stderr [concat $devlist ]
+ for {set x 0} {$x<[llength $devlist]} {incr x} {
+ $name.popup add command -label [lindex $devlist $x] \
+ -command [list midi_popup_action \
+ $buttonname $varname $devlist $x]
+ }
+ tk_popup $name.popup [winfo pointerx $name] [winfo pointery $name] 0
+}
+
+# start a dialog window to select midi devices. "longform" asks us to make
+# controls for opening several devices; if not, we get an extra button to
+# turn longform on and restart the dialog.
+
+proc pdtk_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
+ outdevlist outdev1 outdev2 outdev3 outdev4 longform} {
+ global midi_indev1 midi_indev2 midi_indev3 midi_indev4
+ global midi_outdev1 midi_outdev2 midi_outdev3 midi_outdev4
+ global midi_indevlist midi_outdevlist
+
+ set midi_indev1 $indev1
+ set midi_indev2 $indev2
+ set midi_indev3 $indev3
+ set midi_indev4 $indev4
+ set midi_outdev1 $outdev1
+ set midi_outdev2 $outdev2
+ set midi_outdev3 $outdev3
+ set midi_outdev4 $outdev4
+ set midi_indevlist $indevlist
+ set midi_outdevlist $outdevlist
+
+ toplevel $id
+ wm title $id {midi}
+ wm protocol $id WM_DELETE_WINDOW [concat midi_cancel $id]
+
+ frame $id.buttonframe
+ pack $id.buttonframe -side bottom -fill x -pady 2m
+ button $id.buttonframe.cancel -text {Cancel}\
+ -command "midi_cancel $id"
+ button $id.buttonframe.apply -text {Apply}\
+ -command "midi_apply $id"
+ button $id.buttonframe.ok -text {OK}\
+ -command "midi_ok $id"
+ pack $id.buttonframe.cancel -side left -expand 1
+ pack $id.buttonframe.apply -side left -expand 1
+ pack $id.buttonframe.ok -side left -expand 1
+
+ # input device 1
+ frame $id.in1f
+ pack $id.in1f -side top
+
+ label $id.in1f.l1 -text "input device 1:"
+ button $id.in1f.x1 -text [lindex $indevlist $midi_indev1] \
+ -command [list midi_popup $id $id.in1f.x1 midi_indev1 $indevlist]
+ pack $id.in1f.l1 $id.in1f.x1 -side left
+
+ # input device 2
+ if {$longform && [llength $indevlist] > 2} {
+ frame $id.in2f
+ pack $id.in2f -side top
+
+ label $id.in2f.l1 -text "input device 2:"
+ button $id.in2f.x1 -text [lindex $indevlist $midi_indev2] \
+ -command [list midi_popup $id $id.in2f.x1 midi_indev2 $indevlist]
+ pack $id.in2f.l1 $id.in2f.x1 -side left
+ }
+
+ # input device 3
+ if {$longform && [llength $indevlist] > 3} {
+ frame $id.in3f
+ pack $id.in3f -side top
+
+ label $id.in3f.l1 -text "input device 3:"
+ button $id.in3f.x1 -text [lindex $indevlist $midi_indev3] \
+ -command [list midi_popup $id $id.in3f.x1 midi_indev3 $indevlist]
+ pack $id.in3f.l1 $id.in3f.x1 -side left
+ }
+
+ # input device 4
+ if {$longform && [llength $indevlist] > 4} {
+ frame $id.in4f
+ pack $id.in4f -side top
+
+ label $id.in4f.l1 -text "input device 4:"
+ button $id.in4f.x1 -text [lindex $indevlist $midi_indev4] \
+ -command [list midi_popup $id $id.in4f.x1 midi_indev4 $indevlist]
+ pack $id.in4f.l1 $id.in4f.x1 -side left
+ }
+
+ # output device 1
+
+ frame $id.out1f
+ pack $id.out1f -side top
+ label $id.out1f.l1 -text "output device 1:"
+ button $id.out1f.x1 -text [lindex $outdevlist $midi_outdev1] \
+ -command [list midi_popup $id $id.out1f.x1 midi_outdev1 $outdevlist]
+ pack $id.out1f.l1 $id.out1f.x1 -side left
+
+ # output device 2
+ if {$longform && [llength $indevlist] > 2} {
+ frame $id.out2f
+ pack $id.out2f -side top
+ label $id.out2f.l1 -text "output device 2:"
+ button $id.out2f.x1 -text [lindex $outdevlist $midi_outdev2] \
+ -command \
+ [list midi_popup $id $id.out2f.x1 midi_outdev2 $outdevlist]
+ pack $id.out2f.l1 $id.out2f.x1 -side left
+ }
+
+ # output device 3
+ if {$longform && [llength $indevlist] > 3} {
+ frame $id.out3f
+ pack $id.out3f -side top
+ label $id.out3f.l1 -text "output device 3:"
+ button $id.out3f.x1 -text [lindex $outdevlist $midi_outdev3] \
+ -command \
+ [list midi_popup $id $id.out3f.x1 midi_outdev3 $outdevlist]
+ pack $id.out3f.l1 $id.out3f.x1 -side left
+ }
+
+ # output device 4
+ if {$longform && [llength $indevlist] > 4} {
+ frame $id.out4f
+ pack $id.out4f -side top
+ label $id.out4f.l1 -text "output device 4:"
+ button $id.out4f.x1 -text [lindex $outdevlist $midi_outdev4] \
+ -command \
+ [list midi_popup $id $id.out4f.x1 midi_outdev4 $outdevlist]
+ pack $id.out4f.l1 $id.out4f.x1 -side left
+ }
+
+ # if not the "long form" make a button to
+ # restart with longform set.
+
+ if {$longform == 0} {
+ frame $id.longbutton
+ pack $id.longbutton -side top
+ button $id.longbutton.b -text {use multiple devices} \
+ -command {pd pd midi-properties 1 \;}
+ pack $id.longbutton.b
+ }
+}
+
+############ pdtk_path_dialog -- dialog window for search path #########
+
+proc path_apply {id} {
+ global pd_path0 pd_path1 pd_path2 pd_path3 pd_path4
+ global pd_path5 pd_path6 pd_path7 pd_path8 pd_path9
+
+ pd [concat pd path-dialog \
+ $pd_path0 $pd_path1 $pd_path2 $pd_path3 $pd_path4 \
+ $pd_path5 $pd_path6 $pd_path7 $pd_path8 $pd_path9 \
+ \;]
+}
+
+proc path_cancel {id} {
+ pd [concat $id cancel \;]
+}
+
+proc path_ok {id} {
+ path_apply $id
+ path_cancel $id
+}
+set pd_path0 sdfgh
+
+proc pdtk_path_dialog {id} {
+ global pd_path0 pd_path1 pd_path2 pd_path3 pd_path4
+ global pd_path5 pd_path6 pd_path7 pd_path8 pd_path9
+
+ toplevel $id
+ wm title $id {PD search path for patches and other files}
+ wm protocol $id WM_DELETE_WINDOW [concat path_cancel $id]
+
+ frame $id.buttonframe
+ pack $id.buttonframe -side bottom -fill x -pady 2m
+ button $id.buttonframe.cancel -text {Cancel}\
+ -command "path_cancel $id"
+ button $id.buttonframe.apply -text {Apply}\
+ -command "path_apply $id"
+ button $id.buttonframe.ok -text {OK}\
+ -command "path_ok $id"
+ pack $id.buttonframe.cancel -side left -expand 1
+ pack $id.buttonframe.apply -side left -expand 1
+ pack $id.buttonframe.ok -side left -expand 1
+
+ for {set x 0} {$x < 10} {incr x} {
+ # input device 1
+ entry $id.f$x -textvariable pd_path$x -width 80
+ bind $id.f$x <KeyPress-Return> [concat path_ok $id]
+ pack $id.f$x -side top
+ }
+
+ focus $id.f0
+}
+
+proc pd_set {var value} {
+ global $var
+ set $var $value
+}
diff --git a/pd/src/u_main.tk.test b/pd/src/u_main.tk.test
deleted file mode 100644
index fc32a321..00000000
--- a/pd/src/u_main.tk.test
+++ /dev/null
@@ -1,2686 +0,0 @@
-set pd_nt 0
-# (The above is 0 for unix, 1 for microsoft, and 2 for Mac OSX. The first
-# line is automatically munged by the relevant makefiles.)
-
-# Copyright (c) 1997-1999 Miller Puckette.
-# For information on usage and redistribution, and for a DISCLAIMER OF ALL
-# WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-
-# changed by Thomas Musil 09.2001
-# between "pdtk_graph_dialog -- dialog window for graphs"
-# and "pdtk_array_dialog -- dialog window for arrays"
-# a new dialogbox was inserted, named:
-# "pdtk_iemgui_dialog -- dialog window for iem guis"
-#
-# there are 2 new features: 1.) line-delete-protection in edit-menue
-#
-# 2.) there are all iem-guis in a seperated put-gui-menue
-#
-# all this changes are labeled with #######iemlib##########
-
-if {$pd_nt == 1} {
- global pd_guidir
- set pd_gui2 [string range $argv0 0 [expr [string last \\ $argv0 ] - 1]]
- regsub -all \\\\ $pd_gui2 / pd_gui3
- set pd_guidir $pd_gui3/..
- load $pd_guidir/bin/pdtcl
-}
-
-if {$pd_nt == 2} {
- global pd_guidir
- set pd_gui2 [string range $argv0 0 [expr [string last / $argv0 ] - 1]]
- set pd_guidir $pd_gui2/..
- load $pd_guidir/bin/pdtcl
-}
-
-# it's unfortunate but we seem to have to turn off global bindings
-# for Text objects to get control-s and control-t to do what we want for
-# "text" dialogs below. Also we have to get rid of tab's changing the focus.
-
-bind all <Key-Tab> ""
-bind all <Shift-Key-Tab> ""
-bind Text <Control-t> {}
-bind Text <Control-s> {}
-# puts stderr [bind all]
-
-################## set up main window #########################
-frame .mbar -relief raised -bd 2
-canvas .dummy -height 1c -width 1c
-frame .controls
-pack .mbar .controls .dummy -side top -fill x
-menubutton .mbar.file -text File -menu .mbar.file.menu
-menubutton .mbar.find -text Find -menu .mbar.find.menu
-menubutton .mbar.windows -text Windows -menu .mbar.windows.menu
-menubutton .mbar.audio -text Audio -menu .mbar.audio.menu
-menubutton .mbar.help -text Help -menu .mbar.help.menu
-pack .mbar.file .mbar.find .mbar.windows .mbar.audio -side left
-pack .mbar.help -side right
-menu .mbar.file.menu
-menu .mbar.find.menu
-menu .mbar.windows.menu -postcommand [concat pdtk_fixwindowmenu]
-menu .mbar.audio.menu
-menu .mbar.help.menu
-
-set ctrls_audio_on 0
-set ctrls_meter_on 0
-set ctrls_inlevel 0
-set ctrls_outlevel 0
-
-frame .controls.switches
-checkbutton .controls.switches.audiobutton -text {compute audio} \
- -variable ctrls_audio_on \
- -anchor w \
- -command {pd [concat pd dsp $ctrls_audio_on \;]}
-
-checkbutton .controls.switches.meterbutton -text {peak meters} \
- -variable ctrls_meter_on \
- -anchor w \
- -command {pd [concat pd meters $ctrls_meter_on \;]}
-
-pack .controls.switches.meterbutton .controls.switches.audiobutton -side left
-
-frame .controls.in
-label .controls.in.label -text IN
-entry .controls.in.level -textvariable ctrls_inlevel -width 3
-button .controls.in.clip -text {CLIP} -state disabled
-pack .controls.in.label .controls.in.level .controls.in.clip -side top
-
-frame .controls.out
-label .controls.out.label -text OUT
-entry .controls.out.level -textvariable ctrls_outlevel -width 3
-button .controls.out.clip -text {CLIP} -state disabled
-pack .controls.out.label .controls.out.level .controls.out.clip -side top
-
-button .controls.dio -text "DIO\nerrors" \
- -command {pd [concat pd audiostatus \;]}
-
-pack .controls.switches -side bottom
-pack .controls.in .controls.out -side left
-pack .controls.dio -side right
-
-bind . <Control-Key> {pdtk_pd_ctrlkey %W %K 0}
-bind . <Control-Shift-Key> {pdtk_pd_ctrlkey %W %K 1}
-
-
-############### set up global variables ################################
-
-set untitled_number 1
-set untitled_directory [pwd]
-set saveas_client doggy
-set pd_opendir $untitled_directory
-############iemlib##################
-# need it to know, if new or open file
-set iem_new_open_flag "open"
-############iemlib##################
-
-################ utility functions #########################
-
-proc pdtk_enquote {x} {
- set foo [string map {"," "" ";" "" \" ""} $x]
- set foo2 [string map {" " "\\ "} $foo]
- concat $foo2
-}
-
-proc pdtk_debug {x} {
- tk_messageBox -message $x -type ok
-}
-
-proc pdtk_watchdog {} {
- pd [concat pd ping \;]
- after 2000 {pdtk_watchdog}
-}
-
-proc pdtk_check {x message} {
- set answer [tk_messageBox \-message $x \-type yesno \-icon question]
- switch $answer {
- yes {pd $message} }
-# no {tk_messageBox \-message "cancelled" \-type ok}
-}
-
-set menu_windowlist {}
-
-proc pdtk_fixwindowmenu {} {
- global menu_windowlist
- .mbar.windows.menu delete 0 end
- foreach i $menu_windowlist {
- .mbar.windows.menu add command -label [lindex $i 0] \
- -command [concat menu_domenuwindow [lindex $i 1]]
- }
-}
-
-############### the "New" menu command ########################
-proc menu_new {} {
- global untitled_number
- global untitled_directory
-############iemlib##################
- global iem_new_open_flag
-
- set iem_new_open_flag "new"
-############iemlib##################
- pd [concat pd filename Untitled-$untitled_number $untitled_directory \;]
- pd {
- #N canvas;
- #X pop 1;
- }
- set untitled_number [expr $untitled_number + 1]
-}
-
-################## the "Open" menu command #########################
-
-proc menu_open {} {
- global pd_opendir
- global pd_nt
-############iemlib##################
- global iem_new_open_flag
-
- set iem_new_open_flag "open"
-############iemlib##################
-
-# workaround -- initialdir doesn't work on MACOSX yet ---
- if {$pd_nt == 2} {
- cd $pd_opendir
- set filename [tk_getOpenFile -defaultextension .pd \
- -filetypes { {{pd files} {.pd}} {{max files} {.pat}}} ]
- } else {
- set filename [tk_getOpenFile -defaultextension .pd \
- -filetypes { {{pd files} {.pd}} {{max files} {.pat}}} \
- -initialdir $pd_opendir]
- }
-# puts stderr $filename
- if {$filename != ""} {
- set directory [string range $filename 0 \
- [expr [string last / $filename ] - 1]]
- set pd_opendir $directory
- set basename [string range $filename \
- [expr [string last / $filename ] + 1] end]
-
-# pd_debug [concat file $filename base $basename dir $directory]
-
- pd [concat pd open [pdtk_enquote $basename] \
- [pdtk_enquote $directory]\;]
- }
-}
-
-################## the "Message" menu command #########################
-proc menu_send {} {
- toplevel .sendpanel
- entry .sendpanel.entry -textvariable send_textvariable
- pack .sendpanel.entry -side bottom -fill both -ipadx 100
- .sendpanel.entry select from 0
- .sendpanel.entry select adjust end
- bind .sendpanel.entry <KeyPress-Return> {
- pd [concat $send_textvariable \;]
- after 50 {destroy .sendpanel}
- }
- focus .sendpanel.entry
-}
-
-################## the "Quit" menu command #########################
-proc menu_really_quit {} {pd {pd quit;}}
-
-proc menu_quit {} {pdtk_check {Really quit?} {pd quit;}}
-
-######### the "Pd" menu command, which puts the Pd window on top ########
-proc menu_pop_pd {} {raise .}
-
-######### the "audio" menu command ###############
-proc menu_audio {flag} {pd [concat pd dsp $flag \;]}
-
-######### the "documentation" menu command ###############
-
-set doc_number 1
-
-proc menu_opentext {filename} {
- global doc_number
- global pd_guidir
- global pd_myversion
- set name [format ".help%d" $doc_number]
- toplevel $name
- text $name.text -relief raised -bd 2 -font fixed \
- -yscrollcommand "$name.scroll set" -background white
- scrollbar $name.scroll -command "$name.text yview"
- pack $name.scroll -side right -fill y
- pack $name.text -side left -fill both -expand 1
-
- set f [open $filename]
- while {![eof $f]} {
- set bigstring [read $f 1000]
- regsub -all PD_BASEDIR $bigstring $pd_guidir bigstring2
- regsub -all PD_VERSION $bigstring2 $pd_myversion bigstring3
- $name.text insert end $bigstring3
- }
- close $f
- set doc_number [expr $doc_number + 1]
-}
-
-set help_directory $pd_guidir/doc
-
-proc menu_documentation {} {
- global help_directory
- global pd_nt
-############iemlib##################
- global iem_new_open_flag
-
- set iem_new_open_flag "open"
-############iemlib##################
-
- if {$pd_nt == 2} {
- cd $help_directory
- set filename [tk_getOpenFile -defaultextension .pd \
- -filetypes { {{documentation} {.pd .txt .htm}} } ]
- } else {
- set filename [tk_getOpenFile -defaultextension .pd \
- -filetypes { {{documentation} {.pd .txt .htm}} } \
- -initialdir $help_directory]
- }
-
- if {$filename != ""} {
- if {[string first .txt $filename] >= 0} {
- menu_opentext $filename
- } elseif {[string first .htm $filename] >= 0} {
- if {$pd_nt == 0} {
-#I wish I could get this to run in the background; the "&" doesn't do it:
- exec sh -c \
- [format "mozilla file:%s || netscape file:%s &\n" \
- $filename $filename]
- } else {
- tk_messageBox -message \
- {sorry -- can't open htm files yet; open this manually} \
- -type ok
- }
- } else {
- set help_directory [string range $filename 0 \
- [expr [string last / $filename ] - 1]]
- set basename [string range $filename \
- [expr [string last / $filename ] + 1] end]
- pd [concat pd open [pdtk_enquote $basename] \
- [pdtk_enquote $help_directory] \;]
- }
- }
-}
-
-proc menu_doc_open {subdir basename} {
- global pd_guidir
-############iemlib##################
- global iem_new_open_flag
-
- set iem_new_open_flag "open"
-############iemlib##################
-
- set dirname $pd_guidir/$subdir
-
- if {[string first .txt $basename] >= 0} {
- menu_opentext $dirname/$basename
- } else {
- pd [concat pd open [pdtk_enquote $basename] \
- [pdtk_enquote $dirname] \;]
- }
-}
-
-#################### the "File" menu for the Pd window ##############
-.mbar.file.menu add command -label New -command {menu_new} \
- -accelerator "Ctrl+n"
-.mbar.file.menu add command -label Open -command {menu_open} \
- -accelerator "Ctrl+o"
-.mbar.file.menu add command -label Message -command {menu_send} \
- -accelerator "Ctrl+m"
-.mbar.file.menu add separator
-.mbar.file.menu add command -label Quit -command {menu_quit} \
- -accelerator "Ctrl+q"
-
-#################### the "Find" menu for the Pd window ##############
-.mbar.find.menu add command -label {last error?} -command {menu_finderror}
-
-#################### the "Audio" menu for the Pd window ##############
-.mbar.audio.menu add command -label On -accelerator "Ctrl+/" \
- -command {menu_audio 1}
-.mbar.audio.menu add command -label Off -accelerator "Ctrl+." \
- -command {menu_audio 0}
-
-#################### the "Help" menu for the Pd window ##############
-.mbar.help.menu add command -label {About Pd} \
- -command {menu_doc_open doc/1.manual 1.introduction.txt}
-.mbar.help.menu add command -label {Test Audio and MIDI} \
- -command {menu_doc_open doc/7.stuff/tools testtone.pd}
-.mbar.help.menu add command -label {Load Meter} \
- -command {menu_doc_open doc/7.stuff/tools load-meter.pd}
-.mbar.help.menu add command -label {Pure Documentation...} \
- -command {menu_documentation}
-
-########### functions for menu functions on document windows ########
-
-proc menu_save {name} {
- pdtk_canvas_checkgeometry $name
- pd [concat $name menusave \;]
-}
-
-proc menu_saveas {name} {
- pdtk_canvas_checkgeometry $name
- pd [concat $name menusaveas \;]
-}
-
-proc menu_print {name} {
- $name.c postscript -file x.ps
-}
-
-proc menu_close {name} {
- pd [concat $name menuclose \;]
-}
-
-proc menu_cut {name} {
- pd [concat $name cut \;]
-}
-
-proc menu_copy {name} {
- pd [concat $name copy \;]
-}
-
-proc menu_paste {name} {
- pd [concat $name paste \;]
-}
-
-proc menu_duplicate {name} {
- pd [concat $name duplicate \;]
-}
-
-proc menu_selectall {name} {
- pd [concat $name selectall \;]
-}
-
-proc menu_texteditor {name} {
- pd [concat $name texteditor \;]
-}
-
-proc menu_font {name} {
- pd [concat $name menufont \;]
-}
-
-proc menu_tidyup {name} {
- pd [concat $name tidy \;]
-}
-
-proc menu_editmode {name} {
- pd [concat $name editmode 0 \;]
-}
-
-proc menu_object {name accel} {
- pd [concat $name obj $accel \;]
-}
-
-proc menu_message {name accel} {
- pd [concat $name msg $accel \;]
-}
-
-proc menu_floatatom {name accel} {
- pd [concat $name floatatom $accel \;]
-}
-
-proc menu_symbolatom {name accel} {
- pd [concat $name symbolatom $accel \;]
-}
-
-proc menu_comment {name accel} {
- pd [concat $name text $accel \;]
-}
-
-proc menu_graph {name} {
- pd [concat $name graph \;]
-}
-
-proc menu_array {name} {
- pd [concat $name menuarray \;]
-}
-
-############iemlib##################
-proc menu_bng {name accel} {
- pd [concat $name bng $accel \;]
-}
-
-proc menu_toggle {name accel} {
- pd [concat $name toggle $accel \;]
-}
-
-proc menu_numbox {name accel} {
- pd [concat $name numbox $accel \;]
-}
-
-proc menu_vslider {name accel} {
- pd [concat $name vslider $accel \;]
-}
-
-proc menu_hslider {name accel} {
- pd [concat $name hslider $accel \;]
-}
-
-proc menu_hdial {name accel} {
- pd [concat $name hdial $accel \;]
-}
-
-proc menu_vdial {name accel} {
- pd [concat $name vdial $accel \;]
-}
-
-proc menu_vumeter {name accel} {
- pd [concat $name vumeter $accel \;]
-}
-
-proc menu_mycnv {name accel} {
- pd [concat $name mycnv $accel \;]
-}
-
-proc menu_protectmode {name} {
- pd [concat $name protectmode 0 \;]
-}
-
-############iemlib##################
-
-proc menu_windowparent {name} {
- pd [concat $name findparent \;]
-}
-
-proc menu_findagain {name} {
- pd [concat $name findagain \;]
-}
-
-proc menu_finderror {} {
- pd [concat pd finderror \;]
-}
-
-proc menu_domenuwindow {i} {
- raise $i
-}
-
-proc menu_fixwindowmenu {name} {
- global menu_windowlist
- $name.m.windows.m add command
- $name.m.windows.m delete 4 end
- foreach i $menu_windowlist {
- $name.m.windows.m add command -label [lindex $i 0] \
- -command [concat menu_domenuwindow [lindex $i 1]]
- }
-}
-
-################## the "find" menu item ###################
-
-set find_canvas nobody
-set find_string ""
-set find_count 1
-
-proc find_apply {name} {
- global find_string
- global find_canvas
- regsub -all \; $find_string " _semi_ " find_string2
- regsub -all \, $find_string2 " _comma_ " find_string3
-# puts stderr [concat $find_canvas find $find_string3 \
-# \;]
- pd [concat $find_canvas find $find_string3 \
- \;]
- after 50 destroy $name
-}
-
-proc find_cancel {name} {
- after 50 destroy $name
-}
-
-proc menu_findobject {canvas} {
- global find_string
- global find_canvas
- global find_count
-
- set name [format ".find%d" $find_count]
- set find_count [expr $find_count + 1]
-
- set find_canvas $canvas
-
- toplevel $name
-
- label $name.label -text {find...}
- pack $name.label -side top
-
- entry $name.entry -textvariable find_string
- pack $name.entry -side top
-
- frame $name.buttonframe
- pack $name.buttonframe -side bottom -fill x -pady 2m
- button $name.buttonframe.cancel -text {Cancel}\
- -command "find_cancel $name"
- button $name.buttonframe.ok -text {OK}\
- -command "find_apply $name"
- pack $name.buttonframe.cancel -side left -expand 1
- pack $name.buttonframe.ok -side left -expand 1
-
- $name.entry select from 0
- $name.entry select adjust end
- bind $name.entry <KeyPress-Return> [ concat find_apply $name]
- focus $name.entry
-}
-
-
-############# pdtk_canvas_new -- create a new canvas ###############
-proc pdtk_canvas_new {name width height geometry} {
- global pd_opendir
- global iem_new_open_flag
-
- toplevel $name
- frame $name.m -relief raised -bd 2
-# puts stderr [concat geometry: $geometry]
- wm geometry $name $geometry
- canvas $name.c -width $width -height $height -background white \
- -yscrollcommand "$name.scrollvert set" \
- -xscrollcommand "$name.scrollhort set" \
- -scrollregion [concat 0 0 $width $height]
-
- scrollbar $name.scrollvert -command "$name.c yview"
- scrollbar $name.scrollhort -command "$name.c xview" \
- -orient horizontal
-
- pack $name.m -side top -fill x
- pack $name.scrollhort -side bottom -fill x
- pack $name.scrollvert -side right -fill y
- pack $name.c -side left -expand 1 -fill both
- wm minsize $name 1 1
- wm geometry $name $geometry
-
-# the file menu
-
- menubutton $name.m.file -text File -menu $name.m.file.m
- pack $name.m.file -side left
- menu $name.m.file.m
-
- $name.m.file.m add command -label New -command {menu_new} \
- -accelerator "Ctrl+n"
-
- $name.m.file.m add command -label Open -command {menu_open} \
- -accelerator "Ctrl+o"
-
- $name.m.file.m add command -label Message -command {menu_send} \
- -accelerator "Ctrl+m"
-
- $name.m.file.m add separator
- $name.m.file.m add command -label Save -command [concat menu_save $name] \
- -accelerator "Ctrl+s"
-
- $name.m.file.m add command -label Close \
- -command [concat menu_close $name] \
- -accelerator "Ctrl+w"
-
- $name.m.file.m add command -label "Save as..." \
- -command [concat menu_saveas $name] \
- -accelerator "Ctrl+S"
-
- $name.m.file.m add command -label Print -command [concat menu_print $name] \
- -accelerator "Ctrl+p"
-
- $name.m.file.m add separator
-
- $name.m.file.m add command -label Quit -command {menu_quit} \
- -accelerator "Ctrl+q"
-
-# the edit menu
- menubutton $name.m.edit -text Edit -menu $name.m.edit.m
- pack $name.m.edit -side left
- menu $name.m.edit.m
-
-
- $name.m.edit.m add command -label Cut -command [concat menu_cut $name] \
- -accelerator "Ctrl+x"
-
- $name.m.edit.m add command -label Copy -command [concat menu_copy $name] \
- -accelerator "Ctrl+c"
-
- $name.m.edit.m add command -label Paste \
- -command [concat menu_paste $name] \
- -accelerator "Ctrl+v"
-
- $name.m.edit.m add command -label Duplicate \
- -command [concat menu_duplicate $name] \
- -accelerator "Ctrl+d"
-
- $name.m.edit.m add command -label {Select all} \
- -command [concat menu_selectall $name] \
- -accelerator "Ctrl+a"
-
- $name.m.edit.m add command -label {Text Editor} \
- -command [concat menu_texteditor $name] \
- -accelerator "Ctrl+t"
-
- $name.m.edit.m add command -label Font \
- -command [concat menu_font $name]
-
- $name.m.edit.m add command -label {Tidy Up} \
- -command [concat menu_tidyup $name]
-
- $name.m.edit.m add separator
-
-############iemlib##################
-# instead of "red = #BC3C60" we take "grey85", so there is no difference,
-# if widget is selected or not.
-
- $name.m.edit.m add checkbutton -label "Edit mode" \
- -indicatoron true -selectcolor grey85 \
- -command [concat menu_editmode $name] \
- -accelerator "Ctrl+e"
-
-
-
- $name.m.edit.m add checkbutton -label "Protect" \
- -indicatoron true -selectcolor grey85 \
- -command [concat menu_protectmode $name] \
- -accelerator "Ctrl+r"
-
- if { $iem_new_open_flag == "open" } {
- $name.m.edit.m entryconfigure "Edit mode" -indicatoron false }
- $name.m.edit.m entryconfigure "Protect" -indicatoron false
-
-############iemlib##################
-
-# the put menu
- menubutton $name.m.put -text Put -menu $name.m.put.m
- pack $name.m.put -side left
- menu $name.m.put.m
-
- $name.m.put.m add command -label Object \
- -command [concat menu_object $name 0] \
- -accelerator "Ctrl+1"
-
- $name.m.put.m add command -label Message \
- -command [concat menu_message $name 0] \
- -accelerator "Ctrl+2"
-
- $name.m.put.m add command -label Number \
- -command [concat menu_floatatom $name 0] \
- -accelerator "Ctrl+3"
-
- $name.m.put.m add command -label Symbol \
- -command [concat menu_symbolatom $name 0] \
- -accelerator "Ctrl+4"
-
- $name.m.put.m add command -label Comment \
- -command [concat menu_comment $name 0] \
- -accelerator "Ctrl+5"
-
-############iemlib##################
-
- $name.m.put.m add command -label Bang \
- -command [concat menu_bng $name 0] \
- -accelerator "Alt+b"
-
- $name.m.put.m add command -label Toggle \
- -command [concat menu_toggle $name 0] \
- -accelerator "Alt+t"
-
- $name.m.put.m add command -label Number2 \
- -command [concat menu_numbox $name 0] \
- -accelerator "Alt+n"
-
- $name.m.put.m add command -label Vslider \
- -command [concat menu_vslider $name 0] \
- -accelerator "Alt+v"
-
- $name.m.put.m add command -label Hslider \
- -command [concat menu_hslider $name 0] \
- -accelerator "Alt+h"
-
- $name.m.put.m add command -label Vdial \
- -command [concat menu_vdial $name 0] \
- -accelerator "Alt+d"
-
- $name.m.put.m add command -label Hdial \
- -command [concat menu_hdial $name 0] \
- -accelerator "Alt+i"
-
- $name.m.put.m add command -label VU \
- -command [concat menu_vumeter $name 0] \
- -accelerator "Alt+u"
-
- $name.m.put.m add command -label Canvas \
- -command [concat menu_mycnv $name 0] \
- -accelerator "Alt+c"
-
-############iemlib##################
-
- $name.m.put.m add command -label Graph \
- -command [concat menu_graph $name]
-
- $name.m.put.m add command -label Array \
- -command [concat menu_array $name]
-
-
-
-# the find menu
- menubutton $name.m.find -text Find -menu $name.m.find.m
- pack $name.m.find -side left
- menu $name.m.find.m
- $name.m.find.m add command -label {Find...} -accelerator "Ctrl+f" \
- -command [concat menu_findobject $name]
- $name.m.find.m add command -label {Find Again} -accelerator "Ctrl+g" \
- -command [concat menu_findagain $name]
- $name.m.find.m add command -label {Find last error} \
- -command [concat menu_finderror]
-
-# the window menu
- menubutton $name.m.windows -text Windows -menu $name.m.windows.m
- pack $name.m.windows -side left
- menu $name.m.windows.m -postcommand [concat menu_fixwindowmenu $name]
- $name.m.windows.m add command -label {parent window}\
- -command [concat menu_windowparent $name]
- $name.m.windows.m add command -label {Pd window} -command menu_pop_pd
- $name.m.windows.m add separator
-
-# the audio menu
- menubutton $name.m.audio -text Audio -menu $name.m.audio.m
- pack $name.m.audio -side left
- menu $name.m.audio.m
- $name.m.audio.m add command -label On -accelerator "Ctrl+/" \
- -command {menu_audio 1}
- $name.m.audio.m add command -label Off -accelerator "Ctrl+." \
- -command {menu_audio 0}
-
-# the help menu
- menubutton $name.m.help -text Help -menu $name.m.help.m
- pack $name.m.help -side right
- menu $name.m.help.m
- $name.m.help.m add command -label {Getting Started} \
- -command {menu_doc_open doc/1.manual 1.introduction.txt}
- $name.m.help.m add command -label {Test Audio and MIDI} \
- -command {menu_doc_open doc/7.stuff/tools testtone.pd}
- $name.m.help.m add command -label {Load Meter} \
- -command {menu_doc_open doc/7.stuff/tools load-meter.pd}
- $name.m.help.m add command -label {Pure Documentation} \
- -command {menu_documentation}
-
-# the popup menu
- menu $name.popup -tearoff false
- $name.popup add command -label {Properties} \
- -command [concat popup_action $name 0]
- $name.popup add command -label {Open} \
- -command [concat popup_action $name 1]
- $name.popup add command -label {Help} \
- -command [concat popup_action $name 2]
-
-# WM protocol
- wm protocol $name WM_DELETE_WINDOW [concat menu_close $name]
-
-# bindings.
-# this is idiotic -- how do you just sense what mod keys are down and
-# pass them on? I can't find it anywhere.
-# Here we encode shift as 1, control 2, alt 4, in agreement
-# with definitions in g_canvas.c. The third button gets "8" but we don't
-# bother with modifiers there.
-# We don't handle multiple clicks yet.
-
- bind $name.c <Button> {pdtk_canvas_click %W %x %y %b 0}
- bind $name.c <Shift-Button> {pdtk_canvas_click %W %x %y %b 1}
- bind $name.c <Control-Button> {pdtk_canvas_click %W %x %y %b 2}
- bind $name.c <Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 3}
- bind $name.c <Alt-Button> {pdtk_canvas_click %W %x %y %b 4}
- bind $name.c <Alt-Shift-Button> {pdtk_canvas_click %W %x %y %b 5}
- bind $name.c <Alt-Control-Button> {pdtk_canvas_click %W %x %y %b 6}
- bind $name.c <Alt-Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 7}
- bind $name.c <Button-3> {pdtk_canvas_click %W %x %y %b 8}
-
- bind $name.c <ButtonRelease> {pdtk_canvas_mouseup %W %x %y %b}
- bind $name.c <Control-Key> {pdtk_canvas_ctrlkey %W %K 0}
- bind $name.c <Control-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1}
- bind $name.c <Alt-Key> {pdtk_canvas_altkey %W %K %A}
-# bind $name.c <Mod1-Key> {puts stderr [concat mod1 %W %K %A]}
- bind $name.c <Key> {pdtk_canvas_key %W %K %A}
- bind $name.c <KeyRelease> {pdtk_canvas_keyup %W %K %A}
- bind $name.c <Motion> {pdtk_canvas_motion %W %x %y 0}
- bind $name.c <Alt-Motion> {pdtk_canvas_motion %W %x %y 4}
- bind $name.c <Map> {pdtk_canvas_map %W %s}
-# bind $name.c <Unmap> {puts stderr map}
- focus $name.c
-# puts stderr "all done"
-# after 1 [concat raise $name]
-}
-
-#################### event binding procedures ################
-
-#get the name of the toplevel window for a canvas; this is also
-#the name of the canvas object in Pd.
-
-proc canvastosym {name} {
- string range $name 0 [expr [string length $name] - 3]
-}
-
-set pdtk_lastcanvasconfigured ""
-set pdtk_lastcanvasconfiguration ""
-
-proc pdtk_canvas_checkgeometry {topname} {
- set boo [winfo geometry $topname.c]
- set boo2 [wm geometry $topname]
- global pdtk_lastcanvasconfigured
- global pdtk_lastcanvasconfiguration
- if {$topname != $pdtk_lastcanvasconfigured || \
- $boo != $pdtk_lastcanvasconfiguration} {
- set pdtk_lastcanvasconfigured $topname
- set pdtk_lastcanvasconfiguration $boo
- pd $topname relocate $boo $boo2 \;
- }
-}
-
-proc pdtk_canvas_click {name x y b f} {
-# puts stderr [concat got $f]
- pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b $f \;
-}
-
-proc pdtk_canvas_shiftclick {name x y b} {
- pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b 1 \;
-}
-
-proc pdtk_canvas_ctrlclick {name x y b} {
- pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b 2 \;
-}
-
-proc pdtk_canvas_altclick {name x y b} {
- pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b 3 \;
-}
-
-proc pdtk_canvas_dblclick {name x y b} {
- pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b 4 \;
-}
-
-set pdtk_canvas_mouseup_name 0
-set pdtk_canvas_mouseup_xminval 0
-set pdtk_canvas_mouseup_xmaxval 0
-set pdtk_canvas_mouseup_yminval 0
-set pdtk_canvas_mouseup_ymaxval 0
-
-proc pdtk_canvas_mouseup {name x y b} {
- pd [concat [canvastosym $name] mouseup [$name canvasx $x] \
- [$name canvasy $y] $b \;]
-
-# we use the mouseup event to update scrollbar ranges and recheck the
-# geometry of the window since I haven't taken the time to figure out
-# how to do it right.
-
- global pdtk_canvas_mouseup_name
- global pdtk_canvas_mouseup_xminval
- global pdtk_canvas_mouseup_xmaxval
- global pdtk_canvas_mouseup_yminval
- global pdtk_canvas_mouseup_ymaxval
-
- set size [$name bbox all]
- if {$size != ""} {
- set xminval 0
- set yminval 0
- set xmaxval 100
- set ymaxval 100
- set x1 [lindex $size 0]
- set x2 [lindex $size 2]
- set y1 [lindex $size 1]
- set y2 [lindex $size 3]
-
- if {$x1 < 0} {set xminval $x1}
- if {$y1 < 0} {set yminval $y1}
-
- if {$x2 > 100} {set xmaxval $x2}
- if {$y2 > 100} {set ymaxval $y2}
-
- if {$pdtk_canvas_mouseup_name != $name || \
- $pdtk_canvas_mouseup_xminval != $xminval || \
- $pdtk_canvas_mouseup_xmaxval != $xmaxval || \
- $pdtk_canvas_mouseup_yminval != $yminval || \
- $pdtk_canvas_mouseup_ymaxval != $ymaxval } {
-
- set newsize "$xminval $yminval $xmaxval $ymaxval"
- $name configure -scrollregion $newsize
- set pdtk_canvas_mouseup_name $name
- set pdtk_canvas_mouseup_xminval $xminval
- set pdtk_canvas_mouseup_xmaxval $xmaxval
- set pdtk_canvas_mouseup_yminval $yminval
- set pdtk_canvas_mouseup_ymaxval $ymaxval
- }
-
- }
- pdtk_canvas_checkgeometry [canvastosym $name]
-}
-
-proc pdtk_canvas_key {name key iso} {
-# puts stderr [concat down key= $key iso= $iso]
-# .controls.switches.meterbutton configure -text $key
-# HACK for MAC OSX -- backspace seems different; I don't understand why.
-# invesigate this LATER...
- global pd_nt
- if {$pd_nt == 2} {
- if {$key == "BackSpace"} {
- set key 8
- set keynum 8
- }
- if {$key == "Delete"} {
- set key 8
- set keynum 8
- }
- }
- if {$iso != ""} {
- scan $iso %c keynum
- pd [canvastosym $name] key 1 $keynum \;
- } else {
- pd [canvastosym $name] key 1 $key \;
- }
-}
-
-proc pdtk_canvas_keyup {name key iso} {
-# puts stderr [concat up key= $key iso= $iso]
- if {$iso != ""} {
- scan $iso %c keynum
- pd [canvastosym $name] key 0 $keynum \;
- } else {
- pd [canvastosym $name] key 0 $key \;
- }
-}
-
-proc pdtk_canvas_altkey {name key iso} {
-# puts stderr [concat alt-key $iso]
-############iemlib##################
- set topname [string trimright $name .c]
- if {$key == "b" || $key == "B"} {menu_bng $topname 1}
- if {$key == "t" || $key == "T"} {menu_toggle $topname 1}
- if {$key == "n" || $key == "N"} {menu_numbox $topname 1}
- if {$key == "v" || $key == "V"} {menu_vslider $topname 1}
- if {$key == "h" || $key == "H"} {menu_hslider $topname 1}
- if {$key == "i" || $key == "I"} {menu_hdial $topname 1}
- if {$key == "d" || $key == "D"} {menu_vdial $topname 1}
- if {$key == "u" || $key == "U"} {menu_vumeter $topname 1}
- if {$key == "c" || $key == "C"} {menu_mycnv $topname 1}
-############iemlib##################
-}
-
-proc pdtk_canvas_ctrlkey {name key shift} {
-# first get rid of ".c" suffix; we'll refer to the toplevel instead
- set topname [string trimright $name .c]
-# puts stderr [concat ctrl-key $key $topname]
-
- if {$key == "n" || $key == "N"} {menu_new}
- if {$key == "o" || $key == "O"} {menu_open}
- if {$key == "m" || $key == "M"} {menu_send}
- if {$key == "q" || $key == "Q"} {
- if {$shift == 1} {menu_really_quit} else {menu_quit}
- }
- if {$key == "s" || $key == "S"} {
- if {$shift == 1} {menu_saveas $topname} else {menu_save $topname}
- }
- if {$key == "w" || $key == "W"} {menu_close $topname}
- if {$key == "p" || $key == "P"} {menu_print $topname}
- if {$key == "x" || $key == "X"} {menu_cut $topname}
- if {$key == "c" || $key == "C"} {menu_copy $topname}
- if {$key == "v" || $key == "V"} {menu_paste $topname}
- if {$key == "d" || $key == "D"} {menu_duplicate $topname}
- if {$key == "a" || $key == "A"} {menu_selectall $topname}
- if {$key == "t" || $key == "T"} {menu_texteditor $topname}
- if {$key == "f" || $key == "F"} {menu_findobject $topname}
- if {$key == "g" || $key == "G"} {menu_findagain $topname}
- if {$key == "1"} {menu_object $topname 1}
- if {$key == "2"} {menu_message $topname 1}
- if {$key == "3"} {menu_floatatom $topname 1}
- if {$key == "4"} {menu_symbolatom $topname 1}
- if {$key == "5"} {menu_comment $topname 1}
- if {$key == "slash"} {menu_audio 1}
- if {$key == "period"} {menu_audio 0}
- if {$key == "e" || $key == "E"} {menu_editmode $topname}
-############iemlib##################
- if {$key == "r" || $key == "R"} {menu_protectmode $topname}
-############iemlib##################
-}
-
-proc pdtk_canvas_motion {name x y mods} {
-# puts stderr [concat [canvastosym $name] $name $x $y]
- pd [canvastosym $name] motion [$name canvasx $x] [$name canvasy $y] $mods \;
-}
-
-# "map" event tells us when the canvas becomes visible (arg is "0") or
-# invisible (arg is ""). Invisibility means the Window Manager has minimized
-# us. We don't get a final "unmap" event when we destroy the window.
-proc pdtk_canvas_map {name arg} {
- if {$arg == "0"} {
- pd [canvastosym $name] map 1 \;
- } else {
- pd [canvastosym $name] map 0 \;
- }
-}
-
-set saveas_dir nowhere
-
-############ pdtk_canvas_saveas -- run a saveas dialog ##############
-
-proc pdtk_canvas_saveas {name initfile initdir} {
- global pd_nt
- if {$pd_nt == 2} {
- cd $initdir
- set filename [tk_getSaveFile -initialfile $initfile \
- -defaultextension .pd \
- -filetypes { {{pd files} {.pd}} {{max files} {.pat}} }]
- } else {
- set filename [tk_getSaveFile -initialfile $initfile \
- -initialdir $initdir -defaultextension .pd \
- -filetypes { {{pd files} {.pd}} {{max files} {.pat}} }]
- }
- if {$filename != ""} {
- set directory [string range $filename 0 \
- [expr [string last / $filename ] - 1]]
- set basename [string range $filename \
- [expr [string last / $filename ] + 1] end]
- pd [concat $name savetofile [pdtk_enquote $basename] \
- [pdtk_enquote $directory] \;]
-# pd [concat $name savetofile $basename $directory \;]
- }
-}
-
-############ pdtk_canvas_dofont -- run a font and resize dialog #########
-
-set fontsize 0
-set stretchval 0
-set whichstretch 0
-
-proc dofont_apply {name} {
- global fontsize
- global stretchval
- global whichstretch
- set cmd [concat $name font $fontsize $stretchval $whichstretch \;]
-# puts stderr $cmd
- pd $cmd
-}
-
-proc dofont_cancel {name} {
- set cmd [concat $name cancel \;]
-# puts stderr $cmd
- pd $cmd
-}
-
-proc pdtk_canvas_dofont {name initsize} {
-
- global fontsize
- set fontsize $initsize
-
- global stretchval
- set stretchval 100
-
- global whichstretch
- set whichstretch 1
-
- toplevel $name
- wm title $name {FONT BOMB}
- wm protocol $name WM_DELETE_WINDOW [concat dofont_cancel $name]
-
- frame $name.buttonframe
- pack $name.buttonframe -side bottom -fill x -pady 2m
- button $name.buttonframe.cancel -text {Cancel}\
- -command "dofont_cancel $name"
- button $name.buttonframe.ok -text {Do it}\
- -command "dofont_apply $name"
- pack $name.buttonframe.cancel -side left -expand 1
- pack $name.buttonframe.ok -side left -expand 1
-
- frame $name.radiof
- pack $name.radiof -side left
-
- label $name.radiof.label -text {Font Size:}
- pack $name.radiof.label -side top
-
- radiobutton $name.radiof.radio8 -value 8 -variable fontsize -text "8"
- radiobutton $name.radiof.radio10 -value 10 -variable fontsize -text "10"
- radiobutton $name.radiof.radio12 -value 12 -variable fontsize -text "12"
- radiobutton $name.radiof.radio16 -value 16 -variable fontsize -text "16"
- radiobutton $name.radiof.radio24 -value 24 -variable fontsize -text "24"
- radiobutton $name.radiof.radio36 -value 36 -variable fontsize -text "36"
- pack $name.radiof.radio8 -side top -anchor w
- pack $name.radiof.radio10 -side top -anchor w
- pack $name.radiof.radio12 -side top -anchor w
- pack $name.radiof.radio16 -side top -anchor w
- pack $name.radiof.radio24 -side top -anchor w
- pack $name.radiof.radio36 -side top -anchor w
-
- frame $name.stretchf
- pack $name.stretchf -side left
-
- label $name.stretchf.label -text {Stretch:}
- pack $name.stretchf.label -side top
-
- entry $name.stretchf.entry -textvariable stretchval -width 5
- pack $name.stretchf.entry -side left
-
- radiobutton $name.stretchf.radio1 \
- -value 1 -variable whichstretch -text "X and Y"
- radiobutton $name.stretchf.radio2 \
- -value 2 -variable whichstretch -text "X only"
- radiobutton $name.stretchf.radio3 \
- -value 3 -variable whichstretch -text "Y only"
-
- pack $name.stretchf.radio1 -side top -anchor w
- pack $name.stretchf.radio2 -side top -anchor w
- pack $name.stretchf.radio3 -side top -anchor w
-
-}
-
-############ pdtk_gatom_dialog -- run a gatom dialog #########
-
-# see graph_apply, etc., for comments about handling variable names here...
-
-proc gatom_escape {sym} {
- if {[string length $sym] == 0} {
- set ret "-"
-# puts stderr [concat escape1 $sym $ret]
- } else {
- if {[string equal -length 1 $sym "-"]} {
- set ret [string replace $sym 0 0 "--"]
-# puts stderr [concat escape $sym $ret]
- } else {
- set ret $sym
-# puts stderr [concat escape $sym "no change"]
- }
- }
- concat $ret
-}
-
-proc gatom_unescape {sym} {
- if {[string equal -length 1 $sym "-"]} {
- set ret [string replace $sym 0 0 ""]
-# puts stderr [concat unescape $sym $ret]
- } else {
- set ret $sym
-# puts stderr [concat unescape $sym "no change"]
- }
- concat $ret
-}
-
-proc dogatom_apply {id} {
- set vid [string trimleft $id .]
-
- set var_gatomwidth [concat gatomwidth_$vid]
- global $var_gatomwidth
- set var_gatomlo [concat gatomlo_$vid]
- global $var_gatomlo
- set var_gatomhi [concat gatomhi_$vid]
- global $var_gatomhi
- set var_gatomwherelabel [concat gatomwherelabel_$vid]
- global $var_gatomwherelabel
- set var_gatomlabel [concat gatomlabel_$vid]
- global $var_gatomlabel
- set var_gatomsymfrom [concat gatomsymfrom_$vid]
- global $var_gatomsymfrom
- set var_gatomsymto [concat gatomsymto_$vid]
- global $var_gatomsymto
-
-# set cmd [concat $id param $gatomwidth $gatomlo $gatomhi \;]
-
- set cmd [concat $id param \
- [eval concat $$var_gatomwidth] \
- [eval concat $$var_gatomlo] \
- [eval concat $$var_gatomhi] \
- [eval gatom_escape $$var_gatomlabel] \
- [eval concat $$var_gatomwherelabel] \
- [eval gatom_escape $$var_gatomsymfrom] \
- [eval gatom_escape $$var_gatomsymto] \
- \;]
-
-# puts stderr $cmd
- pd $cmd
-}
-
-proc dogatom_cancel {name} {
- set cmd [concat $name cancel \;]
-# puts stderr $cmd
- pd $cmd
-}
-
-proc dogatom_ok {name} {
- dogatom_apply $name
- dogatom_cancel $name
-}
-
-proc pdtk_gatom_dialog {id initwidth initlo inithi \
- wherelabel label symfrom symto} {
-
- set vid [string trimleft $id .]
-
- set var_gatomwidth [concat gatomwidth_$vid]
- global $var_gatomwidth
- set var_gatomlo [concat gatomlo_$vid]
- global $var_gatomlo
- set var_gatomhi [concat gatomhi_$vid]
- global $var_gatomhi
- set var_gatomwherelabel [concat gatomwherelabel_$vid]
- global $var_gatomwherelabel
- set var_gatomlabel [concat gatomlabel_$vid]
- global $var_gatomlabel
- set var_gatomsymfrom [concat gatomsymfrom_$vid]
- global $var_gatomsymfrom
- set var_gatomsymto [concat gatomsymto_$vid]
- global $var_gatomsymto
-
- set $var_gatomwidth $initwidth
- set $var_gatomlo $initlo
- set $var_gatomhi $inithi
- set $var_gatomwherelabel $wherelabel
- set $var_gatomlabel [gatom_unescape $label]
- set $var_gatomsymfrom [gatom_unescape $symfrom]
- set $var_gatomsymto [gatom_unescape $symto]
-
- toplevel $id
- wm title $id {Atom}
- wm protocol $id WM_DELETE_WINDOW [concat dogatom_cancel $id]
-
- frame $id.buttonframe
- pack $id.buttonframe -side bottom -fill x -pady 2m
- button $id.buttonframe.cancel -text {Cancel}\
- -command "dogatom_cancel $id"
- button $id.buttonframe.ok -text {Apply}\
- -command "dogatom_apply $id"
- pack $id.buttonframe.cancel -side left -expand 1
- pack $id.buttonframe.ok -side left -expand 1
-
- frame $id.paramsymto
- pack $id.paramsymto -side bottom
- label $id.paramsymto.entryname -text {send symbol}
- entry $id.paramsymto.entry -textvariable $var_gatomsymto -width 20
- pack $id.paramsymto.entryname $id.paramsymto.entry -side left
-
- frame $id.paramsymfrom
- pack $id.paramsymfrom -side bottom
- label $id.paramsymfrom.entryname -text {receive symbol}
- entry $id.paramsymfrom.entry -textvariable $var_gatomsymfrom -width 20
- pack $id.paramsymfrom.entryname $id.paramsymfrom.entry -side left
-
- frame $id.radio
- pack $id.radio -side bottom
- label $id.radio.label -text {show label on:}
- frame $id.radio.l
- frame $id.radio.r
- pack $id.radio.label -side top
- pack $id.radio.l $id.radio.r -side left
- radiobutton $id.radio.l.radio0 -value 0 \
- -variable $var_gatomwherelabel \
- -text "left"
- radiobutton $id.radio.l.radio1 -value 1 \
- -variable $var_gatomwherelabel \
- -text "right"
- radiobutton $id.radio.r.radio2 -value 2 \
- -variable $var_gatomwherelabel \
- -text "top"
- radiobutton $id.radio.r.radio3 -value 3 \
- -variable $var_gatomwherelabel \
- -text "bottom"
- pack $id.radio.l.radio0 $id.radio.l.radio1 -side top -anchor w
- pack $id.radio.r.radio2 $id.radio.r.radio3 -side top -anchor w
-
-
- frame $id.paramlabel
- pack $id.paramlabel -side bottom
- label $id.paramlabel.entryname -text label
- entry $id.paramlabel.entry -textvariable $var_gatomlabel -width 20
- pack $id.paramlabel.entryname $id.paramlabel.entry -side left
-
- frame $id.paramhi
- pack $id.paramhi -side bottom
- label $id.paramhi.entryname -text "upper limit"
- entry $id.paramhi.entry -textvariable $var_gatomhi -width 8
- pack $id.paramhi.entryname $id.paramhi.entry -side left
-
- frame $id.paramlo
- pack $id.paramlo -side bottom
- label $id.paramlo.entryname -text "lower limit"
- entry $id.paramlo.entry -textvariable $var_gatomlo -width 8
- pack $id.paramlo.entryname $id.paramlo.entry -side left
-
- frame $id.params
- pack $id.params -side bottom
- label $id.params.entryname -text width
- entry $id.params.entry -textvariable $var_gatomwidth -width 4
- pack $id.params.entryname $id.params.entry -side left
-
-
-
- bind $id.paramhi.entry <KeyPress-Return> [concat dogatom_ok $id]
- bind $id.paramlo.entry <KeyPress-Return> [concat dogatom_ok $id]
- bind $id.params.entry <KeyPress-Return> [concat dogatom_ok $id]
- $id.params.entry select from 0
- $id.params.entry select adjust end
- focus $id.params.entry
-}
-
-############ pdtk_canvas_popup -- popup menu for canvas #########
-
-set popup_xpix 0
-set popup_ypix 0
-
-proc popup_action {name action} {
- global popup_xpix popup_ypix
- set cmd [concat $name done-popup $action $popup_xpix $popup_ypix \;]
-# puts stderr $cmd
- pd $cmd
-}
-
-proc pdtk_canvas_popup {name xpix ypix canprop canopen} {
- global popup_xpix popup_ypix
- set popup_xpix $xpix
- set popup_ypix $ypix
- if {$canprop == 0} {$name.popup entryconfigure 0 -state disabled}
- if {$canprop == 1} {$name.popup entryconfigure 0 -state active}
- if {$canopen == 0} {$name.popup entryconfigure 1 -state disabled}
- if {$canopen == 1} {$name.popup entryconfigure 1 -state active}
- tk_popup $name.popup [expr $xpix + [winfo rootx $name.c]] \
- [expr $ypix + [winfo rooty $name.c]] 0
-}
-
-############ pdtk_graph_dialog -- dialog window for graphs #########
-
-# the graph and array dialogs can come up in many copies; but in TK the easiest
-# way to get data from an "entry", etc., is to set an associated variable
-# name. This is especially true for grouped "radio buttons". So we have
-# to synthesize variable names for each instance of the dialog. The dialog
-# gets a TK pathname $id, from which it strips the leading "." to make a
-# variable suffix $vid. Then you can get the actual value out by asking for
-# [eval concat $$variablename]. There should be an easier way but I don't see
-# it yet.
-
-proc graph_apply {id} {
-# strip "." from the TK id to make a variable name suffix
- set vid [string trimleft $id .]
-# for each variable, make a local variable to hold its name...
- set var_graph_x1 [concat graph_x1_$vid]
- global $var_graph_x1
- set var_graph_x2 [concat graph_x2_$vid]
- global $var_graph_x2
- set var_graph_xpix [concat graph_xpix_$vid]
- global $var_graph_xpix
- set var_graph_y1 [concat graph_y1_$vid]
- global $var_graph_y1
- set var_graph_y2 [concat graph_y2_$vid]
- global $var_graph_y2
- set var_graph_ypix [concat graph_ypix_$vid]
- global $var_graph_ypix
-
- pd [concat $id dialog \
- [eval concat $$var_graph_x1] \
- [eval concat $$var_graph_y1] \
- [eval concat $$var_graph_x2] \
- [eval concat $$var_graph_y2] \
- [eval concat $$var_graph_xpix] \
- [eval concat $$var_graph_ypix] \
- \;]
-}
-
-proc graph_cancel {id} {
- set cmd [concat $id cancel \;]
-# puts stderr $cmd
- pd $cmd
-}
-
-proc graph_ok {id} {
- graph_apply $id
- graph_cancel $id
-}
-
-proc pdtk_graph_dialog {id x1 y1 x2 y2 xpix ypix} {
- set vid [string trimleft $id .]
- set var_graph_x1 [concat graph_x1_$vid]
- global $var_graph_x1
- set var_graph_x2 [concat graph_x2_$vid]
- global $var_graph_x2
- set var_graph_xpix [concat graph_xpix_$vid]
- global $var_graph_xpix
- set var_graph_y1 [concat graph_y1_$vid]
- global $var_graph_y1
- set var_graph_y2 [concat graph_y2_$vid]
- global $var_graph_y2
- set var_graph_ypix [concat graph_ypix_$vid]
- global $var_graph_ypix
-
- set $var_graph_x1 $x1
- set $var_graph_x2 $x2
- set $var_graph_xpix $xpix
- set $var_graph_y1 $y1
- set $var_graph_y2 $y2
- set $var_graph_ypix $ypix
-
- toplevel $id
- wm title $id {graph}
- wm protocol $id WM_DELETE_WINDOW [concat graph_cancel $id]
-
- label $id.label -text {GRAPH BOUNDS}
- pack $id.label -side top
-
- frame $id.buttonframe
- pack $id.buttonframe -side bottom -fill x -pady 2m
- button $id.buttonframe.cancel -text {Cancel}\
- -command "graph_cancel $id"
- button $id.buttonframe.apply -text {Apply}\
- -command "graph_apply $id"
- button $id.buttonframe.ok -text {OK}\
- -command "graph_ok $id"
- pack $id.buttonframe.cancel -side left -expand 1
- pack $id.buttonframe.apply -side left -expand 1
- pack $id.buttonframe.ok -side left -expand 1
-
- frame $id.xrangef
- pack $id.xrangef -side top
-
- label $id.xrangef.l1 -text "X from:"
- entry $id.xrangef.x1 -textvariable $var_graph_x1 -width 7
- label $id.xrangef.l2 -text "to:"
- entry $id.xrangef.x2 -textvariable $var_graph_x2 -width 7
- label $id.xrangef.l3 -text "screen width:"
- entry $id.xrangef.xpix -textvariable $var_graph_xpix -width 7
- pack $id.xrangef.l1 $id.xrangef.x1 \
- $id.xrangef.l2 $id.xrangef.x2 \
- $id.xrangef.l3 $id.xrangef.xpix -side left
-
- frame $id.yrangef
- pack $id.yrangef -side top
-
-# dig in the following that the upper bound is labeled y1 but the variable is
-# y2, etc. This is to deal with the inconsistent use of "upper and lower"
-# graph bounds... in the dialog the upper Y bound is the lower valued Y pixel.
- label $id.yrangef.l1 -text "Y from:"
- entry $id.yrangef.y1 -textvariable $var_graph_y2 -width 7
- label $id.yrangef.l2 -text "to:"
- entry $id.yrangef.y2 -textvariable $var_graph_y1 -width 7
- label $id.yrangef.l3 -text "screen height:"
- entry $id.yrangef.ypix -textvariable $var_graph_ypix -width 7
- pack $id.yrangef.l1 $id.yrangef.y1 \
- $id.yrangef.l2 $id.yrangef.y2 \
- $id.yrangef.l3 $id.yrangef.ypix -side left
-
- bind $id.xrangef.x1 <KeyPress-Return> [concat graph_ok $id]
- bind $id.xrangef.x2 <KeyPress-Return> [concat graph_ok $id]
- bind $id.xrangef.xpix <KeyPress-Return> [concat graph_ok $id]
- bind $id.yrangef.y1 <KeyPress-Return> [concat graph_ok $id]
- bind $id.yrangef.y2 <KeyPress-Return> [concat graph_ok $id]
- bind $id.yrangef.ypix <KeyPress-Return> [concat graph_ok $id]
- $id.xrangef.x2 select from 0
- $id.xrangef.x2 select adjust end
- focus $id.xrangef.x2
-}
-
-# begin of change "iemlib"
-############ pdtk_iemgui_dialog -- dialog window for iem guis #########
-
-set iemgui_define_min_flashhold 50
-set iemgui_define_min_flashbreak 10
-set iemgui_define_min_fontsize 4
-
-proc iemgui_clip_dim {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_wdt [concat iemgui_wdt_$vid]
- global $var_iemgui_wdt
- set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid]
- global $var_iemgui_min_wdt
- set var_iemgui_hgt [concat iemgui_hgt_$vid]
- global $var_iemgui_hgt
- set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid]
- global $var_iemgui_min_hgt
-
- if {[eval concat $$var_iemgui_wdt] < [eval concat $$var_iemgui_min_wdt]} {
- set $var_iemgui_wdt [eval concat $$var_iemgui_min_wdt]
- $id.dim.w_ent configure -textvariable $var_iemgui_wdt
- }
- if {[eval concat $$var_iemgui_hgt] < [eval concat $$var_iemgui_min_hgt]} {
- set $var_iemgui_hgt [eval concat $$var_iemgui_min_hgt]
- $id.dim.h_ent configure -textvariable $var_iemgui_hgt
- }
-}
-
-proc iemgui_clip_num {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_num [concat iemgui_num_$vid]
- global $var_iemgui_num
-
- if {[eval concat $$var_iemgui_num] > 2000} {
- set $var_iemgui_num 2000
- $id.para.num_ent configure -textvariable $var_iemgui_num
- }
- if {[eval concat $$var_iemgui_num] < 1} {
- set $var_iemgui_num 1
- $id.para.num_ent configure -textvariable $var_iemgui_num
- }
-}
-
-proc iemgui_sched_rng {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_min_rng [concat iemgui_min_rng_$vid]
- global $var_iemgui_min_rng
- set var_iemgui_max_rng [concat iemgui_max_rng_$vid]
- global $var_iemgui_max_rng
- set var_iemgui_rng_sch [concat iemgui_rng_sch_$vid]
- global $var_iemgui_rng_sch
-
- global iemgui_define_min_flashhold
- global iemgui_define_min_flashbreak
-
- if {[eval concat $$var_iemgui_rng_sch] == 2} {
- if {[eval concat $$var_iemgui_max_rng] < [eval concat $$var_iemgui_min_rng]} {
- set hhh [eval concat $$var_iemgui_min_rng]
- set $var_iemgui_min_rng [eval concat $$var_iemgui_max_rng]
- set $var_iemgui_max_rng $hhh
- $id.rng.max_ent configure -textvariable $var_iemgui_max_rng
- $id.rng.min_ent configure -textvariable $var_iemgui_min_rng }
- if {[eval concat $$var_iemgui_max_rng] < $iemgui_define_min_flashhold} {
- set $var_iemgui_max_rng $iemgui_define_min_flashhold
- $id.rng.max_ent configure -textvariable $var_iemgui_max_rng
- }
- if {[eval concat $$var_iemgui_min_rng] < $iemgui_define_min_flashbreak} {
- set $var_iemgui_min_rng $iemgui_define_min_flashbreak
- $id.rng.min_ent configure -textvariable $var_iemgui_min_rng
- }
- }
- if {[eval concat $$var_iemgui_rng_sch] == 1} {
- if {[eval concat $$var_iemgui_min_rng] == 0.0} {
- set $var_iemgui_min_rng 1.0
- $id.rng.min_ent configure -textvariable $var_iemgui_min_rng
- }
- }
-}
-
-proc iemgui_verify_rng {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_min_rng [concat iemgui_min_rng_$vid]
- global $var_iemgui_min_rng
- set var_iemgui_max_rng [concat iemgui_max_rng_$vid]
- global $var_iemgui_max_rng
- set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid]
- global $var_iemgui_lin0_log1
-
- if {[eval concat $$var_iemgui_lin0_log1] == 1} {
- if {[eval concat $$var_iemgui_max_rng] == 0.0 && [eval concat $$var_iemgui_min_rng] == 0.0} {
- set $var_iemgui_max_rng 1.0
- $id.rng.max_ent configure -textvariable $var_iemgui_max_rng
- }
- if {[eval concat $$var_iemgui_max_rng] > 0} {
- if {[eval concat $$var_iemgui_min_rng] <= 0} {
- set $var_iemgui_min_rng [expr [eval concat $$var_iemgui_max_rng] * 0.01]
- $id.rng.min_ent configure -textvariable $var_iemgui_min_rng
- }
- } else {
- if {[eval concat $$var_iemgui_min_rng] > 0} {
- set $var_iemgui_max_rng [expr [eval concat $$var_iemgui_min_rng] * 0.01]
- $id.rng.max_ent configure -textvariable $var_iemgui_max_rng
- }
- }
- }
-}
-
-proc iemgui_clip_fontsize {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid]
- global $var_iemgui_gn_fs
-
- global iemgui_define_min_fontsize
-
- if {[eval concat $$var_iemgui_gn_fs] < $iemgui_define_min_fontsize} {
- set $var_iemgui_gn_fs $iemgui_define_min_fontsize
- $id.gnfs.fs_ent configure -textvariable $var_iemgui_gn_fs
- }
-}
-
-proc iemgui_set_col_example {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_bcol [concat iemgui_bcol_$vid]
- global $var_iemgui_bcol
- set var_iemgui_fcol [concat iemgui_fcol_$vid]
- global $var_iemgui_fcol
- set var_iemgui_lcol [concat iemgui_lcol_$vid]
- global $var_iemgui_lcol
-
- $id.col_example_choose.lb_bk configure \
- -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -foreground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] \
- -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_lcol]]
-
- if { [eval concat $$var_iemgui_fcol] >= 0 } {
- $id.col_example_choose.fr_bk configure \
- -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -foreground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] \
- -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_fcol]]
- } else {
- $id.col_example_choose.fr_bk configure \
- -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -foreground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_bcol]]}
-}
-
-proc iemgui_preset_col {id presetcol} {
- set vid [string trimleft $id .]
-
- set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid]
- global $var_iemgui_l2_f1_b0
- set var_iemgui_bcol [concat iemgui_bcol_$vid]
- global $var_iemgui_bcol
- set var_iemgui_fcol [concat iemgui_fcol_$vid]
- global $var_iemgui_fcol
- set var_iemgui_lcol [concat iemgui_lcol_$vid]
- global $var_iemgui_lcol
-
- if { [eval concat $$var_iemgui_l2_f1_b0] == 0 } { set $var_iemgui_bcol $presetcol }
- if { [eval concat $$var_iemgui_l2_f1_b0] == 1 } { set $var_iemgui_fcol $presetcol }
- if { [eval concat $$var_iemgui_l2_f1_b0] == 2 } { set $var_iemgui_lcol $presetcol }
- iemgui_set_col_example $id
-}
-
-proc iemgui_choose_col_bkfrlb {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid]
- global $var_iemgui_l2_f1_b0
- set var_iemgui_bcol [concat iemgui_bcol_$vid]
- global $var_iemgui_bcol
- set var_iemgui_fcol [concat iemgui_fcol_$vid]
- global $var_iemgui_fcol
- set var_iemgui_lcol [concat iemgui_lcol_$vid]
- global $var_iemgui_lcol
-
- if {[eval concat $$var_iemgui_l2_f1_b0] == 0} {
- set $var_iemgui_bcol [expr [eval concat $$var_iemgui_bcol] & 0xFCFCFC]
- set helpstring [tk_chooseColor -title "Background-Color" -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_bcol]]]
- if { $helpstring != "" } {
- set $var_iemgui_bcol [string replace $helpstring 0 0 "0x"]
- set $var_iemgui_bcol [expr [eval concat $$var_iemgui_bcol] & 0xFCFCFC] }
- }
- if {[eval concat $$var_iemgui_l2_f1_b0] == 1} {
- set $var_iemgui_fcol [expr [eval concat $$var_iemgui_fcol] & 0xFCFCFC]
- set helpstring [tk_chooseColor -title "Front-Color" -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_fcol]]]
- if { $helpstring != "" } {
- set $var_iemgui_fcol [string replace $helpstring 0 0 "0x"]
- set $var_iemgui_fcol [expr [eval concat $$var_iemgui_fcol] & 0xFCFCFC] }
- }
- if {[eval concat $$var_iemgui_l2_f1_b0] == 2} {
- set $var_iemgui_lcol [expr [eval concat $$var_iemgui_lcol] & 0xFCFCFC]
- set helpstring [tk_chooseColor -title "Label-Color" -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_lcol]]]
- if { $helpstring != "" } {
- set $var_iemgui_lcol [string replace $helpstring 0 0 "0x"]
- set $var_iemgui_lcol [expr [eval concat $$var_iemgui_lcol] & 0xFCFCFC] }
- }
- iemgui_set_col_example $id
-}
-
-proc iemgui_lilo {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid]
- global $var_iemgui_lin0_log1
- set var_iemgui_lilo0 [concat iemgui_lilo0_$vid]
- global $var_iemgui_lilo0
- set var_iemgui_lilo1 [concat iemgui_lilo1_$vid]
- global $var_iemgui_lilo1
-
- iemgui_sched_rng $id
-
- if {[eval concat $$var_iemgui_lin0_log1] == 0} {
- set $var_iemgui_lin0_log1 1
- $id.para.lilo configure -text [eval concat $$var_iemgui_lilo1]
- iemgui_verify_rng $id
- iemgui_sched_rng $id
- } else {
- set $var_iemgui_lin0_log1 0
- $id.para.lilo configure -text [eval concat $$var_iemgui_lilo0]
- }
-}
-
-proc iemgui_toggle_font {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_gn_f [concat iemgui_gn_f_$vid]
- global $var_iemgui_gn_f
-
- set $var_iemgui_gn_f [expr [eval concat $$var_iemgui_gn_f] + 1]
- if {[eval concat $$var_iemgui_gn_f] > 2} {set $var_iemgui_gn_f 0}
- if {[eval concat $$var_iemgui_gn_f] == 0} {$id.gnfs.fb configure -text "courier" -font {courier 10 bold}}
- if {[eval concat $$var_iemgui_gn_f] == 1} {$id.gnfs.fb configure -text "helvetica" -font {helvetica 10 bold}}
- if {[eval concat $$var_iemgui_gn_f] == 2} {$id.gnfs.fb configure -text "times" -font {times 10 bold}}
-}
-
-proc iemgui_lb {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_loadbang [concat iemgui_loadbang_$vid]
- global $var_iemgui_loadbang
-
- if {[eval concat $$var_iemgui_loadbang] == 0} {
- set $var_iemgui_loadbang 1
- $id.para.lb configure -text "init"
- } else {
- set $var_iemgui_loadbang 0
- $id.para.lb configure -text "no init"
- }
-}
-
-proc iemgui_stdy_jmp {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_steady [concat iemgui_steady_$vid]
- global $var_iemgui_steady
-
- if {[eval concat $$var_iemgui_steady]} {
- set $var_iemgui_steady 0
- $id.para.stdy_jmp configure -text "jump on click"
- } else {
- set $var_iemgui_steady 1
- $id.para.stdy_jmp configure -text "steady on click"
- }
-}
-
-proc iemgui_apply {id} {
- set vid [string trimleft $id .]
-
- set var_iemgui_wdt [concat iemgui_wdt_$vid]
- global $var_iemgui_wdt
- set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid]
- global $var_iemgui_min_wdt
- set var_iemgui_hgt [concat iemgui_hgt_$vid]
- global $var_iemgui_hgt
- set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid]
- global $var_iemgui_min_hgt
- set var_iemgui_min_rng [concat iemgui_min_rng_$vid]
- global $var_iemgui_min_rng
- set var_iemgui_max_rng [concat iemgui_max_rng_$vid]
- global $var_iemgui_max_rng
- set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid]
- global $var_iemgui_lin0_log1
- set var_iemgui_lilo0 [concat iemgui_lilo0_$vid]
- global $var_iemgui_lilo0
- set var_iemgui_lilo1 [concat iemgui_lilo1_$vid]
- global $var_iemgui_lilo1
- set var_iemgui_loadbang [concat iemgui_loadbang_$vid]
- global $var_iemgui_loadbang
- set var_iemgui_num [concat iemgui_num_$vid]
- global $var_iemgui_num
- set var_iemgui_steady [concat iemgui_steady_$vid]
- global $var_iemgui_steady
- set var_iemgui_snd [concat iemgui_snd_$vid]
- global $var_iemgui_snd
- set var_iemgui_rcv [concat iemgui_rcv_$vid]
- global $var_iemgui_rcv
- set var_iemgui_gui_nam [concat iemgui_gui_nam_$vid]
- global $var_iemgui_gui_nam
- set var_iemgui_gn_dx [concat iemgui_gn_dx_$vid]
- global $var_iemgui_gn_dx
- set var_iemgui_gn_dy [concat iemgui_gn_dy_$vid]
- global $var_iemgui_gn_dy
- set var_iemgui_gn_f [concat iemgui_gn_f_$vid]
- global $var_iemgui_gn_f
- set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid]
- global $var_iemgui_gn_fs
- set var_iemgui_bcol [concat iemgui_bcol_$vid]
- global $var_iemgui_bcol
- set var_iemgui_fcol [concat iemgui_fcol_$vid]
- global $var_iemgui_fcol
- set var_iemgui_lcol [concat iemgui_lcol_$vid]
- global $var_iemgui_lcol
-
- iemgui_clip_dim $id
- iemgui_clip_num $id
- iemgui_sched_rng $id
- iemgui_verify_rng $id
- iemgui_sched_rng $id
- iemgui_clip_fontsize $id
-
- if {[eval concat $$var_iemgui_snd] == ""} {set hhhsnd "empty"} else {set hhhsnd [eval concat $$var_iemgui_snd]}
- if {[eval concat $$var_iemgui_rcv] == ""} {set hhhrcv "empty"} else {set hhhrcv [eval concat $$var_iemgui_rcv]}
- if {[eval concat $$var_iemgui_gui_nam] == ""} {set hhhgui_nam "empty"
- } else {
- set hhhgui_nam [eval concat $$var_iemgui_gui_nam]}
-
- if {[string index $hhhsnd 0] == "$"} {
- set hhhsnd [string replace $hhhsnd 0 0 #] }
- if {[string index $hhhrcv 0] == "$"} {
- set hhhrcv [string replace $hhhrcv 0 0 #] }
- if {[string index $hhhgui_nam 0] == "$"} {
- set hhhgui_nam [string replace $hhhgui_nam 0 0 #] }
-
- pd [concat $id dialog \
- [eval concat $$var_iemgui_wdt] \
- [eval concat $$var_iemgui_hgt] \
- [eval concat $$var_iemgui_min_rng] \
- [eval concat $$var_iemgui_max_rng] \
- [eval concat $$var_iemgui_lin0_log1] \
- [eval concat $$var_iemgui_loadbang] \
- [eval concat $$var_iemgui_num] \
- $hhhsnd \
- $hhhrcv \
- $hhhgui_nam \
- [eval concat $$var_iemgui_gn_dx] \
- [eval concat $$var_iemgui_gn_dy] \
- [eval concat $$var_iemgui_gn_f] \
- [eval concat $$var_iemgui_gn_fs] \
- [eval concat $$var_iemgui_bcol] \
- [eval concat $$var_iemgui_fcol] \
- [eval concat $$var_iemgui_lcol] \
- [eval concat $$var_iemgui_steady] \
- \;]
-}
-
-proc iemgui_cancel {id} {pd [concat $id cancel \;]}
-
-proc iemgui_ok {id} {
- iemgui_apply $id
- iemgui_cancel $id
-}
-
-proc pdtk_iemgui_dialog {id mainheader \
- dim_header wdt min_wdt wdt_label hgt min_hgt hgt_label \
- rng_header min_rng min_rng_label max_rng max_rng_label rng_sched \
- lin0_log1 lilo0_label lilo1_label loadbang steady num_label num \
- snd rcv \
- gui_name \
- gn_dx gn_dy \
- gn_f gn_fs \
- bcol fcol lcol} {
-
- set vid [string trimleft $id .]
-
- set var_iemgui_wdt [concat iemgui_wdt_$vid]
- global $var_iemgui_wdt
- set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid]
- global $var_iemgui_min_wdt
- set var_iemgui_hgt [concat iemgui_hgt_$vid]
- global $var_iemgui_hgt
- set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid]
- global $var_iemgui_min_hgt
- set var_iemgui_min_rng [concat iemgui_min_rng_$vid]
- global $var_iemgui_min_rng
- set var_iemgui_max_rng [concat iemgui_max_rng_$vid]
- global $var_iemgui_max_rng
- set var_iemgui_rng_sch [concat iemgui_rng_sch_$vid]
- global $var_iemgui_rng_sch
- set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid]
- global $var_iemgui_lin0_log1
- set var_iemgui_lilo0 [concat iemgui_lilo0_$vid]
- global $var_iemgui_lilo0
- set var_iemgui_lilo1 [concat iemgui_lilo1_$vid]
- global $var_iemgui_lilo1
- set var_iemgui_loadbang [concat iemgui_loadbang_$vid]
- global $var_iemgui_loadbang
- set var_iemgui_num [concat iemgui_num_$vid]
- global $var_iemgui_num
- set var_iemgui_steady [concat iemgui_steady_$vid]
- global $var_iemgui_steady
- set var_iemgui_snd [concat iemgui_snd_$vid]
- global $var_iemgui_snd
- set var_iemgui_rcv [concat iemgui_rcv_$vid]
- global $var_iemgui_rcv
- set var_iemgui_gui_nam [concat iemgui_gui_nam_$vid]
- global $var_iemgui_gui_nam
- set var_iemgui_gn_dx [concat iemgui_gn_dx_$vid]
- global $var_iemgui_gn_dx
- set var_iemgui_gn_dy [concat iemgui_gn_dy_$vid]
- global $var_iemgui_gn_dy
- set var_iemgui_gn_f [concat iemgui_gn_f_$vid]
- global $var_iemgui_gn_f
- set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid]
- global $var_iemgui_gn_fs
- set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid]
- global $var_iemgui_l2_f1_b0
- set var_iemgui_bcol [concat iemgui_bcol_$vid]
- global $var_iemgui_bcol
- set var_iemgui_fcol [concat iemgui_fcol_$vid]
- global $var_iemgui_fcol
- set var_iemgui_lcol [concat iemgui_lcol_$vid]
- global $var_iemgui_lcol
-
- set $var_iemgui_wdt $wdt
- set $var_iemgui_min_wdt $min_wdt
- set $var_iemgui_hgt $hgt
- set $var_iemgui_min_hgt $min_hgt
- set $var_iemgui_min_rng $min_rng
- set $var_iemgui_max_rng $max_rng
- set $var_iemgui_rng_sch $rng_sched
- set $var_iemgui_lin0_log1 $lin0_log1
- set $var_iemgui_lilo0 $lilo0_label
- set $var_iemgui_lilo1 $lilo1_label
- set $var_iemgui_loadbang $loadbang
- set $var_iemgui_num $num
- set $var_iemgui_steady $steady
- if {$snd == "empty"} {set $var_iemgui_snd [format ""]
- } else {set $var_iemgui_snd [format "%s" $snd]}
- if {$rcv == "empty"} {set $var_iemgui_rcv [format ""]
- } else {set $var_iemgui_rcv [format "%s" $rcv]}
- if {$gui_name == "empty"} {set $var_iemgui_gui_nam [format ""]
- } else {set $var_iemgui_gui_nam [format "%s" $gui_name]}
-
- if {[string index [eval concat $$var_iemgui_snd] 0] == "#"} {
- set $var_iemgui_snd [string replace [eval concat $$var_iemgui_snd] 0 0 $] }
- if {[string index [eval concat $$var_iemgui_rcv] 0] == "#"} {
- set $var_iemgui_rcv [string replace [eval concat $$var_iemgui_rcv] 0 0 $] }
- if {[string index [eval concat $$var_iemgui_gui_nam] 0] == "#"} {
- set $var_iemgui_gui_nam [string replace [eval concat $$var_iemgui_gui_nam] 0 0 $] }
- set $var_iemgui_gn_dx $gn_dx
- set $var_iemgui_gn_dy $gn_dy
- set $var_iemgui_gn_f $gn_f
- set $var_iemgui_gn_fs $gn_fs
-
- set $var_iemgui_bcol $bcol
- set $var_iemgui_fcol $fcol
- set $var_iemgui_lcol $lcol
-
- set $var_iemgui_l2_f1_b0 0
-
- toplevel $id
- wm title $id [format "%s-PROPERTIES" $mainheader]
- wm protocol $id WM_DELETE_WINDOW [concat iemgui_cancel $id]
-
- frame $id.dim
- pack $id.dim -side top
- label $id.dim.head -text $dim_header
- label $id.dim.w_lab -text $wdt_label -width 6
- entry $id.dim.w_ent -textvariable $var_iemgui_wdt -width 5
- label $id.dim.dummy1 -text " " -width 10
- label $id.dim.h_lab -text $hgt_label -width 6
- entry $id.dim.h_ent -textvariable $var_iemgui_hgt -width 5
- pack $id.dim.head -side top
- pack $id.dim.w_lab $id.dim.w_ent $id.dim.dummy1 -side left
- if { $hgt_label != "empty" } {
- pack $id.dim.h_lab $id.dim.h_ent -side left}
-
- frame $id.rng
- pack $id.rng -side top
- label $id.rng.head -text $rng_header
- label $id.rng.min_lab -text $min_rng_label -width 6
- entry $id.rng.min_ent -textvariable $var_iemgui_min_rng -width 9
- label $id.rng.dummy1 -text " " -width 1
- label $id.rng.max_lab -text $max_rng_label -width 8
- entry $id.rng.max_ent -textvariable $var_iemgui_max_rng -width 9
- if { $rng_header != "empty" } {
- pack $id.rng.head -side top
- if { $min_rng_label != "empty" } {
- pack $id.rng.min_lab $id.rng.min_ent -side left}
- if { $max_rng_label != "empty" } {
- pack $id.rng.dummy1 \
- $id.rng.max_lab $id.rng.max_ent -side left} }
-
- if { [eval concat $$var_iemgui_lin0_log1] >= 0 || [eval concat $$var_iemgui_loadbang] >= 0 || [eval concat $$var_iemgui_num] > 0 || [eval concat $$var_iemgui_steady] >= 0 } {
- label $id.space1 -text "---------------------------------"
- pack $id.space1 -side top }
-
- frame $id.para
- pack $id.para -side top
- label $id.para.dummy2 -text "" -width 1
- label $id.para.dummy3 -text "" -width 1
- if {[eval concat $$var_iemgui_lin0_log1] == 0} {
- button $id.para.lilo -text [eval concat $$var_iemgui_lilo0] -width 5 -command "iemgui_lilo $id" }
- if {[eval concat $$var_iemgui_lin0_log1] == 1} {
- button $id.para.lilo -text [eval concat $$var_iemgui_lilo1] -width 5 -command "iemgui_lilo $id" }
- if {[eval concat $$var_iemgui_loadbang] == 0} {
- button $id.para.lb -text "no init" -width 5 -command "iemgui_lb $id" }
- if {[eval concat $$var_iemgui_loadbang] == 1} {
- button $id.para.lb -text "init" -width 5 -command "iemgui_lb $id" }
- label $id.para.num_lab -text $num_label -width 9
- entry $id.para.num_ent -textvariable $var_iemgui_num -width 4
- if {[eval concat $$var_iemgui_steady] == 0} {
- button $id.para.stdy_jmp -text "jump on click" -width 11 -command "iemgui_stdy_jmp $id" }
- if {[eval concat $$var_iemgui_steady] == 1} {
- button $id.para.stdy_jmp -text "steady on click" -width 11 -command "iemgui_stdy_jmp $id" }
- if {[eval concat $$var_iemgui_lin0_log1] >= 0} {
- pack $id.para.lilo -side left -expand 1}
- if {[eval concat $$var_iemgui_loadbang] >= 0} {
- pack $id.para.dummy2 $id.para.lb -side left -expand 1}
- if {[eval concat $$var_iemgui_num] > 0} {
- pack $id.para.dummy3 $id.para.num_lab $id.para.num_ent -side left -expand 1}
- if {[eval concat $$var_iemgui_steady] >= 0} {
- pack $id.para.dummy3 $id.para.stdy_jmp -side left -expand 1}
- if { $snd != "nosndno" || $rcv != "norcvno" } {
- label $id.space2 -text "---------------------------------"
- pack $id.space2 -side top }
-
- frame $id.snd
- pack $id.snd -side top
- label $id.snd.dummy1 -text "" -width 2
- label $id.snd.lab -text "send-symbol:" -width 12
- entry $id.snd.ent -textvariable $var_iemgui_snd -width 20
- if { $snd != "nosndno" } {
- pack $id.snd.dummy1 $id.snd.lab $id.snd.ent -side left}
-
- frame $id.rcv
- pack $id.rcv -side top
- label $id.rcv.lab -text "receive-symbol:" -width 15
- entry $id.rcv.ent -textvariable $var_iemgui_rcv -width 20
- if { $rcv != "norcvno" } {
- pack $id.rcv.lab $id.rcv.ent -side left}
-
- frame $id.gnam
- pack $id.gnam -side top
- label $id.gnam.head -text "--------------label:---------------"
- label $id.gnam.dummy1 -text "" -width 1
- label $id.gnam.lab -text "name:" -width 6
- entry $id.gnam.ent -textvariable $var_iemgui_gui_nam -width 29
- label $id.gnam.dummy2 -text "" -width 1
- pack $id.gnam.head -side top
- pack $id.gnam.dummy1 $id.gnam.lab $id.gnam.ent $id.gnam.dummy2 -side left
-
- frame $id.gnxy
- pack $id.gnxy -side top
- label $id.gnxy.x_lab -text "x_off:" -width 6
- entry $id.gnxy.x_ent -textvariable $var_iemgui_gn_dx -width 5
- label $id.gnxy.dummy1 -text " " -width 10
- label $id.gnxy.y_lab -text "y_off:" -width 6
- entry $id.gnxy.y_ent -textvariable $var_iemgui_gn_dy -width 5
- pack $id.gnxy.x_lab $id.gnxy.x_ent $id.gnxy.dummy1 \
- $id.gnxy.y_lab $id.gnxy.y_ent -side left
-
- frame $id.gnfs
- pack $id.gnfs -side top
- label $id.gnfs.f_lab -text "font:" -width 6
- if {[eval concat $$var_iemgui_gn_f] == 0} {
- button $id.gnfs.fb -text "courier" -font {courier 10 bold} -width 7 -command "iemgui_toggle_font $id" }
- if {[eval concat $$var_iemgui_gn_f] == 1} {
- button $id.gnfs.fb -text "helvetica" -font {helvetica 10 bold} -width 7 -command "iemgui_toggle_font $id" }
- if {[eval concat $$var_iemgui_gn_f] == 2} {
- button $id.gnfs.fb -text "times" -font {times 10 bold} -width 7 -command "iemgui_toggle_font $id" }
- label $id.gnfs.dummy1 -text "" -width 1
- label $id.gnfs.fs_lab -text "fontsize:" -width 8
- entry $id.gnfs.fs_ent -textvariable $var_iemgui_gn_fs -width 5
- pack $id.gnfs.f_lab $id.gnfs.fb $id.gnfs.dummy1 \
- $id.gnfs.fs_lab $id.gnfs.fs_ent -side left
-
- label $id.col_head -text "--------------colors:--------------"
- pack $id.col_head -side top
-
- frame $id.col_select
- pack $id.col_select -side top
- radiobutton $id.col_select.radio0 -value 0 -variable $var_iemgui_l2_f1_b0 \
- -text "backgd" -width 5
- radiobutton $id.col_select.radio1 -value 1 -variable $var_iemgui_l2_f1_b0 \
- -text "front" -width 5
- radiobutton $id.col_select.radio2 -value 2 -variable $var_iemgui_l2_f1_b0 \
- -text "label" -width 5
- if { [eval concat $$var_iemgui_fcol] >= 0 } {
- pack $id.col_select.radio0 $id.col_select.radio1 $id.col_select.radio2 -side left
- } else {pack $id.col_select.radio0 $id.col_select.radio2 -side left}
-
- frame $id.col_example_choose
- pack $id.col_example_choose -side top
- button $id.col_example_choose.but -text "compose color" -width 10 \
- -command "iemgui_choose_col_bkfrlb $id"
- label $id.col_example_choose.dummy1 -text "" -width 1
- if { [eval concat $$var_iemgui_fcol] >= 0 } {
- button $id.col_example_choose.fr_bk -text "o=||=o" -width 5 \
- -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -foreground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] \
- -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] -pady 2
- } else {
- button $id.col_example_choose.fr_bk -text "o=||=o" -width 5 \
- -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -foreground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] -pady 2}
- button $id.col_example_choose.lb_bk -text "testlabel" -width 7 \
- -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \
- -foreground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] \
- -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] -pady 2
-
- pack $id.col_example_choose.but $id.col_example_choose.dummy1 \
- $id.col_example_choose.fr_bk $id.col_example_choose.lb_bk -side left
-
- label $id.space3 -text "------or click color preset:-------"
- pack $id.space3 -side top
-
- frame $id.bcol
- pack $id.bcol -side top
- foreach i { 0 1 2 3 4 5 6 7 8 9 } hexcol { 16579836 14737632 12369084 \
- 16572640 16572608 16579784 14220504 14220540 14476540 16308476 } {
- button $id.bcol.c$i -background [format "#%6.6x" $hexcol] \
- -activebackground [format "#%6.6x" $hexcol] \
- -font {courier 2 normal} -padx 7 -pady 6 \
- -command [format "iemgui_preset_col %s %d" $id $hexcol] }
- pack $id.bcol.c0 $id.bcol.c1 $id.bcol.c2 $id.bcol.c3 $id.bcol.c4 \
- $id.bcol.c5 $id.bcol.c6 $id.bcol.c7 $id.bcol.c8 $id.bcol.c9 -side left
-
- frame $id.fcol
- pack $id.fcol -side top
- foreach i { 0 1 2 3 4 5 6 7 8 9 } hexcol { 10526880 8158332 6316128 \
- 16525352 16559172 15263784 1370132 2684148 3952892 16003312 } {
- button $id.fcol.c$i -background [format "#%6.6x" $hexcol] \
- -activebackground [format "#%6.6x" $hexcol] \
- -font {courier 2 normal} -padx 7 -pady 6 \
- -command [format "iemgui_preset_col %s %d" $id $hexcol] }
- pack $id.fcol.c0 $id.fcol.c1 $id.fcol.c2 $id.fcol.c3 $id.fcol.c4 \
- $id.fcol.c5 $id.fcol.c6 $id.fcol.c7 $id.fcol.c8 $id.fcol.c9 -side left
-
- frame $id.lcol
- pack $id.lcol -side top
- foreach i { 0 1 2 3 4 5 6 7 8 9 } hexcol { 4210752 2105376 0 \
- 9177096 5779456 7874580 2641940 17488 5256 5767248 } {
- button $id.lcol.c$i -background [format "#%6.6x" $hexcol] \
- -activebackground [format "#%6.6x" $hexcol] \
- -font {courier 2 normal} -padx 7 -pady 6 \
- -command [format "iemgui_preset_col %s %d" $id $hexcol] }
- pack $id.lcol.c0 $id.lcol.c1 $id.lcol.c2 $id.lcol.c3 $id.lcol.c4 \
- $id.lcol.c5 $id.lcol.c6 $id.lcol.c7 $id.lcol.c8 $id.lcol.c9 -side left
-
-
- label $id.space4 -text "---------------------------------"
- pack $id.space4 -side top
-
- frame $id.cao
- pack $id.cao -side top
- button $id.cao.cancel -text {Cancel} -width 6 \
- -command "iemgui_cancel $id"
- label $id.cao.dummy1 -text "" -width 3
- button $id.cao.apply -text {Apply} -width 6 \
- -command "iemgui_apply $id"
- label $id.cao.dummy2 -text "" -width 3
- button $id.cao.ok -text {OK} -width 6 \
- -command "iemgui_ok $id"
- pack $id.cao.cancel $id.cao.dummy1 \
- $id.cao.apply $id.cao.dummy2 \
- $id.cao.ok -side left
-
- label $id.space5 -text ""
- pack $id.space5 -side top
-
- bind $id.dim.w_ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.dim.h_ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.rng.min_ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.rng.max_ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.para.num_ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.snd.ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.rcv.ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.gnam.ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.gnxy.x_ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.gnxy.y_ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.gnfs.fs_ent <KeyPress-Return> [concat iemgui_ok $id]
- bind $id.cao.ok <KeyPress-Return> [concat iemgui_ok $id]
-
- $id.dim.w_ent select from 0
- $id.dim.w_ent select adjust end
- focus $id.dim.w_ent
-}
-# end of change "iemlib"
-
-############ pdtk_array_dialog -- dialog window for arrays #########
-proc array_apply {id} {
-# strip "." from the TK id to make a variable name suffix
- set vid [string trimleft $id .]
-# for each variable, make a local variable to hold its name...
- set var_array_name [concat array_name_$vid]
- global $var_array_name
- set var_array_n [concat array_n_$vid]
- global $var_array_n
- set var_array_saveit [concat array_saveit_$vid]
- global $var_array_saveit
- set var_array_otherflag [concat array_otherflag_$vid]
- global $var_array_otherflag
- set mofo [eval concat $$var_array_name]
- if {[string index $mofo 0] == "$"} {
- set mofo [string replace $mofo 0 0 #] }
-
- pd [concat $id arraydialog $mofo \
- [eval concat $$var_array_n] \
- [eval concat $$var_array_saveit] \
- [eval concat $$var_array_otherflag] \
- \;]
-}
-
-proc array_cancel {id} {
- set cmd [concat $id cancel \;]
- pd $cmd
-}
-
-proc array_ok {id} {
- array_apply $id
- array_cancel $id
-}
-
-proc pdtk_array_dialog {id name n saveit newone} {
- set vid [string trimleft $id .]
-
- set var_array_name [concat array_name_$vid]
- global $var_array_name
- set var_array_n [concat array_n_$vid]
- global $var_array_n
- set var_array_saveit [concat array_saveit_$vid]
- global $var_array_saveit
- set var_array_otherflag [concat array_otherflag_$vid]
- global $var_array_otherflag
-
- set $var_array_name $name
- set $var_array_n $n
- set $var_array_saveit $saveit
- set $var_array_otherflag 0
-
- toplevel $id
- wm title $id {array}
- wm protocol $id WM_DELETE_WINDOW [concat array_cancel $id]
-
- frame $id.name
- pack $id.name -side top
- label $id.name.label -text "name"
- entry $id.name.entry -textvariable $var_array_name
- pack $id.name.label $id.name.entry -side left
-
- frame $id.n
- pack $id.n -side top
- label $id.n.label -text "size"
- entry $id.n.entry -textvariable $var_array_n
- pack $id.n.label $id.n.entry -side left
-
- checkbutton $id.saveme -text {save contents} -variable $var_array_saveit \
- -anchor w
- pack $id.saveme -side top
-
- if {$newone != 0} {
- frame $id.radio
- pack $id.radio -side top
- radiobutton $id.radio.radio0 -value 0 \
- -variable $var_array_otherflag \
- -text "in new graph"
- radiobutton $id.radio.radio1 -value 1 \
- -variable $var_array_otherflag \
- -text "in last graph"
- pack $id.radio.radio0 -side top -anchor w
- pack $id.radio.radio1 -side top -anchor w
- } else {
- checkbutton $id.deleteme -text {delete me} \
- -variable $var_array_otherflag -anchor w
- pack $id.deleteme -side top
- }
- frame $id.buttonframe
- pack $id.buttonframe -side bottom -fill x -pady 2m
- button $id.buttonframe.cancel -text {Cancel}\
- -command "array_cancel $id"
- if {$newone == 0} {button $id.buttonframe.apply -text {Apply}\
- -command "array_apply $id"}
- button $id.buttonframe.ok -text {OK}\
- -command "array_ok $id"
- pack $id.buttonframe.cancel -side left -expand 1
- if {$newone == 0} {pack $id.buttonframe.apply -side left -expand 1}
- pack $id.buttonframe.ok -side left -expand 1
-
- bind $id.name.entry <KeyPress-Return> [concat array_ok $id]
- bind $id.n.entry <KeyPress-Return> [concat array_ok $id]
- $id.name.entry select from 0
- $id.name.entry select adjust end
- focus $id.name.entry
-}
-
-############ pdtk_canvas_dialog -- dialog window for canvass #########
-proc canvas_apply {id} {
-# strip "." from the TK id to make a variable name suffix
- set vid [string trimleft $id .]
-# for each variable, make a local variable to hold its name...
- set var_canvas_xscale [concat canvas_xscale_$vid]
- global $var_canvas_xscale
- set var_canvas_yscale [concat canvas_yscale_$vid]
- global $var_canvas_yscale
- set var_canvas_graphme [concat canvas_graphme_$vid]
- global $var_canvas_graphme
-# set var_canvas_stretch [concat canvas_stretch_$vid]
-# global $var_canvas_stretch
- pd [concat $id donecanvasdialog \
- [eval concat $$var_canvas_xscale] \
- [eval concat $$var_canvas_yscale] \
- [eval concat $$var_canvas_graphme] \
- \;]
-}
-
-proc canvas_cancel {id} {
- set cmd [concat $id cancel \;]
- pd $cmd
-}
-
-proc canvas_ok {id} {
- canvas_apply $id
- canvas_cancel $id
-}
-
-proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
- set vid [string trimleft $id .]
-
- set var_canvas_xscale [concat canvas_xscale_$vid]
- global $var_canvas_xscale
- set var_canvas_yscale [concat canvas_yscale_$vid]
- global $var_canvas_yscale
- set var_canvas_graphme [concat canvas_graphme_$vid]
- global $var_canvas_graphme
-# set var_canvas_stretch [concat canvas_stretch_$vid]
-# global $var_canvas_stretch
-
- set $var_canvas_xscale $xscale
- set $var_canvas_yscale $yscale
- set $var_canvas_graphme $graphme
-# set $var_canvas_stretch $stretch
-
- toplevel $id
- wm title $id {canvas}
- wm protocol $id WM_DELETE_WINDOW [concat canvas_cancel $id]
-
- frame $id.xscale
- pack $id.xscale -side top
- label $id.xscale.label -text "X units per pixel"
- entry $id.xscale.entry -textvariable $var_canvas_xscale -width 10
- pack $id.xscale.label $id.xscale.entry -side left
-
- frame $id.yscale
- pack $id.yscale -side top
- label $id.yscale.label -text "Y units per pixel"
- entry $id.yscale.entry -textvariable $var_canvas_yscale -width 10
- pack $id.yscale.label $id.yscale.entry -side left
-
- checkbutton $id.graphme -text {graph on parent} \
- -variable $var_canvas_graphme -anchor w
- pack $id.graphme -side top
-
-# checkbutton $id.stretch -text {stretch on resize} \
-# -variable $var_canvas_stretch -anchor w
-# pack $id.stretch -side top
-
-
- frame $id.buttonframe
- pack $id.buttonframe -side bottom -fill x -pady 2m
- button $id.buttonframe.cancel -text {Cancel}\
- -command "canvas_cancel $id"
- button $id.buttonframe.apply -text {Apply}\
- -command "canvas_apply $id"
- button $id.buttonframe.ok -text {OK}\
- -command "canvas_ok $id"
- pack $id.buttonframe.cancel -side left -expand 1
- pack $id.buttonframe.apply -side left -expand 1
- pack $id.buttonframe.ok -side left -expand 1
-
- bind $id.xscale.entry <KeyPress-Return> [concat canvas_ok $id]
- bind $id.yscale.entry <KeyPress-Return> [concat canvas_ok $id]
- $id.xscale.entry select from 0
- $id.xscale.entry select adjust end
- focus $id.xscale.entry
-}
-
-############ pdtk_data_dialog -- run a data dialog #########
-proc dodata_send {name} {
-# puts stderr [$name.text get 0.0 end]
-
- for {set i 1} {[$name.text compare [concat $i.0 + 3 chars] < end]} \
- {incr i 1} {
-# puts stderr [concat it's [$name.text get $i.0 [expr $i + 1].0]]
- set cmd [concat $name data [$name.text get $i.0 [expr $i + 1].0] \;]
-# puts stderr $cmd
- pd $cmd
- }
- set cmd [concat $name end \;]
-# puts stderr $cmd
- pd $cmd
-}
-
-proc dodata_cancel {name} {
- set cmd [concat $name cancel \;]
-# puts stderr $cmd
- pd $cmd
-}
-
-proc dodata_ok {name} {
- dodata_send $name
- dodata_cancel $name
-}
-
-proc pdtk_data_dialog {name stuff} {
-
- toplevel $name
- wm title $name {Atom}
- wm protocol $name WM_DELETE_WINDOW [concat dodata_cancel $name]
-
- frame $name.buttonframe
- pack $name.buttonframe -side bottom -fill x -pady 2m
- button $name.buttonframe.send -text {Send (Ctrl s)}\
- -command [concat dodata_send $name]
- button $name.buttonframe.ok -text {OK (Ctrl t)}\
- -command [concat dodata_ok $name]
- pack $name.buttonframe.send -side left -expand 1
- pack $name.buttonframe.ok -side left -expand 1
-
- text $name.text -relief raised -bd 2 -height 40 -width 60 \
- -yscrollcommand "$name.scroll set" -font fixed
- scrollbar $name.scroll -command "$name.text yview"
- pack $name.scroll -side right -fill y
- pack $name.text -side left -fill both -expand 1
- $name.text insert end $stuff
- focus $name.text
- bind $name.text <Control-t> [concat dodata_ok $name]
- bind $name.text <Control-s> [concat dodata_send $name]
-}
-
-############ check or uncheck the "edit" menu item ##############
-#####################iemlib#######################
-proc pdtk_canvas_editval {name value} {
- if { $value } {
- $name.m.edit.m entryconfigure "Edit mode" -indicatoron true
- } else {
- $name.m.edit.m entryconfigure "Edit mode" -indicatoron false
- }
-}
-
-proc pdtk_canvas_protectval {name value} {
- if { $value } {
- $name.m.edit.m entryconfigure "Protect" -indicatoron true
- } else {
- $name.m.edit.m entryconfigure "Protect" -indicatoron false
- }
-}
-#####################iemlib#######################
-
-############ pdtk_text_new -- create a new text object #2###########
-proc pdtk_text_new {canvasname myname x y text font color} {
-# if {$font < 13} {set fontname [format fixed $font]}
-# if {$font >= 13} {set fontname [format fixed $font]}
- $canvasname create text $x $y \
- -font [format fixed $font] \
- -tags $myname -text $text -fill $color -anchor nw
-# pd [concat $myname size [$canvasname bbox $myname] \;]
-}
-
-################ pdtk_text_set -- change the text ##################
-proc pdtk_text_set {canvasname myname text} {
- $canvasname itemconfig $myname -text $text
-# pd [concat $myname size [$canvasname bbox $myname] \;]
-}
-
-############### event binding procedures for Pd window ################
-
-proc pdtk_pd_ctrlkey {name key shift} {
-# puts stderr [concat key $key shift $shift]
-# .dummy itemconfig goo -text [concat ---> control-key event $key];
- if {$key == "n" || $key == "N"} {menu_new}
- if {$key == "o" || $key == "O"} {menu_open}
- if {$key == "m" || $key == "M"} {menu_send}
- if {$key == "q" || $key == "Q"} {
- if {$shift == 1} {menu_really_quit} else {menu_quit}
- }
- if {$key == "slash"} {menu_audio 1}
- if {$key == "period"} {menu_audio 0}
-}
-
-######### startup function. ##############
-# Tell pd the current directory; this is used in case the command line
-# asked pd to open something. Also, get character width and height for
-# font sizes 8, 10, 12, 14, 16, and 24.
-
-proc pdtk_pd_startup {version} {
- global pd_myversion
- set pd_myversion $version
-
- set width1 [font measure fixed x]
- set height1 [lindex [font metrics fixed] 5]
-
- set width2 [font measure fixed x]
- set height2 [lindex [font metrics fixed] 5]
-
- set width3 [font measure fixed x]
- set height3 [lindex [font metrics fixed] 5]
-
- set width4 [font measure fixed x]
- set height4 [lindex [font metrics fixed] 5]
-
- set width5 [font measure fixed x]
- set height5 [lindex [font metrics fixed] 5]
-
- set width6 [font measure fixed x]
- set height6 [lindex [font metrics fixed] 5]
-
- set width7 [font measure fixed x]
- set height7 [lindex [font metrics fixed] 5]
-
- pd [concat pd init [pdtk_enquote [pwd]] \
- 8 $width1 $height1 \
- 10 $width2 $height2 \
- 12 $width3 $height3 \
- 14 $width4 $height4 \
- 16 $width5 $height5 \
- 24 $width6 $height6 \
- 36 $width7 $height7 \
- \;];
-}
-
-##################### DSP ON/OFF, METERS, DIO ERROR ###################
-proc pdtk_pd_dsp {value} {
- global ctrls_audio_on
- if {$value == "ON"} {set ctrls_audio_on 1} else {set ctrls_audio_on 0}
-# puts stderr [concat its $ctrls_audio_on]
-}
-
-proc pdtk_pd_meters {indb outdb inclip outclip} {
-# puts stderr [concat meters $indb $outdb $inclip $outclip]
- global ctrls_inlevel ctrls_outlevel
- set ctrls_inlevel $indb
- if {$inclip == 1} {
- .controls.in.clip configure -background red
- } else {
- .controls.in.clip configure -background grey
- }
- set ctrls_outlevel $outdb
- if {$outclip == 1} {
- .controls.out.clip configure -background red
- } else {
- .controls.out.clip configure -background grey
- }
-
-}
-
-proc pdtk_pd_dio {red} {
-# puts stderr [concat dio $red]
- if {$red == 1} {
- .controls.dio configure -background red -activebackground red
- } else {
- .controls.dio configure -background grey -activebackground lightgrey
- }
-
-}
-
-############# text editing from the "edit" menu ###################
-set edit_number 1
-
-proc texteditor_send {name} {
- set topname [string trimright $name .text]
- for {set i 0} \
- {[$name compare [concat 0.0 + [expr $i + 1] chars] < end]} \
- {incr i 1} {
- set cha [$name get [concat 0.0 + $i chars]]
- scan $cha %c keynum
- pd [concat pd key 1 $keynum \;]
- }
-}
-
-proc texteditor_ok {name} {
- set topname [string trimright $name .text]
- texteditor_send $name
- destroy $topname
-}
-
-
-proc pdtk_pd_texteditor {stuff} {
- global edit_number
- set name [format ".text%d" $edit_number]
- set edit_number [expr $edit_number + 1]
-
- toplevel $name
- wm title $name {TEXT}
-
- frame $name.buttons
- pack $name.buttons -side bottom -fill x -pady 2m
- button $name.buttons.send -text {Send (Ctrl s)}\
- -command "texteditor_send $name.text"
- button $name.buttons.ok -text {OK (Ctrl t)}\
- -command "texteditor_ok $name.text"
- pack $name.buttons.send -side left -expand 1
- pack $name.buttons.ok -side left -expand 1
-
- text $name.text -relief raised -bd 2 -height 12 -width 60 \
- -yscrollcommand "$name.scroll set" -font fixed
- scrollbar $name.scroll -command "$name.text yview"
- pack $name.scroll -side right -fill y
- pack $name.text -side left -fill both -expand 1
- $name.text insert end $stuff
- focus $name.text
- bind $name.text <Control-t> {texteditor_ok %W}
- bind $name.text <Control-s> {texteditor_send %W}
-}
-
-############# open and save dialogs for objects in Pd ##########
-
-proc pdtk_openpanel {target} {
- global pd_opendir
- global pd_nt
- if {$pd_nt == 2} {
- cd $pd_opendir
- set filename [tk_getOpenFile ]
- } else {
- set filename [tk_getOpenFile \
- -initialdir $pd_opendir]
- }
- if {$filename != ""} {
- set directory [string range $filename 0 \
- [expr [string last / $filename ] - 1]]
- set pd_opendir $directory
-
- pd [concat $target symbol [pdtk_enquote $filename] \;]
- }
-}
-
-proc pdtk_savepanel {target} {
- set filename [tk_getSaveFile]
- if {$filename != ""} {
- pd [concat $target symbol [pdtk_enquote $filename] \;]
- }
-}
-
-########################### comport hack ########################
-
-set com1 0
-set com2 0
-set com3 0
-set com4 0
-
-proc com1_open {} {
- global com1
- set com1 [open com1 w]
- .dummy itemconfig goo -text $com1
- fconfigure $com1 -buffering none
- fconfigure $com1 -mode 19200,e,8,2
-}
-
-proc com1_send {str} {
- global com1
- puts -nonewline $com1 $str
-}
-
-
-############# start a polling process to watch the socket ##############
-# this is needed for nt, and presumably for Mac as well.
-# in UNIX this is handled by a tcl callback (set up in t_tkcmd.c)
-
-if {$pd_nt == 1} {
- proc polleofloop {} {
- pd_pollsocket
- after 20 polleofloop
- }
-
- polleofloop
-}
-
diff --git a/pd/src/x_connective.c b/pd/src/x_connective.c
index 2b28f052..f5173d6e 100644
--- a/pd/src/x_connective.c
+++ b/pd/src/x_connective.c
@@ -128,6 +128,22 @@ static void pdsymbol_anything(t_pdsymbol *x, t_symbol *s, int ac, t_atom *av)
outlet_symbol(x->x_obj.ob_outlet, x->x_s = s);
}
+ /* For "list" message don't just output "list"; if empty, we want to
+ bang the symbol and if it starts with a symbol, we output that.
+ Otherwise it's not clear what we should do so we just go for the
+ "anything" method. LATER figure out if there are other places where
+ empty lists aren't equivalent to "bang"??? Should Pd's message passer
+ always check and call the more specific method, or should it be the
+ object's responsibility? Dunno... */
+static void pdsymbol_list(t_pdsymbol *x, t_symbol *s, int ac, t_atom *av)
+{
+ if (!ac)
+ pdsymbol_bang(x);
+ else if (av->a_type == A_SYMBOL)
+ pdsymbol_symbol(x, av->a_w.w_symbol);
+ else pdsymbol_anything(x, s, ac, av);
+}
+
void pdsymbol_setup(void)
{
pdsymbol_class = class_new(gensym("symbol"), (t_newmethod)pdsymbol_new, 0,
@@ -1215,6 +1231,11 @@ static void makefilename_symbol(t_makefilename *x, t_symbol *s)
outlet_symbol(x->x_obj.ob_outlet, gensym(buf));
}
+static void makefilename_set(t_makefilename *x, t_symbol *s)
+{
+ x->x_format = s;
+}
+
static void makefilename_setup(void)
{
makefilename_class = class_new(gensym("makefilename"),
@@ -1222,6 +1243,8 @@ static void makefilename_setup(void)
sizeof(t_makefilename), 0, A_DEFSYM, 0);
class_addfloat(makefilename_class, makefilename_float);
class_addsymbol(makefilename_class, makefilename_symbol);
+ class_addmethod(makefilename_class, (t_method)makefilename_set,
+ gensym("set"), A_SYMBOL, 0);
}
/* -------------------------- swap ------------------------------ */
diff --git a/pd/src/x_gui.c b/pd/src/x_gui.c
index 03e1b0dd..b469467a 100644
--- a/pd/src/x_gui.c
+++ b/pd/src/x_gui.c
@@ -48,19 +48,15 @@ void gfxstub_new(t_pd *owner, void *key, const char *cmd)
char namebuf[80];
t_gfxstub *x;
t_symbol *s;
- /* if any exists with matching key, no need to make a
- new one; just tell tk to send it front. */
+ /* if any exists with matching key, burn it. */
for (x = gfxstub_list; x; x = x->x_next)
- {
if (x->x_key == key)
- {
- sys_vgui("raise .gfxstub%x\n", x);
- sys_vgui("focus .gfxstub%x\n", x);
- return;
- }
- }
- if (strlen(cmd) + 84 > MAXPDSTRING)
+ gfxstub_deleteforkey(key);
+ if (strlen(cmd) + 50 > MAXPDSTRING)
+ {
+ bug("audio dialog too long");
return;
+ }
x = (t_gfxstub *)pd_new(gfxstub_class);
sprintf(namebuf, ".gfxstub%x", (t_int)x);
diff --git a/pd/src/z.pd b/pd/src/z.pd
deleted file mode 100644
index 22c5b0d9..00000000
--- a/pd/src/z.pd
+++ /dev/null
@@ -1,9 +0,0 @@
-#N canvas 0 0 450 300 10;
-#X obj 111 114 +~;
-#X obj 112 56 +~;
-#N canvas 281 44 450 300 foo 1;
-#X obj 111 114 +~;
-#X obj 112 56 +~;
-#X connect 1 0 0 0;
-#X restore 206 67 pd foo;
-#X connect 1 0 0 0;
diff --git a/pd/src/z2.pd b/pd/src/z2.pd
deleted file mode 100644
index c49a070f..00000000
--- a/pd/src/z2.pd
+++ /dev/null
@@ -1,3 +0,0 @@
-#N canvas 0 0 450 300 10;
-#X obj 114 57 1;
-#X obj 111 114 1;
diff --git a/pd/src/z3.pd b/pd/src/z3.pd
deleted file mode 100644
index 837a79c0..00000000
--- a/pd/src/z3.pd
+++ /dev/null
@@ -1,17 +0,0 @@
-#N canvas 0 0 450 300 10;
-#X floatatom 87 39 5 0 0 0 - - -;
-#X floatatom 294 40 5 0 0 0 - - -;
-#X obj 88 75 vdl 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 -1
-1;
-#X obj 294 69 hdl 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1 -1
-0;
-#X floatatom 88 206 5 0 0 0 - - -;
-#X floatatom 295 207 5 0 0 0 - - -;
-#X obj 172 121 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 175 91 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
--262144 -1 -1 0 256;
-#X connect 0 0 2 0;
-#X connect 1 0 3 0;
-#X connect 2 0 4 0;
-#X connect 3 0 5 0;
diff --git a/pd/src/z4.pd b/pd/src/z4.pd
deleted file mode 100644
index 653e036b..00000000
--- a/pd/src/z4.pd
+++ /dev/null
@@ -1,2 +0,0 @@
-#N canvas 140 411 616 323 12;
-#X obj 293 98 table \$1-bar 45;
diff --git a/pd/src/z5.pd b/pd/src/z5.pd
deleted file mode 100644
index 1adc7b08..00000000
--- a/pd/src/z5.pd
+++ /dev/null
@@ -1,8 +0,0 @@
-#N canvas 223 88 626 431 12;
-#N canvas 0 0 450 300 numbox 0;
-#X obj 125 47 loadbang;
-#X msg 124 75 123.456;
-#X floatatom 124 99 3 0 0;
-#X connect 0 0 1 0;
-#X connect 1 0 2 0;
-#X restore 212 48 pd numbox;
diff --git a/pd/src/z6.pd b/pd/src/z6.pd
deleted file mode 100644
index f8502dc2..00000000
--- a/pd/src/z6.pd
+++ /dev/null
@@ -1,4 +0,0 @@
-#N canvas 121 193 452 302 12;
-#X obj 101 40 inlet;
-#X obj 92 138 outlet;
-#X coords 0 0 1 1 200 140 1;