5 years, 1 month ago.

Audio effects LPC1768

Hello,

I am very new to mbed and c++ programming. I have been given the following task which I require some help with, if this is in the wrong area or has already been answered please point me in the right direction.

Read potentiometer on analogue in 1. Read switch on digital in 1. Read input on analogue 2 @ certain frequency (sound input). Output signal on analogue out 1 with following modifications; if switch = 0, apply a reverb effect to the sound determined by analogue input 1. if switch = 1, add a random noise (or tremolo, distortion etc) to the signal where amplitude is determined by analogue input 1.

I have been able to complete the task to the following degree; create a sound output (using PwmOut). Change the frequency of the sound when a switch is pressed. Duty cycle of the PwmOut is controlled by the potentiometer input. I am struggling with the audio effects aspect of the task as I do not know how to create said effects in C++. Any help would be greatly appreciated. Thanks in advance.

1 Answer

5 years, 1 month ago.

The assignment "Read input on analogue 2 @ certain frequency (sound input). Output signal on analogue out 1 with following modifications.." looks to me like you are supposed to take analog samples of the input sound and output these samples again on analog out after some modifications. The PWM will only output a single frequency at a time and unless you modulate the duty cycle at high frequency and lowpass filter it this wont be suitable to generate audio output,

You could start by using a Ticker running at the samplerate to sample an analog input and output that same sample on the analog out. In the next step you could then modify that sample before outputting it again. You will have to make sure that the analog input voltage (audio) stays within the safe region 0V..3V3.