Tutorial on making a MIDI arpeggio synthesizer
Source: InternetPublisher:明天见 Keywords: Synthesizer Chip MIDI Updated: 2024/12/27
With this project you can turn your CHIP into a simple synthesizer that is ready to use, capable of creating a wide variety of sounds. Control it with a MIDI keyboard or even OSC!
As a long-time electronic music lover and enthusiast, I can see any piece of technology as a source of sound. Since the chip has built-in audio, battery operation, and a convenient USB jack, I knew it would make a great little portable interactive noise box with a variety of great sounds.
The first step in implementing CHIP-MAS was to find a good platform for programming synthesizers. There are several different paths to choose from: C++ and an audio framework like asoundlib or Jamoma, python and Pyo, a professional language like Faust, or, if you want to do something simple with samples, Pygame or Pysound. I chose Pure Data (aka Pd), an open source, extensible graphical programming environment. Designed to generate and manipulate sounds, Pure Data is a great way to quickly prototype and create new ways of making music.
Once I decided on a programming environment, it was time to develop the synthesizer. I used one of the more interesting but less CPU-intensive examples from the Pure Data samples ( C08.analog.sequencer.pd ) as it has an interesting wavetable synthesizer and a sequencer. I did a lot of work to give the synthesizer more sonic diversity and integrated a MIDI keyboard to create arpeggiated sequences.
Overview
The basic steps are
Startup Chip
Install Pure Data
Get Git (repo)
Set the synthesizer to start at boot time
Install Pure Data
The first step is to install the Pure Data program. Pure Data comes in "extended" and "vanilla" versions. As you might expect, "extended" provides more features, but I didn't need those extra features, so I installed "vanilla." Installation is easy from the command line on the CHIP:
sudo apt-get update
s
Humans are very sensitive listeners. One of the challenges of music programming is to keep the time from "performing an action" (pressing a key on the piano keyboard) to "hearing the sound" as short as possible. This is generally called "latency" and is a huge topic of compromise for electronic music producers and programmers.
Pure Data prefers to give high priority to the operating system, and this can be done with some configuration. Edit the configuration file in the nano editor:
sudo nano /etc/security/limits.conf
Add the line where:
@audio - rtprio 99
@audio - memlock unlimited
to the end of the file. Now you can restart CHIP to make sure it takes effect
sudo reboot
In order for this stuff to actually work, Pure Data needs to be started from a CHIP terminal with the "live" flag on, like this:
pd-rt
If you want to make your own synthesizers or modify the ones I made, you might also want to install the Pure Data application on your "everyday" computer. The CHIP is a great computer, but if you have a faster computer with a higher resolution monitor, you might find it easier to program with Pure Data, as it tends to take up a lot of screen space.
Get a software synthesizer
Go to your Documents folder, and extract the git repo:
cd ~/Documents
git clone https://github.com/nyboer/CHIPMAS.git
Some synth details
If you're interested in how synthesizers work, here are a few things worth mentioning. When making the synthesizer, I wanted to be able to create a wide variety of sounds: percussive, noisy, bright, simple, clean, aggressive, and so on. However, I didn't want to use up too much CPU. So I chose a wavetable synthesizer design, which can scan tables of different sizes to produce several complex waveforms from a single wave. After that I created a few tables that can be mixed, resulting in a lot of possible timbres. Add synchronized low-pass filters, amplitude and table scan envelopes, and we have a very versatile synthesizer.
All parameters can be controlled via Open Sound Control (OSC), which means this tiny synth is network-capable. But for this simple case, I designed it around a cheap Akai Synth Station 25 keyboard. This way, I can plug in a USB MIDI controller, fire up CHIP, and have a complex synth sound.
You'll notice that the jump git repository below this article also has a file called "graintable.touchosc", which is the file for the Touch OSC app for Android and iOS. It gives you control over multiple parameters in CHIP-MAS, as well as the option to control the sound using your phone's motion sensors.
Connecting the controller
I designed this piece with a MIDI keyboard. You just press a chord and the notes play in the order you press the keys. Use the modulation and pitch bend wheels to change the filter cutoff frequency and the crossfades between wavetables. If you use an Akai Synth Station 25 keyboard, you can use six of the eight buttons to change presets (the top row of buttons) or change the tempo (up or down, in 4 BPM increments).
Before starting CHIP, you need to connect your keyboard so that the program can find it.
Make a sound
Just press keys on your keyboard and move the pitch and modulation wheels to make some weird sounds.
Final product
Eventually, I'd like to turn this into a fully functional project that can be used in a series of steps: plug in a keyboard, turn on the chip, plug in headphones, and quit.
This is pretty easy to do though, the necessary service files are included in the git repository. The service script simply tells Linux to turn on our compositor patch once a certain service is available. You should double check the line: systemd
ExecStart=/usr/bin/pd -nogui -rt /home/chip/Documents/CHIPMAS/CHIPMASsynth.pd
Make sure the absolute paths to pd and CHIP-MASsynth.pd are correct.
Change your directory to wherever you have your git repository, and then copy the services file from the repository to the correct location:
sudo cp chipmassynth.service /etc/systemd/system/chipmassynth.service
Now we need to make our systemd aware of this new service:
sudo systemctl daemon-reload
sudo systemctl enable chipmassynth.service
You can test the service with the following command:
sudo systemctl start chipmassynth
and
systemctl status chipmassynth
and
sudo systemctl stop chipmassynth
The Pure Data patch has some special information in the "pd init" subpatch to make sure it grabs the first MIDI device, turns off the audio input, and turns on the first audio input (the CHIP's built-in audio) to ensure the synth chip is ready to play once it boots up.
Make CHIP unique
CHIP has "zero configuration networking" enabled via `avahi`, but I want to take full advantage of this. I have several CHIPs lying around, so it would be better if they had unique names.
In short, you need to edit a couple of files and change "chip" to "synth" (or whatever you want to call it)
sudo nano /etc/hostname
sudo nano /etc/hosts
Also, I'm on a Mac, so I like to add Apple Services:
sudo nano /etc/avahi/services/afpd.service
And add the following:
Restart avah:
sudo /etc/init.d/avahi-daemon restart
Password-free login
It would also be nice to be able to use `ssh` and `scp` to control and copy files to CHIP without having to enter a password every time.
Generate an SSH key pair on your computer
ssh-keygen -t rsa
and save it to
~/.ssh/id_rsa.pub
Copy it to CHIP:
scp ~/.ssh/id_rsa.pub chip@:~/
On CHIP, you need to install rsync, set it up for ssh, and copy your public key into its authorized keys file:
cd ~/
sudo apt-get install rsync
mkdir .ssh
cat id_rsa.pub 》》 .ssh/authorized_keys
rm id_rsa.pub
chmod go-w ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Now, on your host, you can easily move all PureData patches without logging in:
rsync -avzu CHIPMAS/ chip@boer04.local:~/Documents/CHIPMAS
Possible extensions
I'm glad I finished a simple synthesizer on CHIP for such a cheap price Even though I set out to build something very simple, there's actually quite a bit of signal calculation going on in this synthesizer, since it's scanning 4 wavetables simultaneously and mixing them along with the noise signal, modulating them with an envelope.
Even though it's not optimized it still only takes about 25% of the cpu of CHIP. I think the synth could be simplified and fixed to turn off things that aren't being used. It could also use some oversampling to improve the sound quality, and the more CPU intensive but better sounding Moog analog "bob~" filter could be removed in place of Pure Data's "vcf~".
Finally, you need to take advantage of the CHIP's built-in networking. CHIPs are so cheap that it's not unreasonable to run 6 or 8 of these synthesizers on a single CHIP and synchronize and control them over the network.
- Tutorial on making a MIDI arpeggio synthesizer
- How to adjust the bass and treble of CXA1005
- TDA2009A power amplifier circuit
- The easy production of several top-quality tube preamplifiers
- Toy electronic chicken
- The fun of making ISD1820 voice recording box
- 6C16+FU50 high-fidelity tube amplifier circuit with unique sound
- Using Shuguang 350C tube to make tube amplifier
- Typical circuit of LM4809/LM4810 for dual-channel headphone amplifier
- Audio amplifier circuit of the Expo flowerpot speaker
- LA4461N audio IC circuit
- TDA2030 audio power amplifier circuit diagram
- Voice controlled bird circuit
- Transistor Audio Mixer Circuit Diagram
- 2-tube FM microphone with 3V power supply
- Simulating bird call circuit schematic diagram
- Several good field effect transistor power amplifier circuit diagrams
- Squelch Tuned Audio Switching/Mixing Circuit Diagram
- transistor audio mixer
- High quality melody circuit