TwitterFacebook

Blender 3D tutorial – tesla effect.

This is a simple tutorial about tesla effect. I make it to see how to handle with simple operations under Blender 3D enviroment. First you need to open Blender 3D application and you’ll see this :
Blender 3D tesla
Select your Camera with left mouse click and press this keys: Alt + R (this will reset your Camera rotation).
Press the 1 and/ or 5 numpad keys to be able to drag the camera. Now using right click over arrows to drag the camera into the centre of the screen. Each object has x,y and z arrow with this colors : red , green and blue.
Blender 3D tesla
With Camera object selected press this keys: R X and type 90 ( this will rotate the Camera with 90 degrees).
If you will press F12 key will see the output render image.
Select the Cube object with right mouse click and press X key , you will see one dialog message. Press ok to delete the Cube object.
The next step is to create the wires. Using left mouse click to put the mouse cursor into centre of the scene.
See if this possition is good by pressing 1 and 3 on your numpad keyboard. If not you can use also 3D rotation of the scene by pressing under wheel mouse and move the mouse. When your 3D cursor is on centre of the screen then you can add the wires, see:
tesla-003
Press this keys : Shift + A and select : Curve , Nurbs Curve . Then press R , X 90 and then R , Y 90. This is the result:
tesla-004
Drag this into center of view camera by using left mouse click under red arrow (will move it under x possition).
Then press N and you will see a panel with some stuff : like Transform (not of this is set to 0 and this is bad).
Now will fix location, rotation and scale by pressing key Ctr + A and fix all of this ( see Transform from panel).
As you see the centre of this object is not into the centre of nurbs curve was move it, so press :
Shift + S and select Cursor to selected, put your cursor under nurbs curve and press Shift + Ctr + Alt + C and select origin to 3D cursor. The x,y,z location will not be 0 , but the centre of object is into right place.
The centre of object can also be set into edit mode but I will show you into another tutorial.
Now add a new Curve Circle with Shift + A keys  into the scene.
tesla-006
Now select the Nurbs Curve and from property of this select BezierCircle to make this wire.
tesla-007
After that , when you scale the BezierCircle the wire will be change it. Select the Nurbs Curve press Ctr+D to duplicate, move it along x axis using key G and X, press R and 180 to have this:
tesla-008
See if this possition is good by pressing 1 and 3 on your numpad keyboard.
Press Ctr + A and add Empty – Arrow to this. Press Ctr + D this will duplicate it. Grab it along x axis under second Nurbs Curve. Then for each Empty press I and select LocRot to set keyframe 0. Go to yeyframe 60 (select by left click mouse under Timeline – see the bottom of the Blender 3D application) and by selecting each empty press I with LocRot to fix the end location.
tesla-009
Test all to be into same possition along x axis by using 1 and 3 from numpad.
Select framekey 20 and with Shift key select this two Empty move it along Z by presing G key and Z.
Now press S key and X key and scale all. This two Empty will need to touch all Nurbs Curves and press I key with LocRot.
Repeat by selecting key frame 40 and this time grab it along Z axis to the bottom of wires – Nurbs Curves and scale it along X axis. Make same operation to set it on keyframe 30. In this key frame the Empty will need to touch the Nurbs Curves.
Set the end of keyframes rate to 60.
If is all good when you press Alt + A the Empty’s will follow the Nurbs Curbs.
See the next picture to see how I set this:
tesla-010
Select this two Empty press Shift + S – Cursor to Selected and then Shift + A – Curve – Path to add one Path to this Emptys.
Press Tab key and select 3 by 5 vertices and press Del key to remove them and press Tab key again.
See if this Path is between two empty. If not grab it and also use Shift + Ctr +Alt + C to set Origin to Geometry. Test all to be into same possition along x axis by using 1 and 3 from numpad.
Select one Empty then select the Path , press Tab to go into Edit Mode and select just one vertice and press Ctr + H to hook it with Hook to Selected Object.
Repeat with the second Empty and the vertice from Path. This will hook the Path to this two Emptys.
tesla-011
Test animation by using Alt + A keys. If it working well then select the Path go to Modifiers tab.
You will see your two hook and will need to add a new one Wave.
tesla-012
I add another one Wave modifier and I set it with my values. You will need to set with yours because this depends by your objects size. Also on each wave modifiers you need to uncheck the Y from Motion.
Also the Path will need to set, go to Geometry Extrude from Data ( here is all property of Path) and set Extrude.
This will make it more visible. Then select one material for your Path and you can make Your animation.
You can download my file from here.

How to record sound from microphone with ffmpeg.

First you need to download the last ffmpeg software version.
You can find it here.
Next you need to see the microphone hardware. You need to use this command to see all your devices:

C:\ffmpeg\bin>ffmpeg.exe -list_devices true -f dshow -i dummy

The result show you like strings

[dshow @ 0000000002d5cd40] DirectShow video devices
[dshow @ 0000000002d5cd40]  "Front Camera"
[dshow @ 0000000002d5cd40] DirectShow audio devices
[dshow @ 0000000002d5cd40]  "Microphone (Realtek High Definition Audio)"
dummy: Immediate exit requested

After that use this command to record your microphone:

C:\ffmpeg\bin>ffmpeg.exe -rtbufsize 1500M -f dshow -i audio="Microphone (Realtek
 High Definition Audio)" -acodec pcm_s16le -ac 1  test.flv

Than will create a flv format file. I used VLC software because bsplayer got me some errors.

pygame – using sound, mixer, volume, channels, fade-in and out effect .

PyGame module come with sound feature and this allow users to test some effects.
The next source code will make a window and also will play a song.
After you can test all effects with python version 3.4.1 .
Just see the keys from source code and test it. The song is a ogg file.
I used this sample from a recording of the album Through the Devil Softly by the artist Hope Sandoval and The Warm Inventions from here.
Let’s see the python script:

import pygame, sys
blue = (55, 75, 155)
 
pygame.init()
pygame.display.set_caption('pygame - using sound effect')
size = [460, 100]
screen = pygame.display.set_mode(size)
clock = pygame.time.Clock()
 
# load sound file
pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)

pygame.mixer.music.set_volume(0.5)
sound = pygame.mixer.Sound("bird.ogg")
snd_array = pygame.sndarray.array(sound)
snd_out = pygame.sndarray.make_sound(snd_array)
snd_out.play()

mychannel=pygame.mixer.find_channel()
while pygame.mixer.find_channel is None: 
    print (pygame.mixer.find_channel)
allchannels=pygame.mixer.get_num_channels()
print ('all channels - ',allchannels)
print ('duration -',sound.get_length(),' seconds')
print ('press 1 - play sound')
print ('press 2 - play sound in a loop')
print ('press 3 - play sound with 9 seconds fade-in effect')
print ('press 4 - play sound just for 9 seconds')
print ('press 5 - play sound 3 more times')
print ('press 9 - stop playing with fadeout effect set 9 ')
print ('press 0 - stop playing instantly')
print ('press up arrow key - up volume')
print ('press down arrow key - down volume')
 
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_1:
                sound.play()
            if event.key == pygame.K_2:
                sound.play(-1)
            if event.key == pygame.K_3:
                sound.play(-1, fade_ms=9000)
            if event.key == pygame.K_4:
                sound.play(-1, 9000)
            if event.key == pygame.K_5:
                sound.play(3)
            if event.key == pygame.K_9:
                sound.fadeout(9000)
            if event.key == pygame.K_0:
                sound.stop()
            if event.key == pygame.K_UP:
                sound.set_volume(sound.get_volume()+0.1)
                print(sound.get_volume())
            if event.key == pygame.K_DOWN:
                sound.set_volume(sound.get_volume()-0.1)
                print(sound.get_volume())
    screen.fill(blue)
    pygame.display.update()
    clock.tick(10)

News: Superfast Browser – to fast.

If your browser is to slow and don’t use many extensions then you can use
You can download it from after you stop all antivirus tasks.
I don’t know why this browser have trouble with antivirus or security app’s , because is a clean software.
Anyway the browser is fast , don’t working with auto passwords software.
It’s seam a google chrome browser without problems.
I saw many browsers and now the worst browser is Google Chrome , Firefox and Safari.
I used just because I have some extensions like xmarks and passwords.
I also tested a asm browser and this working very well with flash player.
Under Linux OS the browsers have many problems with flash memory.
But now for windows 8 the Superfast Browser work great.

super fast browser
super fast browser

Yara python module – part 001

YARA is a multi-platform program running on Windows, Linux and Mac OS X.
More about yara python module can be see it here
YARA used this keywords with rules under files.

all 	and 	any 	ascii 	at 	condition 	contains
entrypoint 	false 	filesize 	fullword 	for 	global 	in
import 	include 	int8 	int16 	int32 	int8be 	int16be
int32be 	matches 	meta 	nocase 	not 	or 	of
private 	rule 	strings 	them 	true 	uint8 	uint16
uint32 	uint8be 	uint16be 	uint32be 	wide

The Yara documentation can be found in this link.
The yara python module use version 1.7.7 and this will need to use when make rules.
Instalation with pip :

C:\Python34>cd Scripts
C:\Python34\Scripts>pip install yara
Downloading/unpacking yara
Installing collected packages: yara
  Running setup.py install for yara

    Installing yara-ctypes-script.py script to C:\Python34\Scripts
    Installing yara-ctypes.exe script to C:\Python34\Scripts
Successfully installed yara
Cleaning up...

Let’s see this in action.
First you need to make your user under your_user account.
I make one folder named yara to keep the my rules, see:

C:\\Users\\your_user\\Dropbox\\yara\\

and I test this file named doc_data.txt, from here:

C:\\Users\\your_user\\Dropbox\\

The file has this text :

InfoKey: Creator
InfoValue: TeX
InfoKey: Producer
InfoValue: pdfTeX-1.40.3
InfoKey: PTEX.Fullbanner
InfoValue: This is pdfTeX using libpoppler, Version 3.141592-1.40.3-2.2 (Web2C 7.5.6) kpathsea version 3.5.6
InfoKey: ModDate
InfoValue: D:20110210185614-08'00'
InfoKey: CreationDate
InfoValue: D:20110210185614-08'00'
PdfID0: 5691a9b61e98f4c329d4f9f6deb5363c
PdfID1: 5691a9b61e98f4c329d4f9f6deb5363c
NumberOfPages: 24

and the rule file detectstring has this rule:

rule detectstring
{
    strings:
        $my_text_string = "5691a9b61e98f4c329d4f9f6deb5363c"

    condition:
        $my_text_string 
}

You can use python shell with this source code:

import yara
from yara import *
dir(yara)
['CALLBACK_ABORT', 'CALLBACK_CONTINUE', 'INCLUDE_PATH', 'Rules', 'YARA_RULES_ROO
T', 'YaraSyntaxError', '__builtins__', '__cached__', '__doc__', '__file__', '__l
oader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'com
pile', 'libyara_wrapper', 'load_rules', 'preprocessor', 'rules', 'version']
print(yara.version.__version__)
1.7.7
rules=yara.compile("C:\\Users\\your_user\\Dropbox\\yara\\detectstring")
matches=rules.match("C:\\Users\\your_user\\Dropbox\\doc_data.txt")
print(matches)
{'main': [{'tags': [], 'matches': True, 'rule': 'detectstring', 'meta': {}, 'str
ings': [{'flags': 19, 'identifier': '$my_text_string', 'data': '5691a9b61e98f4c3
29d4f9f6deb5363c', 'offset': 326}, {'flags': 19, 'identifier': '$my_text_string'
, 'data': '5691a9b61e98f4c329d4f9f6deb5363c', 'offset': 367}]}]}

The above rule is telling YARA that the file containing the string must be reported.
The print will show the rule compiled and the result.

yara python
yara python