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
{"ft_lang_label":"__label__en","ft_lang_prob":0.845361,"math_prob":0.92432535,"size":1609,"snap":"2020-24-2020-29","text_gpt3_token_len":490,"char_repetition_ratio":0.1694704,"word_repetition_ratio":0.08560311,"special_character_ratio":0.3101305,"punctuation_ratio":0.24054053,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98374164,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-06-04T16:20:25Z\",\"WARC-Record-ID\":\"<urn:uuid:e8bd6699-83a1-43c2-ba4d-b85eb2a49a48>\",\"Content-Length\":\"25776\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8581ff13-a97b-4b32-a919-7ec501abf26e>\",\"WARC-Concurrent-To\":\"<urn:uuid:77c49a09-aabf-4c6e-a16e-d42f659ace18>\",\"WARC-IP-Address\":\"128.46.104.5\",\"WARC-Target-URI\":\"https://www.projectrhea.org/rhea/index.php?title=2019_Spring_ECE_301_Boutin_21_Savage_in_MATLAB_Jeff_Rodrigues&oldid=76841\",\"WARC-Payload-Digest\":\"sha1:EIUHBDQT2XKPRPMKMR5MS32HW2OMHJJT\",\"WARC-Block-Digest\":\"sha1:CDZIHEM7NCTH4XMSVOBI7MXNJNAPWKH6\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-24/CC-MAIN-2020-24_segments_1590347445880.79_warc_CC-MAIN-20200604161214-20200604191214-00589.warc.gz\"}"}