Disruptively sincere

Rants in a box.

OpenBSD’s Great Base System to Test & Play With MIDI Interfaces

A little background story: I wanted to play some music with my MIDI keyboard and had a Pentium 4 desktop laying around with no display.

I had already installed OpenBSD on it to give it a try (and update the Ubuntu 10.10 install I hadn’t touched in years). During the install I decided to keep the default OpenSSH running and configure the WiFi network. That’s it, I had a server to connect to! And I found out there was a console-based MIDI sequencer for OpenBSD: midish!

The end result is simple, everything works!

Now I’ll give you the details of this fast setup.

The first thing is to check if the OS is registering the MIDI input properly. The OpenBSD FAQ has good info about it. Just connect it, check dmesg for a new midi interface and cat the input to the screen! Here’s the one liner from the FAQ:

aucat -Mq rmidi/1 -o - | hexdump -e '1/1 "%02x\n"'

I kind of messed up everything from here because my USB keyboard (Roland) wasn’t outputting standard MIDI. Just have a look at the user manual of your instruments and check if they do, or if there is a way to fallback to standard (as I found out later).

Now it’s time to start the sequencer and choose a sound module! If you have a hardware one, good for you. I picked the first I found on the ports tree: fluidsynth. Pick your install method, I chose the package.

Ok, now all pieces are there, the last step is to set them up.

The sndiod man-page has some good info but the midish one is pretty sparce for what we are trying to accomplish. Go to the official manual, there the docs are a lot better.

Here’s my midishrc in case you want some inspiration:

# Device 0: Roland      # keys: 0, drumpad: 9
dnew 0 "rmidi/1"    ro
inew roland_keys    {0 0}
inew roland_drumpad {0 9}

# Device 1: fluidsynth  # drums: 9, piano: others
dnew 1 "midithru/0" wo
onew fluid_piano    {1 0}
onew fluid_drums    {1 9}

# Connect Roland to fluidsynth
fnew fluidsynth
fmap {any roland_keys}    {any fluid_piano}
fmap {any roland_drumpad} {any fluid_drums}

It should be pretty much self explanatory. I use midish to send the midi input from the keyboard to the synth. You could do that by piping the output of the interface straight to fluidsynth (with aucat just like the earlier test) but you lose lots of control and the ability to record what you’re playing.

Everything is ready, start the soft-synth if you use one, start midish and enter an interactive mode (i for example). You should be able to play and hear some sounds!

However I still had a big problem: lag. There was half a second between a key press and the audio. Not great.

So I went back to the mailing lists (I checked some to setup midish properly). And there I found the missing answer. Alexandre Ratchov, author of both sndiod and midish had already posted an answer with the config values he uses to play!

And it worked. Here they are, all together:

sndiod -r48000 -b240 -z120
rmidish # (then start with i, or p or other to save, with a midishrc)
fluidsynth -c 2 -z 128 -g 0.5 /usr/local/share/generaluser-gs/GeneralUser_GS.sf2

A few more comments:

  • You may configure rmidish on the fly instead of writting a midishrc file, the interpreter works nicely!

  • sndiod daemon should already be runnning but with the default flags from rc.conf; restarting it without a reboot works without issues and if you have a dedicated machine you might want to edit rc.conf.local

  • Fluidsynth needs an soundfont. Luckily there’s one in the ports tree to: generaluser-gs-soundfont. It is the one used in the previous example.

  • You’ll also need to keep fluidsynth in the foreground otherwise it won’t play back sound. tmux, dtach or abduco should do the trick if you want to stop the connection.

  • Ah and the -g 0.5 flag to fluidsynth is just to increase the gain, it has nothing to do with MIDI.

Just one more thing, there’s a midish mailing list. You might want to check out the archive.

UPDATE 16/02

I hadn’t played piano in 4 years, but it wasn’t as bad as I expected. My fingers felt numb and unresponsive yet my muscle memory was surprisingly good. After a few minutes practising Across the Stars the cords were coming back!

I also managed to bring back from the dead my old (over 12 years old) Yamaha keyboard. Nothing was wrong with it but around 6 years ago I bought a MIDI/USB interface to use it as a controller but never managed to get it working (it was on Windows XP back in the day). Yesterday I remembered the interface was laying around and after a few minutes, it was connected and dmesg showed OpenBSD had found it! After a little more tweaking, I was playing with both keyboards!

Merci Alexandre, your code is awesome!

Image comes from OpenBSD 3.0

I’ll Be Back Soon

Hi everyone,

It’s been a while since I posted something. Exams are here and until next moth I won’t be writing much, but hey, I have a few blog-posts waiting to be posted, so be patient!

If you want to read something else, I’ll give you a link or two for those of you who can read Spanish.

Un buen blog sobre anime ha abierto sus puertas: FUWA-FUWA TSUNDERE THEORIES.

Es el regreso del autor de Serious Moe Business, regreso esperado (por mi parte).

No he encontrado el articulo original en portugués pero os dejo un resumen en castellano del artículo de Tostao para la Folha de Sao Paulo sobre el fútbol del mundial. Es un pequeño homenaje al fútbol español.

Espero que os guste la lectura!

Just one more thing, I just received my NFC Ring and it’s awesome. I’ll write more about it very soon.

Imagen original de @seriousmoeblog

A Pokemon Easter Egg in Android 4.4 Calculator App

UPDATE June 2014: The easter egg is from CyanogenMod! Thanks guys, you’re doing a great job, and with humour!

Your read right, there is an Easter egg in Android! And about (old-school) Pokemon!, straight from the nineties.

The screen-shot is from a Galaxy Nexus running a nightly build of CM-11. I don’t know if the Easter-egg comes from Google or the CyanogenMod team. Now that you know, why not twisting the subject a bit!

You might have recognised the Privacy Guard icon! Yes, the one from CyanogenMod. I’ve been running the nightly builds on my phone for a year and a half and it really works for me.

This ROM suits my way of understanding technology. It is a stripped down version of android (stock android) with granular control and many extra configurations, neat and clean!

Aside from a few hiccups (such as the proximity sensor turning off the screen but not disabling the touch-screen in 4.2 (CM-10.1) for some weeks) it is a great experience and always gratifying when after an update you see the new features pop out!

It is always nice to find an Easter egg in software, reminds me of the time when every single video-game add some hidden (or not so hidden) cheats and we used to get them in magazines! Back in the PlayStation (yes, I’m talking about the first one that some will remember as PSX) and early PS2 days.

More Wallpapers

This time Haruhi gets her wallpaper, I don’t want her to get mad!

I actually used that image as a background for months, at least six. And if it isn’t there now it’s because I formatted my laptop’s hard-drive and forgot about it!

I’ll probably come back some day.

You can find the original in a higher resolution at pixiv.net, and thanks to すぎまさ, the original artist!

Gone Home, an Experience Rather Than a Game

Art is about telling a story

Any form of art I can thing of right now somehow wishes to tell a story, let it be music, paintings or even photography (this one deserves a whole post). Even Richard Serra sculptures (I love them by the way) tell stories, and deep ones with yourself as the protagonist.

Why this intro? because video-games are also storytelling devices. They can also be Art.

I recently played through Gone Home and loved it, I enjoyed every part of it. From the heartwarming love story, the storm sounds, the music to the horror-game-like environment. It was so good I was almost in tears by the end of it (especially during the-last-gig journal entry).

Yet this is not what I want to talk about today.

The best part of it is that story can’t be told effectively in any other form of media. It could be a lovely short story or novel, or even a film but it would lose most of it’s strength.

The real magic of the game is just that. Being a game, letting you be the protagonist. You have the last word about what you should see, read, learn and experience during the game. It doesn’t force you through a linear path feeding you the plot – nor the background information about the characters.

It is your decision if you want to go through the house and dig up the secondary stories. No one forces you to learn how the relationship between Janice and Terrance is, or Terrance current job issues (and alcohol ones), not even Oscar’s deep dark storyline.

Oscar’s past (beware of the spoiler if you follow this link) is the one that really shines. It is the easiest to miss. It makes a lot of sense.

Sam’s last year is the main plot and thus the only one “forced” on you (this is not what I meant, you’re playing it for that story, I hope you get my point). Your parents story is more difficult to grasp, yet easy to find. Both live in that house. We can clearly see who fills each room or space of the house and Sam gets the most of it. Oscar is no longer living but he still is the “owner” of the basement and the secret passages. His story is also the further away in time. This concept shines with him: his darker secrets are implicit within the little evidence that remains…

What do you think about it? Have you played it?

Do you share this point of view about video games? Do you think they can offer alternative ways of communication and storytelling?

By the way, did you also fall for Sam? She is just so cute, and with a very deep voice acting!

There is little more I have to say about it (and so much has already been said), so I’ll give you a few links as a follow up:

The Awesome fan art is by fortheloveofpizza, you can find it here