%!PS % Magic Sinewave Quantization Utilities GG27 % ========================================================= % by Don Lancaster /ggnum 27 store % Copyright c 2003 by Don Lancaster & Synergetics, Box 809, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available http://www.tinaja.com/info01.html % Linking welcome. Reposting expressly forbidden. % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 1.1 % Tutorial shows how to analyze exact quantization effects on Magic Sinewaves. % IMPORTANT NOTE: Don Lancaster's file gonzo.ps is required for this program. % After obvious location mods, uncomment ONE of the following two lines: (C:\\windows\\desktop\\gonzo\\gonzo.ps) run % use internal gonzo % (A:\\gonzo.ps) run % use external gonzo % NOTE THAT ALL PS FILENAME STRINGS !!!DEMAND!!! DOUBLE REVERSE SLASHES. % GONZO20A Guru Gonzo PostScript power tools (Interim release) % Includes gonzo justification and layout utilities. % Copyright c 1990, 1996, 2001 by Don Lancaster and Synergetics, Box 809, % Thatcher Arizona, 5552 (928) 428-4073 don@tinaja.com support % via http://www.tinaja.com All commercial rights and all electronic % media rights **FULLY** reserved. Reposting is expressly forbidden. %%%%%%%%%%% links menu directory %%%%%%%%%%%% % This code locks pdfmark commands out of a PostScript printer. /pdfmark where {pop}{userdict /pdfmark /cleartomark load put} ifelse % /surl "start url" marks the beginning of a text sequence to be urled. % It also paints the text blue... /surl {mark /blue cvx 0.33 /setgray cvx % change text to blue /currentpoint cvx % remember box start /urly /exch cvx /store cvx /urlx /exch cvx /store cvx ] cvx % complete deferred command printlist exch 3 index exch put % stuff into gonzo printlist exch 1 add exch % increment gonzo list count } def % /eurl "end url" unmarks the end of a text sequence and sets up % the pdfmark needed to define the Acrobat web link. /eurl {mark % start deferred proc exch % position url string % /black cvx 0 /setgray cvx % turn blue marker off % maintextcolor /setrgbcolor cvx % reset to main text color??? /aqua cvx /black cvx /makeurl cvx % defer call of url builder ] cvx % complete deferred proc printlist exch 3 index exch % stuff into gonzo printlist put exch 1 add exch % increment gonzo list count } def % /makeurl generates the pdfmark, receiving a {(urlstring) makeurl}. % Note that it is not called until formatted printlist time... /urlover 0.2 def % fraction of hot area over bounds /makeurl { /cururlname exch store % save the url string mark % start pdfmark currentfont /ScaleMatrix get 3 get /fsize exch store % guess height /Rect [ urlx fsize urlover mul sub % set box left x urly fsize urlover mul sub % set box left y currentpoint exch fsize urlover mul add exch fsize add ] /Border [ 0 0 0] % [0 0 0 ] = none; [0 0 2] = debug /Color [ .7 0 0 ] /Action <> /Subtype /Link /ANN % annotation type pdfmark % call pdf operators } def % /makeurlx generates the box specific pdfmark, receiving % a {(urlstring) makeurl}. % Note that it is not called until formatted printlist time... /makeurlx { /cururlnamex exch store % save the url string mark % start pdfmark /Rect [ xpos % set box left x ypos 0.9 sub % set box left y xpos 2.8 add % box right x ypos 0.9 sub 2.8 add % box right y ] /Border [ 0 0 0] % [0 0 0 ] = none; [0 0 2] = debug /Color [ .7 0 0 ] /Action <> /Subtype /Link /ANN % annotation type pdfmark % call pdf operators } def /maintextcolor {0 0 0 } def % text link specific data -- use dictionary instead below { /cubic01 {(http://www.tinaja.com/cubic01.asp) eurl} def /hack62 {(http://www.tinaja.com/glib/hack62.pdf) eurl} def /increment {(http://www.tinaja.com/text/bezgen3.html) eurl} def /interpolate {(http://members.bellatlantic.net/~vze2vrva/design.html) eurl } def /bezmath {(http://www.tinaja.com/text/bezmath.html) eurl } def /table {(http://www.tinaja.com/psutils/imtable.psl) eurl } def } pop % dictionary method << %zzzzz %%%% unused links have been commented for gg9a simplicity /muse90 (http://www.tinaja.com/glib/muse90.pdf) /vismagsn (http://www.tinaja.com/glib/vismagsn.psl) /optjit01 (http://www.tinaja.com/psutils/optjit01.psl) /optjit01demo (http://www.tinaja.com/psutils/optjit01.pdf) /qall01 (http://www.tinaja.com/psutils/qall01.psl) /deltapat (http://www.tinaja.com/glib/deltapat.pdf) /mindist1 (http://www.tinaja.com/glib/mindist1.pdf) /deltams1 (http://www.tinaja.com/glib/deltams1.pdf) /grabjpg (http://www.tinaja.com/psutils/grabjpg.psl) /gallery (http://www.tinaja.com/glib/gallery.pdf) /nutour01 (http://wwww.tinaja.com/nutour01.pdf) /linkpdf1 (http://www.tinaja.com/glib/linkpdf1.html) /ebayfoto (http://www.tinaja.com/glib/ebayfoto.pdf) /jpeg2pdf.html (http://www.tinaja.com/text/jpeg2pdf.html) /pdf2bmp (http://www.tinaja.com/psutils/pdf2bmp.psl) /bitmfont (http://www.tinaja.com/psutils/bitmfont.txt) /antifontpsl (http://www.tinaja.com/psutils/antifont.psl) /antifonttxt (http://www.tinaja.com/psutils/antifont.txt) /histog01 (http://www.tinaja.com/psutils/histog01.psl) /swingtlt (http://www.tinaja.com/glib/swingtlt.pdf) /newsamoe (news:///alt.marketing/online.ebay) /webtrends (http://www.netiq.com/webtrends/default.asp) /stegan (http://63.140.207.28/books/bkwater.asp) /nodi (http://www.pages.ebay.com/help/community/notice-infringe2.pdf) /ebayvero (http://www.pages.ebay.com/help/community/vero-program.html) /aboutme (http://members.ebay.com/aboutme/abeja/) /magfill2 (http://www.tinaja.com/psutils/magfill2.psl) /bmprpt01 (http://www.tinaja.com/psutils/bmprpt01.psl) /waywere (http://www.tinaja.com/glib/waywere.pdf) /nikon (http://www.nikon.com) /bayer (http://www.coreco.com/Web/wbtools3.nsf/0/87fce126f109ea3a05256c7100591c9a?OpenDocument) /hewpack (http://www.hp.com) /auct01 (http://www.tinaja.com/auct01.asp) /blat01 (http://www.tinaja.com/auct01.asp) /moreebay (http://www.tinaja.com/glib/moreebay.pdf) /auctscne (http://www.tinaja.com/glib/auctscne.pdf) /autourl (http://www.tinaja.com/glib/autourl.pdf) /msintro1 (http://www.tinaja.com/glib/msintro1.pdf) /msintrosource (http://www.tinaja.com/glib/msintro1.psl) /knockout (http://www.tinaja.com/glib/knockout.bmp) /stepsynt (http://www.tinaja.com/glib/stepsynt.pdf) /msintro1 (http://www.tinaja.com/glib/msintro1.pdf) /msinprop (http://www.tinaja.com/glib/msinprop.pdf) /muse106 (http://www.tinaja.com/glib/muse106.pdf) /muse142 (http://www.tinaja.com/glib/muse142.pdf) /math01 (http://www.tinaja.com/math01.asp) /cubic01 (http://www.tinaja.com/cubic01.asp) /bez4pts (http://www.tinaja.com/glib/bez4pts.pdf) /muse145 (http://www.tinaja.com/glib/muse145.pdf) /muse148 (http://www.tinaja.com/glib/muse148.pdf) /curveft3 (http://www.tinaja.com/psutils/curveft3.psl) /fuzzybez (http://www.tinaja.com/glib/fuzzybez.pdf) /bmprpt01 (http://www.tinaja.com/psutils/bmprpt01.psl) /nowhit01 (http://www.tinaja.com/psutils/nowhit01.psl) /blender (http://www.tinaja.com/psutils/blender.psl) /speedup2 (http://www.tinaja.com/glib/speedup2.pdf) /histog01 (http://www.tinaja.com/psutils/histog01.psl) /imgviewer32 (http://www.arcatapet.net/imgv32.cfm) /basis (http://www.tinaja.com/glib/basis.pdf) /expbmp (http://www.tinaja.com/glib/expbmp.pdf) /dodbur01 (http://www.tinaja.com/psutils/dodbur01.psl) /dodgebur (http://www.tinaja.com/glib/dodgebur.pdf) /magfill1 (http://www.tinaja.com/psutils/magfill1.psl) /swingt01 (http://www.tinaja.com/psutils/swingt01.psl) /before01 (http://www.tinaja.com/images/bargs/marcon01.jpg) /during01 (http://www.tinaja.com/images/bargs/marcon01.bmp) /after01 (http://www.tinaja.com/images/bargs/marconz1.jpg) /repobmp (http://www.tinaja.com/glib/repobmp.pdf) /basis01 (http://www.tinaja.com/glib/basis.pdf) /arcata (http://www.arcatapet.net/imgv32.cfm) /comparebmp (http://www.designer-info.com/Writing/bmp_tiff_jpeg_gif.htm) /imagimag (http://www.tinaja.com/glib/imagimag.pdf) /myebays (http://www.tinaja.com/glib/myebays.pdf) /stepprep (http://www.tinaja.com/glib/stepprep.pdf) /aafont01 (http://www.tinaja.com/aafont01.asp) /here1 (http://village.infoweb.ne.jp/~fwhw1257/study/bmpform.htm) /here2 (http://www.daubnet.com/formats/BMP.html) /bittype (http://www.tinaja.com/psutils/pdf2bmp.psl) /photocombine (http://www.tinaja.com/psutils/blender.psl) /psl (http://www.tinaja.com/psutils/) % dummy temp /psl1 (http://www.tinaja.com/psutils/pdf2bmp.psl) /psl2 (http://www.tinaja.com/psutils/acatdata.psl) /psl3 (http://www.tinaja.com/psutils/catwords.psl) /psl4 (http://www.tinaja.com/psutils/graburls.psl) /psl5 (http://www.tinaja.com/psutils/blender.psl) /psl6 (http://www.tinaja.com/psutils/catools1.psl) /psl7 (http://www.tinaja.com/psutils/strconv.html) /psl8 (http://www.tinaja.com/psutils/bodcat.psl) /psl9 (http://www.tinaja.com/psutils/flatvue1.psl) /psl10 (http://www.tinaja.com/psutils/fern2img.psl) /psl11 (http://www.tinaja.com/psutils/flutools.psl) /psl12 (http://www.tinaja.com/psutils/mscal156q.psl) /psl13 (http://www.tinaja.com/psutils/weblogu2.psl) /psl14 (http://www.tinaja.com/psutils/pfa2pfb.psl) /psl15 (http://www.tinaja.com/psutils/pfb2pfa.psl) /psl16 (http://www.tinaja.com/glib/psdisk03.psl) /psl17 (http://www.tinaja.com/psutils/disktool.psl) /psl18 (http://www.tinaja.com/glib/psinscrt.psl) /psl19 (http://www.tinaja.com/glib/pssearch.psl) /psl20 (http://www.tinaja.com/text/refsum1.html) /psl21 (http://www.tinaja.com/text/reflog1.html) /psl22 (http://www.tinaja.com/psutils/reflog1.psl) /psl23 (http://www.tinaja.com/psutils/refsum1.psl) /psl24 (http://www.tinaja.com/psutils/searepl.psl) /psl25 (http://www.tinaja.com/psutils/weberru2.psl) /psl26 (http://www.tinaja.com/psutils/grabsrch.psl) /psl27 (http://www.tinaja.com/psutils/grabrefs.psl) /magsn01 (http://www.tinaja.com/magsn01.asp) /gonzoutils (http://www.tinaja.com/post01.asp#gonzo) /disktool (http://www.tinaja.com/psutils/disktool.ps) /elesimp (http://www.tinaja.com/glib/elesimp.pdf) /tn5603 (http://partners.adobe.com/asn/developer/pdfs/tn/TN5603.Filters.pdf) /fern2img (http://www.tinaja.com/psutils/fern2img.psl) /fern (http://www.tinaja.com/psutils/fern2img.pdf) /oldfern (http://www.tinaja.com/psutils/fernx1.pdf) /acrosdk (http://partners.adobe.com/asn/developer/acrosdk/main.html) /refman2 (http://partners.adobe.com/asn/developer/pdfs/tn/psrefman.pdf) /refman3 (http://partners.adobe.com/asn/developer/pdfs/tn/PLRM.pdf) /s3011 (http://partners.adobe.com/asn/developer/pdfs/tn/PS3010and3011.Supplement.pdf) /s2011 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2011.supplement.pdf) /s2012 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2012.supplement.pdf) /s2013 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2013.supplement.pdf) /s2014 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2014.supplement.pdf) /s2015 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2015.supplement.pdf) /s2016 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2016.supplement.pdf) /ghost (http://www.cs.wisc.edu/~ghost/) /distlang (http://www.tinaja.com/psutils/distlang.html) /adobepst (http://partners.adobe.com/asn/developer/technotes/) /maildon (mailto:don@tinaja.com) /tinaja (http://www.tinaja.com) /adobe (http://www.adobe.com) /adobesdk (http://partners.adobe.com/asn/developer/acrosdk/main.html) /pstrans (http://www.tinaja.com/glib/pstrans.pdf) /borland (http://www.borland.com/products/downloads/download_cbuilder.html) /ebay (http://cgi6.ebay.com/ws/eBayISAPI.dll?ViewSellersOtherItems&userid=abeja&completed=0&sort=2&since=-1&include=0&page=1&rows=100) /searepl (http://www.tinaja.com/psutils/searepl.psl) /aasdk (http://www.tinaja.com/plugins/AboutAcrobatSDK.api) /uncomp (http://www.tinaja.com/plugins/UncompressPDF.api) /addimage (http://www.tinaja.com/plugins/AddImage.api) /samplejpg (http://www.tinaja.com/plugins/sample.jpg) /transparency (http://www.tinaja.com/plugins/Transparency.api) /threerects (http://www.tinaja.com/plugins/threerects.pdf) /watermark (http://www.tinaja.com/plugins/Watermark.api) /verifyurls (http://www.tinaja.com/plugins/VerifyURLS.api) /flate (http://www.tinaja.com/glib/flatvue.pdf) /pstrans (http://www.tinaja.com/glib/pstrans.pdf) /advt01 (http://www.tinaja.com/advt01.asp) /amlink01 (http://www.tinaja.com/amlink01.asp) /ng1 (news:///comp.text.pdf) /ng2 (news:///comp.lang.postscript) /msc++ (http://msdn.microsoft.com/visualc/productinfo/default.asp) /degub (http://www.tinaja.com/glib/degub.pdf) /ghostscript (http://www.artifex.com/pressreleases/GS70.htm) /demox.psl (http://www.tinaja.com/glib/g9demox.psl) /demox.pdf (http://www.tinaja.com/glib/g9demox.pdf) /demo.pdf (http://www.tinaja.com/glib/g9demo.pdf) /flatvue (http://www.tinaja.com/glib/flatvue.psl) /pdfrefman (http://partners.adobe.com/asn/developer/acrosdk/docs.html) /psrefman (http://partners.adobe.com/asn/developer/technotes/postscript.html) /pdfmrm (http://partners.adobe.com/asn/developer/acrosdk/docs.html) /tipdf (http://partners.adobe.com/asn/developer/acrosdk/docs.html) /asdk (http://partners.adobe.com/asn/developer/acrosdk) /mtcr (http://support.adobe.com/devsup/devsup.nsf/docs/51864.htm) /flatvue1 (http://www.tinaja.com/psutils/flatvue1.psl) /acrob01 (http://www.tinaja.com/acrob01.asp) /post01 (http://www.tinaja.com/post01.asp) /info01 (http://www.tinaja.com/info01.asp) /gurgrm01 (http://www.tinaja.com/gurgrm01.asp) { /tilley (http://www.tilleyfoundation.com) /mnglobal (http://www.mnglobal.com/energy/pg2.htm) /keely (http://www.keelynet.com) /evolve (http://www.evolvedtechnology.com) /hack64 (http://www.tinaja.com/glib/hack64.pdf) /hackar3 (http://www.tinaja.com/glib/hackar3.pdf) /resbn58 (http://www.tinaja.com/glib/resbn58.pdf) /bppt (http://www.batterypoweronline.com) /muse112 (http://www.tinaja.com/glib/muse112.pdf) /muse113 (http://www.tinaja.com/glib/muse113.pdf) /energfun (http://www.tinaja.com/glib/energfun.pdf) /bashpseu (http://www.tinaja.com/glib/bashpseu.pdf) /adobe (http://www.adobe.com) /netscape (http://www.netscape.com) /gallypsl (http://www.tinaja.com/galley1.psl) /gallypdf (http://www.tinaja.com/galley1.pdf) /atn5150 (http://partners.adobe.com/asn/developer/acrosdk/docs/createpdfapi/pdfmarkReference.pdf) /nutour (http://www.tinaja.com/bargains/nutour02.pdf) /nutoursource (http://www.tinaja.com/bargains/nutour02.psl) /bwhistle (http://www.tinaja.com/glib/bwhistle.pdf) /gonzo1 (http://www.tinaja.com/post01.asp#gonzo) /barg01 (http://www.tinaja.com/barg01.asp) /weblib01 (http://www.tinaja.com/weblib01.asp) /gurgrm01 (http://www.tinaja.com/gurgrm01.asp) /z1 (http://www.tinaja.com/bargains/thumb/albradz2.jpg) /z2 (http://www.tinaja.com/bargains/sbtesteq.asp) /z3 (http://www.tinaja.com/images/bargs/albrad02.jpg) /z4 (http://www.tinaja.com/bargains/thumb/tutenaz2.jpg) /z5 (http://www.tinaja.com/bargains/sbphone.asp) /z6 (http://www.tinaja.com/images/bargs/tutena02.jpg) /sourceme (http://www.tinaja.com/glib/gallery.psl) /sourceme2 (http://www.tinaja.com/glib/autourl.psl) } pop >> {mark exch /eurl cvx ] cvx def} forall %%%%%%%%%%%%%%%% New colorizer patches %%%%%%%%%%%%%%%%%% /boxgrays 0.899 def /grayshade boxgrays def /mastergray boxgrays def /staytint {0.33 setgray} def /staytint1 {0.25 setgray} def /showadgrays true def /red {0 settint} def /Zmacro {staytint /ypos ypos 2 add def 72 300 div setlinewidth xpos ypos moveto txtwide 0 rlineto stroke /ypos ypos -2 add def tintoff} def % hair rule /amacro {(zy0) stringmacro /ypos ypos ypara add def 0.33 setgray } def % start drop cap /bmacro {(iFy1) stringmacro /ypos ypos ypara add def black} def % finish drop cap % Gonzo character colorizer /blueon {mark /blue cvx 0.33 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /blueoff {mark /beige cvx 0 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton {mark 0.33 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1 {mark 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1b {mark beige cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1a {mark /aqua cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1p {mark /burple cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1r {mark /red cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1a {mark /aqua cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1b {mark /beige cvx % try for beige after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tintoff {mark 0 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def %%%%%%%%%%%%%% COMPACT VERSION OF COLORIZER II %%%%%%%%%%%%%%%%%%%%%% /settint {dup /currenttint exch store 5.999 mul dup floor cvi /&cbar exch store dup floor sub /&cwt exch store [ {/setgray [ /dup cvx 0.3 &cwt 0.59 mul add /ge cvx [1 /exch cvx &cwt 0.59 mul 0.30 add /sub cvx 1 &cwt sub 0.59 mul 0.11 add /div cvx /dup cvx 1 &cwt sub /mul cvx &cwt /add cvx /exch cvx ] cvx [ &cwt 0.59 mul 0.3 add /div cvx /dup cvx &cwt /mul cvx 0] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.59 1 &cwt sub 0.3 mul add /ge cvx [1 &cwt sub 0.3 mul 0.59 add /sub cvx &cwt 0.3 mul 0.11 add /div cvx /dup cvx &cwt /mul cvx 1 &cwt sub /add cvx /exch cvx 1 /exch cvx] cvx [1 &cwt sub 0.3 mul 0.59 add /div cvx /dup cvx 1 &cwt sub /mul cvx /exch cvx 0] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.59 &cwt 0.11 mul add /ge cvx [&cwt 0.11 mul 0.59 add /sub cvx 1 &cwt sub 0.11 mul 0.30 add /div cvx /dup cvx 1 &cwt sub /mul cvx &cwt /add cvx 1 /exch cvx] cvx [0 /exch cvx &cwt 0.11 mul 0.59 add /div cvx /dup cvx &cwt /mul cvx] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.59 1 &cwt sub mul 0.11 add /ge cvx [1 &cwt sub 0.59 mul 0.11 add /sub cvx &cwt 0.59 mul 0.30 add /div cvx /dup cvx &cwt /mul cvx 1 &cwt sub /add cvx 1] cvx [0 /exch cvx 1 &cwt sub 0.59 mul 0.11 add /div cvx /dup cvx 1 &cwt sub /mul cvx /exch cvx] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.11 &cwt 0.30 mul add /ge cvx[&cwt 0.30 mul 0.11 add /sub cvx 1 &cwt sub 0.30 mul 0.59 add /div cvx /dup cvx 1 &cwt sub /mul cvx &cwt /add cvx /exch cvx 1] cvx [ &cwt 0.30 mul 0.11 add /div cvx /dup cvx &cwt /mul cvx /exch cvx 0 /exch cvx ] cvx /ifelse cvx /setrgbcolor cvx ] cvx /def cvx} {/setgray [ /dup cvx 0.30 1 &cwt sub 0.11 mul add /ge cvx[ 1 /exch cvx 1 &cwt sub 0.11 mul 0.30 add /sub cvx &cwt 0.11 mul 0.59 add /div cvx /dup cvx &cwt /mul cvx 1 &cwt sub /add cvx ] cvx [ 1 &cwt sub 0.11 mul 0.30 add /div cvx /dup cvx 1 &cwt sub /mul cvx 0 /exch cvx] cvx /ifelse cvx /setrgbcolor cvx ] cvx /def cvx} ] &cbar get exec exec} bind def /beige {0.10 settint} def % examples of convenience operators /aqua {0.52 settint} def /blue {0.67 settint} def /lime {0.44 settint} def /burple {0.75 settint} def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /guru { gonzo begin ps.util.1 begin printerror nuisance begin} def % guru % activate gonzo utilities 50 50 10 setgrid % create grid % 56 61 showgrid /setpagefonts { /cstretch 0.015 def /sstretch 0.015 def /font0 /StoneSans-Bold 1.6 gonzofont /font1 /StoneSans 0.95 gonzofont /font2 /StoneSans [0.95 0 0.25 0.95 0 0 ] gonzofont /font4 /StoneSans 0.85 gonzofont /font3 /StoneSans-Bold 0.85 gonzofont /font6 /StoneSans-Bold 0.85 gonzofont /font7 /StoneSans-Bold 1.05 gonzofont % subheaders /font8 /StoneSans-Bold [0.65 0 0 0.65 0 0.4] gonzofont /txtwide 36 store /yinc 1.2 store /kern 0.1 store /pm 1.5 store aqua 0.33 setgray font1 black /amacro { mark /aqua cvx 0.33 /setgray cvx ] cvx printlist exch 3 index exch % stuff into gonzo printlist put exch 1 add exch } def /bmacro { mark /black cvx ] cvx printlist exch 3 index exch % stuff into gonzo printlist put exch 1 add exch } def /shiftin {xpos /xposhold exch store /xpos xpos 3 add store} def /shiftout {/xpos xposhold store} def /texttop 51 store /textleft 3 store /cmacro {aqua 0.25 setgray (znhL7) stringmacro /xpos xpos 1.7 sub store /ypos ypos .1 sub def } def % left title /dmacro {black (pL1hz) stringmacro /xpos xpos 1.7 add store /ypos ypos .1 add def} def % normal text after centered title /fmacro % try and fake | {mark /gsave cvx /currentpoint cvx /moveto cvx 0.1 /setlinewidth cvx 0 0.65 /rlineto cvx /stroke cvx /grestore cvx ] cvx printlist exch 3 index exch put % stuff into gonzo printlist exch 1 add exch % increment gonzo list count } def } def setpagefonts % -2 50.5 (optional header here \274) cl %% Set document opening conventions. Note DOCVIEW limited. [/CropBox [0 0 520 620] % set the wierd size /PAGES pdfmark [ {Catalog} << /ViewerPreferences << /FitWindow true /CenterWindow true >> /PageLayout /OneColumn % continous /Pagemode /UseNone % no thumbs /View [/XYZ null null 1 ] % force 100% >> /PUT pdfmark %%%%%%%%%%%%%%%%% START DEMO ART (not in use) %%%%%%%%%%%%%%%% %%% Hand patching Info: % next available variable is /GS3 % transparency gstate is object 2 % contents stream is object 18 gets q /GS3 gs (xstuff) Q % be sure to q Q bracket to localize % resources stream is object 19 gets /GS3 2 0 R /transoverlay { % make a new graphics state [ /_objdef {newgsstate} /type /dict /OBJ pdfmark % fill the new overlay graphics state - See PDF manual for details [ {newgsstate} << /Type /ExtGState /ca 0.5 % fill transparency is 0.5 /CA 0.5 % stroke transparency is 0.5 /BM /Normal /AIS false /OP false /OPM 1 /op true >> /PUT pdfmark % start a Begin Picture graphics overlay subroutine... [ /BBox [0 0 1000 1000 ] /_objdef {overlaypix} /BP pdfmark % fill the Begin Picture graphics overlay Xobject subroutine... 0 0.5 1 setrgbcolor % on the aqua side of blue 4 4 6 6 rectfill % complete the Begin Picture graphics overlay Xobject... [ /EP pdfmark } def % Write a two squares program... /twosquares { gsave translate 1 0.5 0 setrgbcolor % red side of orange 2 2 6 6 rectfill % do background opaque box [ {overlaypix} /SP pdfmark % show foreground transparent box grestore} def % Distill the two squares program. Initially use a BARE Distiller Job % Options that has no compression, no embedded fonts, and little else save /snap1 exch store %%% transoverlay % create new objects %%% 14 17.5 twosquares snap1 restore %%%%%%%%%%%% END DEMO %%%%%%% %%%%%%%%%%%% PHOTO INSERTS %%%%%%%%%% % When photos are needed, they are inserted here. Comment out otherwise. %%%%%%%%% photo links %%%%%%%%% % combined autopos jpeg conversion and hotlink: /autofigure1 {save /af1 exch store xpos ypos yinc add translate 6 0.65 923 526 .025 % xpos ypos xres yres pixscale (http://www.tinaja.com/images/bargs/flu84501.jpg) % url first (C:\\windows\\desktop\\aaraw_pix\\flu84501.jpg) jpegimageprocwithlink af1 restore} store /autofigure2 {save /af2 exch store xpos ypos yinc add translate 8.5 -2 790 672 .020 % xpos ypos xres yres pixscale (http://www.tinaja.com/images/bargs/tek40841.jpg) % url first (C:\\windows\\desktop\\aaraw_pix\\tek40841.jpg) jpegimageprocwithlink af2 restore} store /autofigure3 {save /af3 exch store xpos ypos yinc add translate 12 0.6 530 816 .018 % xpos ypos xres yres pixscale (http://www.tinaja.com/images/bargs/sencri01.jpg) % url first (C:\\windows\\desktop\\aaraw_pix\\sencri01.jpg) jpegimageprocwithlink af3 restore} store /autofigure4 {save /af4 exch store xpos ypos yinc add translate 12 -0.4 422 612 .024 % xpos ypos xres yres pixscale (http://www.tinaja.com/images/bargs/abspar01.jpg) % url first (C:\\windows\\desktop\\aaraw_pix\\abspar01.jpg) jpegimageprocwithlink af4 restore} store /jpegimageprocwithlink { % hoffset voffset hres vres save /snap2 exch def /infilename exch store % grab passed pix file /inurllink exch store % grab link filename /photoscale exch store /vpixels exch store /hpixels exch store translate % adjust position for final figure ??? inurllink setareaurl % autolink sizing /DeviceRGB setcolorspace % pick color model 0 0 translate % set page position hpixels vpixels scale % magnify unit square photoscale dup scale /infile infilename (r) file def % establish input read file /Data {infile /DCTDecode filter} def % define a data source << % start image dicationary /ImageType 1 % always one /Width hpixels % JPEG width in pixels /Height vpixels % JPEG height in pixels /ImageMatrix [hpixels 0 0 vpixels neg 0 vpixels ] /DataSource Data % proc to get filtered JPEG /BitsPerComponent 8 % color resolution /Decode [0 1 0 1 0 1] % per red book 4.10 >> image % call the image operator ypos snap2 restore /ypos exch def } def /setareaurl { % for auto include routine /cururlname exch store mark % start pdfmark /Rect [ 0 0 hpixels photoscale mul vpixels photoscale mul ] /Border [ 0 0 0] % [0 0 0 ] = none; [0 0 2] = debug /Color [ .7 0 0 ] /Action <> /Subtype /Link /ANN % annotation type pdfmark % call pdf operators } def %%%%%%%%%%% data for quantization figures %%%%%%% /raw [0.0198613 3.75812 0.0300583 0.968559 0.0400088 0.625545 0.0500071 0.473332 0.0598378 0.508493 0.0701048 0.618866 0.080067 0.574973 0.0900779 0.328987 0.0999211 0.358846 0.109939 0.13398 0.119912 0.183206 0.129936 0.374792 0.14006 0.286128 0.150091 0.206733 0.160075 0.190605 0.169949 0.196913 0.17999 0.136811 0.189984 0.223428 0.200178 0.130515 0.209919 0.279305 0.21986 0.179522 0.230087 0.167779 0.239816 0.127177 0.250051 0.18394 0.260079 0.22457 0.269779 0.120137 0.279989 0.142624 0.290027 0.124499 0.299737 0.111797 0.309994 0.123014 0.319982 0.268029 0.329976 0.207562 0.339971 0.0887317 0.349912 0.141557 0.359975 0.0943557 0.369923 0.0895733 0.379933 0.198241 0.389968 0.204985 0.399985 0.107935 0.409949 0.0945179 0.419974 0.125101 0.429965 0.0976423 0.440214 0.0904647 0.449999 0.108261 0.459981 0.0657491 0.470024 0.206909 0.479727 0.0390659 0.489996 0.0464662 0.50005 0.208427 0.509765 0.0436721 0.520046 0.0589122 0.53008 0.0933284 0.540058 0.122129 0.550131 0.108932 0.55981 0.0608129 0.570111 0.0552627 0.579854 0.0621947 0.590107 0.139442 0.59986 0.0498109 0.610232 0.103161 0.619883 0.129033 0.630016 0.0849617 0.640199 0.0601919 0.649749 0.0799222 0.660031 0.0541167 0.669983 0.113527 0.679712 0.0480973 0.690061 0.089419 0.700078 0.107595 0.709859 0.0710718 0.720131 0.041575 0.730196 0.123105 0.740089 0.0584097 0.749848 0.0861482 0.75993 0.0515622 0.769942 0.0761598 0.779974 0.118253 0.789996 0.0481484 0.799986 0.0874933 0.809957 0.0973124 0.820064 0.0534035 0.830362 0.025697 0.83973 0.0399598 0.850034 0.049165 0.859829 0.0851767 0.869827 0.0404494 0.880229 0.0435597 0.889938 0.0723645 0.899933 0.0190775 0.910168 0.0616833 0.919942 0.0725692 0.929991 0.0399983 0.940013 0.102806 0.950018 0.0518368 0.960034 0.0318331 0.970059 0.0823362 0.980036 0.0436783 0.989837 0.0463608 1.00013 0.0562829 ] def /ex54 [ 5.87906 19.9758 5.38078 23.2179 6.61461 22.45 6.48865 23.8991 7.79373 21.6975 7.66747 18.3412 7.16927 15.7147 7.0433 23.5588 7.89268 23.6885 6.44363 24.0582 6.31744 20.4902 5.81917 24.1383 7.16713 21.0382 6.66901 18.9723 6.54259 11.4618 6.04431 22.422 6.99837 23.9206 7.72186 17.6438 7.22366 19.559 7.0974 19.865 8.16101 21.0954 7.66296 21.6132 8.38593 23.3011 8.45734 21.8227 8.33099 20.4936 7.83295 23.6901 9.12148 21.6428 8.99521 24.1041 9.0123 22.5552 10.0761 24.016 9.94987 23.6423 9.4516 18.8 10.3011 18.3618 10.175 15.7533 9.67651 15.8403 10.7406 22.2248 11.2952 23.4363 8.38531 18.1067 9.44916 24.1021 8.95065 19.521 8.82462 16.3613 8.32649 22.8011 9.67415 22.9247 9.1758 23.1169 9.04961 18.7033 10.0041 21.3686 9.50554 20.3098 9.37965 23.1915 10.229 20.7535 9.73083 24.3928 10.7951 23.4553 10.6687 20.0753 10.1704 22.7069 10.9646 20.4496 10.8385 20.1683 11.4042 19.4907 12.0175 23.4256 11.5192 22.1005 12.5835 16.0818 12.4572 16.8864 11.9588 13.1062 12.809 19.7136 12.6826 18.5011 12.1842 20.9156 13.2483 19.5923 13.1218 24.0439 13.8034 21.8302 10.6676 23.761 10.8927 22.8588 11.957 21.8607 11.4587 19.2204 11.3322 17.3188 12.5117 19.7264 12.0132 20.9341 13.1763 23.3152 13.2472 20.7672 13.1206 23.1287 13.4724 23.3126 13.3461 23.9651 13.9117 18.537 13.8022 22.5502 14.2414 20.9416 14.4669 13.1742 13.1752 23.9257 13.6145 24.4108 13.8398 22.6699 ] store /ex54good [ 6.54259 11.4618 11.9588 13.1062 14.4669 13.1742 10.175 15.7533 9.67651 15.8403 10.0041 21.3686 ] store /ex54orig [ 9.88396 24.4257 ] store /ex54want [ 10 0 ] store /shook [ 0.00934937 1.51076 0.0210324 0.978672 0.0312886 0.477679 0.0406482 0.318167 0.0493669 0.337353 0.0617085 0.203131 0.0692016 0.259957 0.0798052 0.229666 0.0885358 0.271299 0.100559 0.1726 0.109939 0.13398 0.118677 0.119296 0.131049 0.187404 0.140698 0.134313 0.149444 0.129195 0.158846 0.106101 0.170589 0.0965049 0.179351 0.0914561 0.189653 0.129042 0.201417 0.0546426 0.210828 0.108576 0.218951 0.100261 0.230727 0.120773 0.241057 0.103841 0.24984 0.0973585 0.259094 0.114175 0.268537 0.0808775 0.281232 0.051974 0.289386 0.0641827 0.301193 0.0942731 0.310907 0.0954356 0.31907 0.0730116 0.330889 0.0677774 0.339699 0.0797174 0.350554 0.0727672 0.360616 0.0859002 0.369923 0.0895733 0.379679 0.0823565 0.391137 0.0758395 0.399965 0.0916116 0.411197 0.0716472 0.419389 0.052739 0.430883 0.0744991 0.441523 0.0643956 0.450642 0.0651337 0.461231 0.0500311 0.470357 0.0682797 0.479727 0.0390659 0.491163 0.0464662 0.500383 0.0701265 0.509765 0.0436721 0.520046 0.0589122 0.529436 0.0621049 0.540979 0.065531 0.549818 0.0659652 0.55981 0.0608129 0.570111 0.0552627 0.579854 0.0621947 0.589296 0.0497526 0.59986 0.0498109 0.610207 0.0454799 0.620493 0.0516502 0.630849 0.0588497 0.639051 0.034206 0.649639 0.0456603 0.660009 0.0522574 0.670628 0.0426991 0.679712 0.0480973 0.69034 0.0477716 0.699467 0.0308037 0.711012 0.0686215 0.720131 0.041575 0.729513 0.0498212 0.739846 0.0430787 0.750499 0.0405623 0.76086 0.0438831 0.770257 0.0497878 0.780553 0.0441616 0.789662 0.0457397 0.800267 0.0325654 0.809451 0.0440074 0.820078 0.0403837 0.830362 0.025697 0.840997 0.0332166 0.85014 0.0337785 0.860449 0.0360605 0.869889 0.015046 0.880467 0.0360463 0.890767 0.0317396 0.899933 0.0190775 0.910273 0.0316686 0.919661 0.0263476 0.929956 0.0388174 0.939357 0.032368 0.949701 0.027215 0.960034 0.0318331 0.970334 0.0351219 0.979745 0.0379512 0.990337 0.0386641 1.00065 0.0439439 ] store %%%%%%%%%%%%% ordinary tracking figures\ /figureoneauto { /figadvance 20 store save /snap2 exch store xpos 8 add ypos figadvance sub translate figure1 snap2 restore /ypos ypos figadvance sub yinc sub store } store /figure1 { 0.50 settint 20 20 showgrid line3 0 1 1 setrgbcolor [{-0.5 0 mt 20.5 r} 10 3] yrpt [{0 -0.5 mt 20.5 u} 10 3] xrpt black gsave 0 0 mt 20 pu 20 pr 20 pd closepath clip 1 0.5 0 setrgbcolor 0 2 raw length 2 sub {/posn2 exch store raw posn2 get 20 mul raw posn2 1 add get 20 mul moveto dot} for 11 18.45 mt dot 1 0 1 setrgbcolor 0 2 shook length 2 sub {/posn2 exch store shook posn2 get 20 mul shook posn2 1 add get 20 mul moveto dot} for 11 17.45 mt dot grestore % remove clip limit /font1 /StoneSans-Bold 0.9 gonzofont font1 0.3 0.3 0.3 setrgbcolor 0 -1.5 (0.0) cc 10 -1.5 (0.5) cc 20 -1.5 (1.0) cc -0.9 0 0.3 sub (0.0%) cr -0.9 10 0.3 sub(0.5%) cr -0.9 20 0.3 sub (1.0%) cr 11.55 18.2 (= raw quant) cl 11.55 17.2 (= best neighbor) cl /font2 /StoneSans-Bold 1.1 gonzofont font1 10 -2.7 (Amplitude) cc gsave -4.2 10 translate 90 rotate 0 0 (Unfiltered THD 2|j-|j22)cc grestore /yinc 1.2 store 24.3 11.5 (Typical\nquantized\nDelta-28\ndistortions) cc } store /figuretwoauto { /figadvance 25 store save /snap2 exch store xpos 8 add ypos figadvance sub translate figure2 snap2 restore /ypos ypos figadvance sub yinc sub store } store /figure2 { 0.50 settint /font0 /StoneSans-Bold 6 gonzofont font0 0 1 1 setrgbcolor 10 3 (54) cc 20 25 showgrid line3 0 1 1 setrgbcolor [{-0.5 0 mt 20.5 r} 10 3] yrpt [{0 -0.5 mt 25.5 u} 10 3] xrpt 0 25 mt 20 r black 0 0 0 setrgbcolor 0 2 ex54 length 2 sub {/posn2 exch store ex54 posn2 get ex54 posn2 1 add get moveto dot} for 1 0 1 setrgbcolor 0 2 ex54good length 2 sub {/posn2 exch store ex54good posn2 get ex54good posn2 1 add get moveto dot} for 1 0.5 0 setrgbcolor ex54want 0 get ex54want 1 get mt dot 1 0 0 setrgbcolor ex54orig 0 get ex54orig 1 get mt dot /font1 /StoneSans-Bold 0.9 gonzofont font1 0.3 0.3 0.3 setrgbcolor 0 -1.5 (0.535) cc 10 -1.5 (0.540) cc 20 -1.5 (0.545) cc -0.9 0 0.3 sub (0.00%) cr -0.9 10 0.3 sub(0.05%) cr -0.9 20 0.3 sub (0.10%) cr % 11.55 18.2 (= raw quant) cl % 11.55 17.2 (= best neighbor) cl /font2 /StoneSans-Bold 1.1 gonzofont font1 10 -2.7 (Amplitude) cc gsave -5.2 10 translate 90 rotate 0 0 (Unfiltered THD 2|j-|j22)cc grestore /yinc 1.2 store 24.3 11.5 (Nearby\nquantized\nAmplitude 54\noptions) cc } store %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /burpwide 29.5 store /burplebox3 {save /burp1 exch store xpos ypos translate -1 .2 mt 3.5 yinc mul .4 add pd burpwide pr 3.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox2 {save /burp1 exch store xpos ypos translate -1 .2 mt 2.5 yinc mul .4 add pd burpwide pr 2.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox2.5 {save /burp1 exch store xpos ypos translate -1 .2 mt 3 yinc mul .4 add pd burpwide pr 3 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox4 {save /burp1 exch store xpos ypos translate -1 .2 mt 4.5 yinc mul .4 add pd burpwide pr 4.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox4.5 {save /burp1 exch store xpos ypos translate -1 .2 mt 5 yinc mul .4 add pd burpwide pr 5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox5 {save /burp1 exch store xpos ypos translate -1 .2 mt 5.5 yinc mul .4 add pd burpwide pr 5.5 yinc mul .4 add pu closepath 0.9 setgray fill true {special5 } if burp1 restore } def /burpcom {save /burpx exch store /bht exch store save /burp1 exch store xpos ypos translate -1 .2 mt bht yinc mul .4 add pd burpwide pr bht yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore} store /burpwidew 32 store /burpcomw {save /burpx exch store /bht exch store save /burp1 exch store xpos 1 sub ypos translate 0 .2 mt bht yinc mul .4 add pd burpwidew pr bht yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore} store /burplebox3.5 {4 burpcom} store /burplebox5.5 {6 burpcom} store /burplebox6 {6.5 burpcom} store /burplebox7 {7.5 burpcom} store /burplebox7.5 {8 burpcom} store /burplebox8 {8.5 burpcom} store /burplebox9 {9.5 burpcom} store /burplebox9.5 {10 burpcom} store /burplebox10 {10.5 burpcom} store /burplebox11 {12 burpcom} store /burplebox12 {12.5 burpcom} store /burplebox12.5 {13 burpcom} store /burplebox13 {13.5 burpcom} store /burplebox13.5 {14 burpcom} store /burplebox14 {14.5 burpcom} store /burplebox14.5 {15 burpcom} store /burplebox15{15.5 burpcom} store /burplebox15.5{16 burpcom} store /burplebox18 {18.5 burpcom} store /burplebox18.5 {19 burpcom} store /burplebox22{22.5 burpcom} store /burplebox25.5{26 burpcom} store /burplebox34w{34.5 burpcomw} store /burplebox34.5w{35 burpcomw} store /burplebox38w{38.5 burpcomw} store /burplebox38.5w{39 burpcomw} store /burplebox40w{40.5 burpcomw} store /burplebox17 {save /burp1 exch store xpos ypos translate -1 .2 mt 17.5 yinc mul .4 add pd burpwide pr 17.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox20 {save /burp1 exch store xpos ypos translate -1 .2 mt 20.5 yinc mul .4 add pd burpwide pr 20.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox23 {save /burp1 exch store xpos ypos translate -1 .2 mt 23.5 yinc mul .4 add pd burpwide pr 23.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox26.5 {save /burp1 exch store xpos ypos translate -1 .2 mt 27 yinc mul .4 add pd burpwide pr 27 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox30 {save /burp1 exch store xpos ypos translate -1 .2 mt 30.5 yinc mul .4 add pd burpwide pr 30.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox36 {save /burp1 exch store xpos ypos translate -1 .2 mt 36.5 yinc mul .4 add pd burpwide pr 36.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def %%%%%%%%%%% figure 1 routine % autopositions on box6 %%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% TWO PATTERNS %%%%%%%%%%%%%% /ivoryrndcolor [230 230 205 40] store % random pattern colors [red blue green variance ] /magentarndcolor [230 100 230 120]store /makepatternstrings { [230 210 190 80] buildpixels magentarndcolor /accentpatstring exch store ivoryrndcolor buildpixels makeimagestring /bodypatstring exch store } store /burppatstrings { ivoryrndcolor buildpixels makeimagestring /bodypatstring exch store magentarndcolor buildpixels makeimagestring /accentpatstring exch store } store /DeviceRGB setcolorspace % pick color model /hpixels 50 store % size of pattern image /vpixels 50 store /issize hpixels vpixels mul store % makestring converts a stack top array into a string... /makestring {dup length string dup /NullEncode filter 3 -1 roll {1 index exch write} forall pop} def % /buildpixels makes three nearby colors given [r b g texture] all 0-255 integers /buildpixels {aload pop /texture exch store /b0 exch store /g0 exch store /r0 exch store 123 srand /r1 r0 texture random texture 2 div sub add cvi dup 255 ge {pop 255}if dup 0 lt {pop 0} if store /g1 g0 texture random texture 2 div sub add cvi dup 255 ge {pop 255}if dup 0 lt {pop 0} if store /b1 b0 texture random texture 2 div sub add cvi dup 255 ge {pop 255}if dup 0 lt {pop 0} if store /r2 r0 texture random texture 2 div sub add cvi dup 255 ge {pop 255}if dup 0 lt {pop 0} if store /g2 g0 texture random texture 2 div sub add cvi dup 255 ge {pop 255}if dup 0 lt {pop 0} if store /b2 b0 texture random texture 2 div sub add cvi dup 255 ge {pop 255}if dup 0 lt {pop 0} if store /r3 r0 texture random texture 2 div sub add cvi dup 255 ge {pop 255}if dup 0 lt {pop 0} if store /g3 g0 texture random texture 2 div sub add cvi dup 255 ge {pop 255}if dup 0 lt {pop 0} if store /b3 b0 texture random texture 2 div sub add cvi dup 255 ge {pop 255}if dup 0 lt {pop 0} if store } store % /makeimagestring creates a sting usable for a pattern image /makeimagestring { 12345 srand % make repeatable /iarray mark issize { r1 g1 b1} repeat ] store % fill all with color 1 issize 2 div cvi { iarray issize % fill half with color 2 random 3 mul cvi [ r2 g2 b2 ] putinterval} repeat issize 2 div cvi { iarray issize % fill third with color 3 random 3 mul cvi [ r3 g3 b3 ] putinterval} repeat iarray makestring } store % /rndimage shows the random string as a patternable image /bodyrandimage { gsave 5 dup scale << % start image dicationary /ImageType 1 % always one /Width hpixels % width in pixels /Height vpixels % height in pixels /ImageMatrix [hpixels 0 0 vpixels neg 0 vpixels ] /DataSource bodypatstring % proc to get string data /BitsPerComponent 8 % color resolution /Decode [0 1 0 1 0 1] % per red book 4.10 >> image % call the image grestore } def /accentrandimage { gsave 5 dup scale << % start image dicationary /ImageType 1 % always one /Width hpixels % width in pixels /Height vpixels % height in pixels /ImageMatrix [hpixels 0 0 vpixels neg 0 vpixels ] /DataSource accentpatstring % proc to get string data /BitsPerComponent 8 % color resolution /Decode [0 1 0 1 0 1] % per red book 4.10 >> image % call the image grestore } def % using a separate pattern dictionary for each pattern... /bodypatdict << /PatternType 1 % Tiling pattern /PaintType 1 % Colored /TilingType 1 /BBox [0 0 50 50] /XStep 5 /YStep 5 /PaintProc { begin bodyrandimage end} >> store /accentpatdict << /PatternType 1 % Tiling pattern /PaintType 1 % Colored /TilingType 1 /BBox [0 0 50 50] /XStep 5 /YStep 5 /PaintProc { begin accentrandimage end} >> store /burpbackmain { save /snapbb exch store save /snapb exch store % show the body background bodypatdict matrix % Identity matrix makepattern % Instantiate the pattern /bodypat exch def 4 0 % for the actual slide size 12 8 /Pattern setcolorspace bodypat setcolor rectfill % Fill rectangle with pattern snapb restore 4 0 12 8 line1 black rectstroke save /snapy exch store % show the accent accentpatdict matrix % Identity matrix makepattern % Instantiate the pattern /accentpat exch def 18.5 0 12 8 4 copy /Pattern setcolorspace accentpat setcolor rectfill % Fill rectangle with pattern snapy restore 18.5 0 12 8 line1 black rectstroke snapbb restore } store /figure3 {save /snap3 exch store translate % 34 8 showgrid makepatternstrings burppatstrings % burpbackstrings burpbackmain snap3 restore } store %%%%%%%%%%%%%%% end figure3 %%%%%%%%%%%% first special plot /special1code { /a01 [ 11.98757334830098 % p1 delay 0.02494857340377088 % p1 width 11.96309297293453 % p2 delay 0.04880748072357122 % p2 width 11.940266741737353 % p3 delay 0.07053366579209097 % p3 width 11.920110003436285 % p4 delay 0.08917718733052737 % p4 width 11.903448622759931 % p5 delay 0.10392320715383363 % p5 width 11.890997400038934 % p6 delay 0.1141272527930397 % p6 width 11.883303463712295 % p7 delay 0.11934332976518647 % p7 width 5.940346750117669 % quadrant delay ] store /a10 [ 11.870255884662251 % p1 delay 0.24926326067621396 % p1 width 11.627261913532986 % p2 delay 0.48772075225425126 % p2 width 11.401006709297277 % p3 delay 0.7050052291468631 % p3 width 11.201126478014806 % p4 delay 0.8916211348287959 % p4 width 11.036121661040383 % p5 delay 1.0393583630906704 % p5 width 10.912994009526542 % p6 delay 1.1416713778561558 % p6 width 10.836964879593466 % p7 delay 1.1939991529573461 % p7 width 5.405629193521989 % quadrant delay ] store /a20 [ 11.730827315951456 % p1 delay 0.4971341380973975 % p1 width 11.247686685343746 % p2 delay 0.9732376712143491 % p2 width 10.798693242131715 % p3 delay 1.407947044520391 % p3 width 10.402477789378082 % p4 delay 1.78228682672421 % p4 width 10.075528131993294 % p5 delay 2.079475909290011 % p5 width 9.831551570148512 % p6 delay 2.285806430413743 % p6 width 9.680871958761386 % p7 delay 2.391516582063389 % p7 width 4.8149587039683155 % quadrant delay ] store /a30 [ 11.582072392748948 % p1 delay 0.7421737945018947 % p1 width 10.862633911787377 % p2 delay 1.454218311923288 % p2 width 10.194732255409651 % p3 delay 2.106545777255711 % p3 width 9.605233324537401 % p4 delay 2.6708278536717955 % p4 width 9.118304754762583 % p5 delay 3.1210612368032926 % p5 width 8.754459346379754 % p6 delay 3.435090920436508 % p6 width 8.529472562792705 % p7 delay 3.5965061939786693 % p7 width 4.226667363010421 % quadrant delay ] store /a40 [ 11.424050411047465 % p1 delay 0.9828418379051129 % p1 width 10.473248533619292 % p2 delay 1.9280479848577236 % p2 width 9.590640663430097 % p3 delay 2.7980351182823426 % p3 width 8.810545720192863 % p4 delay 3.555566231331163 % p4 width 8.164652806450142 % p5 delay 4.164668715768244 % p5 width 7.680713770893433 % p6 delay 4.592711162444033 % p6 width 7.380758970713202 % p7 delay 4.813962276129942 % p7 width 3.6395557969349425 % quadrant delay ] store /a50 [ 11.25647168216318 % p1 delay 1.2174139856738683 % p1 width 10.080431345631026 % p2 delay 2.391612373063623 % p2 width 8.987846411116894 % p3 delay 3.4787553647023585 % p3 width 8.01966536065963 % p4 delay 4.433803253978574 % p4 width 7.214999377113287 % p5 delay 5.210430981795014 % p5 width 6.609527274825396 % p6 delay 5.762766698554145 % p6 width 6.232831441964791 % p7 delay 6.050997667516469 % p7 width 3.0524467812417413 % quadrant delay ] store /a53 [ 11.204229246524123 % p1 delay 1.2863028469519246 % p1 width 9.962015674530373 % p2 delay 2.528117843985992 % p2 width 8.807469507353026 % p3 delay 3.680145761308111 % p3 width 7.783358489290968 % p4 delay 4.695379940110421 % p4 width 6.930993065963889 % p5 delay 5.5244810879620445 % p5 width 6.288586696196958 % p6 delay 6.117000009644471 % p6 width 5.888323429144677 % p7 delay 6.427466502066167 % p7 width 2.876129898966852 % quadrant delay ] store /a60 [ 11.078495962518918 % p1 delay 1.4438411449625086 % p1 width 9.684772040454877 % p2 delay 2.840939034126027 % p2 width 8.38774096372643 % p3 delay 4.143446978421139 % p3 width 7.234097294409224 % p4 delay 5.300789342760972 % p4 width 6.270187484640822 % p5 delay 6.2573120579578045 % p5 width 5.540415121300725 % p6 delay 6.9509377594411745 % p6 width 5.083782352079723 % p7 delay 7.31917029639942 % p7 width 2.4640721668002356 % quadrant delay ] store /a70 [ 10.888278735987464 % p1 delay 1.6594599780251222 % p1 width 9.286332677429444 % p2 delay 3.270497867115676 % p2 width 7.791694139706859 % p3 delay 4.783840563470704 % p3 width 6.455843532587245 % p4 delay 6.147367771354908 % p4 width 5.331869368850619 % p5 delay 7.300805550943892 % p5 width 4.473484564450537 % p6 delay 8.165497800155037 % p6 width 3.9315873351224724 % p7 delay 8.640550109600042 % p7 width 1.8728900051999772 % quadrant delay ] store /a80 [ 10.681702836852158 % p1 delay 1.8602538062958054 % p1 width 8.88398269670934 % p2 delay 3.6714981402848607 % p2 width 7.200946234572324 % p3 delay 5.385275030570618 % p3 width 5.687867904890517 % p4 delay 6.9536645196485765 % p4 width 4.403487202517624 % p5 delay 8.324602905316311 % p5 width 3.4104122823979494 % p6 delay 9.417450259887687 % p6 width 2.774084338047487 % p7 delay 10.068107274017336 % p7 width 1.2766645679914034 % quadrant delay ] store /a90 [ 10.447373907519674 % p1 delay 2.038123534960869 % p1 width 8.472609797490058 % p2 delay 4.0258541900581655 % p2 width 6.615791805649657 % p3 delay 5.91534811864263 % p3 width 4.935247854465985 % p4 delay 7.666864442425741 % p4 width 3.4934960493166684 % p5 delay 9.260584158941057 % p5 width 2.358772151850779 % p6 delay 10.696787617357046 % p6 width 1.6101420251774101 % p7 delay 11.792019752288254 % p7 width 0.6709845938560051 % quadrant delay ] store /a95 [ 10.307313139895288 % p1 delay 2.111222840209404 % p1 width 8.256837177571334 % p2 delay 4.169598534647832 % p2 width 6.323664766096179 % p3 delay 6.124919743159786 % p3 width 4.567759372280754 % p4 delay 7.93736307227887 % p4 width 3.052826978493542 % p5 delay 9.604367560734132 % p5 width 1.8471062124079367 % p6 delay 11.250122874450298 % p6 width 1.0294512420668695 % p7 delay 13.056647531415762 % p7 width 0.36079895429200803 % quadrant delay ] store /a96 [ 10.275153279505902 % p1 delay 2.1233556309882146 % p1 width 8.2115482104066 % p2 delay 4.1930336081984905 % p2 width 6.264803529331843 % p3 delay 6.157765833137692 % p3 width 4.495281237426013 % p4 delay 7.976346292010689 % p4 width 2.9669207635656676 % p5 delay 9.646432050857882 % p5 width 1.7477032094150075 % p6 delay 11.320166050312238 % p6 width 0.9148247359680965 % p7 delay 13.409077457751365 % p7 width 0.2975881111242984 % quadrant delay ] store /a97 [ 10.240457024341477 % p1 delay 2.134077471317074 % p1 width 8.164867772841955 % p2 delay 4.213452442998779 % p2 width 6.205523779081837 % p3 delay 6.185452328837567 % p3 width 4.423234605472523 % p4 delay 8.006618220218015 % p4 width 2.8821971876470442 % p5 delay 9.672069264487952 % p5 width 1.6500883956263123 % p6 delay 11.355113654260407 % p6 width 0.8016574526230471 % p7 delay 13.831443290493283 % p7 width 0.23374710975272705 % quadrant delay ] store /a98 [ 10.201940773921007 % p1 delay 2.1427535621580062 % p1 width 8.1160304405589 % p2 delay 4.229503836724113 % p2 width 6.145502859365315 % p3 delay 6.205687104545131 % p3 width 4.351688442224891 % p4 delay 8.024338941005154 % p4 width 2.7990882078968866 % p5 delay 9.67371438320096 % p5 width 1.555079224439453 % p6 delay 11.330237907918856 % p6 width 0.69116413541866 % p7 delay 14.364207461243552 % p7 width 0.169062719379113 % quadrant delay ] store /a99 [ 10.156863627959598 % p1 delay 2.1480428640811766 % p1 width 8.06339164056924 % p2 delay 4.238341714779558 % p2 width 6.0840316757476 % p3 delay 6.213675963725404 % p3 width 4.280754974385665 % p4 delay 8.02161284750413 % p4 width 2.718452103604484 % p5 delay 9.636460505287125 % p5 width 1.4642999953711353 % p6 delay 11.197329413972475 % p6 width 0.5860923925256714 % p7 delay 15.087472750976061 % p7 width 0.10317752951067405 % quadrant delay ] store /a100 [ 10.097664622565073 % p1 delay 2.146284244870163 % p1 width 8.002396397096308 % p2 delay 4.23222417093767 % p2 width 6.019120165289753 % p3 delay 6.1964902984829 % p3 width 4.21068681625524 % p4 delay 7.977592739007122 % p4 width 2.6425485752095525 % p5 delay 9.523271990574841 % p5 width 1.3819874635530311 % p6 delay 10.855567612314722 % p6 width 0.4941631819604595 % p7 delay 16.184573443763554 % p7 width 0.03542827811961047 % quadrant delay ] store /range [ (01) (10) (20) (30) (40) (50) (53) (60) (70) (80) (90) (95)(96)(97) (98)(99)(100) ] store /procit1 { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 13 get 2.5 mul lineto } def /procit2 { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 11 get 2.5 mul lineto } def /procit3 { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 9 get 2.5 mul lineto } def /procit4 { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 7 get 2.5 mul lineto } def /procit5 { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 5 get 2.5 mul lineto } def /procit6 { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 3 get 2.5 mul lineto } def /procit7 { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 1 get 2.5 mul lineto } def /procit1d { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 12 get 2.5 mul lineto } def /procit2d { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 10 get 2.5 mul lineto } def /procit3d { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 8 get 2.5 mul lineto } def /procit4d { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 6 get 2.5 mul lineto } def /procit5d { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 4 get 2.5 mul lineto } def /procit6d { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 2 get 2.5 mul lineto } def /procit7d { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 0 get 2.5 mul lineto } def /procit8d { dup cvi /curval exch store (a)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 14 get 2.5 mul lineto } def % 40 100 10 setgrid 40 40 showgrid line1 0 30 mt range {procit7d} forall 40 0 lineto 0 0 lineto closepath 0 settint 0.8 setgray fill 0 30 mt range {procit6d} forall 40 0 lineto 0 0 lineto closepath 0.1 settint 0.8 setgray fill 0 30 mt range {procit5d} forall 40 0 lineto 0 0 lineto closepath 0.2 settint 0.8 setgray fill 0 30 mt range {procit4d} forall 40 0 lineto 0 0 lineto closepath 0.27 settint 0.8 setgray fill 0 30 mt range {procit3d} forall 40 0 lineto 0 0 lineto closepath 0.43 settint 0.8 setgray fill 0 30 mt range {procit2d} forall 40 0 lineto 0 0 lineto closepath 0.5 settint 0.8 setgray fill 0 30 mt range {procit1d} forall 40 0 lineto 0 0 lineto closepath 0.6 settint 0.8 setgray fill 0 15 mt range {procit8d} forall 40 0 lineto 0 0 lineto closepath 0.7 settint 0.8 setgray fill 0 0 mt range {procit1} forall 40 0 lineto closepath 0.6 settint 0.6 setgray fill 0 0 mt range {procit2} forall 40 0 lineto closepath 0.5 settint 0.6 setgray fill 0 0 mt range {procit3} forall 40 0 lineto closepath 0.43 settint 0.6 setgray fill 0 0 mt range {procit4} forall 40 0 lineto closepath 0.27 settint 0.6 setgray fill 0 0 mt range {procit5} forall 40 0 lineto closepath 0.2 settint 0.6 setgray fill 0 0 mt range {procit6} forall 40 0 lineto closepath 0.1 settint 0.6 setgray fill 0 0 mt range {procit7} forall 40 0 lineto closepath 0 settint 0.6 setgray fill black 0 0 mt range {procit1} forall stroke 0 0 mt range {procit2} forall stroke 0 0 mt range {procit3} forall stroke 0 0 mt range {procit4} forall stroke 0 0 mt range {procit5} forall stroke 0 0 mt range {procit6} forall stroke 0 0 mt range {procit7} forall stroke 0 30 mt range {procit1d} forall 0 30 mt range {procit2d} forall 0 30 mt range {procit3d} forall stroke 0 30 mt range {procit4d} forall stroke 0 30 mt range {procit5d} forall stroke 0 30 mt range {procit6d} forall stroke 0 30 mt range {procit7d} forall stroke 0 15 mt range {procit8d} forall stroke 0.3 0.3 0.3 setrgbcolor line3 1 setlinecap 1 setlinejoin 0 0 mt 40 u 40 r 40 d 40 l [{ 0 0 mt 0.4 l} 10 5 ] yrpt [{ 40 0 mt 0.4 r} 10 5 ] yrpt [{ 0 0 mt 0.4 d} 10 5 ] xrpt [{ 0 40 mt 0.4 u} 10 5 ] xrpt /cstretch 0.02 store /sstretch 0 store /font0 /StoneSans-Bold 1.5 gonzofont /font1 /StoneSans-Bold 1.2 gonzofont /font2 /StoneSans-Bold 1 gonzofont /font: /StoneSans-Bold [0.6 0 0 0.6 0 0.6] gonzofont /font; /StoneSans-Bold [1.5 0 0 1.5 0 0.2] gonzofont /yinc 2 store font0 20 43.7 (BEST EFFICIENCY N |;=|0 28\nMAGIC SINEWAVE) cc font1 /yinc 1.5 store 0 -2.2 (0.0) cc 20 -2.2 (0.5) cc 40 -2.2 (1.0)cc 20 -4.3 (AMPLITUDE) cc 41 -0.5 (0) cl 41 9.5 (4) cl 41 19.5 (8) cl 41 29.5 (12) cl 41 39.5 (16) cl 45.5 21 (DELAY\nTIME IN\nDEGREES) cc font2 26.5 1.2 (PULSE WIDTHS) cc 1.5 17 (PULSE DELAYS) cl 2.6 32.6 (0|:o) cc 27.4 32.6 (90|:o) cc % generate actual magic sinewave /makemagic {gsave translate 0.25 dup scale line3 /ht 17 store /dht 6 store 0 setlinecap 0 setlinejoin dht setlinewidth 0 0 mt a50 0 get pr 0 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add 0 mt a50 2 get pr 0.1 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add 0 mt a50 4 get pr 0.2 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add 0 mt a50 6 get pr 0.3 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add 0 mt a50 8 get pr 0.4 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add 0 mt a50 10 get pr 0.5 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add a50 10 get add a50 11 get add 0 mt a50 12 get pr 0.6 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add a50 10 get add a50 11 get add a50 12 get add a50 13 get add 0 mt a50 14 get pr 0.7 settint 0.8 setgray stroke %% pulses a50 0 get 0 mt ht pu 0 a50 1 get pr ht pd closepath 0 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add 0 mt ht pu 0 a50 3 get pr ht pd closepath 0.1 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add 0 mt ht pu 0 a50 5 get pr ht pd closepath 0.2 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add 0 mt ht pu 0 a50 7 get pr ht pd closepath 0.3 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add 0 mt ht pu 0 a50 9 get pr ht pd closepath 0.4 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add a50 10 get add 0 mt ht pu 0 a50 11 get pr ht pd closepath 0.5 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add a50 10 get add a50 11 get add a50 12 get add 0 mt ht pu 0 a50 13 get pr ht pd closepath 0.6 settint 0.6 setgray fill 1 setlinecap 1 setlinejoin black 0 0 mt a50 0 get 0 rlineto 0 ht pu a50 1 get 0 rlineto 0 ht pd a50 2 get 0 rlineto 0 ht pu a50 3 get 0 rlineto 0 ht pd a50 4 get 0 rlineto 0 ht pu a50 5 get 0 rlineto 0 ht pd a50 6 get 0 rlineto 0 ht pu a50 7 get 0 rlineto 0 ht pd a50 8 get 0 rlineto 0 ht pu a50 9 get 0 rlineto 0 ht pd a50 10 get 0 rlineto 0 ht pu a50 11 get 0 rlineto 0 ht pd a50 12 get 0 rlineto 0 ht pu a50 13 get 0 rlineto 0 ht pd a50 14 get 0 rlineto 0.45 setlinewidth stroke grestore} def 3.5 33 makemagic } store % end special1code definition %%%%%%%%%%% special2 code /special2code { /ad01 [ 7.434338157133027 % delay a=60-p5e 0.11880195485247924 % delay b=p5e-p5s 0.019577960879085587 % delay c=p1e-p1s 14.855161666700834 % delay d=p2s-p1e 0.021983040440492374 % delay e=p2e-p2s 0.0911673899925809 % delay f=p3s-p2e 0.0353778304366692 % delay g=p3e-p3s 7.4235919995647634 % delay h=30-p3e ] store /ad10 [ 6.840486668588909 % delay a=60-p5e 1.1877031146444991 % delay b=p5e-p5s 0.19606479817654332 % delay c=p1e-p1s 13.542825252098737 % delay d=p2s-p1e 0.1524725715290529 % delay e=p2e-p2s 0.9104569599226266 % delay f=p3s-p2e 0.4224088615298953 % delay g=p3e-p3s 6.7475817735097365 % delay h=30-p3e ] store /ad20 [ 6.179615738852249 % delay a=60-p5e 2.368314508230462 % delay b=p5e-p5s 0.39486570406405263 % delay c=p1e-p1s 12.090328683781834 % delay d=p2s-p1e 0.2773208755122525 % delay e=p2e-p2s 1.8107046591154443 % delay f=p3s-p2e 0.8802494355140809 % delay g=p3e-p3s 5.998600394929625 % delay h=30-p3e ] store /ad30 [ 5.51798715656065 % delay a=60-p5e 3.537987411554724 % delay b=p5e-p5s 0.5996610353231375 % delay c=p1e-p1s 10.6414917563349 % delay d=p2s-p1e 0.378916570008613 % delay e=p2e-p2s 2.6949373104326213 % delay f=p3s-p2e 1.3768763200109077 % delay g=p3e-p3s 5.252142439774445 % delay h=30-p3e ] store /ad40 [ 4.8560795807034935 % delay a=60-p5e 4.692317283738298 % delay b=p5e-p5s 0.8138114048538583 % delay c=p1e-p1s 9.195452323744191 % delay d=p2s-p1e 0.46036801366636126 % delay e=p2e-p2s 3.5594981265840886 % delay f=p3s-p2e 1.9150363136688284 % delay g=p3e-p3s 4.50743695304088 % delay h=30-p3e ] store /ad50 [ 4.194298075500072 % delay a=60-p5e 5.825866502969745 % delay b=p5e-p5s 1.0408488460292488 % delay c=p1e-p1s 7.751463747608284 % delay d=p2s-p1e 0.5238895562340744 % delay e=p2e-p2s 4.403346953313516 % delay f=p3s-p2e 2.496487356236706 % delay g=p3e-p3s 3.7637989621083534 % delay h=30-p3e ] store /ad53 [ 3.995843046736013 % delay a=60-p5e 6.160868086216446 % delay b=p5e-p5s 1.112006440311525 % delay c=p1e-p1s 7.318567062952312 % delay d=p2s-p1e 0.5397256759732585 % delay e=p2e-p2s 4.652707315620958 % delay f=p3s-p2e 2.679463155973238 % delay g=p3e-p3s 3.5408192162162493 % delay h=30-p3e ] store /ad60 [ 3.5330039078836606 % delay a=60-p5e 6.9314513603008905 % delay b=p5e-p5s 1.2842465239317846 % delay c=p1e-p1s 6.308872401421397 % delay d=p2s-p1e 0.5713975364200223 % delay e=p2e-p2s 5.228837780084575 % delay f=p3s-p2e 3.1216051264200075 % delay g=p3e-p3s 3.0205853635376627 % delay h=30-p3e ] store /ad70 [ 2.8725257224432425 % delay a=60-p5e 7.998916501222098 % delay b=p5e-p5s 1.5460427838912807 % delay c=p1e-p1s 4.8671218102361 % delay d=p2s-p1e 0.6062046544537196 % delay e=p2e-p2s 6.042997615507133 % delay f=p3s-p2e 3.789041064453741 % delay g=p3e-p3s 2.2771498477926854 % delay h=30-p3e ] store /ad80 [ 2.2131268407607223 % delay a=60-p5e 9.012727944067371 % delay b=p5e-p5s 1.8200962344110607 % delay c=p1e-p1s 3.4258327180993433 % delay d=p2s-p1e 0.6400219482894229 % delay e=p2e-p2s 6.85987852874419 % delay f=p3s-p2e 4.495547368289273 % delay g=p3e-p3s 1.532768417338616 % delay h=30-p3e ] store /ad90 [ 1.55474755544018 % delay a=60-p5e 9.946227643338275 % delay b=p5e-p5s 2.048752785780998 % delay c=p1e-p1s 1.9853102905593687 % delay d=p2s-p1e 0.736140589142309 % delay e=p2e-p2s 7.705915111477708 % delay f=p3s-p2e 5.236535369142075 % delay g=p3e-p3s 0.7863706551190859 % delay h=30-p3e ] store /ad95 [ 1.225355348586767 % delay a=60-p5e 10.367111550363887 % delay b=p5e-p5s 2.0303138224619843 % delay c=p1e-p1s 1.2665437513423114 % delay d=p2s-p1e 0.9241283097125574 % delay e=p2e-p2s 8.155346335065047 % delay f=p3s-p2e 5.619630049711802 % delay g=p3e-p3s 0.4115708327556433 % delay h=30-p3e ] store /ad98 [ 1.026684367555248 % delay a=60-p5e 10.596415552349142 % delay b=p5e-p5s 1.807508982542501 % delay c=p1e-p1s 0.837605401539733 % delay d=p2s-p1e 1.2493523058395936 % delay e=p2e-p2s 8.441202830348274 % delay f=p3s-p2e 5.855882255842914 % delay g=p3e-p3s 0.18534830398259316 % delay h=30-p3e ] store /ad100 [ 0.8921862350266565 % delay a=60-p5e 10.732271751681054 % delay b=p5e-p5s 1.3169014782635031 % delay c=p1e-p1s 0.5554591355065241 % delay d=p2s-p1e 1.8052854865738012 % delay e=p2e-p2s 8.644568525896716 % delay f=p3s-p2e 6.020358566571353 % delay g=p3e-p3s 0.032968820480391514 % delay h=30-p3e ] store /range [ (01) (10) (20) (30) (40) (50) (53) (60) (70) (80) (90) (95) (98)(100) ] store /procit1 { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 1 get 2.5 mul lineto } def /procit2 { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 2 get 2.5 mul lineto } def /procit3 { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 4 get 2.5 mul lineto } def /procit4 { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 5 get 2.5 mul lineto } def /procit5 { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 6 get 2.5 mul lineto } def /procit6 { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 3 get 2.5 mul lineto } def /procit7 { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 1 get 2.5 mul lineto } def /procit1d { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 0 get 2.5 mul lineto } def /procit2d { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 3 get 2.5 mul lineto } def /procit3d { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 7 get 2.5 mul lineto } def /procit4d { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 6 get 2.5 mul lineto } def /procit5d { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 4 get 2.5 mul lineto } def /procit6d { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 2 get 2.5 mul lineto } def /procit7d { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 0 get 2.5 mul lineto } def /procit8d { dup cvi /curval exch store (ad)exch mergestr cvn /curdat exch store curval 2.5 div curdat cvx exec 14 get 2.5 mul lineto } def % 40 100 10 setgrid 40 40 showgrid line1 % delays 0 37.5 mt range {procit2d} forall 40 0 lineto 0 0 lineto closepath 0.15 settint 0.8 setgray fill 0 18.75 mt range {procit1d} forall 40 0 lineto 0 0 lineto closepath 0 settint 0.8 setgray fill 0 18.75 mt range {procit3d} forall 40 0 lineto 0 0 lineto closepath 0.3 settint 0.8 setgray fill % pulses 0 0 mt range {procit1} forall 40 0 lineto 0 0 lineto closepath 0.0 settint 0.6 setgray fill 0 0 mt range {procit4} forall 40 0 lineto 0 0 lineto closepath 0.5 settint 0.6 setgray fill 0 0 mt range {procit5} forall 40 0 lineto 0 0 lineto closepath 0.6 settint 0.6 setgray fill 0 0 mt range {procit2} forall 40 0 lineto 0 0 lineto closepath 0.15 settint 0.6 setgray fill 0 0 mt range {procit3} forall 40 0 lineto 0 0 lineto closepath 0.3 settint 0.6 setgray fill black line1 0 18.75 mt range {procit1d} forall stroke 0 37.5 mt range {procit2d} forall stroke 0 18.75 mt range {procit3d} forall stroke stroke % width outlines 0 0 mt range {procit1} forall stroke 0 0 mt range {procit2} forall stroke 0 0 mt range {procit3} forall stroke 0 0 mt range {procit4} forall stroke 0 0 mt range {procit5} forall stroke 0.3 0.3 0.3 setrgbcolor line3 1 setlinecap 1 setlinejoin 0 0 mt 40 u 40 r 40 d 40 l [{ 0 0 mt 0.4 l} 10 5 ] yrpt [{ 40 0 mt 0.4 r} 10 5 ] yrpt [{ 0 0 mt 0.4 d} 10 5 ] xrpt [{ 0 40 mt 0.4 u} 10 5 ] xrpt /cstretch 0.02 store /sstretch 0 store /font0 /StoneSans-Bold 1.5 gonzofont /font1 /StoneSans-Bold 1.2 gonzofont /font2 /StoneSans-Bold 1 gonzofont /font: /StoneSans-Bold [0.6 0 0 0.6 0 0.6] gonzofont /font; /StoneSans-Bold [1.5 0 0 1.5 0 0.2] gonzofont /yinc 2 store font0 20 45 (DELTA FRIENDLY N |;=|0 28\nMAGIC SINEWAVE) cc font1 /yinc 1.5 store 0 -2.2 (0.0) cc 20 -2.2 (0.5) cc 40 -2.2 (1.0)cc 20 -4.3 (AMPLITUDE) cc 41 -0.5 (0) cl 41 9.5 (4) cl 41 19.5 (8) cl 41 29.5 (12) cl 41 39.5 (16) cl 46.5 21 (DELAY\nTIME IN\nDEGREES) cc font2 23.5 4.7 (PULSE WIDTHS) cc 1.5 22.5 (PULSE DELAYS) cl % generate actual magic sinewave /makemagicold {gsave translate 0.25 dup scale line3 /ht 12 store /dht 6 store 0 setlinecap 0 setlinejoin dht setlinewidth 0 0 mt a50 0 get pr 0 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add 0 mt a50 2 get pr 0.1 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add 0 mt a50 4 get pr 0.2 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add 0 mt a50 6 get pr 0.3 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add 0 mt a50 8 get pr 0.4 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add 0 mt a50 10 get pr 0.5 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add a50 10 get add a50 11 get add 0 mt a50 12 get pr 0.6 settint 0.8 setgray stroke 0 a50 0 get add a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add a50 10 get add a50 11 get add a50 12 get add a50 13 get add 0 mt a50 14 get pr 0.7 settint 0.8 setgray stroke %% pulses a50 0 get 0 mt ht pu 0 a50 1 get pr ht pd closepath 0 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add 0 mt ht pu 0 a50 3 get pr ht pd closepath 0.1 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add 0 mt ht pu 0 a50 5 get pr ht pd closepath 0.2 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add 0 mt ht pu 0 a50 7 get pr ht pd closepath 0.3 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add 0 mt ht pu 0 a50 9 get pr ht pd closepath 0.4 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add a50 10 get add 0 mt ht pu 0 a50 11 get pr ht pd closepath 0.5 settint 0.6 setgray fill a50 0 get a50 1 get add a50 2 get add a50 3 get add a50 4 get add a50 5 get add a50 6 get add a50 7 get add a50 8 get add a50 9 get add a50 10 get add a50 11 get add a50 12 get add 0 mt ht pu 0 a50 13 get pr ht pd closepath 0.6 settint 0.6 setgray fill 1 setlinecap 1 setlinejoin black 0 0 mt a50 0 get 0 rlineto 0 ht pu a50 1 get 0 rlineto 0 ht pd a50 2 get 0 rlineto 0 ht pu a50 3 get 0 rlineto 0 ht pd a50 4 get 0 rlineto 0 ht pu a50 5 get 0 rlineto 0 ht pd a50 6 get 0 rlineto 0 ht pu a50 7 get 0 rlineto 0 ht pd a50 8 get 0 rlineto 0 ht pu a50 9 get 0 rlineto 0 ht pd a50 10 get 0 rlineto 0 ht pu a50 11 get 0 rlineto 0 ht pd a50 12 get 0 rlineto 0 ht pu a50 13 get 0 rlineto 0 ht pd a50 14 get 0 rlineto 0.45 setlinewidth stroke grestore} def /makemagic {gsave translate 0.8 dup scale line3 /ht 3 store /dht 1.5 store 0 setlinecap 0 setlinejoin dht setlinewidth 0 0 mt ad70 0 get pr 0 settint 0.8 setgray stroke ad70 0 get ad70 1 get add ad70 2 get add 0 mt ad70 3 get pr 0.15 settint 0.8 setgray stroke ad70 0 get ad70 1 get add ad70 2 get add ad70 3 get add ad70 4 get add ad70 5 get add ad70 6 get add 0 mt ad70 7 get pr 0.3 settint 0.8 setgray stroke % pulses ad70 0 get 0 mt ht 2 mul pu ad70 1 get pr ht 2 mul pd closepath 0 settint 0.6 setgray fill ad70 0 get ad70 1 get add 0 mt ht 2 mul pu ad70 2 get pr ht 2 mul pd closepath 0.15 settint 0.6 setgray fill ad70 0 get ad70 1 get add ad70 2 get add ad70 3 get add 0 mt ht 2 mul pu ad70 4 get pr ht 2 mul pd closepath 0.30 settint 0.6 setgray fill ad70 0 get ad70 1 get add ad70 2 get add ad70 3 get add ad70 4 get add 0 mt ht 2 mul pu ad70 5 get pr ht 2 mul pd closepath 0.5 settint 0.6 setgray fill ad70 0 get ad70 1 get add ad70 2 get add ad70 3 get add ad70 4 get add ad70 5 get add 0 mt ht 2 mul pu ad70 6 get pr ht 2 mul pd closepath 0.6 settint 0.6 setgray fill % outlines black line1 1 setlinecap 1 setlinejoin 0 0 mt ad70 0 get pr ht pu ad70 1 get pr ht pd ht pu ad70 2 get pr ht pd ad70 3 get pr ht pu ad70 4 get pr ht pd ht pu ad70 5 get pr ht pd ht pu ad70 6 get pr ht pd ad70 7 get pr stroke 0 0 mt ad70 0 get pr ht 2 mul pu ad70 1 get ad70 2 get add pr ht 2 mul pd ad70 3 get pr ht 2 mul pu ad70 4 get ad70 5 get add ad70 6 get add pr ht 2 mul pd stroke % p3 poker 17.8 -0.45 mt 1.65 -2.5 rlineto black line1 stroke 11.5 -0.45 mt -1.65 -2.5 rlineto black line1 stroke grestore } def 12 31 makemagic font2 11 30.5 (0|:o) cc 37.5 30.5 (30|:o) cc 28.5 28.3 (p2) cc 18.9 28.3 (p1) cc 18 31.8 (p5) cc 28.8 31.8 (p4) cc 32.7 31.8 (p3) cc 18 34.2 (p6) cc 30.2 34.2 (p7) cc } store % end special 2 def % ---------- /special1 {save /s1snap exch store 4.5 2.5 translate 0.8 dup scale special1code s1snap restore} store /special2 {save /s1snap exch store 4.5 17 translate 0.8 dup scale special2code s1snap restore} store /special5 {gsave 4 -5.85 translate line1 black 0.3 0 mt 0.3 l 5.2 u 0.3 r 13.2 0 mt 0.3 r 5.2 u 0.3 l 15.3 0 mt 0.3 l 5.2 u 0.3 r 18.3 0 mt 0.3 r 5.2 u 0.3 l grestore } store /xkernon {/kernsave kern store /kern 0.18 store } def /xkernoff {/kern kernsave store} def /pagenum 1 store /startnewpage { black beige 0.35 setgray 21 -2.5 (|3\320|j|j) ggnum 10 string cvs mergestr (|j.|j) mergestr pagenum 10 string cvs mergestr (|j|j\320) mergestr cc aqua showpage %% start next page /pagenum pagenum 1 add store 50 50 10 setgrid % create grid setpagefonts font1 textleft texttop } def /su {surl font6} store /to {tinton1 font6} store /tx {tintoff font1} store /tabs [14.5 20] store % /font7 /helvetica [0.7 0 0 0.7 0 0.5] gonzofont font1 aqua 0.33 setgray font0 20 47.3 0.7 add 1 sub (Magic |j|jSinewave |j|jQuantization |j|jUtilities) cc 20 45.3 0.7 add ( ) cc black font2 textleft 43 0.3 add % this one only need |h below (|/aqua |/staytint1 |3Don Lancaster Synergetics, Box 809, Thatcher, AZ 85552 copyright c2003 as |/surl |6GuruGram|1|/gurgrm01 |/tinton1 |6#27 |/surl http://www.tinaja.com|/tinaja |/surl don@tinaja.com|/maildon (928) 428-4073 |/aqua |/black |a|0A|b|1|j|jnew class of |/su math functions|1|/math01 called |/su Magic Sinewaves|1|/magsn01 lets you efficiently produce power sinewaves that can have |/to any|/tx chosen number of low harmonics forced very near |/to zero|/tx . And do so using the fewest possible switching events for the highest possible energy efficiency. Two new intros appear |/su here|1|/msintro1 and |/su here|1|/deltams1 , along with a development proposal |/su here|1|/msinprop , a tutorial |/su here|1|/stepsynt , visualizations |/su here|1 |/vismagsn , lots of calculators |/su here|1|/magsn01 , and seminars and workshops |/su here|1|/info01 . |h In this |/su Gurugram|1|/gurgrm01 , we'll take a closer look at how quantization of magic sinewaves into integer delay and width values affects the synthesis accuracy. In general, quantization introduces errors that dramatically raise distortion levels, creates amplitude jitter, and may introduce frequency jitter. While approximate quantization estimations are provided in the |/su Magic Sinewave Calculators|1|/magsn01 , our interests here will be in exact prediction of specific performance. |h Some new |/su PostScript|1|/post01 utilities are available that can give you many of the needed quantization analysis tools. Such as file |/su OPTJIT01.PSL|1|/optjit01 and its |/su OPTJIT01.PDF|1|/optjit01demo demo plots. We'll note in passing that the 32-bit math accuracy of PostScript seems to be acceptable for these specific tasks. As this utility is a personal tool, it may still have some rough edges and may be subject to change and improvement. |c Data Formats |d The original exact calculators determine a list of first quadrant event positions. In the case of a |/su Best Efficiency-28 magic sinewave|1|/msintro1 , there are seven pulses and eight delays whose |/to absolute|/tx starting points are |/to 0, p1s, p1e, p2s, p2e, p3s, p3e, p4s, |/to p4e, p5s, p5e, p6s, p6e, p7s,|/tx and |/to p7e|/tx . For a given amplitude, these will be an increasing series of degree values in the 0 to 90 degree range. |h As we have seen in our |/su Magsine Visualizations|1|/vismagsn as |/su GuruGram #24|1|/gurgrm01 , the situation is somewhat more complex for |/su delta friendly|1|/deltams1 magic sinewaves in that half of the pulse edges must track the others to guarantee three phase compatibility. A new |/to export format|/tx has been added to commercial versions of the calculators that outputs |/to predelay, p5w, p1w, middelay, p2w, p4w, p3w|/tx , and |/to postdelay|/tx . |h ) cl startnewpage (Because of the needed locking, derived widths |/to p6w|/tx will equal the sum of |/to p5w|/tx and |/to p1w|/tx , while |/to p7w|/tx must equal the sum of |/to p2w, p4w|/tx and |/to p3w|/tx . |h Further, the |/to predelay...postdelay|/tx sequence repeats every |/to thirty|/tx degrees. For any thirty degree interval, the sourcecode will decide which phase gets pulses |/to p1, p2|/tx and |/to p3|/tx , which gets |/to p4|/tx and |/to p5|/tx , and which gets |/to p6|/tx and |/to p7|/tx . Of correct polarity. |h The Delta friendly transform from event positions to export format is\274 |6|/shiftin |/aqua |/burplebox9 |/staytint1 |h predelay = 60 - p5e p5w = p5e - p5s p1w = p1e - p1s middelay = p2s - p1e p2w = p2e - p2s p4w = p3s - p2e p3w = p3e - p3s postdelay = 30 - p3e |1|/shiftout |/aqua |/black And one unquantized reverse transform is\274 |6|/shiftin |/aqua |/burplebox18.5 |/staytint1 |h CONTROLLABLE (INDEPENDENT) VARIABLES: |h p1s = predelay + p5w p1e = p1s + p1w p2s = p1e + middelay p2e = p2s + p2w p3s = p2e + p4w p3e = p3s + p3w p5e = 60 - predelay |h LOCKED TRACKING (DEPENDENT) VARIABLES: |h p4s = 60 p3s sub p4e = 60 p2e sub p5s = 60 p1s sub p6s = 120 p5e sub p6e = 60 p1e add p7s = 60 p2s add p7e = 60 p3e add |1|/shiftout |/aqua |/black |h While any seven of the fourteen Delta-28 variables could be made independent, the choice of |/to p1s, p1e, p2s, p2e, p3s, p3e|/tx and |/to p5e|/tx appears to have some analysis and optimization advantages. Especially when optimizing quantized distortion. ) cl startnewpage (|c Quantization Tradeoffs |d Quantization of magic sinewave data into integer sequences trades off the best achievable distortion against the clock frequency, data word size, amplitude jitter, and possibly frequency jitter. While "reasonable" results can often be gotten by using "modified" 8-bit stored data, optimization methods may not be clear. |h A good baseline starting point can be to let a frequency very near 10 Megahertz equal a magic sinewave output frequency of 60 Hertz. If |/to 3472|/tx clock cycles are used in a 30 degree interval, an entire cycle will consist of |/to 41664|/tx cycles . And a 10 MegaHertz PIC clock should produce an output frequency of |/to 60.0038|/tx Hertz. Conversely, a frequency of 60 Hertz can be gotten from a |/to 9.999360|/tx MHz PIC clock. Note that a PIC clock is |/to four times|/tx the instruction cycle time. |h These particular values give us a |/to 2.1198|/tx degree full scale for 8-bit data, which corresponds to one count being |/to 0.008641|/tx degrees. Values above the 2.1198 full scale are easily handled by adding a ramp of |/to amplitude|j*|jk|/tx . Depending on the actual data, inverse ramps and|j/|jor end truncated ramps can also be used. Thus, as we have already seen in |/su MINDIST1.PDF|1|/mindist1 as |/su GuruGram #19|1|/gurgrm01 , we can get a lot more than 8-bit accuracy and still use 8-bit stored data values. |h Quantization consists of converting exact degree values into a group of eight integers that are supposed to sum to 3272 over a 30 degree interval. The degrees to integers algorithm is\274 |6|/shiftin |/aqua |/burplebox3.5 |/staytint1 |h degreesperbit = 0.008641 |h quantout = int ( round (degreesin|j/|jdegreesperbit)) |1|/shiftout |/aqua |/black |h And the corresponding reverse transform is |6|/shiftin |/aqua |/burplebox3.5 |/staytint1 |h degreesperbit = 0.008641 |h degreesout = quantin * degreesperbit |1|/shiftout |/aqua |/black |h Thus an amplitude |/to 0.54|/tx array of |/to [|j3.929702 6.271940 1.1360694 7.174293 |/to 0.5446923 4.7354755 2.7413283 3.466498|j]|/tx degrees becomes an integer sequence of |/to [|j454 727 132 829 63 549 318 400|j]|/tx . Once again, note that these larger integers can be generated by an 8-bit table lookup plus an 8-bit function. |h For instance, the 549 value might be synthesized as an 8-bit stored value of 117 added to 8 times the desired amplitude of 54. Or 117 + (|j8|j*|j54|j) = 549. Note further that a delay of eight times a stored value gets easily done simply by creating a delay loop of |/to eight instruction cycles per count|/tx . ) cl startnewpage (|c A minor gotcha |d When we quantize, the "virtually zero" distortion is very likely to get a lot worse. How much worse can be found by converting the integers back into degrees and then recalculating the Fourier coefficients. But, before we do, note that\274 |6|/shiftin |/aqua |/burplebox2 |/staytint1 The sum of the quantizations does NOT necessarily equal the quantization of the sums! |1|/shiftout |/aqua |/black |h Each and every 8 data value degree array summed to 30 degrees. But when you quantize, you get a Gaussian type thingy that depends on the roundup or rounddown stats of the individual data. Typically, one-half of your quantized amplitudes will sum to 3472. Most of the others will sum to 3471 or 3473, while a few stragglers will sum to higher or lower values. |h This means that\274 |6|/shiftin |/aqua |/burplebox2 |/staytint1 |h Direct use of quantized data can cause frequency jitter! |1|/shiftout |/aqua |/black |h In this example, a frequency jitter of 2 counts out of 3472 translates to just under |/to 0.05|/tx percent jitter worst case. Which is probably negligible for most apps. But we can easily achieve zero jitter with minor mods to our quantized data. At only a negligible distortion penalty. |h Ferinstance, you could manually go through the data. If you have a 3471 sum, find the |/to one|/tx pre rounding value closest |/to below|/tx 0.5 and round it |/to up|/tx instead. I automated this in a utility that initially "rounds" everything at a 0.75 threshold, guaranteeing low data. The threshold is then lowered in tiny increments till the 3472 value is reached for each and every quantized data array. |h If a quantized array with jitter was, say, |/to [|j454 727 132 829 63 549 318 400|j]|/tx , its frequency dejittered improvement might look like |/to [|j454 727 133 829 63 549 318 |/to 400|j]|/tx . I feel that frequency dejittering is most often a very good idea. |h |c Amplitude Jitter |d Quantizing will also give us some amplitude jitter, but this is usually not too significant. If you select a hundred amplitude levels, this implies you are willing to take anything from |/to 53.50001|/tx to |/to 54.44449|/tx for amplitude 54 . Which I'll define as an amplitude jitter of plus or minus fifty percent. |j As we'll shortly see, purposely allowing a max amplitude jitter around the ten percent range can significantly lower our quantized distortion levels. |h Conversely, distortion could be traded off for lower amplitude jitter. ) cl startnewpage (|c Some Results |d The orange dots here give us a preliminary plot of the raw quantization errors we can expect from our above example\274 |/figureoneauto We see that our raw quantized total harmonic distortion for the second through twenty-second harmonic is under 0.2 percent for most higher amplitude values. And that is |/to before|/tx any filtering. Our filter, of course, has bigger things to worry about. Namely the uncontrolled twenty third and higher harmonics. |h We see that 8-bit data thus gives us "acceptable" distortion after quantization in this |/to 10 MHz --> 60 Hz|/tx example. We might be tempted to try and reduce our clock frequency further. Perhaps going to |/to 6 MHz --> 60 Hz|/tx or even using that internal |/to 4 MHz|/tx PIC clock option for fixed 60 Hertz apps. But these reductions may make synthesizing very low or very high amplitudes tricky, especially for Delta 44 or Delta 60 magic sinewave options. |h It does turn out there is a sneaky trick we can pull that can further reduce our quantized harmonic distortion. I'll call this one\274 |h |c Shaking the Box |d Compared to our quantized solution, what are the nearest |/to adjacent|/tx 78,125 magic sinewaves up to? It turns out that a "nearby" magic sinewave can often give us a |/to two to twelve decibel|/tx thd 2-22 distortion reduction. ) cl startnewpage (Which can result in the magenta dots in our previous figure. Reducing most prefiltered 2-22 distortions to well under one tenth of a percent total thd. |h To "shake the box", you take your independent |/to p1s, p1e, p2s, p2e, p3s, p3e|/tx , and |/to p5s|/tx integers and alter each value by |/to -2, -1, 0, 1,|/tx or |/to 2|/tx counts while you are doing an exhaustive search. The results for amplitude 54 might look like this\274 |/figuretwoauto I've left those nearby results with higher distortions unplotted. Here, we see that the orange dot is what we want in the way of a "perfect" magic sinewave, the red dot is our initial quantization, and the magenta dots offer several "better" tradeoffs. In this example, I'd go with the 0.0655% x 0.5409 amplitude improved solution. |h Note that all of the new data values will still sum to 3472. Because half the delay and position values are dependent on (|jand calculated from|j) the other half. No new frequency jitter is introduced by this process. |h When plotted on a different scale and allowing higher distortion values, this gives us a classic "dripping stalactite" plot. One that was crucial in early magic sinewave development. When it was found that the drips could be miraculously forced to zero if you used accurate enough calculations. ) cl startnewpage (|c A Data Set |d Here's a preliminary data set using our above example that may be used for sourcecode generation\274 |6|/shiftin |/aqua |/burplebox38.5w |/staytint1 [ [868 0 0 1730 0 0 0 868] 0.000000 0.0000000 3472 ] [ [860 13 2 1722 0 10 6 859] 1.510760 0.0093493 3472 ] [ [850 29 5 1701 6 22 8 851] 0.978672 0.0210324 3472 ] [ [845 43 7 1683 7 33 14 840] 0.477679 0.0312886 3472 ] [ [837 56 9 1668 7 43 20 832] 0.318167 0.0406482 3472 ] |h [ [830 68 11 1653 10 52 23 825] 0.337353 0.0493669 3472 ] [ [821 85 14 1631 11 65 30 815] 0.203131 0.0617085 3472 ] [ [815 95 16 1619 13 73 33 808] 0.259957 0.0692016 3472 ] [ [807 110 18 1601 14 84 39 799] 0.229666 0.0798052 3472 ] [ [800 122 20 1587 16 93 43 791] 0.271299 0.0885358 3472 ] |h [ [791 138 23 1567 18 106 49 780] 0.172600 0.1005590 3472 ] [ [784 151 25 1551 19 116 54 772] 0.1339800 0.109939 3472 ] [ [777 163 27 1536 21 125 58 765] 0.1192960 0.118677 3472 ] [ [768 180 30 1515 22 138 65 754] 0.1874040 0.131049 3472 ] [ [761 193 32 1499 24 148 70 745] 0.1343130 0.140698 3472 ] |h [ [754 205 34 1484 26 157 74 738] 0.1291950 0.149444 3472 ] [ [747 218 36 1468 26 167 80 730] 0.1061010 0.158846 3472 ] [ [738 234 39 1448 28 179 86 720] 0.0965049 0.170589 3472 ] [ [731 246 41 1434 29 188 91 712] 0.0914561 0.179351 3472 ] [ [723 260 43 1417 31 199 96 703] 0.1290420 0.189653 3472 ] |h [ [714 276 46 1397 32 211 103 693] 0.0546426 0.201417 3472 ] [ [707 289 48 1381 33 221 108 685] 0.1085760 0.210828 3472 ] [ [701 300 50 1367 35 229 112 678] 0.1002610 0.218951 3472 ] [ [691 316 53 1348 36 241 119 668] 0.1207730 0.230727 3472 ] [ [684 330 55 1330 37 252 125 659] 0.1038410 0.241057 3472 ] |h [ [677 342 57 1316 38 261 130 651] 0.0973585 0.249840 3472 ] [ [670 354 60 1300 40 270 135 643] 0.1141750 0.259094 3472 ] [ [663 367 62 1284 40 280 141 635] 0.0808775 0.268537 3472 ] [ [653 384 65 1263 42 293 148 624] 0.0519740 0.281232 3472 ] [ [647 395 67 1249 43 301 153 617] 0.0641827 0.289386 3472 ] |h [ [638 411 70 1229 44 313 160 607] 0.0942731 0.301193 3472 ] [ [630 424 72 1214 45 323 166 598] 0.0954356 0.310907 3472 ] [ [624 435 74 1200 46 331 171 591] 0.0730116 0.319070 3472 ] [ [615 451 77 1180 47 343 178 581] 0.0677774 0.330889 3472 ] [ [608 463 79 1165 48 352 183 574] 0.0797174 0.339699 3472 ] |1|/shiftout |/aqua |/black ) cl startnewpage (|6|/shiftin |/aqua |/burplebox38.5w |/staytint1 [ [600 477 82 1147 49 363 190 564] 0.0727672 0.350554 3472 ] [ [592 491 84 1130 50 373 196 556] 0.0859002 0.360616 3472 ] [ [585 503 87 1114 51 382 202 548] 0.0895733 0.369923 3472 ] [ [578 516 89 1098 51 392 209 539] 0.0823565 0.379679 3472 ] [ [569 531 92 1079 53 403 216 529] 0.0758395 0.391137 3472 ] |h [ [562 543 94 1064 54 412 221 522] 0.0916116 0.399965 3472 ] [ [553 558 97 1046 54 423 229 512] 0.0716472 0.411197 3472 ] [ [547 569 99 1032 55 431 234 505] 0.0527390 0.419389 3472 ] [ [538 584 102 1013 56 442 242 495] 0.0744991 0.430883 3472 ] [ [530 598 105 995 56 453 249 486] 0.0643956 0.441523 3472 ] |h [ [523 610 107 980 57 462 255 478] 0.0651337 0.450642 3472 ] [ [515 624 110 962 58 472 262 469] 0.0500311 0.461231 3472 ] [ [508 636 112 947 59 481 268 461] 0.0682797 0.470357 3472 ] [ [501 648 115 931 59 490 275 453] 0.0390659 0.479727 3472 ] [ [493 661 118 914 60 500 282 444] 0.0464662 0.491163 3472 ] |h [ [485 675 120 897 61 510 289 435] 0.0701265 0.500383 3472 ] [ [478 687 123 881 61 519 296 427] 0.0436721 0.509765 3472 ] [ [470 700 126 864 62 529 303 418] 0.0589122 0.520046 3472 ] [ [463 712 129 848 62 538 310 410] 0.0621049 0.529436 3472 ] [ [454 727 132 829 63 549 318 400] 0.0655310 0.540979 3472 ] |h [ [447 739 134 814 64 557 324 393] 0.0659652 0.549818 3472 ] [ [440 751 137 797 64 567 332 384] 0.0608129 0.559810 3472 ] [ [432 764 140 780 65 577 339 375] 0.0552627 0.570111 3472 ] [ [424 777 143 764 65 586 346 367] 0.0621947 0.579854 3472 ] [ [417 789 145 748 66 595 353 359] 0.0497526 0.589296 3472 ] |h [ [409 802 149 730 66 605 361 350] 0.0498109 0.599860 3472 ] [ [401 815 152 713 66 615 369 341] 0.0454799 0.610207 3472 ] [ [393 828 155 696 67 624 377 332] 0.0516502 0.620493 3472 ] [ [385 841 158 679 67 634 385 323] 0.0588497 0.630849 3472 ] [ [379 851 160 665 68 642 391 316] 0.0342060 0.639051 3472 ] |h [ [371 864 164 647 68 652 399 307] 0.0456603 0.649639 3472 ] [ [363 877 167 630 68 662 407 298] 0.0522574 0.660009 3472 ] [ [355 890 170 612 69 672 415 289] 0.0426991 0.670628 3472 ] [ [348 901 173 597 69 680 423 281] 0.0480973 0.679712 3472 ] [ [340 914 176 579 70 690 431 272] 0.0477716 0.690340 3472 ] |1|/shiftout |/aqua |/black ) cl startnewpage (|6|/shiftin |/aqua |/burplebox34w |/staytint1 [ [333 925 179 564 70 699 438 264] 0.0308037 0.699467 3472 ] [ [324 939 183 545 70 710 447 254] 0.0686215 0.711012 3472 ] [ [317 950 185 530 71 718 455 246] 0.0415750 0.720131 3472 ] [ [310 961 188 514 72 727 462 238] 0.0498212 0.729513 3472 ] [ [302 973 192 497 71 737 471 229] 0.0430787 0.739846 3472 ] |h [ [294 986 195 479 72 747 479 220] 0.0405623 0.750499 3472 ] [ [286 998 198 462 72 757 488 211] 0.0438831 0.760860 3472 ] [ [279 1009 201 446 73 766 495 203] 0.0497878 0.770257 3472 ] [ [271 1021 204 429 74 775 504 194] 0.0441616 0.780553 3472 ] [ [264 1031 207 414 74 784 512 186] 0.0457397 0.789662 3472 ] |h [ [256 1043 211 396 74 794 521 177] 0.0325654 0.800267 3472 ] [ [249 1054 213 381 75 803 528 169] 0.0440074 0.809451 3472 ] [ [241 1066 216 363 76 813 537 160] 0.0403837 0.820078 3472 ] [ [233 1077 220 346 76 823 546 151] 0.0256970 0.830362 3472 ] [ [225 1089 223 328 77 833 555 142] 0.0332166 0.840997 3472 ] |h [ [218 1099 225 313 78 842 563 134] 0.0337785 0.850140 3472 ] [ [210 1110 228 296 79 852 572 125] 0.0360605 0.860449 3472 ] [ [203 1120 231 280 80 862 580 117] 0.0150460 0.869889 3472 ] [ [195 1131 233 262 82 872 589 108] 0.0360463 0.880467 3472 ] [ [187 1141 236 245 83 883 598 99] 0.0317396 0.890767 3472 ] |h [ [180 1151 237 230 85 892 606 91] 0.0190775 0.899933 3472 ] [ [172 1162 238 213 88 902 615 82] 0.0316686 0.910273 3472 ] [ [165 1171 239 197 91 912 623 74] 0.0263476 0.919661 3472 ] [ [157 1181 239 180 95 922 633 65] 0.0388174 0.929956 3472 ] [ [150 1190 238 164 100 932 641 57] 0.0323680 0.939357 3472 ] [ [142 1200 235 147 107 943 650 48] 0.0272150 0.949701 3472 ] |h [ [134 1209 230 130 116 955 659 39] 0.0318331 0.960034 3472 ] [ [126 1218 223 113 127 966 669 30] 0.0351219 0.970334 3472 ] [ [119 1226 210 97 144 977 677 22] 0.0379512 0.979745 3472 ] [ [111 1234 188 80 170 989 688 12] 0.0386641 0.990337 3472 ] [ [103 1242 151 63 211 1001 698 3] 0.0439439 1.000650 3472 ] |1|/shiftout |/aqua |/black |h As before, the quantized integer matrix is made up of |/to predelay, p5w, p1w, |/to middelay, p2w, p4w, p3w, and postdelay|/tx . Followed by the distortion in percent, the normalized amplitude, and the integer count per thirty degrees. The latter also serves as a frequency jitter checksum. |h Also as before, values above an 8-bit "full scale" of 255 are realized by summing with an eight bit function. Typical functions are ramps of |/to amplitude|j*|jk|/tx , its inverse, or truncated versions of same. ) cl startnewpage (|c Some Fourier Math |d I overwhelmingly prefer to use the |/su PostScript|1|/post01 language for all of my engineering analysis. Especially when graphic display is involved. Sadly, PostScript uses only 32-bit math routines making it inappropriate for actual determination of true magic sinewave zero nulls. |h Which is why we went to the 64-bit Javascript routines for all the actual |/su Magic|/magsn01 |/su Sinewave Calulators|1|/magsn01 Typically, |/su PostScript|1|/post01 has a noise floor in the sixth or seventh decimal place, while JavaScript can easily work fifteen decimal places or more. |h Fortunately, |/su PostScript|1|/post01 is good enough for routine magic sinewave use as we've done here. Here is how you calculate a fundamental amplitude using classic DFT |/su Fourier Series|1|/muse90 \274 |6|/shiftin |/burple |/burplebox8 |/staytint1 /a1 {curdegarray 0 get cos curdegarray 1 get cos sub curdegarray 2 get cos add curdegarray 3 get cos sub curdegarray 4 get cos add curdegarray 5 get cos sub curdegarray 6 get cos add curdegarray 7 get cos sub curdegarray 8 get cos add curdegarray 9 get cos sub curdegarray 10 get cos add curdegarray 11 get cos sub curdegarray 12 get cos add curdegarray 13 get cos sub 4 mul pi div} store |1|/shiftout |/aqua |/black |h Here |/to curdegarray|/tx is |/to p1s, p1e, p2s, p2e, p3s, p3e, p4s, p4e, p5s, p5e, p6s, p6e, |/to p7s,|/tx and |/to p7e|/tx . And |/to pi|/tx is predefined as 3.1415926 or thereabouts. |h A typical relative harmonic is calculated as\274 |6|/shiftin |/burple |/burplebox15 |/staytint1 /h7 {curdegarray 0 get 7 mul cos curdegarray 1 get 7 mul cos sub curdegarray 2 get 7 mul cos add curdegarray 3 get 7 mul cos sub curdegarray 4 get 7 mul cos add curdegarray 5 get 7 mul cos sub curdegarray 6 get 7 mul cos add curdegarray 7 get 7 mul cos sub curdegarray 8 get 7 mul cos add curdegarray 9 get 7 mul cos sub curdegarray 10 get 7 mul cos add curdegarray 11 get 7 mul cos sub curdegarray 12 get 7 mul cos add curdegarray 13 get 7 mul cos sub 4 mul pi div 7 div a1 div} store |1|/shiftout |/aqua |/black |h ) cl startnewpage (Other harmonics are suitably scaled, such as multiplying angles by 5 and dividing output by 5 on the fifth harmonic, etc\274 |h Although the triad harmonics of 3, 9, 15, and 21 should be identically zero in a |/su delta friendly magic sinewave|1|/deltams1 , it still may pay to calculate them. Both to find possible errors and to keep track of the |/su PostScript|1|/post01 repeat calc noise floor. |h Total harmonic distortion |/to 2-22|/tx is then calculated by\274 |6|/shiftin |/burple |/burplebox4 |/staytint1 /thd {h3 dup mul h5 dup mul add h7 dup mul add h9 dup mul add h11 dup mul add h13 dup mul add h15 dup mul add h17 dup mul add h19 dup mul add h21 dup mul add sqrt 100 mul} store |1|/shiftout |/aqua |/black |c For More Help |d Additional |/su Magic Sinewave|1|/magsn01 help is available per the previously shown web links. Detailed analysis of system specifics are available at our standard consulting rates. Per our |/su Magic Sinewave Development Proposal|1|/msinprop and our |/su Consulting Services|1|/info01 . |h Additional |/surl |6GuruGrams|1|/gurgrm01 columns await your ongoing support as a |/surl |6Synergetics|/advt01 |/su Partner|1|/advt01 . ) cl startnewpage %%%%%%%%%%%%%%%%%%%% % EOF