How can I convert air pressure / time data to an audio file?

조회 수: 5 (최근 30일)
Lacin Sahin
Lacin Sahin 2019년 1월 21일
편집: Alberto Mora 2019년 1월 21일
I have got a data set (.txt) which consist of air pressure values (in Pa, Pascals) with a sampling rate of 200. How can I write this data to an audio file (.wav)?
What I've tried is:
1- I import the data into Matlab. There are different output types. I can import it as table, column vector, numeric matrix, string array or cell array. I guess the right one is numeric matrix, so I go with that one.
2- When I do that, it imports the data set as a "double" (I'm not sure what that means either but anyway).
3- The data I have has values such as: 12.579522758541621, -8.705727330368635, 0.004533738540940603 etc. These are in Pascals. However, when I use the audiowrite command, it normalizes the values to -1 and +1, which clips the audio, and this is not what I want. I guess I have to convert these values to something else, or some different data set, or scale these values. This is the point that I get lost. The script in Matlab named "handel.mat" has a data set that has values between -1 and +1 which works very well. How can I convert my data to that data type?
Thanks!
- Lacin

답변 (1개)

Alberto Mora
Alberto Mora 2019년 1월 21일
편집: Alberto Mora 2019년 1월 21일
Before ask on the comunity, I think that is better have a look on google.
Anyhow, here is the answer.
If this solution works, please remember to accept the answer in order to help other users.
Regars,
A

카테고리

Help CenterFile Exchange에서 Audio Plugin Creation and Hosting에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by