Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

transforming matrix values and passing it into fucntion

1 visualización (últimos 30 días)
Avesta Molaei
Avesta Molaei el 21 de Nov. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hello,
I'm a MATLAB beginner and face quite an issue on a assignment. The goal of the assignement is to create music with functions the professor gave us. I managed to create a quite simple melody, but I would like to tackle something more complex: I wrote a simple melody in MIDI, openned it with a text editor and now I have a matrix of MIDI codes for the notes.
Now, the first step would be to translate those MIDI codes to frequencies: I know that . I want to create a vector/matrix containing the midicodes passed through this formula, and I can't seem to find the way to do it.
The next (and final?) step would be to pass those codes into the teachers function. It's called newsound(), and takes as an argument a frequency. It then creates the sound by adding one by one the frequency components, and other utility stuff.
Now, what I need to pass into the soundsc() function of MATLAB is the result of newsound() of all the individual frequencies in a matric called S. This is what I mean:
Let's say f[i] is the vector/matrix containing the frequencies translated from MIDI.
S is a 1*n sized matrix, 1 being the column, and n being the amount of frequencies.
S1= newsound(f1)
S2=newsound(f2)
......
Sn=newsound(fn)
Then, it is simply a matter of plugging S into soundsc with a given sampling frequency.
I would appreciate any help, thanks!

Respuestas (1)

Harsha Priya Daggubati
Harsha Priya Daggubati el 26 de Dic. de 2019
Hi,
I think you can just use the midicodes matrix you have in the formula for frequency you already mentioned, as far as I know that works fine. You can use the frequency matrix thus populated in your newsound function.

Productos


Versión

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by