Thursday, September 09, 2010

adventures with tgawarper

To go forward with the mirrordome project, purchased the tgawarper software for windows from LochNess. It appears to have some bugs, as the product page itself notes -
When using the "-o output filemask" option and the filemask contains a folder
structure or drive letter, the program will prepend its "w_" onto the filemask
instead of the actual filename — instead of creating "d:/output/w_filename.tga",
it will create "w_d:/output/filename.tga" (which will likely fail). So you may
have to be creative in order to use this feature in its current implementation.

My workaround was to copy the exe to the folder which had the input images, and run it from there without the -o option, so that output also goes to the same folder.

Time taken: for
tgawarper -w 1920 -a 5 s3_%04d.tga EP_xyuv_1920.map
it took approx 2.9 seconds per frame on my Athlon X2 Dual Core @ 1.9 GHz. 36 seconds of 30 fps video, 1100 frames in an hour. Later, using Virtualdub and AVISynth to make a 6 Mbps HD movie using XVid codec, approx 2.5 fps rendering speed. The AVISynth input avs file was using ImageSource, an avs file with the following lines:
video = ImageSource("w_s3_%04d.tga", 0000, 1110, 29.97)
audio = DirectShowSource("C:\My Path\myfilename.mov")
return AudioDub(video, audio)

phone recording - good only for voice memos

Tried recording on the QTEK 9100 at 44.1 kHz 16 bit mono using the built-in mic. Saturates pretty badly for the volume levels inside bhajan hall during bhajans. Also has a rolloff at 8 khz. 30 ms lag in 30 minutes compared to the Tascam recording.

extracting video recorded on DVD - isobuster

DS had some DVDs with video which were not readable. Apparently they had been recorded with a Toshiba DVD Video recorder DVR17. The DVDs were written, but not finalized, and the session was left open according to Nero. Nero was unable to finalize it because the format is slightly different, since it was written by a hardware DVD player. I tried to get a raw dump of the data using dvdisaster, did not work - dvdisaster needs ECC data from a 'good version' of the disk to start with, I suppose. Then tried the free version of isobuster. It showed the VOB files, but required us to buy the software to extract them. DS ponied up the $30 and we got the files out.

Friday, August 20, 2010

Korg NanoKontrol and Reaper

Got a Korg NanoKontrol courtesy A2, and using it with Reaper was a breeze. Connected it to USB, XP recognized it. Started Reaper, went to Options -> Preferences -> Audio -> Midi Devices and chose the "USB Audio Device" giving it an alias and making it control only. Then, in Actions -> Show Action list choosing actions like Set volume for track 28 etc and choosing the Add button, the appropriate MIDI channel etc automatically filled in if the fader is moved. Since the NanoKontrol has 9 faders, 9 knobs and 18 buttons, it can control volume and PFL for 18 tracks from the same "scene". Since it does not have motorized faders, changing scenes is not such a good idea. I had only 14 tracks to control, the US-1641's 14 analog inputs, so this was more than enough. The earphones are Ultimate Ears Metrofi 220.





Sunday, August 15, 2010

ftp users who cannot delete files

S asked for an ftp account where users cannot delete files once they upload, with only a super-ftp user being able to delete. This was something like our old chrooted ftp, I think. Anyway, with dreamhost, this forum post suggested one way, while the Dreamhost wiki showed all the pitfalls. So, decided against it.

download filenames with spaces

Based on a visitor email to webmaster, checked out a download problem. Found that there are many Radio Sai Bhajan Classrooms which have download-file-name with spaces on the database.

Did an update to the database. Basically just
Update `files_table` SET `downloadfileName` = REPLACE(downloadfilename, ' ' , '_' ) where `downloadfilename` like '%Clasr%'

But because our database has some strange requirements on the server, it actually had to be written as

Update `files_table` SET `downloadfileName` = REPLACE(downloadfilename, CONVERT(_utf8 ' ' USING latin1) , CONVERT(_utf8 '_' USING latin1) ) where `downloadfilename` like CONVERT(_utf8 '%Clasr%' USING latin1) COLLATE latin1_swedish_ci

It updated 40 odd entries. I also then replaced Clasroom with Classroom in download file names, and later renamed in these dl.radiosai.org using lots of
mv Source.mp3 Destination.mp3
statements in a text file.

Doing this for all entries, using
where `downloadfilename` like CONVERT(_utf8 '%' USING latin1) COLLATE latin1_swedish_ci
it said updated 4 more entries.

Then updated our local database also, and again replaced all download_File_names with spaces with underscores for all entries, and Clasroom with Classroom.

firewall configuration at studio

Setting up a backup stream for AsiaStar at the Studio, implemented by PB using ices and icecast. Configuring the firewall to point to the right server at the right port took a while, because we did not remember that two rules are required - one for "allow" to the port, and one to SAT to the appropriate server. Not only are two rules required, the order is also important. The Allow has to come below the SAT rule.

"Right-click for more options" is shown in the firewall's web control panel. This works with IE when the site is added to Trusted Sites. Doesn't seem to work with firefox on linux. One of the "more options" is 'move up' for moving the rule up in the list.

Indic on the Sony Reader

Quick update on the Sony Reader PRS-300. Tried out Sanskrit pdfs. Some of them have the verses as embedded images, which are displayed, of course. Even PDFs with embedded fonts, like this one or this one are rendering quite well on the reader if not reflowed. If reflow is attempted, the font becomes completely messed up.

Wednesday, August 04, 2010

update on file deleting and newer versions of files

Uploading newer versions of files causes problems, with the older version refusing to be over-written on colinux. This happens probably due to some ownership issues, with files being copied in multiple ways using colinux / Windows / cygwin. Maybe the IIS website running with that folder as web-root is also an issue. Anyway, this time, P first tried uploading directly - sftp complained
cannot write to filename.mp3.
Then he tried deleting the files using Windows Explorer. Worked in D:, not in E:. E: complained that the file is in use by some other program or user. Tried stopping IIS and deleting, did not work. Tried deleting in colinux as root, it complained
rm: cannot unlink `filename.mp3': Permission denied
Then he tried again from Windows Explorer, and this time it worked. Two possible reasons:
(a) Colinux might have relinquished hold on the file so that Windows could delete it
(b) stopping IIS needed some time and or a window refresh before the file could be deleted.

Update: Apparently, deleting in Linux and then (after it says permission denied) deleting on Windows seems to be a working option. IIS seems to be "not guilty".

change formatting to print to a smaller paper size

A follow-up to my earlier post about printing with dot-matrix printers. I needed to print multiple pages to a different paper size. On Windows,
type filename.bin > lpt1
works best, since it can be added to batch jobs.
copy filename.bin > lpt1
works only for a single invocation at a time. Adding it multiple times to a batch job does the "copy" only once, so only one page is printed.

Till now we used condensed mode extensively. Now, found 15 cpi mode is almost as dense, but much prettier. For setting the paper size, the commands I used were, in Hex,
1B32 - sets 1/6 inch line spacing
1B43420D0D - sets the page length to 66 lines. Since it is 1/6 inch line spacing, that makes it 11 inches. The 0Ds are just padding, I think, but I added them just to be safe. Viewed a page printed to file using the printer driver in a hex editor to be sure of the way to add the 66 lines part. The command for font cpi comes last
1B67 - sets 15 cpi

Monday, July 19, 2010

extracting text from pdf

A good way to extract text from pdfs which are predominantly text, is in my case using the free Mobipocket Creator, since I have it installed anyway. It creates an intermediate html file and images extracted into a folder, useful for converting to other formats etc.

Thursday, July 15, 2010

using the Optoma EP1080 for mirrordome

Trying out the Optoma projector with the mirror sourced from Bangalore, had some issues with colour calibration. The NVidia control panel on the Acer laptop as well as the OS X display control panel on JG's Macbook both mention turning the brightness and contrast all the way up - and they are meant for flat panels and CRTs, not projectors. Mentioning sites like this for calibration to Paul Bourke, he said just leaving everything at the defaults except the gamma setting can get 90% good results.

Windows Media Encoder batch jobs

As noted in a previous post, Windows Media Encoder batch jobs can be made to work by making batch files with lines like
cscript.exe wmcmd.vbs -wme 11_1.wme
cscript.exe wmcmd.vbs -wme 11_2.wme
cscript.exe wmcmd.vbs -wme 11_3.wme

But WMVAppend needs all the files to be encoded this way, otherwise it cannot append files, even if they were created with the same wme file, using the GUI!

Friday, July 09, 2010

more updates on the Transcend MP 330

After my last post on the Transcend MP 330, some more info. The 60 ms lead was probably due to the Darla card. Recording live using the Tascam US-1641 and the MP 330, found the MP 330 to have a lag of 10 ms in 30 minutes. Which is very good.



Using the built-in mic, excessive sensitivity is a problem. Keeping it at a distance of 2 feet and talking in a normal conversational tone keeps it from saturating, but anything louder than that makes it clip. A bit of hum at 5.5kHz and 11 kHz or so. Noise-reduction removes that, of course.

using the Optoma EP1080

Finally got my hands on the Optoma TX 1080 aka EP 1080 projector which Paul Bourke recommends. It had some issues which had to be sorted out before use in the Planetarium.

The Optoma logo - Startup logo had to be made a black screen. Logo capture needed VGA input - it did not capture from S-Video. Supplying a 1920 x 1080 signal, it captured with no issues. Takes a minute or so to capture.

Turn off confirmation - When turning off the projector with the remote, it displays "To turn off, press Power button". Since this should not be displayed during the show, had to work out the turn off using RS232 or network option.

Network control - An RJ45 jack allows the projector to be controlled via an ethernet network. It has a built-in web server, and ip address can be set from the menu. Unfortunately, the manual did not mention that the web server is password protected. Found the password by trial and error, admin for the Administrator login. Once logged in, password can be disabled, so that just pressing login leaving the password field blank logs you in. The interface is not fully compatible with firefox, IE gives best results. Unfortunately, our control machine upstairs does not have a network card, so RS-232 seemed to be the way to go.

RS-232 - Tried many times with Hyperterminal, but did not succeed till, by trial and error, found the following:
(a) The projector needs to be turned on after the computer connects to the RS-232 port via hyperterminal or whatever.
(b) The string to be sent to the projector has a space in it. It should be ~0000 1 and not ~00001
(c) Autoit version 3.3.0 onwards are not compatible with Win98 etc.
(d) The control machine upstairs had no CD-drive, and since it runs Win98FE, needed this driver to recognize the 1 GB Sandisk flash drive.

Once I worked out all these, could get an autoit script to send the On and Off commands using a hyperterminal window which was opened at startup.

Time taken to autodetect - Autodetecting the S-video signal was taking more than a minute. Sending the S-video signal using RS-232 ~0012 9 after 30 seconds does the job - brings up the video in 34 seconds.

Mirror deformation - For using the projector in the mirrordome configuration, the mirror needs some support, without which it deforms under its own weight. Jury-rigged with thermocol, will try again using reduced mirror area.

Tuesday, July 06, 2010

notifications on radio silence

Following a conversation with B, I thought about ways to detect silence when SGH goes off the air on AsiaStar, and using the parallel port for detecting silence and so on. P came up with the Restless Winamp plugin to be installed at the playout server. We did that, and modified the C:\Documents and Settings\User\Application Data\Winamp\winamp.ini file by adding
[Restless Winamp Plugin]
Hit_Start_After_Millis=30000
Hit_Start_After_Minutes_Seconds=00:30

P then suggested using the sound card instead for silence detection, and immediately found the Piraside Silence Detector - software which does this very job! Hooking up a modem to the machine can then make it dial P or me when the silence is detected. But it does not work as easily as given on it's home page - a bat file with commands sent to COM1 etc don't work under WinNT or above. XP etc do not allow direct access to hardware from the Command Prompt, unlike DOS. After tests with hyperterminal etc, the solution of choice is currently autoit - using a user dll and control script to send AT commands to the modem. Just simple ATDT to dial the number, using a ProcessWait to wait for a while, ATH to hang up and so on.

Monday, July 05, 2010

adventures with Sony Readers

The Sony Reader PRS-500 had come back to me from A in December 2009, "not working". The screen was showing ghosting, taking a long time to change pages and so on. Sent it to the US for repair and or firmware upgrade. There, nothing was done since the Sony store guys just sent N to the website. Finally it came back, and found it working reasonably well. Probably the battery had some issues due to being left idle for many months, and a few charge / discharge cycles brought it back in the pink.

Because of the delays, purchased a Sony PRS-300 because R was also interested. Tried out the Calibre software, which has matured a lot since its inception in 2006-2007. Found that only the 0.6 versions and earlier support the PRS-500 with old firmware. Conversions to LRF or EPUB take 20-30 seconds per book, and there is a nice bulk conversion system.

Found a small glitch - when "merging" different versions, it is supposed to change all meta data to match the destination version. But the metadata for author in the EPUB files were not being changed. The calibre window shows the correct author name, but on uploading to the device, the device shows the original un-corrected Author name.

Transcend MP 330

Trying out the Transcend MP330. Surprisingly good recording options. 32 kHz ADPCM wav files in Best mode. 128 kbps stereo. With the built-in mic, saturates at two feet with my singing - it is a bit too sensitive. But quality is good. With line-in, AGC - automatic gain control, I think. Only 0.05 second - 50 milliseconds - lag after 45 minutes of recording. I tested it by playing back a wav file from Sathya using the Darla card, assuming that the Darla itself is close to frame-accurate. In terms of frames, for 25 fps, that would be just over one frame. Far better than the M-Audio Mobile Pre!

Tuesday, June 29, 2010

bash string processing and file renaming

For some reason, some 200 files had not been renamed on the dreamhost download server. Occasional reader emails of files not found alerted me to this.

When I checked the rename shell script, these files were not listed in it. They did have download filenames in our local database, but were not listed in the rename shell script for some reason. Manually renamed them by doing some string manipulation:
find ~ -name '* *' sort > toberenamed.txt
cat toberenamed.txt while read FILE ;

do echo mv \"$FILE\" $(echo $FILEsed 's/ /_/g') ;
done > toberenamed.sh
vim toberenamed.sh

#(to check manually and remove non-essentials)
chmod +x toberenamed.sh
./toberenamed.sh

sample searches and auto suggest

Added sample searches and auto suggest to the search wizard. That seems to make it ready for prime time, so a link also added to the Radiosai home page. Sample searches are javascript calls onclick, with the variables being initialized and the submit javascript being called. Auto suggest is simple-minded in the sense it cannot suggest after one word is typed in. For example, if Concert H is typed, it will not suggest Hariharan, but if H is typed, Hariharan is suggested. Something is better than nothing, of course. This implementation entirely in javascript is from here. The keywords were from descriptions, filenames, festival names etc. in a sort of free association. Later, sorted the auto suggest keywords with alphabetizer.

Then implemented a sort of "hit enter to submit" for the first and last pages of the Wizard. Though it follows the general idea given here, it does not seem to work with IE8. IE8 seems to ignore the Enter key entirely, and does not seem to send any window.event at all when I tested with some code which was to just give a javascript alert.