\\ MAGTAPEQ.SEQ Make tables of Audio Magnetic Tape Recording Eq & Conversions CHANGE LIST: jm 91-06-08 16:50, 91-09-16, 91-09-23 jmod 92-01-07 13:00 Eq names from NAB & IEC2 to NAB (IEC2) form. jm 93-08-30 13:35 Clarify some explations, & TableCaption names factor PrintOneTable out of MRLTables; add 30 in/s IEC1 & Ampex300 jm 93-12-22 Added 48 mm/s speed; re-assigned Ser Nrs to keep in speed order. jm 94-05-03 Make everything except test frequency table a real number; want a better infinity. Also use ZMAG in calcs. jm 94-05-04 Renamed from EQCONVF to MAGTAPEQ. jm 99-05-26 Add instruction, how to change for 1/3 oct frequencies jm 99-05-27 12:40 Add eq for 190 mm/s, 100 us, obsolete CCIR; renumber; conform table headers to Choo&U; jm 99-05-26 Chg so ALL tables are created, incl. "0" jm 99-05-27 12:41 Add 1/3rdOctTables jm 2003-02-27 Add 17, obsolete DGG, 27 us. jm 2003-03-26 Add 18, approx DGG (25 us); add POT (print one table) jm 2003-05-15 Corrections & clarifications to text PROGRAM FILES: MAGTAPEQ.EXE is the executable program. It is made from Forth with software floating point (FSFLOAT.EXE), some auxiliary level functions (LEVELS.SEQ), and the words in this (MAGTAPEQ.SEQ) file. Reminder to me on how to compile: click on "F-PC with Floating Point"; type fload magtapeq fsave magtapeq AUTHOR of MAGTAPEQ: Jay McKnight, at Magnetic Reference Lab, 229 Polaris Ave, Ste 4, Mountain View, CA 94043, USA. Phone +1 650 965 8187; E-mail mrltapes@flash.net ; Website http://www.flash.net/~mrltapes . INTRODUCTION: This file is the source code for the executable MAGTAPEQ.EXE . The program is written in Forth, the dialect "F-PC", for PC DOS systems without a floating-point processor. Altho I can't teach you Forth right here, I'll give you a few clues to using and understanding the programs. If you want to learn more about Forth, visit the Forth Interest Group (FIG) website http://www.forth.org or contact me and I can direct you to tutorial materials. COMMENTS IN THE TEXT Only text between { } is compiled -- the rest is comments. Text on the rest of a line after \ is also comments. Text between ( ) is a "stack comment". Forth is a "postfix" (Reverse Polish) language that passes data on a stack. ( n1 n2 -- n3 ) is a stack comment, indicating in this case that numbers n1 and n2 are put on the stack before executing that word, and n3 is returned on the stack after executing the word. So if n1 is 2, n2 is 5, and the word is "+", then n3 would be 7. CASE SENSITIVITY: F-PC can be case-sensitive or not. This one is set up to be case INsensitive. The capitalization that you will see here is only for ease of reading. PRINTING: The output from this program is tables which are laid out with spaces, not tabs. Therefore they should be printed with a fixed-pitch font such as Courier. FORTH Forth is written by defining new "words" that are based on already-defined words. (Forth is "early binding", which means that all of the words in a new definition MUST already be defined.) Typically (but not necessarily) the last-defined word IS "the program". Type MAGTAPEQ at the DOS prompt, and the entire Forth program is loaded into memory, and you will see an opening screen (really for programmers). Press the ENTER key, and Forth will respond "OK", which is the Forth prompt. To leave Forth, type BYE and press the ENTER key, and you'll be back in DOS. MAKING EQUALIZATION TABLES For an explanation of what these tables are, and how to use them, see Sec. 2.3.2 of "Choosing and Using MRL Calibration Tapes...", MRL Publication Choo&U, available on our website (see address above). To print a complete set of tables (over 30 pages, 3 tables to a page),type MRLTABLES and press Enter. To print to a file instead of to a printer,type pfile eqtables.txt mrltables pclose and press enter. This makes the table file EQTABLES.TXT on the default drive, and displays "OK" when it is done. To print one table, choose the serial number (0...18) of the speed and eq standard for the Calibration Tape (ncal), and for the Playback System (nplay) from the table "StandardSpeeds&Eqs" on page 4. Suppose the Cal Tape is 15 in/s (381 mm/s) NAB, then ncal is 11. Suppose the Playback System is 762 mm/s (30 in/s) AES, then nplay is 14. To print to the screen, type 11 14 DOT and press Enter. (DOT is an alias for DisplayOneTable) To print one table to the printer, type 11 14 POT and press Enter. To print to a file called TABLE1.TXT, type fileprint TABLE1.TXT 11 14 POT toprinter and press Enter. (Be patient -- may take a few moments to start printing.) To display this file under F-PC when MAGTAPEQ is running, type sed magtapeq and press Enter. To print this file from F-PC when MAGTAPEQ is running, type fprint magtapeq.seq and press Enter. All of the above list only the frequencies used on MRL Calibration tapes -- that is, octaves from 32 Hz to 8 kHz, and 1/3rd octaves from 10 kHz to 20 kHz. To list all 1/3rd octaves from 20 Hz to 20 kHz, type Use1/3rdOctFreqs at the command line, then follow the other instructions above. To restore the MRL frequencies, type UseMRLFreqs { anew eq needs sfloat needs complex needs levels : f? f@ f. ; \ Print a floating-point number fvariable Sc \ Speed of Calibration Tape, [mm/s] fvariable Fclo \ Transition Frequency of Cal Tape, low [Hz] fvariable Fchi \ Transition Frequency of Cal Tape, high [Hz] fvariable Sp \ Speed of playback, [mm/s] fvariable Fplo \ Transition Frequency of playback, low [Hz] fvariable Fphi \ Transition Frequency of playback, high [Hz] fvariable freq \ frequency to calc at fvariable freqRatio \ ratio of play speed to Cal Tape speed \ = ratio of play frequency to Cal Tape frequency fvariable 1000-Hz-response } Table of Standard Speeds & Equalizations of interest. Std "Time Constants" converted to frequency exactly (not rounded to preferred numbers) jmod 94-05-03 Add serial "0" to give standard repro eq ( enter 0 n ) or standard recorded flux (enter n 0 ) with speed & eq n. { create StandardSpeeds&Eqs \ speed/[mm/s] Flo/[Hz] Fhi/[Hz] Serial Nr & Standard Time Constants f0.0 f, f0.0 f, finfinity f, \ 0 Constant Flux 47.675 f, 50.0 f, 1327.0 f, \ 1 IEC (1981) OpenReel 3180 & 120 æs 95.25 f, 50.0 f, 1768.0 f, \ 2 NAB & IEC 3180 & 90 æs 95.25 f, 50.0 f, 1327.0 f, \ 3 obs EIA RS-224 (1959) 3180 & 120 95.25 f, 50.0 f, 796.0 f, \ 4 obs Ampex (1953) 3180 & 200 127.0 f, 50.0 f, 2170.0 f, \ 5 5 in/s spcl 3150 & 70 190.5 f, f0.0 f, 2274.0 f, \ 6 IEC1 ì & 70 æs 190.5 f, f0.0 f, 1592.0 F, \ 7 obs CCIR (1953) ì & 100 190.5 f, 50.0 f, 3183.0 f, \ 8 NAB (IEC2) 3180 & 50 190.5 f, f0.0 f, 3183.0 f, \ 9 NAB & IEC Cart ì & 50 381.0 f, f0.0 f, 4547.0 f, \ 10 IEC1 ì & 35 æs 381.0 f, 50.0 f, 3183.0 f, \ 11 NAB (IEC2) 3180 & 50 381.0 f, f0.0 f, 6366.0 f, \ 12 Prop SM & Pac Rec Cart ì & 25 381.0 f, 50.0 f, 11789.0 f, \ 13 Nagra Master 3180 & 13.5 762.0 f, f0.0 f, 9095.0 f, \ 14 AES (IEC2) ì & 17.5 æs 762.0 f, f0.0 f, 4547.0 f, \ 15 obsolete IEC1 ì & 35 762.0 f, f0.0 f, finfinity f, \ 16 obsolete Ampex 200A&300 ì & 0 762.0 f, f0.0 f, 5895.0 f, \ 17 obsolete DGG ì & 27 762.0 f, f0.0 f, 6366.0 f, \ 18 approx obsolete DGG ì & 25 19 value Entries } Make strings to identify speeds & equalizations in the tables. { : label0 ." Constant Flux" ; : label1 ." 1.88 in/s, IEC (1981) OpenReel" ; : label2 ." 3.75 in/s, NAB & IEC Equalization" ; : label3 ." 3.75 in/s, obsolete EIA RS-224 (1959) Eq" ; : label4 ." 3.75 in/s, obsolete Ampex (1953...1958) Eq" ; : label5 ." 5 in/s, Spcl w/ 50 & 2240 Hz Trans freqs " ; : label6 ." 7.5 in/s, IEC (IEC1) Equalization" ; : label7 ." 7.5 in/s, obsolete CCIR (1953) Eq" ; : label8 ." 7.5 in/s, NAB (IEC2) Equalization" ; : label9 ." 7.5 in/s, NAB & IEC Broadcast Cart Eq" ; : label10 ." 15 in/s, IEC (IEC1) Equalization" ; : label11 ." 15 in/s, NAB (IEC2) Equalization" ; : label12 ." 15 in/s, Proposed Studio Master Eq & PRE Bdcst Cart Eq" ; : label13 ." 15 in/s, Nagra Master Equalization" ; : label14 ." 30 in/s, AES (IEC2) Equalization" ; : label15 ." 30 in/s, obsolete IEC1 Equalization" ; : label16 ." 30 in/s, obsolete Ampex 200A & 300 Eq" ; : label17 ." 30 in/s, obsolete DGG Equalization" ; : label18 ." 30 in/s, approx obsolete DGG Equalization" ; : ShowSpeed&Eq exec: label0 label1 label2 label3 label4 label5 label6 label7 label8 label9 label10 label11 label12 label13 label14 label15 label16 label17 label18 ; } Using the item number n on the stack, pick a speed & eq set, & put the values into the fvariables. Each entry is 3 real items, and each real item is f#bytes (6) bytes, so each entry is f#bytes 3 * (18) bytes long. { : SetCalTapeSpeed&Eq ( n -- ) 18 * StandardSpeeds&Eqs + dup dup \ 3 copies of n'th address f@ Sc f! \ first place is speed 6 + f@ Fclo f! \ second is lo freq eq 12 + f@ Fchi f! ; \ third is hi freq eq : SetPlaySpeed&Eq ( n -- ) 18 * StandardSpeeds&Eqs + dup dup \ 3 copies of n'th address f@ Sp f! \ first place is speed 6 + f@ Fplo f! \ second is lo freq eq 12 + f@ Fphi f! ; \ third is hi freq eq } Alternate ident, by mm/s speed and transition freqs. Not used \ ." Sc = " Sc . ." mm/s, Fclo = " Fclo . ." Hz, Fchi = " Fchi u. ." Hz" \ ." Sp = " Sp . ." mm/s, Fplo = " Fplo . ." Hz, Fphi = " Fphi u. ." Hz" { : TableCaption ( ncal nplay -- ) swap ." CONVERSION TABLE FOR DIFFERENT SPEEDS AND EQUALIZATIONS" cr ." Normalized to the 1000 Hz Recorded Fluxivity" cr ." Calibration Tape " dup 2 .r ." : " ShowSpeed&Eq cr ." Desired Playback " dup 2 .r ." : " ShowSpeed&Eq cr ." Recorded Playback Playback" cr ." Frequency/ Frequency/ Level/" cr ." [Hz] [Hz] [dB]" cr ; } { create 1/3rdOctFreqs \ Standard frequencies, 31 of 1/3rd octave series, 20 Hz to 20 kHz 20 , 25 , 32 , 40 , 50 , 63 , 80 , 100 , 125 , 160 , 200 , 250 , 315 , 400 , 500 , 630 , 800 , 1000 , 1250 , 1600 , 2000 , 2500 , 3150 , 4000 , 5000 , 6300 , 8000 , 10000 , 12500 , 16000 , 20000 , create MRLFreqs \ Standard frequencies, 13 used on MRL Calib tapes 32 , 63 , 125 , 250 , 500 , 1000 , 2000 , 4000 , 8000 , 10000 , 12500 , 16000 , 20000 , } { defer Freqs 13 value NrOfFreqs : UseMRLFreqs 13 =: NrOfFreqs ['] MRLFreqs is Freqs ; : Use1/3rdOctFreqs 31 =: NrOfFreqs ['] 1/3rdOctFreqs is Freqs ; UseMRLFreqs } { : setFreq ( i -- ) 2* Freqs + @ ifloat freq f! ; } Cal Tape flux response ratio at frequency freq { : Rcaltape ( F: -- r ) Fclo f@ freq f@ f/ f1.0 zmag \ sqrt [( Fclo / freq )^2 + 1^2 ] freq f@ Fchi f@ f/ f1.0 zmag \ sqrt [( freq / Fchi )^2 + 1^2 ] f/ \ / ; } Play flux resp ratio at freqRatio * freq, which is the actual played freq. { : Rplay ( F: -- r ) freq f@ freqRatio f@ f* fdup Fphi f@ f/ f1.0 zmag \ sqrt [( freq / Fphi )^2 + 1^ ] fswap \ sqrt [ ] freq Fplo f@ fswap f/ f1.0 zmag \ sqrt [( Fplo / freq )^2 + 1^ ] f/ \ / ; } One table: Using Cal Tape Speed&Eq & Play Speed&eq, plot repro levels for the freq sequence. Skip for same Speed&Eq in Cal Tape and Playback. { : DisplayOneTable ( ncal nplay --- ) cr 2dup <> if 2dup ( nplay ) SetPlaySpeed&Eq ( nrec ) SetCalTapeSpeed&Eq ( ncal nplay ) TableCaption Sp f@ f0.0 f= Sc f@ f0.0 f= or \ See Ser Nr 0: Const Flx if f1.0 else Sp f@ Sc f@ f/ then freqRatio f! 1000.0 freq f! Rcaltape Rplay f* 1000-Hz-response f! NrOfFreqs 0 do i setFreq \ Calc Cal Tape freq freq f@ fdup \ Get Cal Tape freq int 12 d.r \ Print Cal Tape freq freqRatio f@ f* \ Calc repro freq int 12 d.r \ Print repro freq Rcaltape Rplay f* \ Calc response at freq 1000-Hz-response f@ f/ \ Normalize to 1kHz VRatio>Level 2 12 f.r cr \ Calc level & print it loop else 2drop then ; ' DisplayOneTable alias DOT } Print one table (POT) to the printer { : POT ( ncal nplay -- ) printing on DOT Formfeed emit \ To get printer to print printing off ; } Print a set of tables using 0st Cal Tape Speed&Eq, 0st Play Speed&eq, plot repro levels for the freq sequence. Then 1st Play Speed&Eq, etc. { : MRLtables ( -- ) \ Does all tables, no questions asked cls ." Printing Tables " UseMRLFreqs printing on Entries 1+ 0 do Entries 1+ 0 do j i DisplayOneTable loop loop Formfeed emit printing off ; } Same as above, with all 1/3rd Octave Frequencies { : 1/3rdOctTables ( -- ) \ Does all tables, no questions asked cls ." Printing Tables " Use1/3rdOctFreqs printing on Entries 1+ 0 do Entries 1+ 0 do j i DisplayOneTable loop loop Formfeed emit printing off ; }