音声データ(1次元デ​ータ)からデータを一​部を抽出する方法につ​いて

11 views (last 30 days)
一秀 近藤
一秀 近藤 on 1 Nov 2022
Commented: 一秀 近藤 on 2 Nov 2022
[x,fs]=audioread("output3.wav")
音声データからデータの一部を抜き取る方法を教えていただきたいです。(1~50000点など)
簡単な質問になりますがご教授のほどよろしくお願いします。

Answers (1)

Atsushi Ueno
Atsushi Ueno on 1 Nov 2022
load handel.mat
audiowrite("output3.wav",y,Fs); % サンプル handel.mat の音声データをファイルに書き込んだ
clear y Fs
[x,fs] = audioread("output3.wav"); % 再度ファイルを読み取る
size(x) % このサンプル handel.mat の音声データは73113点の長さがある
ans = 1×2
73113 1
y = x(1:50000);
size(y) % データの一部(1~50000点)を抜き取った
ans = 1×2
50000 1
sound(y,fs); % 曲の途中で止まる事を確認できる
  1 Comment
一秀 近藤
一秀 近藤 on 2 Nov 2022
わかりやすい回答ありがとうございました!参考にさせていただきます!

Sign in to comment.

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!