Do you want to listen jazz all day? On the Internet you have plenty of stations to choose from, for example, http://www.listenlive.eu/jazz.html. In this project we want to listen all these radio stations in a simple Raspberry Pi project and a minimal interface. We just need to plug the Raspberry with a network cable, and connect the audio output to an amplifier. With a button we start the mpd service (Music Player Daemon) and we select up to 40 channels.
You can download from the wiki (http://wiki.joanillo.org/index.php/Raspberry_Pi:_Internet_Ràdio) the bash script, and the configuration file with the list of all stations. If you want the system to run completely unattended you can run the script at system startup. The electronics required are minimal, I think the video show clearly the required connections, and if not you have in the w0iki more information (although in Catalan).
I wish you a happy 2013 and a lot of jazz! Here’s the video:
The other day I bought in a Cash Converter a second hand Wii drumset (18 euros), with the idea to plug it in my Ubuntu box and have some fun. These drumsets were launched in 2007, five years ago. Obviously some people have interfaced these consoles into Linux, and I have benefited from the code that I found here and there. However, the coding that I found was not for my exact model (there are also versions for PS2, PS3 and X360), so I had to figure out the codes sent by the drumset (also the codes for hitting both drumsticks at the same time, or drumticks and pedal). I had no previous experience in programming the libusb library. Using this library has been the only way to detect how hard you hit the stick, and so do a little volume control, but with little resolution.
For hearing something the host code must generate and send MIDI messages to a synthesizer. I used Hydrogen as a drum box. I planned four different presets that are accessed using the Wii buttons (the typical 1, 2, A and B Wii buttons). There are two versions of the code, the first one uses ALSA, and the other is for the JACK audio server. You can download the project code: projecte jrbdrum
Another lullaby composed by my father. But this time is and old one, written to me 42 years ago. I don’t want to put a picture of myself as a baby, so I put the first picture I caught on Google Images to illustrate this post.
The score transcription was made in Lilypond. Playback with fluidsynth and JACK, directly recorded in Audacity. it’s an easy GNU/Linux workflow for recording midi files.
Lyrics in Catalan:
Non, non, Joan, amb molta pau. Que la soneta va arribant;
Non, non, fillet, dorm ben aviat, tens la mareta al teu costat.
Les veus del dia ja s’han fos. Dorm en silenci i bon repòs;
Non, non, Joan, en el teu llit, que els dolços somnis van venint.
Another lullaby from my father. Devoted to their grandchildren (the 10 that he has, another that is coming, and the ones that may come). Among them, Maria and Pere, mines. A sweet song and a simple tune, so is intended for sleeping the children, often not an easy job.
Dorm, infantó, la dolça son.
noneta non canta la mare;
somnis de pau t’envoltaran;
noneta non, dins del bressol,
noneta non, canta l’amor.
These days returned my interest for the FFT so, with the idea of learning audio programming techniques, I wanted to code a tuner or a spectral power analyzer with my Linux box (it means it should be a JACK client).
First of all you have to look what FFT algorithm could be used, GPL licenced, and googling a little bit I realise that FFTW (http://www.fftw.org/) is the election:
FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). We believe that FFTW, which is free software, should become the FFT library of choice for most applications.
I was compiling few examples and became familiar with the calculations of the FFT. What I want to compute is the power spectral range of an audio signal, so the data will be real samples (one dimension) coming from my microphone; and the FFT output will be complex values, and both the real part and the imaginary part are important in order to compute the power spectrum of a signal.
fftPlan = fftwf_plan_dft_r2c_1d(fftSize, fftIn, fftOut, FFTW_MEASURE); //r2c_1d: real to complex, one dimension
Searching if there are open source tuners, preferably CLI and JACK compatible I found two projects that are precisely using the FFTW library:
First of all I capture the signal coming from the microphone, and as a result I have two files: a wav file, and a text file where I write a sufficient number of samples.
Second: I open the sample file, apply a Hanning window to the samples for smoothing, compute the FFT, compute the power spectral range of the signal, and I write an output file ready to be processed with the graphics utility gnuplot (http://www.gnuplot.info/).
I never worked with gnuplot, the Matlab equivalent in Linux world. Running the gnuplot demo that quickly shows all the gnuplot possibilities, I was really impressed. In this case to draw the graphic is very easy:
jcapture is a small program written in C++ that records the signal from the microphone and write an audio file in wav format. Basically JACK client that automatically connects to system: capture_1, which is the physical port that represents the mic input of your sound interface, and thanks the libsndfile library, writes the input audio data to the buffer audio file.
jcapture also displays the input signal level graphically on the console (it is a console program, no graphical interface). If you are interested in the JACK API programming you are welcome to download jcapture:
Today is the 155th anniversary of the birth of Heinrich Rudolf Hertz (155 is not a special number… didn’t they anything better to tell?). To illustrate this event there is a flash movie in Google.com front page, a sine wave function really disastrous.
Everyone knows that the derivative of sine function is cosine, and therefore the slope at origin is 1,
sin ‘(0) = cos (0) = 1
If x and y axes have the same scale, it means that the slope when the sine function crosses the horizontal axis must be a line of 45 degrees. Since the cosine function takes values between -1 and 1, the slope at any point can not be a vertical line!
Well, there are people drawing sine waves just linking semicircles … some mathematical background please …