Sunday, December 6, 2015

Choirs need electronic temperament keyboard

Choirs which perform early music need, for rehearsal purposes, an electronic keyboard capable of playing in various temperaments. All these temperaments should be adjustable by a simple slider bar, so that the choir's listening experience will fall at a point which lies anywhere (at the director's discretion) from hearing each temperament fully, to hearing merely a barely-detectable taste of the "flavor" of that temperament. This slider bar must range from 100% (for full engagement of the selected temperament) to 0% (for Equal Temperament).

This aspect of the keyboard would thus follow the advice of the best experts on temperament, who generally believe that, in history, always and actually, practice has been to use no temperament only in its pure form: but instead, that the timeline of historical practice constitutes a gradual drift from one temperament to another. Further, they believe it is historically accurate for us to duplicate today these same practices from the past, by means of any degree of alteration from Equal Temperament which we desire, using our own good taste.

Since the last century represents the triumph of Equal Temperament, perhaps our use of other temperaments should remain fairly close to it. The slider would enable this.

In order to perform early music, choirs need these temperaments:
  • Bradley Lehman/J.S. Bach
  • Equal Temperament
  • Meantone
  • Pythagorean
  • Valotti
  • Victorian
Some facility to load in new temperaments would be desirable as well.

Copyright (c) 2015 Mark D. Blackwell.

Thursday, August 13, 2015

Open inbound port on Windows 7, howto

Let's say you wish to open up a port (i.e., a local, inbound port) for the use of (i.e., to be served by) some program running on your Windows 7 (Home Premium SP1) computer. If installing the program didn't automatically result in opening up that port, here's how to do so.

For security reasons, you should limit the usage of an inbound local port to just the single receiving program. Plus in many cases you should configure that program not to use its standard port number (if possible). Instead, pick a number between 1024 and 49151 (inclusive and random) to be your inbound local port number.


First identify what Windows 7 calls your router's 'Network Location'. (Later we'll need this.) Here's how to do it:
  1. In Control Panel, click 'Network and Sharing Center'.
  2. Under the words 'View your active networks', identify (of your active routers) which is the appropriate one. (Most people only have one active router.)
  3. Find and click the text you see, immediately under that active router. Then
  4. Observe which Network Location is selected (i.e., surrounded by a dotted box).
  5. You should decide (if you haven't already) whether this router is best considered as providing:
    • A Home Network (a private network);
    • A Work Network (in a corporate domain); or
    • A Public Network.
    As it happens, my wireless router is provided by my landlord, so I categorize it as an unsafe Public Network. And that's its Network Location.

Then set up Windows Firewall to allow your desired inbound connection to the receiving program. (You'll need to be an Administrator for this.) Here's how:
  1. In Control Panel, click 'Windows Firewall'.
  2. Click 'Advanced Settings'—this takes you to 'Windows Firewall with Advanced Security'.
  3. Click 'Inbound Rules'.
  4. Click 'New Rule'.
  5. Select 'Port' and click 'Next'.
  6. Ensure 'TCP' is selected.
  7. Ensure 'Specific local ports' is selected.
  8. Enter your local inbound port number and click 'Next'.
  9. Ensure 'Allow the Connection' is selected, and click 'Next'.
  10. For 'When does this rule apply?', ensure that the box by your router's Network Location (see above) is checked (but no other Network Locations are), and click 'Next'.
  11. Under the word 'Name', enter the name of the receiving program, then a word (or an abbreviation) indicating (to you) the port's purpose (or functionality), the words 'In' and 'Port', and the port number (all five concatenated together). Click 'Finish'. (Later, this naming scheme will ease finding this rule, if necessary.)
  12. Click 'Refresh'.
  13. Right-click your new rule and select 'Properties'.
  14. Click the 'Advanced' tab.
  15. If you need this local inbound port to be accessible merely from other computers within your LAN, then:
    • Under 'Edge traversal', ensure 'Block edge traversal' is selected. This prevents computers outside your LAN from initiating contact with this inbound port on your computer (at least, through this Windows Firewall 'Action: Allow' rule).
    Otherwise, to allow inbound access to this local port from computers outside your LAN:
    • Under 'Edge traversal', unselect 'Block edge traversal'.
  16. Click the 'Programs and Services' tab.
  17. Select 'This program'.
  18. Enter the path to your receiving program and click 'OK'.
Copyright (c) 2015 Mark D. Blackwell.

Wednesday, August 12, 2015

SSH to guest Debian stretch on a VirtualBox Windows 7 host from LAN, howto

Suppose you have a virtual machine (or VM), in which you have installed a guest operating system: e.g., Debian stretch. And, it's running under a (physical) Windows 7 (Home Premium SP1) host operating system (by means of Oracle's VirtualBox software developed by wholly-owned Innotek GmbH).

You might wish to access that Debian guest from another box on your host's LAN. Here's how to do so with SSH. (If you're on Windows, you can do this IMO most enjoyably from Git Bash or Cygwin, although SSHing more directly from Windows is also possible.)

These instructions should work just as well with Debian's jessie or wheezy releases (in all likelihood). One caveat: Debian normally disallows SSH access as root. Instead, log in as a regular user and do 'sudo' (or 'su') if you wish to be root.


In your guest Debian operating system, install the software to accept your inbound SSH connection:
sudo apt-get install openssh-server

I. For the desired VM, adjust its VirtualBox settings:
  1. Choose network type NAT.
  2. Forward some inbound port on the host to inbound port 22 on the guest.
Here are the details on how to accomplish this:
  1. To provide an additional layer of security, pick a number between 1024 and 49151 (inclusive and random) to be the inbound local port ('host port') on your physical VirtualBox host.
  2. In VirtualBox Manager, select your desired VM (it can be running).
  3. In the VirtualBox Manager menu, click Machine–Settings–Network.
  4. Ensure the 'Adapter 1' tab is selected.
  5. Ensure 'Enable Network Adapter' is checked.
  6. You'll see the words 'Attached to'. There, select 'NAT'.
  7. Ensure that the blue, drop-down arrow by the word 'Advanced' has dropped down to show you the advanced settings.
  8. Click the 'Port Forwarding' button.
  9. Click the green icon, bearing a plus sign, whose tooltip is 'Adds new port forwarding rule'.
  10. Find and select the newly-created row.
  11. In the 'Name' column, type 'guestssh'.
  12. Ensure 'Protocol' is 'TCP'.
  13. In the 'Host Port' column, type your inbound local port.
  14. In the 'Guest Port' column, type '22'.
II. Set up Windows Firewall to allow the desired SSH connection, by following the steps in this post to create the new firewall rule. In particular:
  • Name it 'VirtualBoxSSHInPort' followed by the port number.
  • Under 'Edge traversal', ensure 'Block edge traversal' is selected.
  • For the path to the receiving program, use the path to the VirtualBox executable (on your host system).
III. Determine the Internet Protocol (IP) address of your VirtualBox host as viewed by its active router. Here's how:
  1. In your VirtualBox host's system tray, click the icon of the active router.
  2. Make sure the drop-down arrow by the words 'Wireless Network Connection' is selected, so you see a list of routers.
  3. Find the name of your active router in the list.
  4. Right-click that name.
  5. Click on 'Status'.
  6. Click the 'Details' button.
  7. In the 'Property' column, find the words 'IPv4 Address'.
  8. Read across to the 'Value' column.
  9. Note its four, dot-separated numbers. That's the IP address of your VirtualBox host, in the LAN provided by its active router. And for your SSH connection command it will be your target IP address.
In order to allow SSH connections to your VirtualBox guest, the VirtualBox software does Network Address Translation (NAT). So, BTW, your VirtualBox guest will report that you are logged in from some other LAN (with another IP address), not from your active router's LAN. The foreign port number will be different, as well.

IV. Now you can test the availability of your inbound SSH connection.

By default, to log in, SSH detects your local username and tries to use it.

Typical Windows usernames begin with a capital letter, yet typical GNU/Linux usernames begin with a lower-case letter. Therefore SSH's default username likely will fail. So instead (from Windows), the SSH command to access your VirtualBox VM is:
$ ssh {lowercase username}@{target IP address} -p {host port}
Since my name (and Windows username) is Mark, I enter:
$ ssh mark@{target IP address} -p {host port}
Alternatively, instead of logging in, you can run a single command (per these tutorials) and retrieve its output to your local, non-SSH computer—e.g.:
$ ssh mark@{target IP address} -p {host port} cat some-file > here
Or, you can use SCP.

Copyright (c) 2015 Mark D. Blackwell.

Wednesday, July 29, 2015

GNU nano on Windows with UTF-8 and color, howto

Ever since the day I first installed the Debian GNU/Linux distribution, I've been using their default text editor, called GNU nano.

I quite like GNU nano. It can edit multiple files at once (combined with grep, find, or a shell glob); it has syntax highlighting; it can undo (as well as redo); etc. Plus, it's extremely simple to use!

For general use on Windows, IMO the best text editor is Notepad2. Yet when I'm developing software, GNU nano is my editor of choice—even when I'm (forced to be) on Windows—for instance, in Git Bash (Git for Windows).

More broadly, if GNU nano is installed on Windows, it might form a good "bridge" to help Windows users adapt to the UNIX command line (in advance, partially—if they will ever need it). Then (at least) the editor will be familiar. This IMO is the first hurdle.

But first, a little history. Elm (etymology: ELectronic Mail) is a text-based email client. Pine (etym.: the word itself, or Pine Is Nearly Elm) is a text-based email client developed at the University of Washington, where evergreen trees abound. Pico (etym.: PIne COmposer) is a text editor. GNU nano (etym.: a word similar to pico in meaning, or Nano’s ANOther editor) is a free software rewrite of pico which includes many improvements. All of this software is for Unix.

Currently, GNU nano's website says its latest Windows build is version 2.5.3 (of GNU nano). As the download directory informs us, this was last modified on 2016-02-25. Its README.TXT says 'this version of nano for Win32 systems was compiled using...cygwin and PDCurses 2.4.'

Also, however, this GNU nano build was compiled with option '--disable-utf8' (as the command 'nano --version' reveals).

At present, Windows (even as far back as XP SP3) is pretty thoroughgoing in its use of UTF-8. So, because some of my projects need UTF-8, I decided to look into how I could work around this problem.

Ultimately, I extracted nano.exe from a recent version (at that time, 2.1.0-1) of Cygwin. That, as well as copying just a few other files from Cygwin, created a standalone GNU nano which works fine (without the bulk of Cygwin) on my Windows box—and it displays UTF-8. (BTW, I use several Windows computers; I haven't installed Cygwin on all of them.)

Note: you must set the following Windows environment variable (but you can change the 'en_US' part if you like):
  • LANG   :   en_US.UTF-8
You must unset the following Windows environment variable (unless it happens already to have the value 'cygwin'):
  • TERM
If you like, you can do this in a Windows 'batch' file, which then starts GNU nano.

EDIT: Previously, I had suggested setting Windows environment variables HOME and TERM (partly in line with the GNU nano editor's recommendations) but when unconventionally set, these can conflict with other software, notably Ruby.

Typically, when adapted to Windows, most software will calculate the correct 'home' location of user data, but will defer to our choice if we ourselves set the HOME variable. Sometimes that creates problems among the different console-like programs (such as cmd.exe, ConEmu, Git for Windows, Cygwin, etc., especially with their different pathname string formats for the root of a disk drive). One seemingly working value for the HOME variable is %USERPROFILE%.

Also, some software may require the Windows environment variable TERM to be set to some particular value other than 'cygwin'.

The necessary files copied from Cygwin are just:
  • bin\cyggcc_s-1.dll
  • bin\cygiconv-2.dll
  • bin\cygintl-8.dll
  • bin\cygmagic-1.dll
  • bin\cygncursesw-10.dll
  • bin\cygwin1.dll
  • bin\cygz.dll
  • bin\nano.exe
  • etc\nanorc
  • lib\terminfo
  • usr\share\misc\magic
  • usr\share\misc\magic.mgc
  • usr\share\terminfo\63\cygwin
Place these in the same-named folders under your 'nano' program folder. Create an additional folder (in the same place):
  • home\%USERNAME%\
and enjoy.

If you want syntax highlighting, pick up all the syntax highlighting files as well:
  • usr\share\nano\*.nanorc
Although you might run it from cmd.exe, GNU nano can do color-highlighting of syntax nevertheless. To do this, edit etc\nanorc in the following way, but keep its line endings as LF only.

Uncomment any (or all) of that configuration file's lines containing 'include ...' in order to make it pull in the various files above, which you desire. They define the particular sets of syntax which GNU nano will highlight.

The extension of the file you're editing usually determines which '*.nanorc' syntax file GNU nano will apply. (A regular expression atop each syntax file determines this.)

To highlight trailing spaces (often disliked by Git—the version control software), you might find it useful to append usr\share\nano\default.nanorc (and any other syntax-highlighting file you choose) with:

      # Trailing whitespace
      color ,blue "[[:space:]]+$"

To highlight the following as well, add:

      # Spaces in front of tabs
      color ,red " + +"

If you want to make all tabs and spaces visible whenever you type Alt-P, then uncomment and change the 'set whitespace' line in etc\nanorc to:

      set whitespace "»·"

Also, Lubomir I. Ivanov reports he has made a build for Windows of GNU nano 2.2.6. In addition to '--enable-utf8', he compiled with '--enable-extra' obtaining GNU nano's experimental features such as undo. He added a customized Windows command console as well, so his build may be even better.

Copyright (c) 2015 Mark D. Blackwell.

Friday, March 20, 2015

All good-sounding, choral 13th chords

Here is a PDF of all good-sounding choral 13th chords (excluding transpositions) along with a MIDI. It contains 203 chords in an extreme choral range: F2 to A5, sorted in an order useful for music composition purposes.

This list also contains about fifteen chords which don't sound as good. However, I didn't detect a pattern I could use, in order to remove them automatically.

I removed all chords containing:
  • Minor seconds;
  • Minor ninths;
  • Tritones;
  • Two consecutive major seconds;
  • More than two major seconds;
  • Major seconds starting lower than F3 or higher than F4;
  • Gaps greater than an octave which resume higher than F4.

Copyright (c) 2015 Mark D. Blackwell.

Tuesday, March 17, 2015

Greek language history

Some time ago, I took notes on an interesting book about the history of Greek: The Greek Language, B.F.C. Atkinson, 1931.

My notes touch on:
  • Greek's linguistic sources in other cultures.
  • A history of pitch accents in Greek.
  • The Septuagint translation (into Greek)'s impact on (Greek) vocabulary and modes of expression.
  • Linguistic and stylistic currents (from the Septuagint and Aramaic) in the New Testament.
  • A comparison of Plato with the (Greek) New Testament, regarding each's linguistic impact.
  • Greek and English linguistic histories compared.
  • Linguistic change depends upon political and social development.
The notes: page 1, page 2, page 3.

Copyright (c) 2015 Mark D. Blackwell.