Você está na página 1de 3

Departamento de Electrónica, Telecomunicações e Informática

Sistemas Multimédia

Trabalho para Casa no 3: Sı́ntese de uma Pauta Musical

Na figura 1 podemos observar uma partitura constituı́da por duas pautas. Na pauta de
cima pode-se observar uma sequência de notas musicais de C4 a G5 . A nota C5 está uma
oitava acima da nota C4 , ou seja a sua frequência é o dobro. Dado que existem 12 notas
por oitava, a razão entre as notas é

r12 = 2 ⇒ r = 21/12 ≈ 1.0595 (1)

tal como se pode observar na tabela 1. Esta razão designa-se por meio tom. Nesta tabela
estão representadas as notas sustenidas e a relação entre a notação Anglo-Saxónica (A, B,
etc.) e a usada em Portugal (Dó, Ré, etc.).

Figura 1: Pauta musical retirada da Wikipedia

Lá A3 220Hz
Lá# A3 # 233Hz
Si B3 247Hz
Dó C4 262Hz
Dó# C4 # 277Hz
Ré D4 294Hz
Ré# D4 # 311Hz
Mi E4 330Hz
Fá F4 349Hz
Fá# F4 # 370Hz
Sol G4 392Hz
Sol# G4 # 415Hz

Tabela 1: Tabela das notas musicais

Na figura 2 podemos observar a distribuição das notas musicais pelo teclado de um piano.
A nota A4 (Lá na notação mais usual em Portugal) tem uma frequência de 440Hz.

1
 

         

             
             

 

Figura 2: Oitava 3 e 4 de um teclado de piano com indicação da frequência de algumas das notas

Uma pauta musical é uma forma gráfica de representar a variação das componentes de
frequência de um sinal ao longo do tempo. Trata-se de um conceito semelhante ao do
espectrograma.
Neste trabalho pretende-se que cada aluno elabore um programa em Matlab que “toque”
as notas de uma partitura musical à escolha. Partituras de músicas conhecidas e simples
podem ser encontradas■no seguinte
CHAPTER link. Não é obrigatório que10 os tempos da melodia
3 – BASIC OPERATIONS

gerada sejam respeitados, apenas


» nmat
Midi Toolbox para Matlab
a sequência das notas e a sua frequência.
nmat =
0 0.9000 1.0000 64.0000 82.0000 0 0.5510
MIDI •  Toolbox
1.0000 desenvolvida
0.9000 1.0000pelo departamento
71.0000 89.0000 de música
0.6122 da
0.5510
universidade
2.0000
2.5000
de
0.4500
0.4500
Jyväskylä
1.0000
1.0000
na Finlândia.
71.0000
69.0000
82.0000
70.0000
1.2245
1.5306
0.2755
0.2755
3.0000 0.4528 1.0000 67.0000 72.0000 1.8367 0.2772
•  Para3.5000
Em alternativa os alunos opodem
trabalho para casa nº3
0.4528recorrer
1.0000 apenas
à toolbox
66.0000 interessa
midi
72.0000 a função
para
2.1429 Matlab desenvolvida pela
0.2772
4.0000 0.9000 1.0000 64.0000 70.0000 2.4490 0.5510
readmidi.
universidade de Jyväskylä
5.0000 na0.9000
Finlândia.
0.9000 1.0000 Esta toolbox
66.0000 79.0000 disponibiliza
3.0612 0.5510 a função readmidi
6.0000 1.0000 67.0000 85.0000 3.6735 0.5510
que permite passar• para
Disponível
7.0000 no endereço
uma variável
1.7500 do Matlab
1.0000 66.0000 a informação
72.0000 4.2857 contida num ficheiro MIDI
1.0714

https://www.jyu.fi/hum/laitokset/musiikki/en/research/coe/materials/miditoolbox
com o seguinte formato: As
We see colunas
that the variable nmatcomcontainsmais interesse
a 7 x 10 matrix paraTheo trabalho são a “MIDI
filled with numbers.
columns refer to various types of information such as MIDI pitch and MIDI channel.
•  Utilização: nmat
The rows stand for the=individual
readmidi('laksin.mid');
note events (in this case, the melody has 10 notes
■ CHAPTER
and 3 – is
each of them BASIC OPERATIONS
described 10
in terms pitch, onset time, duration, volume and so
nota
forth). The labels of the columns are as follows: inicio duração

ONSET » nmat
DURATION MIDI MIDI VELOCITY ONSET DURATION
(BEATS) (BEATS) channel PITCH (SEC) (SEC)
nmat =
The0 first column 0.9000indicates1.0000
the onset of the notes in82.0000
64.0000 beats (based0on ticks per0.5510
quarter
note)
1.0000and the 0.9000
second column the duration
1.0000 of the notes
71.0000 in these same
89.0000 beat-values.
0.6122 0.5510 The
third
2.0000column denotes
0.4500 the MIDI
1.0000 channel (1-16),
71.0000 and the fourth
82.0000 the MIDI
1.2245 pitch, where
0.2755
middle
2.5000 C (C4)0.4500
is 60. The1.0000
fifth column is the velocity
69.0000 describing1.5306
70.0000 how fast the key of
0.2755
the3.0000 0.4528
note is pressed, 1.0000
in other 67.0000
words, how 72.0000
loud the note is played 1.8367
(0-127). The0.2772
last two
3.5000 0.4528 1.0000 66.0000 72.0000 2.1429
columns correspond to the first two (onset in beats, duration in beats) except that
Módulo 3 – parte I de Sistemas Multimédia 0.2772 34
4.0000are used
seconds 0.9000
instead of1.0000
beats. 64.0000 70.0000 2.4490 0.5510
5.0000 0.9000
Figura 3: Significado das1.0000 66.0000
colunas mais79.0000 3.0612 para
importantes 0.5510 o trabalho.
6.0000 0.9000 1.0000 67.0000 85.0000 3.6735 0.5510
Often one wants
7.0000
to refer only
1.7500
to pitch66.0000
1.0000
or duration values
72.0000
in the notematrix.
4.2857
For clarity
1.0714
and convenience, these columns may be called by few basic selector functions that
refer
We toseeeach
thatspecific column only.contains
These are
a 7onset (eitherfilled with or
'beat' 'sec',The the
PITCH” que tem a informação da frequência da nota a tocar, a “ONSET (SEC)” que tem
former
columns
the variable
is refer
the default ), dur
to various
nmat
types (ofeither 'beat'
information
x 10 matrix
such or as'sec'),
MIDI pitch channel,
numbers.
and MIDI pitch,
channel.
o instante inicial (em segundos) para começar a tocar a nota e a “DURATION (SEC)” que
and
the
rows stand. For
Thevelocity
notematrix
and each of them
example,
for the note events returns
pitch(nmat)
individual
is described inreturns
and onset(nmat) terms only
(in this only
pitch,the
case,the
onsettime,
onset times
theMIDI notes
melody
(in beats)
duration,
hasvalues
of the and
volume
of
10 notes
events
so
tem a duração da nota em segundos. A informação das notas está em código e a nota C4
inforth).
the notematrix.
The labels of the columns are as follows:

corresponde ao númeroCollection
60.
ONSET Paraformat
DURATION mais
(BEATS) (BEATS) channel
MIDIinformaç MIDI
PITCH
ões
VELOCITYconsultar
ONSET DURATION o manual na página www
Large corpora of music are more convenient to process in Matlab(SEC)
if they are(SEC)
stored in
dedicada à toolbox. Matlab’s
The firstown cell indicates
column structuresthe
rather
onsetthan keeping
of the notes them as (based
in beats MIDI files that per
on ticks are quarter
loaded
separately
note) andforthethe analysis.
second Youthe
column canduration
store multiple notematrices
of the notes in these in cellbeat-values.
same structures from
The
a third
directory
columnof MIDI
denotesfiles
theby using
MIDI (1-16), and function.
dir2cellmatr
channel the fourthThe
the function
MIDI pitch,processes
where
allmiddle
MIDI C files in is
(C4) the60.
current directory
The fifth columnandisstores the notematrices
the velocity describingand
howthe filenames
fast in
the key of
the
thevariables of your choice:
note is pressed, in other words, how loud the note is played (0-127). The last two
Envolvente columns correspond to the first two (onset in beats, duration in beats) except that
seconds» are
[demo_collection,filenames]
used instead of beats. = dir2cellmatr;

After
Oftencreating celltomatrix
one wants structure
refer only of the
to pitch MIDI files,
or duration individual
values notematrices
in the notematrix. can be
Os alunos que o pretendam
called podem
by the following
and convenience,
gerar
theseconvention:
uma envolvente paraForcadaclarity
columns may be called by few basic selector functions that
nota musical de modo
refer to each specific
a tornar o som mais agradável. A column only. These arede
envolvente onset (either 'beat' or 'sec', the
cada nota musical pode ser definida por
former is the default), dur (either 'beat' or 'sec'), channel, pitch,
and velocity. For example, pitch(nmat) returns only the MIDI notes values of
■ MIDI Toolbox ■
the notematrix and onset(nmat) returns only the onset times (in beats) of the events
in the notematrix.

Collection format 2
Large corpora of music are more convenient to process in Matlab if they are stored in
Matlab’s own cell structures rather than keeping them as MIDI files that are loaded
separately for the analysis. You can store multiple notematrices in cell structures from
a directory of MIDI files by using dir2cellmatr function. The function processes
quatro tempos diferentes tal como se pode ver na figura 4.


   

Figura 4: Envolvente de uma nota musical que torna o som mais realista

Você também pode gostar