- C 100%
myCSignalProcessingFakePedal #
This project implements signal processing features in C for WAV files, emulating a pedalboard.
Features #
- WAV audio file signal processing;
- Efficient live audio signal processing with PortAudio;
- 10+ available DSP filters;
- FPFDSL[1] to store filter setups and load multiple of them;
- 10+ example FPFDSL files;
- Support to custom DSP filters;
- Live processing interface for filter management;
Setup #
Requirements #
- PortAudio: required for the live processing option.
- Install via
sudo dnf install portaudio-develfor Fedora. - Install via
sudo apt install portaudio19-devfor Debian/Ubuntu.
- Install via
Compiling The Project #
To run this software, you must compile it from the source code.
You can clone it from GitHub:
git clone https://github.com/akai-keisanki/myCSignalProcessingFakePedal.git
And cd into the directory:
cd myCSignalProcessingFakePedal/
Then you can build it with Make and (G)CC:
make fake_pedal
Usage #
Important
Due to technical difficulties, this program only processes 16b WAV files with 44B-header (44100Hz recommended). The file should be named input.wav and be in the working directory.
You can use Make to generate an input.wav from a pre_input.wav file in your input directory, formating it with ffmpeg to the required conventions:
make input.wav
An output.wav shall be generated after fake_pedal's running is finished with exit code 0.
Command-Line Usage #
fake_pedal requires a filter input option as its first argument and a following IO option to work with.
The filter input options are:
f: read from a following file (name) with the FPFDSL[1:1] format.c: load no filters (clean).
The IO options are:
f: process files. Must be followed by 2 arguments: the input and output proper WAV files.l: process and play live audio with PortAudio.
You can get a brief description of the command line structure with fake_pedal help.
FPFDSL[1:2] #
The FPFDSL[1:3] is a straightfoward and visual format where every name, value or delimiter -- some element -- is represented by a string separated by spaces from the other elements, defining combinations of filters and their settings to store custom tones.
It's details will not be covered by this description, but some examples are available in this repository in the fpfdsl_examples/ directory so that you can check the syntax and use the following available filter list to write your own setups.
Live processing #
The live processing mode applies the filters to audio samples from the default audio input device and plays the processed samples on the default audio output device using a PortAudio callback.
While running, a command-line user interface is used for typing commands such as stopping the live processing, listing the filters in use, adding filters, removing filters etc.
It is recommended to type h or ? and press Enter to get a list of the currently available commands and their input formats.
Available filters #
-
multiply- FPFDSL Identifiers:
Multiply,Multiplier,Gain - Parameters:
mul/multiplier/coefficient/gain
- FPFDSL Identifiers:
-
clip- FPFDSL Identifiers:
Clip,Clipper,HardClip,HardClipper - Parameters:
thr/thresholdas a fraction of the total signal
- FPFDSL Identifiers:
-
low_pass- FPFDSL Identifiers:
LowPass,HighCut - Parameters:
cut/hcut/high_cutas a fractionmix
- FPFDSL Identifiers:
-
high_pass- FPFDSL Identifiers:
HighPass,LowCut - Parameters:
cut/lcut/low_cutas a fractionmix
- FPFDSL Identifiers:
-
mid_scoop- FPFDSL Identifiers:
MidScoop,MidScooper - Parameters:
lcut/low_cutas a fractionhcut/high_cutas a fractionmix
- FPFDSL Identifiers:
-
bit_crush- FPFDSL Identifiers:
BitCrush,BitCrusher,LoFi - Parameters:
res/resolution/crushas an ammount of bitsmix
- FPFDSL Identifiers:
-
pitch_shift(BETA)- FPFDSL Identifiers:
PitchShift,PitchShifter - Parameters:
uni/unities/semitonesas an integer
- FPFDSL Identifiers:
-
saturate- FPFDSL Identifiers:
Saturate,Saturator - Parameters:
mul/multiplier/coefficient/gainmix
- FPFDSL Identifiers:
-
delay- FPFDSL Identifiers:
Delay,Delayer - Parameters:
dly/delay/stepsas an unsigned integermix
- FPFDSL Identifiers:
-
drive- FPFDSL Identifiers:
Drive,Driver,OverDrive,OverDriver - Parameters:
thr/thresholdas a fraction of the total signalmix
- FPFDSL Identifiers:
-
compress- FPFDSL Identifiers:
Compress,Compressor - Parameters:
rat/ratio(positive for downwards, negative for upwards)thr/thresholdas a fraction of the total signalatk/attackas a fraction (higher imples quicker changes)mix
- FPFDSL Identifiers:
-
auto_wah- FPFDSL Identifiers:
AutoWah,AutomaticWah - Parameters:
atk/attackas a fraction (higher imples quicker changes)
- FPFDSL Identifiers:
-
harmonize(BETA)- FPFDSL Identifiers:
Harmonize,Harmonizer,Octave - Parameters:
uni/unities/semitonesas an integermix
- FPFDSL Identifiers:
Extra: Adding your own filters #
In order to add your own filters, you must write .c and .h files (e.g. my_filter.c and my_filter.h) in the filters/ directory and update the filters/filter_includes.def and filters/available_filters.def files with the filter's information.
Your filter's .h file must include util_filter_base.h and define a struct filter *init_filter_my_filter(...) (where my_filter must be named the same your files) function that takes the filter's parameters as arguments.
The .def files have an own structure that must be followed. Check the other listed filters there for more detail.