Sunday, December 21, 2014

What is good audio editing software on Linux

Whether you are an amateur musician or just a student recording his professor, you need to edit and work with audio recordings. If for a long time such task was exclusively attributed to Macintosh, this time is over, and Linux now has what it takes to do the job. In short, here is a non-exhaustive list of good audio editing software, fit for different tasks and needs.

1. Audacity

Let's get started head on with my personal favorite. Audacity works on Windows, Mac, and Linux. It is open source. It is easy to use. You get it: Audacity is almost perfect. This program lets you manipulate the audio waveform from a clean interface. In short, you can overlay tracks, cut and edit them easily, apply effects, perform advanced sound analysis, and finally export to a plethora of format. The reason I like it so much is that it combines both basic features with more complicated ones, but maintain an easy leaning curve. However, it is not a fully optimized software for hardcore musicians, or people with professional knowledge.

2. Jokosher

On a different level, Jokosher focuses more on the multi-track aspect for musical artists. Developed in Python and using the GTK+ interface with GStreamer for audio back-end, Jokosher really impressed me with its slick interface and its extensions. If the editing features are not the most advanced, the language is clear and directed to musicians. And I really like the association between tracks and instruments for example. In short, if you are starting as a musician, it might be a good place to get some experience before moving on to more complex suites.

3. Ardour

And talking about compex suites, Ardour is complete software for recording, editing, and mixing. Designed this time to appeal to all professionals, Ardour features in term of sound routing and plugins go way beyond my comprehension. So if you are looking for a beast and are not afraid to tame it, Ardour is probably a good pick. Again, the interface contributes to its charm, as well as its extensive documentation. I particularly appreciated the first-launch configuration tool.

4. Kwave

For all KDE lovers, KWave corresponds to your idea of design and features. There are plenty of shortcuts and interesting options, like memory management. Even if the few effects are nice, we are more dealing with a simple tool to cut/paste audio together. It becomes shard not to compare it with Audacity unfortunately. And on top of that, the interface did not appeal to me that much.

5. Qtractor

If Kwave is too simplistic for you but a Qt-based program really has some appeal, then Qtractor might be your option. It aims to be "simple enough for the average home user, and yet powerful enough for the professional user." Indeed the quantity of features and options is almost overwhelming. My favorite being of course customizable shortcuts. Apart from that, Qtractor is probably one of my favorite tools to deal with MIDI files.


Standing for Linux MultiMedia Studio, LMMS is directly targeted for music production. If you do not have prior experience and do not want to spend too much time getting some, go elsewhere. LMMS is one of those complex but powerful software that only a few will truly master. The number of features and effects is simply too long to list, but if I had to pick one, I would say that the Freeboy plugin to emulate Game Boy sound system is just magical. Past that, go see their amazing documentation.

7. Traverso

Finally, Traverso stood out to me for its unlimited track count and its direct integration with CD burning capacities. Aside from that, it appeared to me as a middle man between a simplistic software and a professional program. The interface is very KDE-like, and the keyboard configuration is always welcome. And cherry on the cake, Traverso monitors your resources and make sure that your CPU or hard drive does not go overboard.
To conclude, it is always a pleasure to see such a large diversity of applications on Linux. It makes finding the software that best fits your needs always possible. While my personal favorite stays Audacity, I was very surprised by the design of programs like LMMS or Jokosher.
Did we miss one? What do you use for audio editing on Linux? And why? Let us know in the comments.

How to configure MySQL and MariaDB to accept remote connections

MySQL and MariaDB

Track down connectivity issues to MySQL and MariaDB servers running on Linux.

Connection -- refused
Recently while reviewing MySQL client tools, I discovered a Linux MySQL server on my local network refusing all incoming connections.
To diagnose the problem, I first wanted to determine if MySQL was running on the machine, using the ps command to list processes. I discovered MySQL was running, but unfortunately it was running with command option known as --skip-networking enabled. Reviewing the official documentation for this option, I found that --skip-networking instructs MySQL not to listen for remote TCP/IP connections. This obviously is not ideal if MySQL is needed for use as a database server on a local network.

ps command mysql skip-networking
Because I run Slackware, I suspected that the -skip-networking option was being specified inside the /etc/rc.mysqld script. But as I've often found in similar situations diagnosing Linux issues, knowing beforehand the names of all of script files that execute commands in such a particular way becomes invaluable when tracking down problems.
Finding and fixing
So, I decided to use KDE's built-in Find Files/Folders tool, starting at root (/) to search all files (*.*) and subfolders containing "--skip-networking". After scanning, the search tool verified that rc.mysqld was indeed the only script file containing text matching this particular option.

Searching Linux for files with matching text
With a right-click, I opened rc.mysqld…

Open rc.mysqld for editing
…and quickly found the reference to "--skip-networking" and commented it out, inserting "#" at the beginning of the line.

Use # to comment --skip-networking line
Next, I edited MySQL's configuration file /etc/my.cnf to match the text listed below. I ensured bind-address was set to -- this address instructs MySQL to accept connections from any IP address on my network.
# The following options will be passed to all MySQL clients

 Then, I ran commands to check if the Linux server itself was configured to accept requests on MySQL's port 3306. I used the iptables --list command, but found no references to INPUT port 3306.

iptables --list
So, I added input port 3306, issuing another iptables command:
# iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT

iptables adding port 3306
Finally, I restarted MySQL so that the new settings would take effect:

# /etc/rc.d/rc.mysqld restart
Testing the new settings
To test MySQL, I wanted to connect from a different machine on my network. So I turned to a Windows machine running the SQLyog MySQL client. I used the same username and password credentials -- along with port 3306 -- matching the options placed in the my.cnf file on my Linux machine earlier. The MySQL Host Address, is the IP address of my Linux server.

Windows MySQL client settings.

With a click of the Connect button -- all databases on the MySQL server are available for use by the database client app.

List of MySQL databases
This article is published as part of the IDG Contributor Network. Want to Join?

Creating your first Linux App with Python and Flask

Creating your first  Linux  App with  Python and Flask
Whether playing on Linux or working on Linux there is a good chance you have come across a program written in python. Back in college I wish they thought us Python instead of Java, it’s fun to learn and useful in building practical applications like the yum package manager.
In this tutorial I will take you through how I built a simple application which displays useful information like memory usage per process, CPU percentage etc using python and a micro framework called flask.
Python Basics, Lists, Classes, Functions, Modules.
HTML/CSS (basic)
You don’t have to be an advanced python programmer to follow this tutorial, But before you go further I recommend you read
Installing Python 3 on Linux
On most Linux distributions python is installed by default. This is how you can find out the python version on your system.
[root@linux-vps ~]# python -V
Python 2.7.5
We will be using python version 3.x to build our app. As per all improvements are now only available in this version which is not backward compatible with python 2.
Caution: Before your proceed I strongly recommend you try this tutorial out on a Virtual machine, since python is a core component of many Linux Distributions any accidents may cause permanent damage to your system.
This step is for RedHat based variants like CentOS (6&7), Debian based variants like Ubuntu,Mint and Rasbian can skip this step as you should have python version 3 installed by default. If not use apt-get instead of yum to install the relevant packages below.
[leo@linux-vps] yum groupinstall 'Development Tools'
[leo@linux-vps] yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
[leo@linux-vps] wget
[leo@linux-vps] tar -xvzf Python-3.4.2.tgz
[leo@linux-vps] cd Python-3.4.2
[leo@linux-vps] ./configure
[leo@linux-vps] make
# make altinstall  is recommended as make install can overwrite the current python binary, 
[leo@linux-vps]   make altinstall
After a successful, installation you should be able to access the python 3.4 shell with the command below.
[leo@linux-vps]# python3.4
Python 3.4.2 (default, Dec 12 2014, 08:01:15)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit ()
Installing packages in python with PIP
Python comes with it’s own package manager, similar to yum and apt-get. You will need to use it to download, install and uninstall packages.
[leo@linux-vps] pip3.4 install "packagename"

[leo@linux-vps] pip3.4 list

[leo@linux-vps] pip3.4 uninstall "packagename"
Python Virtual Environment
In Python a virtual environment is a directory where your projects dependencies are installed. This is a good way to segregate projects with different dependencies. It also allows you to install packages without the need for sudo access.
[leo@linux-vps] mkdir python3.4-flask
[leo@linux-vps] cd python3.4-flask 
 [leo@linux-vps python3.4-flask] pyvenv-3.4 venv
To create the virtual environment you will need to use the “pyvenv-3.4” command. This will create a directory called “lib” inside the venv folder where the dependencies for this project will be installed. It will also create a bin folder which will contain pip and python executables for this virtual environment.
Activating the Virtual Environment for our Linux system information project
 [leo@linux-vps python3.4-flask] source venv/bin/activate
 [leo@linux-vps python3.4-flask] which pip3.4
[leo@linux-vps python3.4-flask] which python3.4
Installing flask with PIP
Lets go ahead and install out first module the flask framework which will take care of the routing and template rendering of our app.
 [leo@linux-vps python3.4-flask]pip3.4 install flask
Creating your first app in flask.
Step 1:Create directories where your app will reside.
[leo@linux-vps python3.4-flask] mkdir  app
 [leo@linux-vps python3.4-flask]mkdir app/static
 [leo@linux-vps python3.4-flask]mkdir app/templates
Inside the python3.4-flask folder create a folder called app which will contain two sub-folders “static” and “templates”. Our python script will reside inside the app folder, files like css/js inside the static folder and templates folder will contain our html templates.
Step 2:Create an initialization file inside the app folder.
[leo@linux-vps python3.4-flask] vim app/
from flask import Flask

app = Flask(__name__)
from app import index
This file will create a new instance of Flask and load our python program stored in a file called which we will create next.
[leo@linux-vps python3.4-flask]vim app/
from app import app

def index():
 import subprocess
 cmd = subprocess.Popen(['ps_mem'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
 out,error = cmd.communicate()
 memory = out.splitlines()    
Routing in flask is handled by the route decorator. It is used to bind a URL to a function.
In order to run a shell command in python you can use the Popen class from Subprocess module.
This class will take a list as an argument, the first item of the list will default to being executable while the next item will be considered the option. Here is another example
subprocess.Popen(['ls', ‘-l’],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
stdout and stderr will store the output and error of this command respectively. You can then access this output via the communicate method of the Popen class.
out,error = cmd.communicate()
To display the output in a better way via the html template, I have used the splitlines () method,
memory = out.splitlines()
More information on python subprocess module is available in the docs at the end of this tutorial.
Step 3: Create an html template where we can display the output of our command.
In order to do this we need to use the Jinja2 template engine in flask which will do the template rendering for us.
Your final file should look as follows
from flask import render_template
from app import app

def index():
 import subprocess
 cmd = subprocess.Popen(['ps_mem'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
 out,error = cmd.communicate()
 memory = out.splitlines()     
return render_template('index.html', memory=memory)
Now create an index.html template inside the templates folder, flask will search for templates in this folder.
[leo@linux-vps python3.4-flask]vim app/templates/index.html

Memory usage per process

{% for line in memory %} {{ line.decode('utf-8') }} {% endfor %}
The Jinja2 template engine allows you to use the “{{ … }}” delimiter to print results and {% … %} for loops and value assignment. I used the “decode()” method for formatting purposes.
Step 4: Running the app.
[leo@linux-vps python3.4-flask]vim
from app import app
app.debug = True'', port=80)
The above code will run the app in debug mode. If you leave out the IP address and port it will default to localhost:5000.
[leo@linux-vps python3.4-flask] chmod +x
[leo@linux-vps python3.4-flask] python3.4
how to install python 3 and flask on linux
I have added more code to the app so that it gives you cpu, I/O and load avg as well.
how to install python 3 and flask on linux
You can access the code to this app here.
This is a brief introduction to flask and I recommend you reading the tutorials and docs below for indepth information.