Posted May 08, 2024 by Alex May
Thank you for downloading PDFXR!
PDFXR is a way to generate simple retro synth sound effects for your games or apps. If you feel excited, go have a play and come back to read this later, if ever. You can learn a lot just by playing and seeing what dials have different effects!
Read below to find out how to use PDFXR, and read the section called "Using your effects" to find out how to load them into your game.
There are 4 audio modules in PDFXR, and one System module. On the modules are many dials and waveform selectors, all controlled with the crank. You control the currently selected control using the directional pad, and use the crank (and sometimes the A button) to change the control. Press the B button anytime to play the current effect.
The Core module is always on and defines the basics of the sound - the wave type, the envelope, the pitch and the volume. We will go into these below.
There are 2 similar modules called Tremolo and Vibrato. These are low frequency oscillators (LFOs), which modulate the frequency (pitch) and amplitude (volume)of the signal respectively. Each has dials controlling the strength of the signal and how fast it happens. An LFO also has a wave type and some options for delaying and fading in.
The Arpeggio module also modulates frequency. It defines a series of notes to play in a repeating sequence. The Arpeggio mod is special, because it is secretly actually part of the Tremolo module. That's why when you turn it on, the Tremolo will also turn on if it's off. You'll also notice that the Tremolo wave type is disabled.
The System module lets you do filing and randomisation.
The Core module controls the overall sound of your effect.
There are several wave types to choose from.
The envelope defines an overall volume for the whole duration of the sound. It's a little bit fiddly because it's designed for instruments, but we provide everything you need to control it here. The envelope starts with an Attack phase, then there is a Decay phase, then there is a Sustain phase and finally there is a Release phase.
The Envelope is visualised at the top of the Core module. Turning dials that control the shape of the envelope make the modified part of the envelope in the display above flicker to let you know what you are changing.
The overall volume of the sound effect is contorlled by the Vol dial.
The Cur dial controls the curvature of the envelope. Try it out. When it's 0, the envelope changes in straight lines. When it's 1, an exponential function is used, making the volume change fast at first and then slow later. It can make sounds feel more natural.
Finally, the pitch the sound is played at is controled by the Ptc dial. The value of this dial is in the MIDI note scale, where 60 is C4.
If we were using an instrument, the volume, pitch and duration would all be controlled by the musician playing the notes. Here we let you set them so that you won't have to do mess with it when it comes to playing the sound effect back. When you load the synth into your game, you can actually control any of this when playing it if you want to as the Playdate synth API has parameters for all of them.
This module controls the frequency or pitch of the sound. Like the envelope, the signal is visualised at the top of the module. You need to turn the Tremolo module on for it to work, the control is in the top right.
The LFO includes a special wave type on the far right called Sample and Hold. Every time the LFO updates (at the rate you set) it takes the value of the synth and uses that as the output value of the LFO. This produces a kind of randomisation that tends not to be consistent when you play the effect back. Can be fun! Try it out!
This module is exactly like the Tremolo module except that instead of controlling the pitch, it controls volume. This happens alongside the envelope, so if one or the other reads 0, you get no sound, and if they're both 1, you get all the sound.
This module overrides the Tremolo waveform and instead makes it repeat a series of notes. The values on the dials of the Arpeggio module are in half-tones, but this is only true if the tremolo Depth is set to 1.
Dials on the Arpeggio module can be deactivated so you get a shorter sequence of notes. The last dial that is not firmly set to 0 is the last active one. To deactivate a dial, turn it all the way to the left until it goes semi-transparent. If it doesn't, it's because a dial to the right is not at 0.
The System module has 6 functions for randomisation, filing, loading presets and undo/redo.
Loading and Saving work as you might expect - you can save your current effect to your Playdate console or load an effect you created earlier. Use the crank to scroll the display if you have lots of samples.
The Preset button lets you load a preset from a pre-defined set of effects. The presets are all slightly randomised, so you get a slightly different one each time. The "New Project" preset makes a completely random effect.
The Mutate button takes the current sound effect and messes with it a bit. It'll sound slightly different after. Rarely, it'll change the wave type on one or more of the modules, which might result in quite a different sound.
The Random button makes a new random effect. The result depends on the preset you last loaded. Most of the presets create a similar sounding effect to the preset, but New Project makes a completely random one which can be great for inspiration or just playing around.
The Undo button is not actually a button. You control undo and redo in PDFXR using the crank. You can undo and redo 250 annotated actions.
Once you've created and saved an effect, you'll be itching to use it in your game. We provide a simple Lua API for doing just that. If you are a C head, or use some other language, just know that the files are saved as JSON, and examining the provided Lua file should give you the info you need to write a C version. It's really simple, honestly.
To get the files off your Playdate, plug it into your computer and enter data disk mode (either by going through the system menu on the device or by holding left, home and lock while on the home screen). Find the folder Data/io.itch.psychicteeth.pdfxr/samples and your saved samples will be in there. Copy them into your project, and also copy pdfxr.lua to your poject. You'll need to import "pdfxr"
in your main.lua to use this library.
To load one of your samples, create a new pdfxr synth instance by calling:
local mySynthInstance = pdfxr.synth.new(path)
where path is the path to your sample. This function returns a new pdfxr synth.
Then you can play the effect back by calling:
mySynthInstance:play()
Simple as that! If you want it to play continuously, call:
mySynthInstance:start()
That will start it going. You'll need to call:
mySynthInstance:stop()
To make it stop. Use this API for things like engine sounds or sirens or other things that need to go on for a while.
Both play() and start() take optional parameters for the note and volume to play it at. If you leave them out, the note and volume you specified in the PDFXR app are used.
A pdfxr synth is really just a wrapper around the Playdate SDK synth object and in fact you can just use that if you like:
local playdateSynthObject = mySynthInstance.synth
Use this to, for example, set the volume or panning while the sound is playing if your sound is moving around.
Please go to the itch page and leave a comment for support.
Thanks again for downloading PDFXR!