Audio Tone Burst Generator      Jed Margolin  4/25/2025

 

 

A.  Introduction

 

Several years ago I did a project called Audio Tone Burst Generator using an MSP430G2402 microcontroller and a AD9822 waveform generator. This updated version uses a Raspberry Pi Pico and keeps the AD9833. The Pico is faster, has more memory, and has 2 cores (for this project I am using only one core). Last year I started using the Raspberry Pi Pico instead of the Texas Instruments MSP430G2xxx family of microcontrollers. I posted several projects. Click Here. If you have not used the Pico I recommend you read it for background because I tell the story of how I got the Pico SDK installed and how I use it. The original article also contains other useful information. You should at least read this short piece on making things: Click Here.

 

B.  What is an Audio Tone Burst Generator?

 

An Audio Tone Burst Generator sends out periodic bursts of an audio tone. Mine sends out a periodic burst of a sine wave where you can set the frequency of the tone in the burst and the time between bursts. There is a sync output for triggering an oscilloscope.

 

 

This is what a tone burst sounds like: tone-burst.wav

 

It can also be used as a regular sine-wave audio generator and as a sweep generator. There are two sweep mode ranges: 20 Hz to 5 KHz and 20 Hz to 15 KHz.

 

With a separate program it is a VCO. Anyone want to do a head end for a Theremin?

 

 

C.  What is an Audio Tone Burst Generator Used For?

 

It is used for measuring the time delay of a piece of audio equipment. Modern audio equipment may use some fancy digital processing which may introduce a noticeable delay in the sound. You may want to measure the time delay in a piece of audio equipment in the following situations.

 

1.  If you use your own sound system with your TV and your sound system does some fancy digital processing the delay may be long enough that you will notice that the actor’s mouth movements are not synchronized with the sound. That is very distracting. For television applications, the Advanced Television Systems Committee recommends that audio should lead video by no more than 15 milliseconds and audio should lag video by no more than 45 milliseconds. See https://en.wikipedia.org/wiki/Audio-to-video_synchronization

 

2.  In a sound re-enforcement system such as may be used in a meeting, you can increase the feedback margin by several dB by using a frequency scaler (pitch shifter also known as a pitch changer) to change the sound going to the sound re-enforcement system (amplifier and speakers). The sound being fed back is at an ever increasing or decreasing frequency so it doesn’t howl. If you limit the frequency scaling to +/- 5% the people speaking will not notice. Indeed, you should lower the pitch of the person’s voice, not raise it. When we talk, bone-conduction to our ears acts as a low pass filter so our voice sounds lower to us than to the people we are talking to. Thus we are less likely to notice that our speech has been frequency scaled down a little.

 

The frequency scaler will have some time delay. If delay is more than 50ms we will hear that as an echo and most people will be distracted by that.

 

Indeed, if the delay is around 200ms most people will try to talk slower (and slower) in order to “catch up” with themselves. This can provide a great deal of amusement for everyone except the person who is talking. The amount of delay depends on several factors including age. See this article on Delayed Auditory Feedback (DAF): https://en.wikipedia.org/wiki/Delayed_Auditory_Feedback. A delay of 200ms seems to be the worst: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4477042/ .

 

Frequency scaling is difficult to do in real time.

 

The best frequency scaler that I have heard is in my old Stanton STR8-80 turntable. It has a control to vary the speed of the turntable and then a frequency scaler (pitch shifter) to restore the pitch of the music. You can speed up and slow down the music without changing its pitch. The turntable also has an auxiliary audio input which is inserted before the pitch shifter. When you use the turntable speed control it obviously cannot change the speed of the auxiliary audio input so you are left with a very fine pitch shifter (frequency scaler).

 

In measuring the time delay of the Stanton STR8-80 I discovered that the delay is different for different frequencies but in all cases is less than 15ms. This would be a good frequency scaler for a sound re-enforcement system for a meeting.

 

Some microphone mixers have special effects which include pitch shifters. I have not tested them. If you are using a microphone mixer because you are recording the meeting you want to send the clean mix to the recorder and the frequency-scaled mix to the amp and speakers.

 

I wonder if a good realtime frequency scaler can be done with a Raspberry Pi Pico.

 

If so, you can use the Audio Tone Burst Generator to make sure the delay is within an acceptable limit.

 

It is important to note that pitch shifting is frequency scaling. If you were to do frequency shifting, then octaves would no longer be octaves and everything would sound bad. And not just music. Your mellifluous voice would no longer be so mellifluous.

 

D.  If all you want to do is make this project without modifying the code or writing you own from scratch I am posting the uf2 file. To load the program (the .uf2 file) into the Pico you:

 

1.  Connect the Pico USB to a PC running Windows 10. It should have the driver for the Pico USB port. If it doesn’t you might have to install the Software Developer Kit (SDK) available at this link: https://github.com/raspberrypi/pico-setup-windows/releases/latest/download/pico-setup-windows-x64-standalone.exe. You might want to read this first: https://www.raspberrypi.com/news/raspberry-pi-pico-windows-installer/

 

It will install the USB driver. You don’t have to run the SDK.

 

2.  Press and hold the BOOTSEL button on the Pico. Then press and release the Reset pushbutton on my board. Then release the BOOTSEL pushbutton.

 

3.  Windows Explorer should automatically open to the Pico device as a folder called RPI-RP2 (G:). It should contain 2 files:

 

 

Copy and paste the uf2 file to that folder. The Pico folder will disappear and the Pico will run the program you have now loaded into the Pico.

 

This is the board:

 

 

These are the parts under the LCD. C4 and C14 are mounted horizontally so they fit under the LCD:

 

 

3.  This is the bare board top (Capacitors C4 and C14 have to mounted horizontally, I have provided room for that):

 

 

 

This is the bare board bottom:

 

 

The good ground plane coverage didn’t happen by accident. It certainly didn’t happen by using the auto-router. I routed all of the traces by hand to get good ground plane coverage.

 

Note 1: The board can instead be used as a VCO with an input of 0V - 3.3V. This uses a different program which I am also posting. When using it as a VCO you can use either the onboard trimpot as the voltage controller (which can be either a 1-turn trimpot or a 25-turn trimpot) or an external voltage. The blue jumper plug at the upper right corner allows you to use the on-board pot as the VCO input. If you are not using the VCO configuration you can leave it off as well as a few other parts.

 

Note 2: The board runs from the Pico’s USB port. If you are programming the Pico connect a cable from the Pico to your PC. This will also run the board. If you just want to run the board connect the Pico’s USB port to a USB power supply.

 

 

The Audio Tone Burst Generator uses a Raspberry Pi Pico to control an Analog Devices AD9833 and displays the User selections on a 16x2 LCD.  From the AD9833 datasheet (https://www.analog.com/media/en/technical-documentation/data-sheets/AD9833.pdf):

 

The AD9833 is a low power, programmable waveform generator capable of producing sine, triangular, and square wave outputs. Waveform generation is required in various types of sensing, actuation, and time domain reflectometry (TDR) applications. The output frequency and phase are software programmable, allowing easy tuning. No external components are needed. The frequency registers are 28 bits wide: with a 25 MHz clock rate, resolution of 0.1 Hz can be achieved; with a 1 MHz clock rate, the AD9833 can be tuned to 0.004 Hz resolution.

 

When you buy a module it will probably come with a straight header.

 

 

My board layout requires that you use a right-angle header.

 

 

 

 

This is how to use the Audio Tone Burst Generator

 

Mode Switch: Switch between Burst, Continuous Frequency, and two Sweep Modes;

 

   Press and release to change modes; Comes up in Burst Mode

 

 

 In Burst Mode you can control the delay between the bursts and the frequency of the burst. It starts in Delay control:

 

  INC - Press and release to increase the time between bursts (1 ms steps)

 

  DEC - Press and release to decrement the time Between bursts (1 ms steps)

 

 

 In Continuous Frequency Mode:

 

  INC - Press and release to increase the frequency

      - Press and hold for about 2 seconds to keep increasing the frequency; release to stop

 

  DEC - Press and release to decrement the frequency

      - Press and hold for about 2 seconds to keep decreasing the frequency; release to stop

 

  MODE - Press and release to select the frequency steps of 1 Hz, 10 Hz, and 100 Hz

 

 In Sweep Mode 1: It sweeps between 20Hz and 5KHz

 

 In Sweep Mode 2: It sweeps between 20Hz and 15KHz

 

The Header pin labeled “Sync” is for triggering an oscilloscope to measure the delay through the equipment you are testing. In Burst Mode it goes low at the beginning of the burst and goes high at the end of the burst. In Sweep mode it goes low at the beginning of the sweep (20 Hz) and goes high at 1KHz (about 800 ms). The sweep from 20 Hz to 5 KHz takes about 34 seconds.

 

The skill level for stuffing the board is: Intermediate. Make sure you use a temperature-controlled soldering iron. I use a temperature of 360 degrees Celsius. And don’t inhale the solder fumes. If you don’t have a fume hood use a fan to blow the solder fumes away from you.

 

To compile the source code I use the Raspberry Pi Pico SDK on Windows 10. I have written about it here.

 

The skill level to use the Raspberry Pi Pico SDK is: Advanced. (Maybe Really Advanced).

 

 

Software

 

Note 1 - Most of my variables are global. I don’t want to waste time passing pointers to variables that are global anyway. (I do use pointers for some things, like structures and strings.) If you submit programs like mine for a class assignment you will probably get a bad grade because you are not supposed to do it this way.

 

Note 2 -  The Pico compiler thinks integers are 32 bits so I am trying to use the C++ convention where the size is explicitly stated. I have not changed everything to this convention.

 

Name

C++

Bytes

Range

bool

 

1

true or false

signed char

int8_t

1

-128 to 127

unsigned char

uint8_t

1

0 to 255

short int

int16_t

2

-32768 to 32767

unsigned short int

uint16_t

2

0 to 65535

int

int32_t

4

-2147483648 to 2147483647

unsigned int

uint32_t

4

0 to 4294967295

long int

int32_t

4

-2147483648 to 2147483647

unsigned long int

uint32_t

4

0 to 4294967295

long long

int64_t

8

-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

unsigned long long

uint64_t

8

0 to 18,446,744,073,709,551,615

float

 

4

+/- 3.4e +/- 38 (~7 digits)

double

 

8

+/- 1.7e +/- 308 (~15 digits)

long double

 

8

+/- 1.7e +/- 308 (~15 digits)

wchar_t

 

2 or 4

1 wide character

 

 

Note 3 - I use the uart with a CH340/CH341 USB to TTL Adaptor. This is not “USB to Serial Port”. Serial Port is RS-232 which was originally a +22V/-22V signal level and used a DB25 connector. Later the voltage level was dropped to as little as +5V/-5V and a DB9 connector could be used. The CH340 is not that. The CH340 does TTL levels but +3.3V is supported. There is a USB connector on one end and a 6-pin header on the other. Select 3V3 with the Header Plug.

5V

Don’t Use

VCC

Header Plug

3V3

Header Plug

TXD

To My RXD

RXD

To my TXD

GND

To My GND

 

There are drivers for several operating systems: Windows 7, Windows 10, probably Windows 11, MAC, Linux. There does not appear to be drivers for Chromebook unless you make it a Linux machine. My Windows 10 PC already had the drivers for it. I use it with a freeware serial program called AccessPort from http://www.sudt.com/en/ap/index.html  If you use the keyboard check the box that says Real Time Send.

 

Files

 

I am providing the following files:

 

1.  Schematic: jm_pico-tone-burst-schematic.pdf

 

2.  Bill of Material: jm_pico-tone-burst-bom.pdf

 

3.  Source Code (in C) for Tone Burst Generator: jm_pico-tone-burst-source.zip 

 

4.  uf2 file for Tone Burst Generator: jm_pico-tbg.uf2 .

 

5.  Source Code (in C) for VCO: jm_pico-tone-burst-source-vco.zip         

 

6.  uf2 file for Pico VCO: jm_pico-tbg-vco.uf2 .

 

7.  Gerber files for the board: jm_pico-tone-burst-gerber.zip

 

 

Notes

 

1.  Trimpot R2 adjusts the contrast for the LCD Display.

 

2. The optimum length of the nylon standoffs for the LCD display is 11mm. That is a difficult length to buy. I use 10mm standoffs with a 1mm washer.

 

3.  I put the ICs in sockets. Always use sockets with machine-tooled pins. The sockets with leaf-springs are crap.

 

4.  The audio outputs are: Line Level and Microphone Level. If the Mic output are not exactly the level that you need you can change R12 and/or R13.

 

 

Happy Tone Bursting.

 

Jed Margolin

Virginia City Highlands

Nevada

4/24/2025

 

 

Documentation: 

 

A.  Raspberry Pi Pico - https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html

I am mirroring several of the documents.

 

1.  Pinouts: For a local copy Click Here

 

2.  RP2040 Datasheet: https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf

For a local copy Click Here

 

3. Getting Started with Raspberry Pi Pico (C/C++): https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf

For a local copy Click Here.

 

4. Raspberry Pi Pico C/C++ SDK. https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf

For a local copy Click Here.

 

5  Windows Installer:  https://www.raspberrypi.com/news/raspberry-pi-pico-windows-installer/

A one-click installer for the Pico C/C++ SDK for Windows 10 and Windows 11.

https://github.com/raspberrypi/pico-setup-windows/releases/latest/download/pico-setup-windows-x64-standalone.exe

 

B.  1602 LCD: https://www.digikey.com/htmldatasheets/production/1542762/0/0/1/hd44780u-lcd-ii-.pdf

For a local copy Click Here.

 

C.  MCP6001 family: https://ww1.microchip.com/downloads/en/DeviceDoc/MCP6001-1R-1U-2-4-1-MHz-Low-Power-Op-Amp-DS20001733L.pdf

For a local copy Click Here.

 

D.   Winbond W25Q16JV 3V 16M-Bit Serial Flash Memory with Dual/Quad SPI Interface

https://www.winbond.com/hq/support/documentation/downloadV2022.jsp?__locale=en&xmlPath=/support/resources/.content/item/DA00-W25Q16JV_1.html&level=1

For a local copy Click Here.

 

E.  Analog Devices AD9833 Datasheet. https://www.analog.com/media/en/technical-documentation/data-sheets/ad9833.pdf

For a local copy Click Here.

 

 

Addendum

 

A.  As a bonus I am posting a simple single-voice version of Gas Music From Jupiter. Gas Music From Jupiter uses an algorithm to produce a tune that starts from a seed, evolves over time, and ends up back where it started. The seed is a 16-bit number so there might be as many as 65,535 different tunes. Some tunes are more interesting than others. (OK, some are boring.) Some tunes start out being not very interesting, but after a few minutes evolve into something very nice. How are the tunes produced? The tunes are produced by an old family algorithm that has been handed down from generation to generation. In other words, it's a secret. So I am posting the uf2 file but not the source code. This version allows you to do four tunes. Press the pushbuttons to select them.

 

For the Gas Music From Jupiter uf2 file: jm_pico_gmfj.uf2 .

 

The full version is on my Web site at http://jmargolin.com/gmfj/gmfj.htm. It uses two midi voices where you can select a large variety of midi voices for each one. Sometimes it is more fun to try different midi voices than to try different tunes.

 

I originally wrote it for Windows 95. It runs in Windows 98 just fine. It runs in Windows Vista but not as well. It runs in Windows 7, Windows 10, and Windows 11 just fine.

 

B.  This has been my experience with Chinese Picos.

 

You can get Chinese Picos on AliExpress.com cheaper than the official Picos from U.S. distributors (typically for less than $2.00).

 

 

However, the unofficial Chinese Picos use a linear voltage regulator to get the USB +5V down to +3.3V. They use a series resistor to reduce the power dissipation in the linear regulator with the result that the voltage at VBUS is about 4.6V. They do not connect it directly to the USB voltage. Although the 4.6V seems to be enough for the 5V LCD I don’t recommend it.

 

The official Pico uses a switching regulator so you get the full 5V USB voltage at VBUS (assuming your USB port is providing 5V). The switching regulator also adds some unavoidable noise to the ADC.

 

This is the Official Raspberry Pi Pico. It has the Official Raspberry Pi Logo.

 

 

You can get Official Raspberry Pi Picos from AliExpress. Just make sure they have the Official Logo.

 

Also, about Chinese Picos:

 

1.  The official Pico has a row spacing of 0.7” (17.8mm). That is the spacing between the pins, not the width of the board. Some of the unofficial Chinese Picos have a row spacing of 0.6” instead of 0.7”.

 

2.  The unofficial Chinese Picos use USB-C, not USB-A. That’s ok, all the new stuff is USB-C.

 

3.  I bought four unofficial Chinese Picos from (I will call) Company A. The ADC did not work on any of them. Everything else on them seems to work, I have some projects that don’t use the ADC, and I paid $1.98 (each) for them. When the first one didn’t work I thought it was my code. Then I tried an official Pico and it worked just fine.

 

4.  I tried again (later) with Company B, buying five. Again, the ADC did not work on any of them. Everything else seems to work, and I paid $2.02 for them.

 

5.  Much later I bought five from Company C for $1.82 (each). The ADC worked fine on all of them.

 

On the other hand:

 

1.  The unofficial Chinese Picos have a Reset pushbutton on the module as well as the Boot pushbutton. You don’t have to unplug-and-replug the USB cable to get it into Boot Mode. This is useful because you can play with the Pico without needing my board (which has a Reset pushbutton on it). 

 

2.  The unofficial Chinese Picos come with the headers. (You still have to solder them yourself). The Chinese Picos that I got all came with a right-angle 4-pin header for the development port. That won’t fit with my board. You have to use a straight 4-pin header.

 

3.  The unofficial Chinese Picos come with at least 4MBytes of Flash and are available with even more. The official Pico comes with 2MBytes of flash. (My programs don’t come even close to needing 2MBytes.)

 

4.  It comes with a WS2812 RGB LED that uses complicated timing to select Red, Green, or Blue and which can be daisy-chained.  I guess it must be popular in China and they think it is popular here, too. Or maybe someone pranked them and told them that it is popular here.

 

 

C  To my fellow Makers in the United States. Trump has put an outrageous tariff (a tax) on goods coming from China. There might be an exception for electronics. If there is, it might or might not include blank PC Boards. Even if there is, it can change at any time. Sometimes every day. What is not likely to change is that Trump has discontinued the policy that packages with a value of $800 or less were not subject to tariffs and the accompanying standard Customs examination. That’s gone. And the standard Customs examination costs $35 (I expect that will go up). Companies in the United States that fabricate PC Boards charge from 20 to 100 times what boards from China were costing me. I am not buying from them. And because I do not post boards unless I have had them fabricated and I stuff them and test them I will not be posting new boards. There is no reason for me to design new boards that I know will probably never be fabricated so this is probably my last board.

 

I plan to spend my remaining time continuing to work on my Compact Nuclear Fusion Reactor and writing French poetry.

 

Meilleures salutations,

 

Jed Margolin

Virginia City Highlands

Nevada

USA

 

.end