21 Savage in MATLAB

A slecture by ECE student Jeff Rodrigues

Partly based on the [Spring 2019] lecture material of Boutin.

## Introduction

21 Savage is a prolific and talented artist. His debut studio album, "Issa Album", came with the lead single "Bank Account", which reached 12th on the Billboard Hot 100. This song is a suitable choice to reproduce in MATLAB, as it has a simple yet catchy tune.

## How it's Done

Playing the main track of "Bank Account" in MATLAB requires four notes: E, F#, A♭, and A. The frequencies of these notes in Hz are 329.63, 369.99, 415.3, and 440, respectively. These frequencies are designated in MATLAB along with a time step. Then, the note frequencies are ordered in a vector 'notes' according to the song, which is then used to input each frequency into a sine wave. The 'reshape' and 'soundsc' functions are used to process and then play the signal.

## The Code

clear all

Fs = 8000;

delta = 1/Fs;

t = 0:delta:0.4;

%Frequencies of the notes

E = 329.63;

A_flat = 415.3;

F_sharp = 369.99;

A = 440;

notes = [E; A_flat; F_sharp; A_flat; E; A_flat; F_sharp; A_flat; E; A_flat; F_sharp; A_flat; A; A_flat; E; A_flat; E; A_flat; F_sharp; A_flat; E; A_flat; F_sharp; A_flat; E; A_flat; F_sharp; A_flat; A; A_flat; E; A_flat];

x = sin(2*pi*notes*t);

song = reshape(x',32*length(t),1);

soundsc(song,1/delta)

## The result

Listen to the result here .

## Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra. Dr. Paul Garrett