♫ Digital Audio Synthesis ♬
A Scilab-based audio synthesis engine that generates musical tones across six octaves using sine wave mathematics — from deep bass C1 to soaring C6.
Priyanka Gandhi A is an Electronics and Communication Engineering student (Roll No. 22UEL031) with a strong grasp of signal processing and digital audio systems. This project demonstrates the application of fundamental DSP concepts — sine wave synthesis, sampling theory, and frequency-domain analysis — implemented entirely in Scilab.
The Audio Tone Generator covers 7 musical notes (C through B) across 6 octaves, offering capabilities ranging from individual note playback to complex chord synthesis and melody sequencing. It bridges abstract mathematical theory with tangible, audible output.
Each tone is a pure sine wave computed as A·sin(2πft), where frequency f determines musical pitch across 6 octaves.
Digital audio is discretized at fs = 8000 Hz with a 0.5-second time vector, satisfying Nyquist for all generated frequencies.
Chords emerge by summing simultaneous sine waves. C Major = C + E + G — superposition of waveforms produces harmony.
Concatenating individual note arrays creates melodic sequences. The code plays a full scale by chaining C4→D4→E4→F4→G4→A4→B4.
// Project done by Priyanka Gandhi A (22uel031) clc; clear all; close; // Sampling frequency fs = 8000; t = 0:1/fs:0.5; // Time vector for 0.5 seconds k = 2; // Frequency scaling factor // ── C Notes (C1–C6) ────────────────────────── C1 = sin(2*%pi*k*33*t); C2 = sin(2*%pi*k*65*t); C3 = sin(2*%pi*k*130*t); C4 = sin(2*%pi*k*262*t); C5 = sin(2*%pi*k*523*t); C6 = sin(2*%pi*k*1047*t); // ── A Notes (A1–A6) ────────────────────────── A4 = sin(2*%pi*k*440*t); // Concert pitch A440 // ── Play higher octave tones ────────────────── sound(C5, fs); // Play C5 (523 Hz) sound(C6, fs); // Play C6 (1047 Hz) // ── Plot waveform ───────────────────────────── plot(t, C6); title('Waveform of C6 (1047 Hz)'); // ── Chord: Higher octave C major ────────────── notes_high = [C5; E5; G5]; sound(sum(notes_high, 'r'), fs); // ── Melody: Scale C5→G5 ─────────────────────── sound([C5, D5, E5, F5, G5], fs);
Every musical tone in the generator is mathematically described by the fundamental sine wave formula:
The sampling frequency (fs = 8000 Hz) must be at least twice the highest frequency to avoid aliasing:
The highest generated tone is B6 at 1976 Hz. Since 8000 Hz > 2 × 1976 = 3952 Hz, Nyquist is satisfied for all tones.
Each octave doubles the frequency. This logarithmic relationship is why musical intervals sound consistent across registers:
Chords are generated by summing individual sine waves. The principle of superposition gives us harmonic content:
The C major chord combines three sine waves at 262 Hz, 330 Hz, and 392 Hz — matching the harmonic series of Western music theory.
| Note | Frequency (Hz) | Scilab Expression (k=2) | Relative Range |
|---|
Full Scilab source code, waveform plots, and documentation available on GitHub.