필터 지우기
필터 지우기

Convert array into music

조회 수: 15 (최근 30일)
S. B. M.
S. B. M. 2022년 2월 15일
댓글: Walter Roberson 2022년 2월 16일
Hello. I have an array of music notes that I can access from ms excel using writetable/writematrix/etc.
I was wondering if it is possible to produce a sound from this as in like playing music. (I saw a question related to this but couldn't quite understand it as the code is long).
To be precise, I actually have a soundfont .sf2 file which is my sample of a custom instrument sound, say instrument X, and I want that sound to come out using this instrument (so not using any default song that MATLAB possibly uses). I have no idea if that is of any use, but my overall intention was to do something like this: 1. Extract that array of notes to MATLAB (the notes are already adjusted so that the soundfont can cover the whole range), 2. Play it with the sound of the custom instrument (where the columns simply represent the beats).
I am not sure if this is possible, but I saw one file on the file exchange page that manipulates soundfont, and so I am wondering about this whole thing.
Thank you so much for suggestions!
  댓글 수: 1
Star Strider
Star Strider 2022년 2월 15일
It may be necessary to use the Audio Toolbox for this. (I don’t have it, so I have no experience with it.)

댓글을 달려면 로그인하십시오.

채택된 답변

Cris LaPierre
Cris LaPierre 2022년 2월 16일
편집: Cris LaPierre 2022년 2월 16일
You can play sounds in MATLAB, but the way I know to do something like what your asking requires a little work. You need to define the frequency/frequencies of the notes, as well as how long to play each note. You then use the sound command to play the note for the specififed amount of time.
You will also need to pause your code while each note is playing, as the code does not stop executing.
See these answers for more:
If you really want to get into creating music, consider the materials in this 1 week course designed to introduce kids to programming
  댓글 수: 3
Cris LaPierre
Cris LaPierre 2022년 2월 16일
The way Bytes and Beats creates different musical instruments (guitar, violin, trumpet, percussion) is from a library of wav files of that instrument playing each note. With this approach, you would need a separate wav file for each duration. The approach to playing is the same (pause the code while playing a note).
Walter Roberson
Walter Roberson 2022년 2월 16일
Audio System Toolbox allows you to create a "system object" that you can fill with samples at run-time without having to pause.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by