打一个数组作为声音和录音输出并行 [英] Playing an array as sound and recording its output in parallel

查看:210
本文介绍了打一个数组作为声音和录音输出并行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道八度/ MATLAB可以播放阵列声音,但我想知道,如果倍频可以这样做:我想循环的频率范围,并有八度使用扬声器输出我的电脑上播放它们,并有八度还使用麦克风输入以获得最大的值记录的声音。我想自动化的方式必须通过频率倍频周期和记录收到这样我以后可以回去看一下谐振频率的数据。倍频可以做这种类型的操作并行?

我使用的是Ubuntu Linux操作系统的64位10.04与全双工声卡

例如:

 清除所有
T = linspace(0,1,44100);
A = 1; %的幅度
FS = 44100第II = 1:1:10
     频率=二; %多少在1秒
     T = 1 /频率;信号%,同期
     vertoffset = 0.5;
     方%
     平方= MOD(T * A / T,A)> A2;
     方方= - vertoffset;
     声音(方形,FS);
结束;


解决方案

这可以用做SOX
http://sox.sourceforge.net/

例如倍频程/ SOX code,这是否是
系统('玩/home/a_playback.wav | REC -c 1 -r 8000 -b 16 /home/a_record.wav修剪0 00:01')

I know Octave/MATLAB can play arrays as sound, but I was wondering if Octave can do this: I would like to cycle through a range of frequencies and have Octave play them using the speaker out on my computer, and have Octave also record the sound using the microphone input to get the max value. I'm trying to automate a way to have Octave cycle through frequencies and record the data received so I can go back later and look at the resonant frequencies. Can Octave do this type of operation in parallel?

I'm using Ubuntu Linux 10.04 64bit with a full duplex sound card

Example:

clear all
t=linspace(0,1,44100);
A = 1; % amplitude
Fs = 44100

for ii=1:1:10
     freq=ii; %how many in 1 sec
     T = 1/freq; % period of the signal
     vertoffset=0.5;
     % square
     square = mod(t * A / T, A) > A / 2;
     square = square - vertoffset;
     sound(square,Fs);
end;

解决方案

This can be done with SOX http://sox.sourceforge.net/

example of the octave/SOX code that does this is system('play /home/a_playback.wav | rec -c 1 -r 8000 -b 16 /home/a_record.wav trim 0 00:01')

这篇关于打一个数组作为声音和录音输出并行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆