V1 Chapter 10
Details
48. SETI File Archive System (2004-08-01 to 2004-09-03)
I ran into a stumbling block on the original database driven archive. I just couldn't get the thing to work correctly. This is probable due to my inexperience with the PHP language but until I get better at it I have installed a non-database oriented system (phpATM). This seems to work alright and will function until I can get a full system running.
47. SETI File Archive System (2004-08-01 to 2004-08-25)
It seems like a long time ago but it was four months ago that I started working in earnest on the archival data base (chapter 9 Items 39,40 & 41). At the time I had decided to build the database using MySQL server and the user interface in PHP. MySQL is a good choice because its free and available on most web servers - including the one your reading this message on. PHP also seems like a good choice because like MySQL its free and supported on this server and it is designed specifically for MySQL control. Its also a capable language and will be interesting to learn. Not Delphi but not bad.
So the lineup will be:
- Apache Server - This web site is hosted on an Apache server and there is a version that runs under Windows for testing on my local machine.
- MySQL Data Base - This will contain the user information and the saved files themselves
- PHP Language - Will be used for the user interface development
I have found a prepackaged PHP script that does most of the file upload and user control called OWL and this will be used as the basis for the archive system. Owl is a Source Forge project which is part of the Open Source initiative.
Stay tuned for developments..........
46. Still on Spectrum Analyzer Rebuild (2004-08-01 to 2004-08-12)
I now have a high speed spectrum analyzer running that contains a test oscillator and can record a WAV file from the incoming data. I have also added the code to include initial SML header information in the WAV file when its saved. This will allow any file saved with the Spectrum Analyzer to be read by the SML Generator. Right now this part is giving me fits. The WAV file generated caused the SML Generator to gag when fed the file. I might have to do some work on the SML Generator - humm...
I finally got the Spectrum Analyzer running right. It turned out that the problem was that I was tagging the wave file with a RIFF chunk that had the tag 'SETI' rather than 'SML '. That made all the difference. I also added the ability to load a preconfigured SML file into the SpecAna so that the resulting wave file will be tagged correctly. The idea is that you create a standard, for your SETI station, SML file and use it over and over for each wave file generated.
Now that I have the first Spectrum Analyzer released I can go back to work on the file archive system.
45. Still On Spectrum Analyzer software Rebuild (2004-07-31 to 2004-08-01)
Part of the problem turned out to be that I did not understand how the Windows sound components, Volume Control and Recording Control, are 'wired'. To make it understandable I have created a functional block diagram (below).
I took a long time to find the Recording Control in the system. It is cleverly hidden inside the Volume Control. Here is how is is found:
- Double click the little speaker . This brings up the volume Control
- Double click the speaker again. Looks like nothing happened right? Nope a second Volume Control is right behind the first. Move the top one aside a bit.
- On either one select Options | Properties and then set the Recording radio Button then OK.
Now you have one of each component and they work like the system block diagram.
No 'little speaker' on your bottom tool bar? Do this: Start | Settings | Control Panel | Sounds and Multimedia | then check "Show volume control on the taskbar" This should bring up the speaker icon. |
The things to notice on the diagram are that their are two ways to route the receiver to the recording system and then to the FFT. The first is by selecting Line In on the Recording Control. The second is by selecting Stereo Mix on the Recording Control. This path results in both the main Volume Control and the Line In control on the Volume Control setting the level to the FFT. This seems confusing to me.
The second is that software WAV generators like the simple sine test generator on the SETI Net Spectrum Analyzer and more complex playback devices like the Windows Media Player or WinAmp come through the Wave input to the Volume control. It seems like you can have several inputs all running through this one input without a problem. I really don't understand how that's done but it works.
I'm still working on the Spectrum Analyzer but it looks like it will run best as a mono, rather than stereo device at a frame rate of 44,100 samples/sec. Sixteen bits quantization. This much seems to work.
I am now working on the recording of the raw WAV data to the hard drive. I plan to tag this data with SML as it moves to storage to maintain its provenance and make it easer to archive.
When I have a good cut at the analyzer running I'll post it for download.
44. Spectrum Analyzer Software Rebuild (2004-07-23 to 2004-07-31)
I have the antenna rotor control software working much better now. I also managed to figure out how to home the antenna pointing east rather than west.
Looking at the spectrum analyzer software I found lots of stuff that I'm not proud of and will work on it. First is the way I was handling the buffers that came in from the sound blaster card. For my own records here is how one buffer of data is organized as it is retrieved from the sound blaster.
Setup as Stereo, 16 bit quantization
byte | bits | byte | bits | Channel |
0 | 76543210 | 1 | 76543210 | First Right Channel Word |
2 | 76543210 | 3 | 76543210 | First Left Channel Word |
4 | 76543210 | 5 | 76543210 | Second Right Channel Word |
... | etc |
The OnBufferFilled function (below) is called each time a buffer is filled by the lower level drivers. First thing it does is check if to see which channel the user wants to appear on the display. rgInput (Radio Group Input) has its Item Index parameter set to zero for the right channel (the WiNRADiO) and one for the left. The left channel is usually a signal generator used for testing.
Function TfrmSpecAna.OnBufferFilled(Buffer: pchar; var Size: integer): boolean; (* O n B u f f e r F i l l e d *) var i, x, N: integer; V: Integer; SP: ^SmallInt; begin N := Size div 2; SP := Pointer(Buffer); if (rgInput.ItemIndex = 0) then inc(SP); for i := 0 to N - 1 do // Process the buffer of data begin v := SP^; // Get a value Inc(SP); SETIFFT.RealSpec[i] := v; end; SETIFFT.Transform; // Do the FFT for i := 1 to Size div 2 do // Draw the chart.... chartSETI.ShowGrafNewOnly; end; |
When the right channel is selected the function increments the pointer past the left channels two bytes. It then picks up one word from the input buffer (two bytes) and moves it to the 'V" integer. At this point I'll add some code to watch for max and min values and other operations. Then it moves the word into the FFT module's RealSpec buffer. This is repeated until the entire buffer is moved to the FFT.
Then the FFT is commanded to do the transformation job that its paid to do. After this the FFT's RealSpec buffer contains the converted waveform in place of the raw data. The spectral data is then moved to the chart for display.
Only the new data is shown to speed up the process. Then everything is cleared up and the system is allowed to process all the messages that this high bandwidth piece of code has been plugging up.
When I have the spectrum analyzer running the way I want I'll package it and release it as a stand alone module (like the SETI Net Clock and the SML Generator) to anyone who wants it.
I have lots more work on this module yet. I must:
- Allow for 8 bit digitization
- Enable changing buffer size and count
- Allow Mono data
- Use a Samples/Sec of 22,055
- Sort out the horizontal baseline of the display
- Add the gain control slider
- Allow the data to be recorded
- Somehow integrate with the SML Generator
Stay tuned
43. Antenna Software Rebuild (2004-07-09 to 2004-07-23)
After completing the YARR (Chapter 9) I got a better look at the Antenna control software that I had written starting back in chapter 2 - It was not a pretty site. Now I'm not a perfectionist but it nags me no end when I think of the rotor control software that works but is so ugly. I am going to spend some time with it to clean up some of the Object Oriented Design mistakes that I made originally like:
- Placing constants in the Main routine rather than the Antenna module
- Retrieving and storing the registry values in the Antenna module
- Use of protected procedures and functions as Borland designed them to be used
- Clean up of the horrible logic needed to home the antenna and move it to the proper position
When this is running again its back to the database - I promise.
This part of the task is complete but during the work I found ugly code in the spectrum analyzer radio control logic. This needs to be worked