Coder Social home page Coder Social logo

music-synthesis-matlab's Introduction

Ad Soyad: İsa Kaan Erdoğan
Öğrenci Numarası: 030114028
Ders Adı: BIM - 311 Sinyal İşleme
Proje: MATLAB ile Sentezleme

Sentezleme İçin Gerekli Sütunlar

Müziği sentezleyebilmek için verinin ~~1.~~ 2. 4. 6. ve 7. sütunlara ihtiyaç olduğunu düşünüyorum. ~~1.Sütun notanın başlangıcını belirtiyor. Bu sütunun 1. değerinden itibaren aldığımız bir döngü ile bütün notaları çaldırabiliriz.~~
(1.Sütun gereksiz kaldı. Yanlış algoritma length(parse) fonksiyonu ile düzeltildi.)
2.sütun tempo cinsinden süreyi belirtiyor. Notaların hızlı veya yavaş olarak çalınması gerektiği burada belirtiliyor. Harmonik olarak güzel bir müzik deneyimi yaşatmaz ancak aksatmadan da müziği çalabilmemizi sağlar.
4.sütun notaların değerlerini gösteriyor. Ufak bir hesaplama ile bu değerlerden o notaların frekanslarını çıkartıp frekanslar üzerinde işlem yapmamız gerekiyor.
6.sütun ilk notadan başlayarak o notanın kaçıncı saniyede çalındığını gösteriyor.
7.sütun ise notanın kaç saniye çalınacağını saniye cinsinden söylüyor. Yani 6. sütundaki değere 7. sütundaki değer her seferinde ekleniyor.
Başlangıç olarak bu sütunlar işimize yarayacak olan sütunlardır.

Kodlar Hakkında Açıklamalar

note.m dosyası

parse=parseMusicXML('muzik/nota.musicxml');

sentez.m dosyası

note; %note.m çağrılır. parse değişkeni burada

LoP = length(parse); %parse'ın uzunluğu alınır
midiChannel=parse(:,3); % İlgili sütun değişkene atanır
midiPitch=parse(:,4); % İlgili sütun değişkene atanır
midiVelocity=parse(:,5); % İlgili sütun değişkene atanır
noteOnset = parse(:,6); % İlgili sütun değişkene atanır
noteDuration = parse(:,7); % İlgili sütun değişkene atanır
timeSigniture=parse(:,10); % İlgili sütun değişkene atanır

freq=(440/32)*2.^((midiPitch-9)/12); % midi Pitch den frekans çevirme hesaplaması şarkının bütün notaların frekansları bu değişkene atanır


VoFF=freq(1,:); %İlk değer seçilir
VoFL=freq(end); %Son değer seçilir.
VoNF=noteDuration(1,:); %İlk değer seçilir
VoNL=noteDuration(end); %Son değer seçilir
%
%freq değişkeninin ilk değeri bir değişkene atanır. Amaç döngüde i'nin ilk
%değerini belirlemek. 
%
%Başka bir değişkene ise freq değişkeninin son değeri
%atanır. Amaç i'nin son değerini belirlemek
%
%tt değişkeni içerisinde kullanacağımız notaların süreleri olan
%noteDuration için ise ilk değeri VoNF'ye son değeri VoNL'ye olmak
%koşuluyla atandı.
%
%
Fs=44100;
Ts=1/Fs;
t=0:Ts:.4;
x = cos(2*pi*freq*t); 
sig = reshape(x',length(freq)*length(t),1);
sound(sig,Fs)

music-synthesis-matlab's People

Contributors

kaanerdogan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.