Matlab实现《追光者》简谱

MATLAB除了生孩子,其他全都能做系列。

使用MATLAB进行播放《追光者》,纯文本内容哦。

1 Fs = 8192;
2 load y;
3 sound(y, Fs);

加载的y是哪里来的呢?当然是调用函数生成的咯。

function y = gen_wave(tone, rythm, type)
    Fs = 8192;
    freqs = [261, 293, 329, 349, 392, 440, 494, 523, 587, 659, 698, 783, 880, 988, 1046, 1174, 0];
    x = linspace(0, 2 * pi * rythm, floor(Fs * rythm));
    if type == 1
        y = sin(freqs(tone) * x);
    else
        y = sin(freqs(tone) * x) .* (1 - x / (2 * pi * rythm));
    end
end

y中的内容就不展示了,全是数据。

链接:!!!!!

链接:https://pan.baidu.com/s/1NPh4SaAJZ3ZMiN2M98vL6g
提取码:8qpu

猜你喜欢

转载自www.cnblogs.com/Super-Lee/p/10662723.html