torsdag 17 oktober 2013

Extract clips of a video and put them together in a single video in terminal

So during a group assignment i needed to clip some videos of youtube. This is how I did it:

First i got the file from youtube using the download helper. Excellent tool by the way. (I downloaded the videos as flv, when downloading them as avi, i got some strange audio synching issues.)

Then I wrote a script to extract my clips from the video. (That was after trying every gui based solution to extract clips)

#!/bin/bash

declare -a startt=(
2:24
5:22
10:32
16:04
16:53
20:00
22:18
);

declare -a lent=(
02:57
03:33
00:46
00:15
02:03
01:45
00:57
);


for I in 0 1 2 3 4 5 6
do
avconv -i Presentationsfilmer/edge.flv -ss 00:${startt[$I]} -t 00:${lent[$I]} -vcodec  copy -acodec copy "clip$I.flv"
done


I got the start and the end times by watching the videos. Then i calculated the length, as needed by the script using Libre Office Calc.. I did not want to do it in my head.

And then for putting it all together... I never did it.. It seamed impossible to find a tool to just merge the different clips.. So I just made a playlist in totem instead. I guess that that gives the video editing in Linux a Failed grade, unfortunately....

So the result.. I still hate to edit movies in Linux, it took much more time than I possibly could imagine. In the future i would probably just use Youtubes video editing tool... That's it for today. So long!

tisdag 15 oktober 2013

How to use a laptop with no screen

My laptop broke. So i thought of throwing it away before I realized the obvious in making a simple server from it. The most usable reason for me to turn it into a server was to be able to use the computational power to run synthesizers wich my secondary computer could not manage. This is the two steps i made.

install ssh

Since i already had ubuntu installed from the beginning. The only thing i really needed to do to convert it to some kind of server was to install ssh:

sudo apt-get install openssh-server

Then to use the computer all I needed to do on the client side was

ssh (ip to the computer) -X

(-X is to be able to run graphical applications as nautilus, gedit, och google-chrome [but to be onest, to run google chrome over forwarded x is a bit overkill] )

wake on lan

It would be possible to keep the computer turned on all the time, but because my computer makes a lot of noise i rather turn it off sporadically. Since my laptop has its powerbutton under the lid, I figured out that it would be most practical to be able to boot it from somewere else. And thats how i came up with the wake up on lan. For my lenovo T61 the wake on lan feature was enabled by default. I got the network card name from my router.. (format 00:00:00:00:00 something) and then i use the awesome command powerwake when i need to start the computer. Works like magic

powerwake (mac-addr)


måndag 7 oktober 2013

Archlinux

My first try to install archlinux. (On virtual box)

This is problems I came across

Keyboard layout:

Since i use the swedish-dvorak layout-that was the first thing I had to get fixed...

The archwiki had instructions to change the layout... locked at that.. Seems like the dvorak layout is installed by deafult

localectl list-keymaps
...

localectl set-keymap --no-convert dvorak-sv-a5

...seems to do kind of the job.. not the same layout for special characters as i am used to but it will work..

in the beginning it looks like you can do 
loadkeys layout


Changing keyboardlayout in x
setxkb -layout se -variant dvorak

then change the xorg.conf (add)

Mounting disk

(assuming the disks are already formated in some fancy fashion) 
In order to install you must mount the hard drive


Working network in fresh install

For some reason my network didn't seem to work on the fresh install. I found this page with the solution in the end. Just run
dhcpcd
and it worked 

Sudo

To be able to install programs with your user it can be convenient to install sudo.

first: $pacman -S sudo

$export VISUAL=   (standard is vi)

use $visudo

add 
ALL = (ALL) ALL

somwhere or

% ALL = (ALL) ALL

Miscellaneous

autocompletion: bash-autocompleton

 

... For this time i gave up... I couldn't get the wireless card to work on my laptop, and on my raspberry pi complation took to much time or did not work at all. I learned a lot about how linux works however so I recomend anybody interested to do the same journey. I have allready used my knowledge on my debian-based linux computers.

Running fluidsynth in my raspberry pi

I must publish this so i can remember it. I had som trouble to start fluidsynth in the background when i did.

fluidsynth -a oss /usr/share/sounds/sf2/FluidR3_GM.sf2 &

however after finding this post i solved it by using

 fluidsynth -a oss -s -i /usr/share/sounds/sf2/FluidR3_GM.sf2 &

and everything works like a charm. Next step is to start fluidsynth with a init.d script.. but that is for tomorrow...

I havent figured out how to change instrumment though (within the same sound-font file)

Good night

söndag 21 juli 2013

How I finally managed to install jack on my raspberry pi


To make jack audio work on the raspberry pi you need to have a patched version of jack audio installed. On the linux audio page there was some information of how to add repository lists. How ever i never succeeded to install those, but found on link to deb-files to the patched versions of jackd and libjack2.

Since i already had jackd and libjack installed i used

dpkg -r --force-depends jackd libjack0

to remove the version of jack I already had installed, without removing programs depending on jack, followed by

dpkg -i *.deb
sudo apt-get -f install


And at last.. The command that finally got jack running on my usb-card for me was : jackd -P84 -p8 -t3500 -d alsa -dhw:Set -p128 -n3 -r48000 -s &



Of course that was before i killed my raspberry by plugging in to much stuff in the usb-port and installing packages at the same time.. 

-- note: --
As an alternative i found that using the oss emulation was not that bad for ordinary synths, as amsynth. Before i got jack up and running I used this method temporarily. Now when I know how to get jack running i hope i will not have to use it again, but here it is for reference usage:

The natural alternative was portaudio, but after some research i found out that more synths were made to rely solely on jack or oss (/dev/dsp). So I decided to install the oss compatibility layer for alsa.

sudo apt-get install alsa-oss
sudo modprobe snd_pcm_oss


the "modprobe" part makes the /dev/dsp file appear, and can be inserted into /etc/rc.local to have it loaded on startup



torsdag 23 maj 2013

Swedish letters and dvorak-layout on usb-keyboard on the Nexus 7

I've finaly got some routine on changing the keyboard layout on my Nexus 7 (and what i know the procedure is the same for all android devices) This is a notice for future use, and if somebody has the same issues.

1. Get files from the device


adb pull /system/usr/keychars/Generic.kcm Generic.kcm
adb pull /system/usr/keylayout/Generic.kl Generic.kl

the kcm-file to set the swedish signs, and the kl-file to change layout. If you only want the swedish letters then you only need to change the kcm file and only the kl-file if you only want to change the layout (location of the keys). Notice that the device sometimes automaticaly changes to swedish letters, so the kcm-change is not always nessesary.

Rembemer to save backups!

2. Change the files

I found a reference to a file that got the swedish (and finish) letters of the alphabet. Especialy the parts in the kcm-file saying

key APOSTROPHE {
    label, number:                      '\''
    base:                               '\u00e4'
    shift:                              '\u00c4'
    ctrl, alt, meta:                    none
}


key SEMICOLON {
    label, number:                      ';'
    base:                               '\u00f6'
    shift:                              '\u00d6'
    ctrl, alt, meta:                    none
}

and

key LEFT_BRACKET {
    label, number:                      '['
    base:                               '\u00e5'
    shift:                              '\u00c5'
    ctrl, alt, meta:                    none
}



And of course bocause i use dvorak, i also has the appropiate dvorak Generik.kl-file


key 1     ESCAPE
key 2     1
key 3     2
key 4     3
key 5     4
key 6     5
key 7     6
key 8     7
key 9     8
key 10    9
key 11    0
key 12    GRAVE
key 13    EQUALS
key 14    DEL
key 15    TAB
key 16    LEFT_BRACKET
key 17    APOSTROPHE
key 18    SEMICOLON
key 19    P
key 20    Y
key 21    F
key 22    G
key 23    C
key 24    R
key 25    L
key 26    COMMA
key 27    RIGHT_BRACKET
key 28    ENTER
key 29    CTRL_LEFT
key 30    A
key 31    O
key 32    E
key 33    U
key 34    I
key 35    D
key 36    H
key 37    T
key 38    N
key 39    S
key 40    MINUS
key 41    APOSTROPHE
key 42    SHIFT_LEFT
key 43    BACKSLASH
key 44    PERIOD
key 45    COMMA
key 46    J
key 47    K
key 48    X
key 49    B
key 50    M
key 51    W
key 52    V
key 53    Z



Push files to the device


And when you are ready, use some useful tool to push the files back again (remount to make the system writable)

adb remount /system/usr/keychars 
adb remount /system/usr/keylayout
adb push Generic.kcm /system/usr/keychars
adb push Generic.kl /system/usr/keylayout



4. Debug

Something can easily go wrong. If so make sure to change the logcat print. Write in terminal

su
logcat

In worst case.. Push the backup-files back again.

Prroblems that i had:

  • I wrote the kcm-file wrong. You cannot make up new letters, that will cause a error.
  • I got the wrong user access set on the files. I sudoed in the files so the system could not use the files. Fixed with chmod.
  • I cannot write z... Not fixed. Don not know any workaroud...




Hope it helps! Post a comment if it doesnt.
Cheers!

fredag 29 mars 2013

The perfect ubuntu/linux jack audio setup

Ok. So I will share my current top notch setup of my Ubuntu audio processing laptop. It consist mostly of free opensource programs

Here is what I got:

Sequencer: seq24/seq42

There is some different sequencers to choose from. You can (I rather don't) use Rosegarden, Qtractor, or some other very ambitious software as sequencer. But to me the best alternative is the simple seq24 sequencer, and alternative the fork project seq42. The difference is that seq24 is specialised more to live performance but seq42 is specialized for making non live tracks. seq24 is in the standard ubuntu repository:

sudo apt-get install seq24

 If you wan't the seq42 however, you need to compile it for your self. (It is not very difficult. There is instructions in the code folder)

Synths

I havent decided wich synths to use yet. But I have tried these with good result:
Pianoteq - i looked for a long time for a good piano synth. This is what I got. I runs both on windows and linux I've heard. But the application I have seen is using the vsthost on the windows version. Note that it is not free like the other applications

vsthost

For running vsti:s in ubuntu. Works well, but as far as I know it does not save the state of the vsti-plugin. If you need something 

sudo apt-get install vsthost

Qjackctl

It is kind of a basic application for jack audio. Actualy I am not very found with the interface, but if you need to change some connection it is allways there for you.

sudo apt-get install qjackctl

Hydrogen

A very nice drum machine.  The best I have tested. There is not much to say. It works! And I prefer the standard drumset so much so I do not even have to configure it to start playing.

sudo apt-get install hydrogen

Gladish

This is what makes it all fit together. Gladish is a graphical interface for the ladi session manager (ladish), that handles. It took me a while to find this blog, that explains how ladish works and how to use it. It was the piece i was looking for for so long. Finaly, I did not have to launch all the programs manualy but could save it an launch it with a simple command. Wonderful

sudo apt-get install gladish

Timemachine

For recording. Can be reset to automatically record when you start playing.

sudo apt-get install timemachine

Fast install

If you just want a lots of cool programs. Just run

sudo apt-get install amsynth gladish qjackctl hydrogen timemachine vsthost seq24

And you are ready to go!



If you have any questions of how to use any of it, please write me a comment.