MATLAB Answers

What's the meaning of instrucment sound in Matlab?

1 ビュー (過去 30 日間)
dachui wang
dachui wang 2019 年 11 月 9 日
Edited: John D'Errico 2019 年 11 月 10 日
I am super confused about how to add an instrument sound to a voice in Matlab? Literally, I don't know what the instrument sound is. Thanks in advance!

  1 件のコメント

Walter Roberson
Walter Roberson 2019 年 11 月 10 日
"instrument sound" is related to the characteristics that make one music instrument sound different from another kind of instrument. But in your particular case, you just need to read in a the sound of some musical instruments playing, and mix them with the sound of a human voice that you read in from a different file.

サインイン to comment.

件の回答 (1)

John D'Errico
John D'Errico 2019 年 11 月 10 日
編集済み: John D'Errico 2019 年 11 月 10 日
Let me just answer this as if you asked for an explanation of what a sound is in the world of MATLAB. For example, if we try:
load handel
what do we get?
Name Size Bytes Class Attributes
Fs 1x1 8 double
y 73113x1 584904 double
We get a simple vector of numbers, as well as the number Fs. If we then type:
then as long s your speakers are turned on, we will hear almost 9 seconds of a rendition of Handel's Hallelujah Chorus. Since Fs is the sample frequency in Hz, it should be 8.9249 seconds.
ans =
The vector is a string of bits, representing a monaural representation. (If it were stored as a stereo repreentation, then y would have been an Nx2 array, for the left and right channels respectively.) The vector y is scaled in the interval [-1,1], representing the mono audio signal.
So what is that audio signal? Sound would be seen as a pressure wave in the air, in this case, sampled at a rate of 8192 samples per second.
If we were to try
t = linspace(0,2*pi,8192);
then we would hear one second of a pure tone at 1000 Hz, sampled at 8192 Hz.
But we can actually add two such sounds, now hearing a slightly more complicated sound. Soundsc will automatically scale the result to [-1,1].
soundsc(sin(1000*t) + sin(500*t))
So, if you had two tracks of sound, one from someone singing and one of a guitar playing the same song and sampled at the same rate for the same length of time, then you could literally add the two tracks together.
Thus, while I don't have 8.9 seconds of an instrumental recording, I might do this:
S1 = load('handel');
S2 = load('gong');
soundsc(S1.y(1:42028) + S2.y)
and the result would be a few seconds of the chorus, with now a gong in the background.

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。




Translated by