How to Use Keyboard Numpad for Music on Linux

In this guide, I'll show you how you can use numpadz as a musical instrument by utilizing your computer numpad on linux. Numpadz is a simple program written in Python by Jason Byers which uses your numpad as a simple sampler.

If you enjoyed mashing up youtube tracks with the numpad, then be ready for the same joy.

How to install numpadz on Linux / Unix

Numpadz is distributed as a python script, you can easily download this script by cloning project source code from Github.

Ensure you have git on your system before you can proceed. You can install it using quickly using your operating system package manager.

# Ubuntu
sudo apt-get install git
# CentOS 
sudo yum install git
# Fedora
sudo dnf install git

Once git is installed, clone the software:

git clone https://github.com/jsoncz/numpadz.git

To use the script, change to numpadz

cd numpadz

I got an error when I first tried running the script

$ python numpadz.py

Traceback (most recent call last):
File "numpadz.py", line 3, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'

This means I need to install pygamepython module using pip.

sudo pip install pygame

Try running the script again after installing the module

$ python numpadz.py 
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
NUMPADZ - Cycle through PACKS with + / -
['samdog', 'stray', 'orwell', 'pakistani', 'emergent', 'sari', 'considerate', 'feedings', 'watchwords', 'dun', 'slum', 'floorboard', 'threaten', 'stetson', 'millions', 'revered', 'manipulatory', 'oddity', 'tailored', 'oppressed']
NUMPADZ - Cycle through GIFS with / and * -
['bluedancer', 'amiga', 'demoscene']

Make the script executable so that you don't have to type python before script name everytime you want to use it.

$ chmod +x numpadz.py 
$ chmod +x numpadz_02.py

Numpadz Usage

When using numpad to play samples, use + or - to cycle between sample packs and use * and / to cycle through GIF packs.

To stop all sounds, Press 0 on Numpad.

Under the download directory, there is a  numpadz_02.py script. Ths is a development which features a recording mode. Instead of gifs, and gifpacks you have recording mode which uses NumLock to toggle recording,

  • / to toggle playback of recorded data
  • * to undo,
  • . to clear pattern
  • + / - is still to cycle sample packs
  • ENTER holds whatever sample is being played without adding to the recorder
  • 0 stops all sounds
  • #secret buttons ;)
  • INSERT / DEL will move speed up and down
  • PGUP/PGDOWN changes the pattern length/start loop position

Note that you can switch sample pack while still holding a key - this will continue to loop that key, allowing some looping without holding.

Example usage

Under the wav directory, there are lots of files you can try with:

$ python numpadz_02.py wav/considerate/0002.wav

You should get output like below:

Read Also:

Numpadz is an interesting tool to keep watching as its developments evolve. Stay tuned for new features and drop a comment if you have any issue using numpadz.

Resource Reference:

Github - Numpadz

Josphat Mutai 12:05 am

About Josphat Mutai

Hat Certified Engineer with more than 2 years experience managing critical Cloud Infrastructures and Services. Passionate about Technology and loves testing and reviewing gadgets and Open-source tools.

Author's All Posts
Like to become part of Linoxide Team and contribute tips? Contact us here.

Comments

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.

2 Comments