After we installed the latest edition of Raspbian to try BitScope on the Raspberry Pi we started having a look around and were delighted to find Sonic Pi was pre-installed.
Sonic Pi is a sound programming environment developed specifically to teach programming concepts where sound synthesis provides the medium for learning how to program.
We like this idea a lot but we also saw another educational possibility; Sonic Pi makes for an excellent complex waveform generator which is easy to use. It's the perfect tool to help explain what an oscilloscope and spectrum analyzer can do and how they can be used to analyze complex waveforms.
Waveform analysis is a very big topic so we're launching an educational blog to cover it and others in more detail soon.
For now, we thought we'd have a brief look at what Sonic Pi can do in terms of basic waveform generation. The first step was to connect the audio output of Raspberry Pi to a BitScope (BitScope Mini in this case). We rigged up an adapter to plug in a stereo 3.5mm jack terminated stereo cable between them but we could have used the standard test probes and a bare 3.5mm socket.
The BitScope is connected to and powered by the Raspberry Pi and it runs both the Sonic Pi programming environment and the BitScope DSO software. We're using an HDMI connected TV as the monitor so we need to switch the audio from HDMI to the stereo output using this command:
sudo amixer cset numid=3 1
which we executed in a terminal. The "1" selects the headphone output. Use "2" to switch back to HDMI or "0" to automatically switch (although we found this did not appear to switch to headphone when we were not using HDMI).
Next we powered up Sonic Pi, power up BitScope DSO, and set it to trace on channel A at 50ms/Div and played the first sound using the play 60 command.
This produced the waveform shown at the top of this page. Sonic Pi calls it pretty_bell and it is indeed a pretty bell sound which you can see looks like an exponentially decaying waveform. It sounds like a bell so we know it cannot be a single sinusoidal waveform so let's have a closer look and see what it is.
Here we can see the start of the bell playing. It comprises two sinewaves summed.
The play 60 command outputs C4 (Middle C) which is 261.63Hz. The fundamental period is therefore 3.83ms which appears correct looking at the timebase grid of 2ms/Div.
The second sinusoid has four cycles per period of the fundamental. It is four times the frequency of the fundamental (1046Hz) and its amplitude is quite high relative to the fundamental which is what produces the bell like tone of the sound.
So far we have viewed the waveform on a normal oscilloscope display in two different timescales. The waveform period and frequency measurements we made are estimates only.
In a future post we'll explain how to use the spectrum analyzer, cursors and automatic waveform parameters to make more precise measurements of these and many other waveform characteristics. We'll investigate and "reverse engineer" how Sonic Pi works to produce the sounds it does and we'll look at some of the practical limitations from a sound synthesis point of view.
|Build a powerful mixed signal workstation with one simple 3D print !||Sep 3|
|Raspberry Pi Zero W, a wireless wonder for only $10 !||Feb 28|
|Raspberry Pi 3 Launch and BitScope Blade||Feb 29|
|Physical Computing with Raspberry Pi and BitScope!||Dec 01|
|BitScope Micro with Raspberry Pi Touchscreen Display!||Sep 09|
|BitScope, Ozberry & Pimoroni at Sydney Mini Maker Faire!||Aug 12|
|Picademy Workshop with Carrie Anne Philbin||Jul 27|
|BitScope Blade for Raspberry Pi at Hannover Maker Faire!||Jun 05|
|BitScope DSO 2.9 Now Available.||Jun 02|
|Getting Started with BitScope||May 08|
|BitScope Micro In-Line Data Acquisition||Apr 02|
|Bootstrapping Raspberry Pi 2 for BitScope||Feb 05|
|Raspberry Pi 2 and BitScope Performance||Feb 02|
|Raspberry Pi Model A+ or B+ or B+ Slimline?||Nov 14|
|BitScope Model 10 or BitScope Micro?||Apr 25|
|BitScope Micro, what's in the box?||Apr 17|
|BitScope Micro Questions & Answers||Apr 12|
|BitScope Micro (New Product) for Raspberry Pi!||Apr 11|
|BitScope Workshop at OzBerryPi||Apr 8|
|How to Install BitScope DSO on Raspberry Pi||Oct 18|
|Electronic Projects Lab for Raspberry Pi||Oct 17|
|BitScope Ed, an Educational Blog about Electronics.||Oct 09|
|BitScope Software Blog Launched||Oct 04|
|How to Install Raspbian and BitScope on Raspberry Pi||Sep 29|
|BitScope Software for Raspberry Pi Oscilloscope||Sep 27|
|BitScope Raspberry Pi Oscilloscope||Sep 25|