RaspberryPi Soundboard – Update #3

Finally found more time to spend on the RaspberryPi Soundboard Project.

After mucking around for days with Pulseaudio, and getting significantly annoyed at being able to do a simple loopback or virtual device functionality, I tried Jack.

Jack is perfect for such ‘piping’, but I figured out the hard way that there is no official Mumble support for Jack.

Thankfully I found out about ALSA’s snd_aloop module. This creates a ‘virtual card’ with 2 devices. If you play audio into one, it comes out of the other. Exactly what I needed, and Mumble does query all the ALSA devices, so I can easily find my ‘Loopback’ device.

mumble

Next was playing the audio. Using simple ‘aplay‘, I could test if my setup was working. But to have better control over the audio (fade-in, fade-out), I would need a more programmatic approach.

Since we’re on a RaspberryPi, Python is a natural choice, although since I am using Archlinux, Python doesn’t come installed!. So I installed Python2 and found pygame, a wrapper around libSDL which has a nice mixer and audio module. It’s surely an overkill for what I’m trying to do. But I do need something that lets me choose which ALSA device to use (with pygame I can define that using environment variables which SDL uses), and something which lets me do basic audio effects like mixing, fading etc.

So this works for now. Although the audio from Mumble is pretty glitchy, I think some Mumble settings need to be tweaked. But I am still worried that running the Mumble GUI is making the Pi slow. I may have to figure out a way to run Mumble headless.

RaspberryPi Soundboard – Update #2

Quick update here. I made 2 small changes to the Soundboard project from last week.

1. I reinstalled Archlinux and stuck with plain Xorg + twm reducing the install footprint.

2. I played around with Mumble to discover that ALSA could support the Pulseaudio main sink’s monitor input as an audio input. This basically pipes all audio (“What-U-Hear”) from Pulseaudio into Mumble. Not exactly what I wanted, but close enough. Especially since I don’t plan to run anything else on this Pi.

alsa

So the audio routing kind of works (I’m not too happy with it, but I’ll roll with it for now). Now to work on trigger the playing of the audio files using a keypad.

Also I’m adding some of the scripts including the init scripts, to this github repo. A lot of the configuration I did was in /etc/ config files, I will add copies of those to this repo in the future..

RaspberryPi Soundboard – Update #1

I spent the last couple of days working on the RaspberryPi Soundboard, and I must say I’m kind of frustrated with Linux Audio. It seems much harder to get stuff working when you want to keep things simpler and not use a GUI.

This is what I’ve achieved.

1. I have a fully configured (WiFi, SSH, etc, etc) Pi running Archlinux + i3wm for GUI

2. I have Mumble running from the command line even when no display is connected to the Pi. “Yay!!

3. I have Pulseaudio running with all the correct settings on the Pi.

RaspberryPi

The main issue I faced was piping the audio. As much as Pulseaudio is the solution to mix and pipe audio around, letting me pipe audio coming from a player (say aplay or sox)  into another application is really difficult. I faced a couple of main issues.

1. It seem none of the players let you choose which “sink” in Pulseaudio should they connect to. I only saw that option in mpd, but that seemed like a total overkill for what I want to do.

2. While using Pulseaudio’s sink.monitor feature works perfectly for my streaming server use case, the soundboard has a slightly different needs. Here we need the audio from the player to end up in Mumble. I am envisioning a Pulseaudio configuration along this line.

aplay => Pulseaudio null-stream –> stream.monitor => Mumble.

3. Finally, getting Mumble to receive audio from Pulseaudio is straightforward, but to set it to receive it from a monitor of a sink seems challenging. The funny bit was I could easily do it using GUI (pavucontrol) but couldn’t find the command (pacmd?? pactl??) to do that.

Any ideas or suggestions would be welcome!! Please comment below!

 

Gingerale

I’ve been dabbling with simple fermentation for a few years now. Kefir (an awesome probiotic), and our dear yeast and do wonders to sugars.

I started with making gingerale based on this recipe from David B. Fankhauser at the U.C. Clermont College with mixed results.

Then came version 0.1 to version 1.0 each with small changes to the recipe.

Finally I have converged to a recipe which is closer to beer brewing techniques than David’s original recipe. The ingredients are more or less the same as the previous versions.  Here’s how I do ginger ale.

0. Clean and dry your fermentation jars, bottles, pots really well. This is pretty important.

1. Grate Ginger

I try to use young ginger, it’s a little more ‘fruity’ and intense (I like my gingerale intense).  The amount of ginger can be varied for how ‘gingery’ you want the final gingerale. I used about 4 teaspoons here.

IMG_20140111_160803

2 a. Measure the total amount of liquid you will be able to fit in your fermentation jars. I use 2 IKEA Burken jars to ferment, they fill about 1liter each.

IMG_20140111_161349

2 b. Add that amount of tap water to a pot and put it on the heat. Next, add the grated ginger, and let it boil for . This is similar to making a wort during brewing.

2 c. Optionally you can drop in a small stick of cinnamon to the boiling wort for added flavour.

IMG_20140111_162538

Boiling achieves a couple of things. Tap water (atleast in Singapore) is fluorinated, which is not very conducive for our probiotics. So boiling should get rid of all the fluorine and other additives(Correction based on comments below : Fluorides in the water are salts and hence will not evaporate by boiling. Chlorine which is also added to tap water is the one which evaporates away when boiled.) It also extracts the flavour from the ginger into the water.

3. Let the hot wort cool down by leaving the pot open. This will also enable the fluorine to evaporate off.

IMG_20140111_164731

4 a. Once the wort is cooled, we can filter the ginger and cinnamon out of it and add the yeast.

IMG_20140111_182348

4 b. You may want to leave some of the ginger in the wort to make the ginger ale more intense, but some people might not like bits of ginger when they drink their gingerale (I love it).

IMG_20140111_182905

4 c. I really would have loved to use champagne yeast, but I didn’t have any handy. Bakers yeast (as I used here) gives it a slight ‘yeasty’ taste, but does the trick. I have also done this with Kefir.

IMG_20140111_182737

5 a. Add sugar to the wort. I usually start with 4 teaspoons of brown sugar (gives it a nice body). In Singapore we get something called Gula Merah (Red Sugar), which I tend to use. Through out the fermenting process, I might add more sugar if it starts tasting sourish (too much sugar has been consumed by the yeast).

IMG_20140111_182936

5 b. Optionally, Add some raisins to the mixture. Grape skin are known to have natural yeast (which ferment the wine), so raisins help to add a bit of kick to the gingerale. This idea came from my friend Stephan talking about how his grandma used to make gingerale with raisins. Theoretically, I think you might be able to pull it off just using raisins without yeast, but I haven’t tried that yet.

6. Let the wort ferment at room temperature in a shaded place (no direct sunlight) for 3 days.

The longer you let it ferment, more sugar will be turned into alcohol. So you can stop when you are comfortable. I keep tasting the fermenting wort daily.

The IKEA Burken jars make an awesome fermenting jar as they let the carbon-dioxide generated during the fermentation out through the seal. It’s not an airlock, but I feel for small term fermentation it’s OK.

7 a. After 3 days I transfer the gingerale to airtight bottles to carbonate. Once again I use IKEA KORKEN bottles with a stopper.

IMG_20140115_084056

 

In this stage you have to carefully control the carbonation by controlling the temperature of the gingerale. Leaving it at room temperature will cause it to carbonate quickly, and you might have spillage when you open the bottle.

I prefer to leave the gingerale in the fridge for a 3-4 days, and let it slowly carbonate (water does carbonate better when it’s cold). But if it doesn’t carbonate in your fridge, you can try leave it out for a 5-6 hours and then putting in fridge.

IMG_20140115_084546

7 b.I do check every few days incase I need to top up the sugar if it has all been consumed by the yeast. Ensure if you add water at this stage to the gingerale, you add distilled water (without fluorine chlorine/fluoride).

IMG_20140118_112205

8. When I have achieved your target carbonation, I add juice of a quarter lemon per bottle. This reduces the fermentation and also adds a nice flavour. You’re now ready to enjoy the gingerale.

Airtight bottles with gingerale sitting in the fridge can still  ferment and carbonate. So do check if it’s not overly pressurised every few days if you’re leaving the gingerale in the fridge for a long time. You can have broken glass bottles due to over-pressurisation.

Try it out and let me know how it goes.. And if you find a hack or improvement be sure to leave a comment below!

RaspberryPi Soundboard – Intro

One of the additional elements in our WeBuild Live podcast set-up is a Soundboard, which lets me trigger sound effects during the show. That board also controls the intro and outro music. Since this needs to be heard in the Live broadcast as well, and post processed, I had to give it its own channel in Mumble. To make life easy, I used an spare Macbook I had lying around, and loaded up Mumble, Soundflower (useful for piping audio between applications) and found SoundPlant (caveat: Soundplant interface looks old, but is pretty useful for what it does).

The current set-up works, but I wanted to make it leaner. So after a couple of days of research, I have the rough plans for a RaspberryPi based Soundboard.

The set-up I’m envisioning is as follows.

Hardware

  • RaspberryPi Model B (to be run headless)
  • Generic USB WiFi Adapter
  • USB Numpad (to trigger the sounds)

Software

  • Raspbian
  • Mumble Client running through VNC
  • PulseAudio (piping audio)
  • aplay (simple audio player)
  • Custom Python scripts to manage and trigger the audio files.

It looks simple enough and I found a few articles on the Interwebs talking about similar ideas, but there could be some gotchas.

Possible Problem Area

  • Latency. The audio has to be heard very quickly after the Numpad keys are pressed.
  • Capturing Numpad Keys robustly.
  • Mumble is a UI based program, it doesn’t have much scripting support.
  • Mechanism to show status of Mumble connections etc.

I will post updates as I keep working on this project.