Initial commit: HPR Knowledge Base MCP Server
- MCP server with stdio transport for local use - Search episodes, transcripts, hosts, and series - 4,511 episodes with metadata and transcripts - Data loader with in-memory JSON storage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
109
hpr_transcripts/hpr0991.txt
Normal file
109
hpr_transcripts/hpr0991.txt
Normal file
@@ -0,0 +1,109 @@
|
||||
Episode: 991
|
||||
Title: HPR0991: Making a Music Sampler with Midi and Pygame
|
||||
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0991/hpr0991.mp3
|
||||
Transcribed: 2025-10-17 17:03:18
|
||||
|
||||
---
|
||||
|
||||
Hello, this is BeGraderClock and welcome to Hacker Public Radio.
|
||||
Today we're going to be talking about PiGame, the MIDI modules that are contained in PiGame,
|
||||
and how you can use those to make a very cool, inexpensive sampler out of a netbook.
|
||||
I first learned about PiGame at the South East Linux Fest.
|
||||
I was watching a presentation by Ryan Ikelis-Cordan about how easy it is to make games in Linux
|
||||
using Python and how hard it is to do it, you know, in Windows, where you would have to
|
||||
type in a ton of code in Windows just to get the little screen to update correctly, and
|
||||
in Linux it was just like two lines.
|
||||
I never really been that much of a gamer, just had a curiosity.
|
||||
I was looking through the PiGame website, and I looked on the documentation link and
|
||||
low and behold, there was some stuff on there about MIDI.
|
||||
MIDI stands for Musical Instrument Digital Interface.
|
||||
MIDI is very, very nerdy, and it's usually associated with keyboards and lots and lots
|
||||
of cables, but some musicians use MIDI and live performances and makes the little less
|
||||
nerdy.
|
||||
Bands like Pick Face and KMFDM can mix electronic instruments and samples with live instruments
|
||||
on stage, and it comes across as very powerful, not like karaoke, like you're singing along
|
||||
to a tape.
|
||||
Everything seems very live, and cohesive, and full of energy, and I've always been really
|
||||
interested in that stuff and try to use electronics in live performances as I play drums, and
|
||||
I was always put off by how expensive equipment is for electronic music.
|
||||
If you want to buy a sampler, which is the little box that plays snippets of audio,
|
||||
like if you want to play a silly little quote from a Clint Eastwood movie, or something
|
||||
like that, something tough like that.
|
||||
You'd have to pay hundreds of dollars for that, and the gear isn't very versatile.
|
||||
It only holds so much information, you can only play the samples in certain ways, and
|
||||
it's always been a problem.
|
||||
But seeing the MIDI modules in the pie game program, I started thinking like, hey, maybe
|
||||
I can just build a sampler.
|
||||
If I can figure out how to use MIDI, I'm going to hook it up to maybe an old netbook.
|
||||
Maybe I can build my own sampler for cheap.
|
||||
So I kept looking around the pie game site, found their mailing list, hopped on it, asked
|
||||
a couple dumb questions, got a bunch of very nice replies, and made it happen.
|
||||
And if I can make it happen with my terrible programming skills, definitely you can make
|
||||
it happen.
|
||||
Before you start, you want to make sure you have pie game version 1.9.1, or better installed
|
||||
on your system.
|
||||
Older versions of pie game did not have the features to use MIDI.
|
||||
Pie game is also a cross-platform.
|
||||
It runs on macOS and Linux and Windows.
|
||||
But for what we want to use it for, an old netbook, Linux was the obvious choice.
|
||||
But if you're in the pain and you want to use Windows or something else, go for it.
|
||||
So to build this sampler out of pie game in MIDI, I needed to learn how to use Python.
|
||||
To learn Python, I just did a couple YouTube tutorials to print out hello world to the
|
||||
screen, learn how to do an if statement and a for loop, which is pretty easy in Python.
|
||||
If you've had any kind of a programming class, even if there's something like a web programming
|
||||
class, I'm sure you can do this.
|
||||
So I wrote a couple little Python test scripts, and I tried to incorporate some of the information
|
||||
that was on the pie game documentation website, which didn't go as planned.
|
||||
So I put a question on the pie game mailing list, and a guy named Leonard Lindstrom wrote
|
||||
back and said, hey, just take a look at the midei.py file under the pie game examples folder.
|
||||
And basically all that I wanted to do was already spelled out in that file.
|
||||
All I needed to do was kind of copy and paste some things and move it around.
|
||||
And it worked like a charm.
|
||||
If you open up a terminal and go to the folder where the midei-py file is and type in python
|
||||
midei.py space dash dash input and hit enter, it will list all the MIDI devices plugged
|
||||
up to the computer at that point.
|
||||
If you follow those same steps, and then after the dash dash input, put the number of the
|
||||
device in the list that showed previously, the Python script will read all the events
|
||||
coming out of the midei device.
|
||||
Right now I have my keyboard hooked up to my computer.
|
||||
I'm running that midei.py script, and if I press the middle C key, the white key on the
|
||||
keyboard, it prints a string of information to the terminal.
|
||||
One of the items in the comma delimited string is data 1, and it returns 60.
|
||||
And now if I press the black key just above the original key I pressed, it returns the
|
||||
same information, but it says 61 now.
|
||||
So you can basically use the information that's being printed out to the screen inside
|
||||
the midei.py file and just kind of go in there and put some if statements that say if
|
||||
you see note 60, play a bass drum sample, and if you see 61, play a cleanyswood sample.
|
||||
And if you see 63, play this piano sample four times, since you're programming your own
|
||||
sample, you can do really neat stuff like using the random function in Python to say if
|
||||
I press this key, randomly play a middle C or a high C. So by just playing normal drums
|
||||
with a trigger hooked up to that middle C, it'll play a range of notes without you doing
|
||||
anything special.
|
||||
It's all just programmed in the little PyGames script.
|
||||
You can do if statements based on the information that's returned.
|
||||
You can say if I press this key, play a bass drum sound, and if I press this other key,
|
||||
play a snare sound, but first stop playing the bass drum sound.
|
||||
So you get this short cropped bass drum sound that's cut off by another sound, which
|
||||
can sound really neat, have one drum that rings out forever in another drum that quickly
|
||||
cuts the other one off.
|
||||
You can put together some pretty interesting stuff.
|
||||
Okay, this includes my little podcast about PyGame and MIDI.
|
||||
I'm going to add some Python examples in the show notes for using if statements to play
|
||||
sounds to get more information about PyGame and MIDI and PyGame.
|
||||
Check out the PyGame.org website and hop on the mailing list.
|
||||
Once again, that was p-y-g-a-m-e-dot-o-r-g.
|
||||
Thanks for listening.
|
||||
This has been BeGrader Clock.
|
||||
Peace out.
|
||||
You have been listening to HackerPublic Radio at HackerPublicRadio.org.
|
||||
We are a community podcast network that releases shows every weekday Monday through Friday.
|
||||
Today's show, like all our shows, was contributed by a HPR listener by yourself.
|
||||
If you ever consider recording a podcast, then visit our website to find out how easy
|
||||
it really is.
|
||||
HackerPublic Radio was founded by the Digital.Pound and the Infonomicum Computer Club.
|
||||
HPR is funded by the binary revolution at binref.com, all binref projects are crowd-sponsored
|
||||
by linear pages.
|
||||
From shared hosting to custom private clouds, go to lunarpages.com for all your hosting
|
||||
needs.
|
||||
Unless otherwise stasis, today's show is released under a creative commons, attribution,
|
||||
share a like, free those own license.
|
||||
Reference in New Issue
Block a user