Waveform Generator

Here you can link to screenshots and demos etc. of programs made using BBC BASIC
MrHiggins
Posts: 13
Joined: Wed 28 Jul 2021, 13:29

Waveform Generator

Post by MrHiggins »

Hi,

I have been learning BBC Basic and set out to do a project to test some DSP algorithms and thought I would share the progress. I have developed a program that generates a sawtooth wave wave made up of harmonics all the way up to the Nyquist frequency, it then plots the output sawtooth as red and all the harmonic sines that make up the sawtooth as white.
I intended to add generation of other waveforms such as square and triangle, and allow the parameters such as the fundamental frequency and sample rate to be set from the UI. I also eventually plan to get the waveforms playable as audio at some point.

The array lib has been pretty useful for this project, I recommend using it if you are doing projects where you are using arrays and doing operations on them like multiplication.

Image

MrHiggins
Posts: 13
Joined: Wed 28 Jul 2021, 13:29

Re: Waveform Generator

Post by MrHiggins »

I've now got it to animate the composition of a sawtooth via adding the harmonics one by one so you can see how the output wave is composed by adding successive harmonics.

Image
(click on image to see the animated gif)

DDRM
Posts: 397
Joined: Mon 02 Apr 2018, 18:04

Re: Waveform Generator

Post by DDRM »

Nice! Quite impressive how fast it gets quite close to a sawtooth.

D

MrHiggins
Posts: 13
Joined: Wed 28 Jul 2021, 13:29

Re: Waveform Generator

Post by MrHiggins »

DDRM wrote:
Tue 31 Aug 2021, 09:56
Nice! Quite impressive how fast it gets quite close to a sawtooth.

D
Thanks! @DDRM

I was quite surprised at how fast it was generating that sawtooth up to Nyquist just adding SIN()'s. I could go further but I'm basing it off CD quality 44100hz sample rate.
I intend to look at getting it to play back via audio at some point.

Has been a really fun little project to do to get into BBC Basic.

Repton
Posts: 41
Joined: Tue 22 May 2018, 13:51

Re: Waveform Generator

Post by Repton »

can you show the source code?

MrHiggins
Posts: 13
Joined: Wed 28 Jul 2021, 13:29

Re: Waveform Generator

Post by MrHiggins »

Repton wrote:
Fri 03 Sep 2021, 19:19
can you show the source code?
I will do once I got a few more things implemented.