My Problem
I've built a very simple transistor guitar pedal. it has 1 mono input, 1 mono output. Now, all I have ever done in the past with ANN's is offline learning with labelled data and some work with autoencoders and all the data I used was digital so spreadsheets, data frames and CSVs etc. So my confusion comes from not understanding a suitable data type/format to use for training the ANN. It's just a confusion over which data would be more applicable to use.

My Pedals Behaviour & It's Input & Output
The input can be any mono signal audio signal, The signal will be from my PC at a sample rate of 44.1Khz or 96Khz, The higher the sample rate the more accurate the network should be but, 96Khz is my maximum input and output my soundcard can handle. Assume I'm using 44.1Khz for I/O. It's a simple pedal with a single knob which increases the gain of the input to the point of heavy distortion. The way it distorts the signal seems to vary on 2 factors:

  • The amount of 'Gain'
  • The frequency of the input signal meaning, A low-frequency bass signal (80hz) doesn't distort the same way as a higher frequency signal (4Khz)

Assumptions & My Understandings
Since the pedals behaviour non-linear AFAIK which to me makes a neural network a good candidate. And since this is a real device Online learning seems to be the way to go and since I can only use 44.1Khz. The neural network I'm going to design hasn't got any fixed deep architecture as of yet but I will use 22,000 neurons for the input and 22,000 neurons for output. As Nyquist sampling theorem suggests. If I use a Tanh Activation from -1 to 1 this should be fine. If I was using a Sigmoid/Logistic then I would choose 44.1 as the input dimension. Also, assume all input signal will be composed of Sine waves.

My Question (TLDR: What should the input data look like?)
My first idea of what input data to use was White noise it represents all the of frequencies of the spectrum and from what I could gather seems to be a good choice to avoid overfitting problems and would help the network learn how multiple frequencies can affect each other over time to create this non-linear distortion.

My second idea of input data would be to input a band of N (5, 10, 150) different frequencies at the same time. This would be a lot less information for the network to learn in one go, unlike the white noise, but this would take longer to process because you would have to go through multiple combinations of different frequencies.

Would any 1 of these two approaches have the desired outcome? or am I missing an obvious problem? If so what data format or type could I input to make a more accurate representation of my distortion pedal?


  • $\begingroup$ Great problem! So you want to model the distortion of your pedal with a NN? Training x data being clean guitar signal and y data being distorted signal? It sounds like a classic online RNN architecture exercise. My main worry would be whether it's computationally feasible to sample and train such a RNN in real time (remember RNNs are slow). Particularly in that context, why do you talk about tanh or sigmoid instead of relu? Also, what do you mean with using White noise as training data? The second idea also needs some clarification, though it would make sense to aggregate data somehow. $\endgroup$ Commented Jun 5, 2018 at 10:29
  • $\begingroup$ What I meant with Tanh and Sigmoid is 44.1Khz is samples taken per second from the source then converted from analogue to digital. If I use Tanh then since it can model between -1 and +1 it can model both the negative and positive parts of the analogue signal, so I did assume I would only need the 22.05Khz inputs from when the analogue signal drops below 0v and then above 0v. But since Sigmoid can only model a +0 number then I would have to use the 44.1Khz to model both the -0v & +0v values, if that makes sense? This could be a wrong approach to the problem or misunderstandings in my knowledge $\endgroup$
    – Definity
    Commented Jun 5, 2018 at 19:04
  • $\begingroup$ What I mean about the White Noise is that since white noise has a equal distrubution of all frequencies. So it seemed like a good place to start to train. But putting in 18Khz (18,000) sine waves all playing together could be a bit to much for it to take on at once and will take forever to train. This is why I thought a set of freqencies like 100hz, 448hz, 3.5khz, 10.11Khz and then train through all combinations.permutations of freqencies which might make the training process shorter. TBH These are just ideas I had in my head so they are very much open to change if i have the wrong idea. $\endgroup$
    – Definity
    Commented Jun 5, 2018 at 19:13

1 Answer 1


Don't try to do online learning, it is not needed and does not bring any benefit in this case. Instead make many recordings of input,output pairs. Keep them to a standard length. Since there should be very little time-dependency in such a distortion pedal, keep them short. Around 100ms clips might be useful to help human evaluations. The model processing should probably be done on chunks of around 1ms, by chopping up the input data, possibly with a weighted window function.

Second, characterize your recording system. Plug the audio out cable directly to your recording input, instead of through the guitar pedal. Record some input,output pairs here. Verify that frequency response is approximately linear in the hearable range. But more importantly, determine the time delay in your (recording) system. This should be removed when comparing outputs to inputs (delay compensation). This means that the model does not have to learn this time delay, and makes it suitable for actually implementing as a real-time model you can use to play later.

As for the training input data, I would recommend using typical guitar playing as the primary source. Play all the styles you'd typically do, from monotonic licks to chords etc. Record some minutes of it, and then split it up into your sample size. If you don't want to record it all yourself, get music online and split into clips.

The non-linearity of a guitar pedal depends a lot on volume. So for each input sample, you should record many variations with different volume levels (data augmentation). You can also augment by applying different filters, generating variations with different mixes of frequency content.

System identification of guitar amplifier and distortion pedals has been researched quite a bit. Neural network approaches has been in use since EMULATING ELECTRIC GUITAR EFFECTS WITH NEURAL NETWORKS by David Sanchez Mendoza, 2005. Lots of relevant submissions to Digital Audio Effects conference (DAFX) since then.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.