Tuesday, May 13, 2014

Better transcription with VLC and Notepad++

Yesterday I posted about humorously bad automatic audio transcription. Turns out that's not the answer, so I turned to the manual route for the time being.

The biggest problem is that because I don't have any dedicated transcription software, I am stuck with a very awkward method of alt tabbing between VLC (the media player) and notepad++ (my text editor) along with spacebar (to play and pause) and alt+left and alt+right to skip a few seconds backward and forward. This becomes really clumsy when I don't pause before switching to notepad++ so the audio keeps playing too far, or I forget where I am and start trying to type in the VLC window. Very slow. So I set about remedying this. What follows is my solution and perhaps might help you speed up your transcription too if you can't afford to buy dedicated software. I'm sure there are some other free tools around or more elegant solutions, but I like using Notepad++ and VLC and my solution is working well for me so far. It should work with any text editor, although VLC is necessary for this system.

So if you're following along at home, get VLC and AutoHotkey and Notepad++ [optional] and Windows. Sorry, AutoHotkey is Windows only as far as I know.

I built a little script that would help me out as it's running in the background. Because I have a keyboard (Logitech G710+) with several macro keys, I was able to bind a complex hotkey to a single button that I can reach with my pinky while typing. I chose Ctrl+alt+(a number) because that wasn't bound to anything already in notepad++ and I didn't have to remember it anyway. The huge advantage is that I am able to play, pause, jump back and forward without losing focus in my text editor. I never have to take my hands off the keyboard or touch the VLC window. With the final hotkey, Ctrl+alt+5 bound to G1, I can pull the current timecode from the media file and paste it into my text editor so that I can mark the spot I'm transcribing.

Here are the keys and their functions in the order I can reach them on my keyboard:

G6: Ctrl+alt+8 - Play or pause the VLC media file, without losing focus in the text editor
G5: Ctrl+alt+9 - Jump back 3 seconds
G4: Ctrl+alt+0 - Jump forward 3 seconds
G3: Ctrl+alt+7 - Jump back 10 seconds
G2: Ctrl+alt+6 - Jump forward 10 seconds
G1: Ctrl+alt+5 - Paste the current timecode into the text

You can edit the "jump distances" by tweaking what Alt+left, right, and Ctrl+left, right do in VLC:

You can use the hotkeys even without a macro keyboard; just edit them in the .ahk file to something a little easier, like Ctrl+` or something. Some helpful documentation on that here.

Finally, you can download the script here!

Hope that helps someone, because it's saving me lots of headaches already.

Later,
Stuart


Monday, May 12, 2014

Bad auto transcription

I ran a focus group today with a few undergraduate students about molecular visualization. I need to transcribe the 45 minute session, so I figured I would maybe try an automatic transcription to do a rough first pass. Adobe Premiere has a system that can do this and even identify individual speakers. You are able to import a script to help it along, because it's designed to sync your script with scenes shot for a movie, but obviously I didn't have that so I just let it go from scratch. The following is some of the output:

[Speaker 45] it's changed this that this lady
[Speaker 18] and a video or go to whoa and Simone hostage to wear this dress
[Speaker 6] just because the slopes the festival he says it is that in ten states it's a certain action yes and fifty years and when I was contagious there
[Speaker 83] it it it it it it it it it it it
[Speaker 103] and cheese over from a new light [ed. note: there were only 7 people in the room]
[Speaker 6] we know what's happening in Sausalito...
[Speaker 16] ... just can't go to the point and click yes instead you should keep in mind that again that abortion is random it is why is this just call him to stick to the orange blossoms many other things...
[Speaker 51] is so so are our first Easter Specter it to others the demotion of business Marquette but I think mom was looking for the orange market well
[Speaker 25] she texted me today secrets in the Rapids
[Speaker 6] still threatened to compete and then one day to make it
[Speaker 18] who is one of the tragedy of errors or the schnapps they know about Ohio...
[Speaker 9] and how their teacher they die will be different in them isn't it close to him
[Speaker 7] just a mechanism Liverpool cables that seemed so far to a mechanism by which locals
[Speaker 25] cancer with the crops
[Speaker 6] lip and yet you can earn you as the cats family when I go we should sell this theory TTC
[Speaker 20] so nice to see change which was nice to be competing for the weekend
[Speaker 7] Satan and his might just mean all those move around

So it was a pretty good discussion; we learned some very interesting things. Needless to say, I'm going to have to start from scratch myself and leave Adobe to work with defined scripts. But I can't help be curious about those secrets in the Rapids... 

Later,
Stuart

Thursday, May 8, 2014

Adding variation to objects using a single shader

I'm working on a scene with many (potentially hundreds) of objects which are pretty much the same. In fact there are many instances with the same shape node. I wanted some subtle variation in the color of the objects, not over the surface of an object, but on an object to object basis.


After doing some research, I encountered a method described here which uses a triple switch node. I've used shading switch nodes a little bit in Maya before so this seemed feasible. The biggest problem, however, was that the method doesn't work with instanced objects out of the box. So I set out to develop a "better" system that works even with instanced objects and combinations of instanced and non-instanced objects.

The idea is that you create a ramp that is piped into any attribute you want to vary. The ramp shows a range of colors and each object gets a random value which corresponds to a single location on the ramp. If you're not able to get a ramp looking random enough for the extent of variation you want, you can always play with the HSV Color Noise attributes or plug something else into the ramp.

1) The image below shows how to setup the initial shading network. Plug a V ramp into the attribute of choice in your material and then create a Single Switch which gets plugged into the place2Dtexture node (output > vCoord).

Edit Dec 2015: Probably simpler to skip the place2dTexture and plug the singleShadingSwitch.output directly to the vCoord of the ramp.



2) Then assign your material to everything you want to exhibit the variation.

3) Then open the AE for your shading switch and press the Add Surfaces button.

4) Then run this code. Just paste it into the script editor, select it all and "execute" or hit enter on the numpad.
string $switch = "singleShadingSwitch1"; //change this name to the switch you want
string $connectedAttr[] = `listConnections -c true -d false -t "shape" $switch`;
//print $connectedAttr; //DEBUG

for ($i = 0; $i < (size($connectedAttr)/2); $i++){

string $obj = $connectedAttr[($i*2)+1];
//string $parent[] = `listRelatives -p $obj`; //get parent transform for instanced transforms
// $obj = $parent[0]; //change object relationship to parent
//print $obj + "\n"; //DEBUG
if (!`attributeExists "randVCoord" $obj`){ //checks if attribute exists
  addAttr -at "float" -ln "randVCoord" -keyable true -hidden false -min 0 -max 1 $obj;
}
float $randCoord = rand(0,1);
setAttr ($obj + ".randVCoord") $randCoord; //set random number to custom transform attribute
if (!`isConnected ($obj + ".randVCoord") ($switch + ".input[" + $i + "].inSingle")`){
  connectAttr ($obj + ".randVCoord") ($switch + ".input[" + $i + "].inSingle");
}
}
You may have to edit the name of the singleShadingSwitch in the script. I was thinking making a custom input dialog but getting the functionality was difficult enough and I didn't want to delve into the whole GUI aspect.

5) Because this is all about visible connections, you can always tweak the ramp or even tweak the random values for individual objects. To do that, adjust the attribute called Rand VCoord to any value from 0–1. The effects probably won't show up in the viewport, but if you hit render the values should appear.

Here are a couple of examples:
Red to Blue ramp into the color
Fractal noise into the bump channel with shader switch controlling amplitude
 I was particularly concerned about instanced objects working with this and so I tested it on my molecular geometry. The first test only gave two different random values because it was the transform node that was itself instance above the coiled coil level of the hierarchy. So I pulled everything out of the hierarchy (not ideal, but works as a quick last step) which resulted in transform1 transform 2... transform 96 each with an instanced transform as a child. In order to put the random attribute on the proper transform, I just added two lines of code that changed the focus from the child to the parent (those are the two commented lines other than the debug print statements). Then I got the middle image, which is a bit extreme, but it works! So I tweaked my ramp a few times and got the image on the right in no time at all.


You can also use this method to add things other than random variation. Instead of a random value, you could assign the distance to the camera (mapped to 0–1 with setRange) or any other per-object transform info.

Later,
Stuart

Saturday, May 3, 2014

sIBL Render

I spent a bit of time testing out some sIBL and Lightsmith tools that make setting up studio renders pretty straightforward. I still need to decide how this might help with molecular environments, but it might be a place to start. I'm also not sure exactly what the object in the middle is; it's just a cylinder extruded a bunch.


I also got to try my watermark, although it's not embedded in anything 3D.

And in case you are also experimenting with Maya 2015 and wondering where Keep Faces Together is, well now it's in the Preferences under the Modelling tab.

Later,
Stuart

Friday, May 2, 2014

Look at Selection

I just installed Maya 2015 and have been playing around with some of the new features. During the process of perusing through menus I stumbled across the command "Look at Selection" in the View menu of the modelling panel. I'm sure it's a very old feature (I know at least Maya 2008) but I haven't ever used it because it doesn't seem to have a hotkey assigned to it so I doubt many other people use it much and ergo I haven't seen people using it in tutorials etc.

It's a very handy command because it does basically the same thing as "frame selected" or "frame all" so it centers the camera's pivot on what you're working on, but it doesn't zoom the camera in or out so you're claustrophobically close to a selection of vertices. Does this sound familiar? Modeling - Alt+LMB orbit - [oh, I'm tumbling away from where I'm working] - f - Alt+RMB zoom out zoom out zoom out - modeling and repeat. So it's great because the camera keeps its distance, but there's no hotkey for it... yet.

I used the MEL mentioned here as a starting point and modified it so it would work with the Look at Selection command which is
viewLookAt [-position linear linear linear] [camera]
so the little MEL script I ended up with is
$currentPanel = `getPanel -withFocus`;
$panelType = `getPanel -to $currentPanel`;
if ($panelType == "modelPanel")
{
string $camera = `modelEditor -q -camera $currentPanel`;
viewLookAt $camera;

}
And then all that was needed was to assign a hotkey to it as described here.
Basically I created a new command in the hotkey editor (which I've assigned the hotkey '?' itself) and then assigned 'Ctrl+f', which wasn't already assigned anything and it's related to the frame hotkey 'f'.

I might end up just remapping 'f' to it if I find I don't use the frame command much anymore. The command is also handy because if there's nothing selected the camera just centers on the origin, instead of zooming way out into space as 'frame' will do in a large scene. Hopefully that's helpful for some people.