Theo Verelst Diary Page

Mon aug 13 2001, 14:02 PM

I've decided after good example to write some diary pages with toughts and events.

Oh, in case anybody fails to understand, I'd like to remind them that these pages are copyrighted, and that everything found here may not be redistributed in any other way then over this direct link without my prior consent. That includes family, christianity, and other cheats. The simple reason is that it may well be that some people have been ill informed because they've spread illegal 'copies' of my materials even with modifications. Apart from my moral judgement, that is illegal, and will be treated as such by me. Make as many references to these pages as you like, make hardcopies, but only of the whole page, including the html-references, and without changing a iota or tittel...

And if not? I won't hesitate to use legal means to correct wrong that may be done otherwise. And I am serious. I usually am. I'm not sure I could get 'attempt to grave emotional assault' out of it, but infrigement on copyright rules is serious enough. And Jesus called upon us to respect the authorities of state, so christians would of course never do such a thing. Lying, imagine that.
 

Previous Diary Entries   |   List of Diary Pages   |   Home Page

Known subjects today, and news, and interesting enough materials, probably I'll put some new sound samples on, also from the monsterrack lexicon-processed ones, and I'll see if I can make a mix and combination with my own physical modeling sounds and that, into an mpeg or so.

At least worth a look and listen, I'll see how far I can get, and I'll maybe throw in a little windows UI example program as well, for testing, mainly, if it works good enough, it makes sense to to some programming on the basis of cygwin with this windows lib, at least for something examplatory that could make it into a product.

Mon 13 Aug 2001, 14:02 AM

Job wise

Apart from other possible development, I've agreed to start at the computer management dept of the amsterdam salvation army in september, to be occupied with various subjects, which possibility wise and possibly developmentwise is not so small.

Windows programming

I've read a little about the microsoft foundation classes, and also about basic gdi, which seems bearable, and compiled a little example windows program:
 
   /*----------------------------------------
     ENDJOIN.C -- Ends and Joins Demo
                  (c) Charles Petzold, 1998
    ----------------------------------------*/

  #include <windows.h>

  LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

  int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                      PSTR szCmdLine, int iCmdShow)
  {
       static TCHAR szAppName[] = TEXT ("EndJoin") ;
       HWND         hwnd ;
       MSG          msg ;
       WNDCLASS     wndclass ;
       
       wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
       wndclass.lpfnWndProc   = WndProc ;
       wndclass.cbClsExtra    = 0 ;
       wndclass.cbWndExtra    = 0 ;
       wndclass.hInstance     = hInstance ;
       wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
       wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
       wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
       wndclass.lpszMenuName  = NULL ;
       wndclass.lpszClassName = szAppName ;
       
       if (!RegisterClass (&wndclass))
       {
            MessageBox (NULL, TEXT ("This program requires Windows NT!"),
                        szAppName, MB_ICONERROR) ;
            return 0 ;
       }
       
       hwnd = CreateWindow (szAppName, TEXT ("Ends and Joins Demo"),
                            WS_OVERLAPPEDWINDOW,
                            CW_USEDEFAULT, CW_USEDEFAULT,
                            CW_USEDEFAULT, CW_USEDEFAULT,
                            NULL, NULL, hInstance, NULL) ;
       
       ShowWindow (hwnd, iCmdShow) ;
       UpdateWindow (hwnd) ;
       
       while (GetMessage (&msg, NULL, 0, 0))
       {
            TranslateMessage (&msg) ;
            DispatchMessage (&msg) ;
       }
       return msg.wParam ;
  }
  LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
  {
       static int  iEnd[] = { PS_ENDCAP_ROUND, PS_ENDCAP_SQUARE, PS_ENDCAP_FLAT };
       static int  iJoin[]= { PS_JOIN_ROUND,   PS_JOIN_BEVEL,    PS_JOIN_MITER } ;
       static int  cxClient, cyClient ;
       HDC         hdc ;
       int         i ;
       LOGBRUSH    lb ;
       PAINTSTRUCT ps ;
       
       switch (iMsg)
       {
       case WM_SIZE:
            cxClient = LOWORD (lParam) ;
            cyClient = HIWORD (lParam) ;
            return 0 ;
            
       case WM_PAINT:
            hdc = BeginPaint (hwnd, &ps) ;
            
            SetMapMode (hdc, MM_ANISOTROPIC) ;
            SetWindowExtEx (hdc, 100, 100, NULL) ;
            SetViewportExtEx (hdc, cxClient, cyClient, NULL) ;
            
            lb.lbStyle = BS_SOLID ;
            lb.lbColor = RGB (128, 128, 128) ;
            lb.lbHatch = 0 ;
            
            for (i = 0 ; i < 3 ; i++)
            {
                 SelectObject (hdc,
                      ExtCreatePen (PS_SOLID | PS_GEOMETRIC |
                                    iEnd [i] | iJoin [i], 10,
                                    &lb, 0, NULL)) ;
                 BeginPath (hdc) ;
                 
                 MoveToEx (hdc, 10 + 30 * i, 25, NULL) ;
                 LineTo   (hdc, 20 + 30 * i, 75) ;
                 LineTo   (hdc, 30 + 30 * i, 25) ;
                 
                 EndPath (hdc) ;
                 StrokePath (hdc) ;
                 
                 DeleteObject (
                      SelectObject (hdc,
                           GetStockObject (BLACK_PEN))) ;
                 MoveToEx (hdc, 10 + 30 * i, 25, NULL) ;
                 LineTo   (hdc, 20 + 30 * i, 75) ;
                 LineTo   (hdc, 30 + 30 * i, 25) ;
            }
            EndPaint (hwnd, &ps) ;
            return 0 ;
            
       case WM_DESTROY:
            PostQuitMessage (0) ;
            return 0 ;
       }
       return DefWindowProc (hwnd, iMsg, wParam, lParam) ;
With this executable program as a result, the zip file contains both the program and the cygwin1.dll library needed for cygwin programs to run, just decompress it into the same directory.

For those interested in using cygwin for such purposes themselves, the compilation command for this one, and I've tested it works at least on a few different machines, was:

gcc -o endjoin.exe -DWIN32 -D__WIN32__ -D_WINDOW endjoin.c -luser32 -lgdi32 -lkernel32
The program opens a window, draws lines with various properties in  a resizable window, and is stopped by pressing the standard right upper corner close button. I just noticed this versionseems to require NT, I'm not sure what happens otherwise, or what the reason is. Maybe the class of windows used here registers fine on 95,98 or 2000 as well, I just used the source from an example, and can't try that now. I don't like the idea of becoming expert in this stuff (being it is fine, but it may take quite some time, and as intended become more or less obsolete by the time expertise is good), though I might do some reading to see what can be made to work fine in general, just to do some basics to run examples well with.

Clearly enough, nothing that much has changed since I did Atari (gem vdi and such) and Xwindows programming at least over a decade ago, at least concerning the main operation modes.

I've been looking at openGL based GUI's, and at using the tk sources, which have an Xwindows based intermediate graphics library to base some programming on, neither yet fell through simple enough, but at least it is interesting to do either 3D stuff as well (as I've done before) or have a very reliable and portable professional product.
 

Combining processed sound files

The drumit program I put up for download already some years ago, though there are various version, for instance one with networked control lines, for instance to act as cgi like web page embedded audio processor as from many pages back.

Basically, it loads wav file samples and can place any sample anywhere in an output sample with adjustable length, amplitude and pitch.

I used the tcl/tk based 'snack' library for audio display playback and some manipulation (such as cropping a sound file) to read mpeg3 files which I could save from the monsterrack web enabled effect unit rack, to splice out the relevant sound parts, convert them to mono (drumit only accepts mono samples at this time), normalize the soft lexicon effect unit output level, and save some as wav files, luckily with CD quality.

Then I took the original and processed files, because the processed files do not have dry/wet controls, and mixed them together using drumit, basically with this shell script 'drit':

len 10000 1 1 1
4098 0 9000 2.5 1
4094 0 9000 0.7 1
Fed to a drumit.exe variation, in this case using the bash shell from cygwin, though dos should work, too:
drumit cave1.wav < drit
To get a sample cave1.wav with the original and processed sound mixed together in reasonable volume ratio. I've converted the result to cave1.mp3 .

The result is not realy something I find worth major disc space, but it is fun enough to have my physical modeling sound generators output fed through various effects into a good enough example of what various effects can do.

The list of applied effects is:

    a2.wav - 2 string simu - Created at: 06:43:09 Jun 26, 2001 - Length: 4s - 1 channel (original)

   4.a2.wav - Processed with Line 6 POD Pro Small Tweed - Created at: 04:58:44 Jun 27, 2001 - Length: 8s
        2.a2.wav - Processed with TC Electronic FireworX Classic Sweeper - Created at: 05:01:17 Jun 27, 2001 - Length: 12s
             1.a2.wav - Processed with Lexicon PCM81 Wet Chorus - Created at: 05:06:50 Jun 27, 2001 - Length: 16s
                  1.a2.wav - Processed with Lexicon PCM91 Guitar Cave - Created at: 05:09:04 Jun 27, 2001 - Length: 20s


The original with only a chorus effect 'Lexicon PCM81 6 Vox Chorus' applied to it sounds (in stereo) like this.

The above is a part from a sort of hawaian guitar like string simulated sound, with an initial upbend of a few semitones, and vibrato of a few herz following though the sustained part, and then processed by a 'Lexicon PCM91 Deep Blue' effect, mixed together with the original (in non 50/50 ratio), turned into mono but quality enough mpeg here.

The reverb portion is shown above, which when the sound is listened to clearly contains fragments of the original sound with its quality in it, making for at least a serious enough slowly ringing decay, except with all too audible glitch in the beginning of the sound, maybe because of a DC level jump in my simulator sample, when it goes from bending phase into vibrato, though that is a smooth transition, or maybe it is because the high frequency components introduced in the sample when the vibrato effect in the string simulator makes the effective string length shorter and longer. That effect can be heard quite well, because the number of sections makes the frequency jumps in the range of percents at the time, because I do no smoothing in this version at all, so the string suddenly jumps from 102 sections to 101 for instance. Audibly that works enough for the effect, but a distinct decaying rattle can be heard at every jump of the string length, which is relatively slowly filtered away when passing back and forth though the string. Since there is no additional filtering at the output of the string simulation, it may be that the digital effect unit's input sampling or sample processing is sensitive to those harmonics, or simply that their repetition because of the reverb is more noticable.

The resulting sound makes the reverb interfere with the upbend and vibrato,