(I made it)
Line 7: Line 7:
 
<center><font size= 4>21 Savage in MATLAB</font size>
 
<center><font size= 4>21 Savage in MATLAB</font size>
  
A [http://www.projectrhea.org/learning/slectures.php slecture] by [[ECE]] student Jeff Rodrigues (or anonymous if desired)
+
A [http://www.projectrhea.org/learning/slectures.php slecture] by [[ECE]] student Jeff Rodrigues
  
 
Partly based on the [[https://www.projectrhea.org/rhea/index.php/2019_Spring_ECE_301_Boutin|ECE301 Spring 2019]] lecture material of Boutin.
 
Partly based on the [[https://www.projectrhea.org/rhea/index.php/2019_Spring_ECE_301_Boutin|ECE301 Spring 2019]] lecture material of Boutin.
Line 13: Line 13:
 
----
 
----
 
----
 
----
==1. Introduction (''Replace by appropriate section title'')==
+
==Introduction==
Text of first section goes here. Here is an example of an equation.
+
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.  
<math> f(x)= \frac{1}{5} \sin x \int_{-\infty}^\alpha \pi^y dy</math>
+
  
 
----
 
----
==2. Derivation (''Replace by appropriate section title'')==
+
==How it's Done==
Text of second section goes here. Here is an example of a list
+
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.
*Blah
+
*Blih
+
*Bloh
+
**Blouh
+
  
 
----
 
----
==3. Example (''Replace by appropriate section title'')==
+
==The Code==
Text of third section goes here. Here is an example of a picture
+
clear all
  
[[Image:nature.jpg]]
+
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)
  
 
----
 
----
==4. Conclusion (''Replace by appropriate section title'')==
+
==References==
Text of fourth section goes here.
+
*https://www.youtube.com/watch?v=7N-kgbVjRuc - the song
----
+
*http://pages.mtu.edu/~suits/notefreqs.html - frequencies of notes
==5. References==
+
*Reference 1
+
*reference 2
+
 
----
 
----
 
----
 
----

Revision as of 22:57, 7 April 2019


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)


References



Questions and comments

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


[to 2019 Spring ECE 301 Boutin]


Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood