Sunday 14 December 2014

Theremin on Processing

Theremin on Processing in progress?


Introduction

While thinking of what I can do with Processing, I stuck on, "Can I play Theremin with the camera built in the Mac?"

I'm afraid if someone has done already and there is :0
I found however it's too small to control and doesn't work well for music (can't make pitch staircase) so I decided to create my own one.

I thought up several implementations for that, but I had meager time and wanted to make with as much vanilla Processing as possible.

Thus my app will be kind of a mashup.


Development Details

From sound libraries
  • minim (sound library for Processing)
  • sound (in vanilla Processing)
I have chosen "sound" due to no need of more functionality.

From video libraries
  • video (in vallina Processing)
  • OpenCV
  • BoofCV (CV library on Java)
I have chosen "BoofCV" because video has no tracking feature and OpenCV couldn't be smoothly installed into my Mac...


Well, this is the screen:



Artifacts

Here is the repository.
GitHub - Theremin on Processing

You can download the application from here:
GitHub - Theremin on Processing - release page

The resolution of the camera is now fit to FaceTime HD (1280x720) in my Mac. Sorry for now if your camera doesn't match...

The usage is written on the project page above.

I did check if I can play a melody :)

Conclusion

During the creation what I felt is this has problems in its accuracy for real performance. Infrared camera devices (e.g. Kinect, Leap Motion) are better for control but here I did without special devices.

This article and artifacts are work in progress after Boulez.

Playing Videos

To prove this Theremin on Processing can play music, I asked my friend, Neko Piano to play with it :)

Here are playing videos.

Checking its control and trying to sing a scale:

Singing "When You Wish Upon a Star":

Neko Piano played a Theremin-like instrument for the first time... so with some wrong pitches.
It's proven however this is a musical instrument! :)
For that matter I couldn't find any videos to play music with Theremin-like digital instrument, you're blindly concerning in technologies, are't you? :)

Sunday 12 October 2014

How to Crop Tabs in Chrome

Did you want to crop tabs in your window in Chrome?
For example you did open lots of tabs but they are not related to other tabs then you may want to separate them.

One solution is to use the extension Tab Scissors:

This enables you cut tabs in one window off into two windows.


But my super recommendation is just to drag tabs in the window.
  1. Select several tabs to crop.
    1. Click the one tab.
    2. Click the other tab in the other side with shift key.
  2. Drag those selected tabs
  3. You get another window with selected tabs.

Like


Enjoy it :)

Wednesday 16 July 2014

git svn with svn branches

How can you use git svn and branches on Subversion server?

It’s not quite easy yet and if you never use it it’s fear for you.
You can practice it in your local and you need to follow these procedures.

Practice for git svn with branches on local

You want to practice it on your local, don’t you?

Create local svn repository and clone it.

Environments

  • Windows
  • TortoiseSVN
  • Git Extensions

You could follow these steps with other OSes.

First of all you may try to clone a svn repository you created in your local.

$ git svn clone /c/Repos/GitPractices/centralsvn . --stdlayout

but you will fail with it.

Initialized empty Git repository in C:/Repos/GitPractices/localgitsvn-a/.git/
E: 'trunk' is not a complete URL  and a separate URL is not specified

In order to evade it, you need to do the following steps

  1. create svn repository

  2. run svnserve

For Windows you need to run commands in bash, e.g. MINGW32 in Git Extensions.

Don’t use this command:

✘ $ svnserve -d -R --root ./

which runs as read only.

Use

$ svnserve -d --root ./

or

$ svnserve -d -r ./

And leave that console open.

  1. svn clone
$ git svn clone --prefix svn/ -s svn://localhost/ ./

or

$ git svn clone -s svn://localhost/ ./

then you will be able to clone it to your local.

And when you try to dcommit, you will fail with an auth error:

$ git svn branch branchb -m "Created Branch B"
Copying svn://localhost/trunk at r2 to svn://localhost/branches/branchb...
Authorization failed: Authorization failed at C:\Program Files (x86)\Git/libexec
/git-core\git-svn line 1183

$ git svn dcommit
Committing to svn://localhost/trunk ...

ERROR from SVN:
Authorization failed: Authorization failed
W: d24d77abd34ffddfed52dd4f741be8373f8cd839 and refs/remotes/svn/trunk differ, u
sing rebase:
:040000 000000 2e3c39bdb69f2b4e2f339ff28ec1878897693d05 000000000000000000000000
0000000000000000 D      testa
Current branch master is up to date.
ERROR: Not all changes have been committed into SVN, however the committed
ones (if any) seem to be successfully integrated into the working tree.
Please see the above messages for details.

anno-access = write

Because svnserve runs still as read only for an anonymous user.
In order to evade this, you need to add “anon-access = write” into the conf/svnserve.conf file in the SVN repository, e.g.
C:\Repos\GitPractices\centralsvn\conf\svnserve.conf

[general]
anno-access = write

Create SVN branch

Prerequisite: you have SVN repository already like explained above.

Unless you create a SVN branch then you will just dcommit to trunk.
Use git svn branch.

$ git svn branch -m "created Branch B" branchb
Copying svn://localhost/trunk at r4 to svn://localhost/branches/branchb...
Found possible branch point: svn://localhost/trunk => svn://localhost/branches/b
ranchb, 4
Found branch parent: (refs/remotes/svn/branchb) 8a0afc7055ddf7b438b22c1bd4aca5a0
c45c0e9a
Following parent with do_switch
Successfully followed parent
r5 = 6dace9fa756cf8ea2320d968707ebce50c0bc35d (refs/remotes/svn/branchb)

In case that you’ve created a local Git branch already,
you have to also create SVN branch firstly to dcommit.

Check a svn branch out

Let’s say you have a branch, branchsvn in SVN.

git svn fetch
git checkout -b branchsvn

Then you have branchsvn in your local and switch to it.

FYI

git checkout -b <branch name>

equals

git branch <branch name>
git checkout <branch name>

Conclusions

  1. Prepare SVN server to practice
    1. Use svnserve
$ svnserve -d -r ./
  1. Make branches synchronized between local Git repository and SVN repository.
    1. Create SVN branch
      Let’s say you want to have branchb synched with SVN repository.
      Create a SVN repository even if you created the git repository in your local.
      You can skip this if SVN repository already has a branch.
$ git svn branch branchb -m "This is a commit message for new branchb."
1. Check the SVN branch out
git svn fetch
git checkout -b branchb

If you have already a git branch in your local to commit to SVN,
run checkout without -b and rebase SVN remote branch.

git svn fetch
git rebase remotes/branchb
git svn dcommit

So you can dcommit as usual.

A shortcut to create synced branches if you don’t have any branch yet.

$ git checkout -b branchb remotes/branchb

How to synchronize between Git branches and SVN ones.

SVN branch exists. SVN branch doesn’t exist.
Git branch exists. A B
Git branch doesn’t exist. C B or C

Assuming you want to synchronize the branch branchb between Git and SVN,
find your alphabet in the table above and follow the corresponding commands below.

  • A (Git + SVN branches exist)

rebase branchb on SVN

$ git svn fetch
$ git rebase remotes/branchb
  • B (Git branch exists or nothing)

svn branch/rebase branchb

$ git svn branch branchb -m "Created Branch B"
$ git rebase remotes/branchb
  • C (SVN branch exists or nothing)

checkout -b

$ git checkout -b branchb remotes/branchb

Processing 2 Movie Maker on Windows 64bit

Movie Maker in Processing doesn't work on Windows 64bit.
Use ffmpeg, which is much richer.

Processing loves float, not double.

Processing doesn't have double APIs but float ones only in July 2014.
It owes to real time graphic in a display.

Functional JavaScript if statement?

Does JavaScript have if statement with return value like Scala?
No, it doesn't.

You have to write a ternary:
var result = checkingValue == null ? "" : checkingValue;
or use function.

Wednesday 9 July 2014

Sunday 15 June 2014

Darksiders

I need to keep myself away from Japanese on the dark side, such as typically 2ch users, or those who really use its slangs or behave as written there. Generally speaking those who live, speak, and observe only in the Net or video games, i.e. social myopia.
Not want to keep away because of narrowing the world, but should do so.

When they're in tough or bad situation, they tend to say, "Then I will do bad things, to someone or to anyone." or "I will shut myself up in my room (possibly metaphorically)."
When they're criticized by someone, they say, "Do you think I'm such stupid as you say?!" It seems they hate 'stupid'.

For they very much lower moral and morale, then I have to keep them as much extra effort, which is unnecessary and wasteful.
As my declaration for working well on business.

Friday 6 June 2014

HTML5 input date validation

HTML5 has <input type="date"> and browsers which support it show their own date picker calender.
And what if you input invalid date, e.g. 2016/2/30?
W3C HTML5 spec says
The value sanitization algorithm is as follows: If the value of the element is not a valid date string, then set it to the empty string instead.
So you never get an original invalid date value.

How can you handle it?


You only know if a value is invalid or not with...


  1. input.validity.badInput
  2. input.validity.valid
  3. input.validationMessage

Further details, please see this: http://stackoverflow.com/questions/13278016/get-input-value-from-html5-inputtype-date-in-chrome/24081375#24081375


Sunday 6 April 2014

git svn Commands State Diagram

 Some people haven't yet used Git because they've already utilized Subversion in their projects or they've never used Git and been afraid of it.
 Even in that case you can however use Git within your local PC, which way is to commit your files to Subversion from your local Git environment. Thus you'll get the situation other people use Subversion only but you use Git, which is anyway better than vanilla Subversion.
 How to use Git with Subversion? That's by a git command, git svn.
 I created the state diagram of git and git svn commands because I can find git diagram but hardly ever git svn one.
 Here you are:

Legend:
 ">..." on an edge: git commands

Red edges: a flow to commit to Subversion repository

Blue edges: a flow to update from Subversion repository



 Can I help you, who are irritated against hackneyed Subversion or trying to use Git?