Revision as of 14:36, 26 April 2019 by Mboutin (Talk | contribs)


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 . .



References



Questions and comments

If you have any questions, comments, etc. please post them here.


[to 2019 Spring ECE 301 Boutin]


Alumni Liaison

Recent Math PhD now doing a post-doctorate at UC Riverside.

Kuei-Nuan Lin