Coder Social home page Coder Social logo

griode's Introduction

Griode

Griode lets you play music using a LaunchPad or a similar controller.

For short demos and tutorials, check this YouTube playlist.

I gave a few talks about Griode:

  • Berlin Hack&Tell at C-Base (May 2018) πŸ”—
  • Linux Technologies Berlin (July 2018) πŸ”—
  • Python Users Berlin (April 2019) πŸ”—

Here are the slides that I use when presenting Griode.

This poster explains how to switch instruments and modes. The original version of the poster was made by JΓ©rΓ΄me Petazzoni to present at PyCon in 2019; and it was then much improved by Elodie Trinh (thanks Elodie!β™₯).

There is also a basic (and incomplete) user manual that you may (or not) find helpful.

Quick start

Here are some quick instructions to get you started, assuming that you have a LaunchPad connected to an Debian/Ubuntu system.

git clone git://github.com/jpetazzo/griode
cd griode
sudo apt-get install python3-pip python3-dev libasound2-dev libjack-dev fluidsynth
pip3 install --user -r requirements.txt
( cd soundfonts; ./download-soundfonts.sh; )
./griode.py

Your LaunchPad should light up with a red and white pattern, and pressing pads should make piano sounds.

Installing on a Raspberry Pi

If you want to setup Griode on a Raspberry Pi, you can use the instructions above, but make sure that you run them as the pi user.

You can use the "lite" (text only) or the "desktop" version, it doesn't matter for Griode.

If you want Griode to start automatically when the Pi is powered on, see this paragraph.

Detailed setup instructions

You need:

  • Python 3
  • FluidSynth (to generate sounds)
  • at least one SoundFont (instrument bank used by FluidSynth)
  • a LaunchPad or similar MIDI controller

Installing Python dependencies

On Debian/Ubuntu systems, you will need the following system packages, so that the python-rtmidi Python package can be installed correctly:

apt-get install python3-dev libasound2-dev libjack-dev

You can then install Griode's requirements with pip:

pip install --user -r requirements.txt

Of course, you are welcome to use virtualenv or anything like that if you want.

If you get compilation errors, you might need extra packages (libraries or headers).

Note: if you have problems related to the installation of python-rtmidi, you might be tempted to try to install rtmidi instead. DO NOT! The two packages are slightly incompatible; so after installing rtmidi, perhaps Griode will start, but you will get another bizarre error at a later point.

Installing FluidSynth

Fluidsynth is a software synthesizer. On Debian/Ubuntu systems, you can install it with:

apt-get install fluidsynth

Installing SoundFonts

Griode requires at least one "SoundFont" so that FluidSynth can make sounds. The easiest way to get started is to go to the soundfonts/ subdirectory, and run the script download-soundfonts.sh.

Griode will load SoundFonts called ?.sf2 in alphabetical order. The download-soundfonts.sh script will create a symlink 0.sf2 pointing to the "GeneralUser GS" SoundFont, which contains the 128 instruments of the General MIDI standard, as well as a few variations, and a few drum kits.

You are welcome to download your own soundfonts, place them in the soundfonts/ subdirectory, and create symlinks to these files: they will be loaded when you start Griode.

What are soundfonts?

SoundFonts are instrument banks used by some audio hardware and by FluidSynth to generate notes of music. The typical extension for SoundFont files is .sf2.

There are many SoundFonts available out there. Some of them are tiny: the Sound Blaster AWE32 (a sound card from the mid-90s) had 512 KB of RAM to load SoundFonts, and there are SoundFonts of that size that offer the 100+ instruments of the General Midi standard! And some SoundFonts are huge: I saw some 1 GB SoundFonts out there with just a couple of piano instruments in them, but in very high quality (i.e. using different samples for each note and for different velocity levels.)

Here are a few links to some SF2 files:

LaunchPad

Griode currently supports the Launchpad Pro, the Launchpad MK2 (aka "RGB"), and has partial support for the Launchpad S. You can plug multiple controllers and use them simultaneously.

Griode relies on the name of the MIDI port reported by the mido library to detect your Launchpad(s). This has been tested on Linux, but the port names might be different on macOS or Windows.

Debugging

You can set the LOG_LEVEL environment variable to any valid logging level, e.g. DEBUG or INFO:

export LOG_LEVEL=DEBUG
./griode.py

Note:

  • DEBUG level is (and will always be) very verbose.
  • You can put the log level in lowercase if you want.
  • The default log level is INFO.

Persistence

Griode saves all persistent information to the state/ subdirectory. If you want to reset Griode (or some of its subsystems) to factory defaults, you can wipe out this directory (or some of the files therein).

Starting automatically on boot

If you are using a Raspberry Pi running the Raspbian distribution, and want to automatically start Griode on boot, you can use the provided systemd unit (griode.service).

After checking out the code in /home/pi/griode, and confirming that it runs correctly, just run:

sudo systemctl enable /home/pi/griode/griode.service
sudo systemctl start griode

Griode will start, and it will be automatically restarted when the Pi reboots.

If it doesn't start, or if you want to see what's going on:

sudo systemctl status griode
sudo journalctl -u griode

Bugs

  • If you keep a note pressed while switching to another gridget, the note will continue to play. This is almost by design.
  • If you keep a note pressed while stopping recording, it might record a zero-length notes.
  • If a sync is triggered while notes are pressed, it might result in zero-length notes.

griode's People

Contributors

arthurlutz avatar daisyt avatar jpetazzo avatar soulshake avatar winkoerades avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

griode's Issues

Soundfont classified wrongly as drums

I used a sounfont with these instruments (as identified by griode):

        Instrument(1, 0, 1126, Distorted), 
        Instrument(1, 1, 1126, Clean), 
        Instrument(1, 2, 1126, Chords), 
        Instrument(1, 3, 1126, Bass)

These were identified as drums because 1126 % 1000 > 100 by get_dk_and_font, I think.

Where does: i.bank % 1000 > 100 mean? Is that supposed to be a property of sound fonts?

Freezes on Clock.py late prompt.

Attempting to run with an original launchpad mini. Program starts but then freezes and says clock.py is running late on the tick speed. I've gotten the pad to do a sort of firework looking animation but no playing yet unfortunately. But there's a decent chance it's because I'm using the latest version of Raspbian and a port name got changed along the stream of updates.

No module named 'yaml'

pi@raspberrypi:~/griode $ ./griode.py
Traceback (most recent call last):
File "./griode.py", line 8, in
from arpeggiator import ArpConfig, Arpeggiator
File "/home/pi/griode/arpeggiator.py", line 5, in
from gridgets import Gridget, Surface
File "/home/pi/griode/gridgets.py", line 3, in
from palette import palette
File "/home/pi/griode/palette.py", line 26, in
import yaml
ModuleNotFoundError: No module named 'yaml'

I have tried installing 'python-yaml' to no avail.

I Can t hear any notes

This project sound cool, but for the moment doesn't work.
My Hardware Is a clone of RaspberryPi called Tritium H2+ with 4 core arm7 and 512 Mb of RAM with ARMBIAN OS, and I bought a new LAUNCHPAD X.
I installed all software and I start griode, but It didn' t sound. I have all light on on my Lauinchpad X but no sound.
I use headphone on that.

Just want to know, after started command ./griode.py Launchpad should sound ...

Maybe I can try this project on regular laptop with linux and then re try on my tritium.

Thank you.

tempo permanently halved?

Hi, same guy as the last issue. Sorry to bother...again... ahah
I love Griode, thanks again for creating this amazing tool!! :)
So, as the title suggests, the drum machine and the arpeggiator seemed really slow, and what basically happened (I think?) is that the tempo got halved? Is it possible? I have it cranked at 190 bpm and it's just playing at 80 bpm in reality... So even less then half. Something wrong with my old Pi? Or did I mess something up? Thanks again for the reading and hope nobody else is having the same issue.

Doesn't autostart

Hi

First I have to thank you for the work you're done here - it works! And Thanks for the youtube tutorials too!

I can not get it to autostart..
I have to write "sudo python 3 griode.py" to make it start.. That might have something to do with it.

It's running on a raspberry pi 3b+ with the newest raspbian desktop..

Regards from Denmark!

couldn't get it to work

Hello,
I followed the setup instructions in the readme but I was never able to make Griode work

Can you help please?
running it without sudo
./griode.py Traceback (most recent call last): File "/home/tchi/griode/./griode.py", line 189, in <module> main() File "/home/tchi/griode/./griode.py", line 176, in main griode = Griode() ^^^^^^^^ File "/home/tchi/griode/./griode.py", line 31, in __init__ persistent_attrs_init(self) File "/home/tchi/griode/persistence.py", line 36, in persistent_attrs_init self.db = shelve_open(self.db_filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/tchi/griode/persistence.py", line 8, in shelve_open cache[filename] = shelve.open(filename, writeback=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/shelve.py", line 243, in open return DbfilenameShelf(filename, flag, protocol, writeback) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/shelve.py", line 227, in __init__ Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/dbm/__init__.py", line 95, in open return mod.open(file, flag, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^ _dbm.error: [Errno 13] Permission denied: 'state/Griode.sav'

running sudo ./griode.py gives:
sudo ./griode.py [INFO] fluidsynth.py:76 __init__() -> Using audio driver: alsa fluidsynth: error: Failed to open the "default" audio device Failed to create the audio driver. Giving up. [INFO] fluidsynth.py:107 __init__() -> Found 0 instruments fluidsynth: error: Failed to open the "default" audio device Failed to create the audio driver. Giving up. [ERROR] fluidsynth.py:139 __init__() -> Failed to locate the fluidsynth port!

running it again with debug level:
export LOG_LEVEL=DEBUG
sudo ./griode.py [INFO] fluidsynth.py:76 __init__() -> Using audio driver: alsa fluidsynth: error: Failed to open the "default" audio device Failed to create the audio driver. Giving up. [INFO] fluidsynth.py:107 __init__() -> Found 0 instruments fluidsynth: error: Failed to open the "default" audio device Failed to create the audio driver. Giving up. [INFO] fluidsynth.py:135 __init__() -> Connected to MIDI output griode:griode 129:0 Traceback (most recent call last): File "/home/tchi/griode/./griode.py", line 189, in <module> main() File "/home/tchi/griode/./griode.py", line 176, in main griode = Griode() ^^^^^^^^ File "/home/tchi/griode/./griode.py", line 33, in __init__ self.devicechains = [DeviceChain(self, i) for i in range(16)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/tchi/griode/./griode.py", line 33, in <listcomp> self.devicechains = [DeviceChain(self, i) for i in range(16)] ^^^^^^^^^^^^^^^^^^^^ File "/home/tchi/griode/./griode.py", line 136, in __init__ self.program_change() File "/home/tchi/griode/./griode.py", line 151, in program_change instrument = self.instrument ^^^^^^^^^^^^^^^ File "/home/tchi/griode/./griode.py", line 144, in instrument groups = fonts.get(self.font_index, fonts[0]) ~~~~~^^^ KeyError: 0

cant get it working

i have some sound but on rows 1, 3, 5, and seven (from bottom), the buttons on colom 4 and 5 doesnt work

Feature request - documentation

Pressing user2 and then up-arrow twice, brings me to this:

2018-07-27 14 30 31

So the top key is for turning on and off the arpeggiator.

We'd really like to know what the others are for ;-)

griode not working

When i start griode i hear click and its starts somewhat but launchpad does not light up and i don't see any instruments.

./griode.py
[INFO] fluidsynth.py:76 init() -> Using audio driver: alsa
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
connect(2) call to /dev/shm/jack-0/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-0/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
connect(2) call to /dev/shm/jack-0/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed

I do see process running ps -ef:

fluidsynth -s -a alsa -o synth.midi-bank-select mma -o synth.sample-rate 44100 -c 8 -p griode

Midi output to 'real' hardware (synths and drum machine)

Interesting project, and noting that it's been idle a while so perhaps no one is watching for bugs...

Is is possible to have the resultant notes be output to 'real' hardware (rather than played by Fluid Synth)? This could be to other USB Midi devices plugged in, or to a UART based 5pin DIN connection (I believe there is a trick needed to get the correct Baud rate).

I imagine this would need some adaption of the instrument picker page to choose destination, and midi channel. Perhaps this would be better as another page entirely.

Python-rtmidi throws an error when installing

When I run pip install --user -r requirements.txt I get this error:
Failed building wheel for python-rtmidi
[Further down]
Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-install-RrVdiZ/python-rtmidi/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-ZJb5Cy/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-RrVdiZ/python-rtmidi/

LaunchPad X support

Originally posted by @worikgh in #8 (comment)

The LaunchPad X is not supported at the moment. There is a good chance that the MIDI messages are very similar and that we can get at least basic features just by adding it to the detection code. If you have a LaunchPad X and some Python skills, I'll be happy to walk you through the process!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.