导航:首页 > 源码编译 > pulseaudio录音源码

pulseaudio录音源码

发布时间:2022-08-05 01:53:38

linux Mint 13 Sound Recorder报错不能启动

1.试试 apt-get install
2.google该工具官方页面

Ⅱ ubuntu alsa声音独占问题怎么解决

Ubuntu下应用程序独占音频声道的问题解决【方法一】(针对无声或音频独占)干掉Pulseaudio,只使用Alsa执行以下命令:sudo apt-get install alsa-oss libasound2 libasound2-pluginssudo mv /etc/X11/Xsession.d/70pulseaudio ~/gconftool-2 -s -t bool /apps/gnome_settings_daemon/plugins/sound/active false#注意:gconftool-2 false 整个是一条命令,请输入在同一行。asoundconf unset-pulseaudiosudo update-rc.d -f pulseaudio remove然后执行asoundconf list输出应该是类似这样的情形:Names of available sound cards:Intel(记下你的声卡名,比如这里的Intel)然后执行:asoundconf set-default-card Intel(Intel请替换为你的声卡名)(补充:个别用户会出现真正的声卡名和HDMI两个选项,请注意不要选HDMI(除非你输出到液晶电视))如果想保留登入时的系统提示音,请编辑~/.bashrc文件:gedit ~/.bashrc在文件末尾加上:export SDL_audiodriver=alsa最后,打开系统->首选项->音效,将从上往下数前四个选项都选成 ALSA - Advanced Felix注:经测试,不这么做好像也没问题。至此,屏蔽pulseaudio并设置alsa已经完全解决。【方法二】(针对音频独占)我们让已经在成功运行于PulseAudio的继续使用PulseAudio。只支持ALSA的软件,继续使用ALSA。解决方法:gksu gedit /etc/pulse/default.pa找到:#load-mole mole-alsa-sink 改为load-mole mole-alsa-sink device=dmix找到:load-mole mole-suspend-on-idle改为#load-mole mole-suspend-on-idle(重新logout再login)另外:找到: (解决录音问题,如skype和audacity)load-mole mole-hal-detect改为:#load-mole mole-hal-detect这样,通过使用dmix,PulseAudio就不会霸占整个audio系统。PulseAudio将成为alsa的其中一个Mix Channel。然后,ALSA和PulseAudio便能很好地共存。以后都不再需要什么libflashsupport for pulseaudio了。还有,安装PulseAudio的控制器,好好享受PulseAudio的优势吧。sudo apt-get install padevchooser【方法三】(针对无声)(注:如果点击屏幕右上的小喇叭图标,出现一个错误提示,则可以直接采用此方法)如果以上设置仍然无效,可以尝试下载编译安装新版的alsa(注:安装之前,请确认自己的内核为源里的最新版)首先到/下载最新的alsa-driver,alsa-lib和alsa-utils。假设下载的文件放在~/alsa (/home/用户名/alsa)。首先进行解压:tar jxvf alsa-driver-xxx.tar.bz2tar jxvf alsa-lib-xxx.tar.bz2tar jxvf alsa-utils-xxx.tar.bz2然后分别编译安装cd ./alsa-driver-xxx./configure && makesudo make installcd ../alsa-lib-xxx./configure && makesudo make installcd ../alsa-utils-xxx./configure && makesudo make install重启计算机(注意不是重启X)

Ⅲ ubuntu怎么用audacity

使用HTK过程中,第一步使用HSLab录音和标签功能时,提示找不到/dev/dsp。显然只有旧的内核才支持OSS声音架构。最新的ALSA是没法被HSLab使用的。怎么办呢?网上提供了一些解决方法,但都不太彻底。索性换个思路,使用其他软件来替换录音和标签功能。很容易就选中了Audacity。
图文并茂的教程:Audacity 音频编辑器教程 http://teliute.org/linux/Teauda/lesson7/lesson7.html
遇到了问题。pulseaudio服务器的问题。
sudp apt-get install audacity 安装很顺利。可是一直有一个问题没解决,就是录音文件存哪里去了?Audacity 录音放哪里了。看来还是命令行的思路。
audacity录音后,可以通过菜单下面的file-export来存到磁盘。

http://yulife.blog.163.com/blog/static/120333049200972810395446/ 录音质量问题: ubuntu 下的录音软件Audacity
http://www.voxforge.org/home/forums/message-boards/speech-recognition-engines/can-htk-only-process-the-audio-files-generated-by-hslab-the-.sig-format 老外遇到类似问题

1.安装并打开pavucontrol(pulse音频管理程序)
2.打开Audacity,设置音频主机平台为ALSA,输出为default,录音音频输入default:
3.按下audacity,在pavucontrol的录音选项卡,将audacity的录音来源设置为:moniter
4.如果进行以上操作后,仍然无法录音,则删除 ~/.pulse,再重新启动机器修复pulse音频管理再试试。
在删除~/.pulse目录后,运行pavucontrol 提示。How to fix “connection to pulseaudio failed”

logout/login就可以了。

再不行的话,另一个解决思路:在使用cmusphinx 时,用到了一个录音工具:

Ⅳ ubuntu怎么安装audio插件

使用如下命令:

sudo apt-get install libpulse-dev

安装时会提示依赖于下面这几个软件,一并安装即可:

libavahi-client-dev libavahi-common-dev libpulse-mainloop-glib0 libpulse0

这个也可以上packages.ubuntu.com官方网址查询libpulse-dev软件的依赖关系,相关链接如下:

http://packages.ubuntu.com/raring/libpulse-dev

如下图所示:

二、pulseaudio库的使用(同步simple API)

pulseaudio官网有关于pulseaudio的API doxygen使用手册,网址如下:

http://freedesktop.org/software/pulseaudio/doxygen/

1、播音sample

A simple playback tool using the simple API

//pacat-simple.c
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <pulse/simple.h>
#include <pulse/error.h>
#define BUFSIZE 1024
int main(int argc, char*argv[]) {
/* The Sample format to use */
static const pa_sample_spec ss = {
.format = PA_SAMPLE_S16LE,
.rate = 44100,
.channels = 2
};
pa_simple *s = NULL;
int ret = 1;
int error;
/* replace STDIN with the specified file if needed */
if (argc > 1) {
int fd;
if ((fd = open(argv[1], O_RDONLY)) < 0) {
fprintf(stderr, __FILE__": open() failed: %s\n", strerror(errno));
goto finish;
}
if (p2(fd, STDIN_FILENO) < 0) {
fprintf(stderr, __FILE__": p2() failed: %s\n", strerror(errno));
goto finish;
}
close(fd);
}
/* Create a new playback stream */
if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_PLAYBACK, NULL, "playback", &ss, NULL, NULL, &error))) {
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
goto finish;
}
for (;;) {
uint8_t buf[BUFSIZE];
ssize_t r;
#if 0
pa_usec_t latency;
if ((latency = pa_simple_get_latency(s, &error)) == (pa_usec_t) -1) {
fprintf(stderr, __FILE__": pa_simple_get_latency() failed: %s\n", pa_strerror(error));
goto finish;
}
fprintf(stderr, "%0.0f usec \r", (float)latency);
#endif
/* Read some data ... */
if ((r = read(STDIN_FILENO, buf, sizeof(buf))) <= 0) {
if (r == 0) /* EOF */
break;
fprintf(stderr, __FILE__": read() failed: %s\n", strerror(errno));
goto finish;
}
/* ... and play it */
if (pa_simple_write(s, buf, (size_t) r, &error) < 0) {
fprintf(stderr, __FILE__": pa_simple_write() failed: %s\n", pa_strerror(error));
goto finish;
}
}
/* Make sure that every single sample was played */
if (pa_simple_drain(s, &error) < 0) {
fprintf(stderr, __FILE__": pa_simple_drain() failed: %s\n", pa_strerror(error));
goto finish;
}
ret = 0;
finish:
if (s)
pa_simple_free(s);
return ret;
}

2、录音sample

A simple recording tool using the simple API

//parec-simple.c
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <pulse/simple.h>
#include <pulse/error.h>
#define BUFSIZE 1024
/* A simple routine calling UNIX write() in a loop */
static ssize_t loop_write(int fd, const void*data, size_t size) {
ssize_t ret = 0;
while (size > 0) {
ssize_t r;
if ((r = write(fd, data, size)) < 0)
return r;
if (r == 0)
break;
ret += r;
data = (const uint8_t*) data + r;
size -= (size_t) r;
}
return ret;
}
int main(int argc, char*argv[]) {
/* The sample type to use */
static const pa_sample_spec ss = {
.format = PA_SAMPLE_S16LE,
.rate = 44100,
.channels = 2
};
pa_simple *s = NULL;
int ret = 1;
int error;
/* Create the recording stream */
if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_RECORD, NULL, "record", &ss, NULL, NULL, &error))) {
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
goto finish;
}
for (;;) {
uint8_t buf[BUFSIZE];
/* Record some data ... */
if (pa_simple_read(s, buf, sizeof(buf), &error) < 0) {
fprintf(stderr, __FILE__": pa_simple_read() failed: %s\n", pa_strerror(error));
goto finish;
}
/* And write it to STDOUT */
if (loop_write(STDOUT_FILENO, buf, sizeof(buf)) != sizeof(buf)) {
fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));
goto finish;
}
}
ret = 0;
finish:
if (s)
pa_simple_free(s);
return ret;
}

3、编译含有pulseaudio库的时候,需要添加pulseaudio的动态链接库-libpulse等,

(可以在/usr/lib/i386-linux-gnu/目录下找到pulse的动态库

/usr/lib/i386-linux-gnu/libpulsecommon-1.1.so
/usr/lib/i386-linux-gnu/libpulsedsp.so
/usr/lib/i386-linux-gnu/libpulse-mainloop-glib.so
/usr/lib/i386-linux-gnu/libpulse-mainloop-glib.so.0
/usr/lib/i386-linux-gnu/libpulse-mainloop-glib.so.0.0.4
/usr/lib/i386-linux-gnu/libpulse-simple.so
/usr/lib/i386-linux-gnu/libpulse-simple.so.0
/usr/lib/i386-linux-gnu/libpulse-simple.so.0.0.3
/usr/lib/i386-linux-gnu/libpulse.so
/usr/lib/i386-linux-gnu/libpulse.so.0
/usr/lib/i386-linux-gnu/libpulse.so.0.13.5)

例如:

gcc -o pacat-simple pacat-simple.c -lpulse -lpulsecommon-1.1 -lpulse-simple

三、ALSA音频库

ALSA全称为:Advanced Linux Sound Architecture

一个网址为:http://www.alsa-project.org/main/index.php/Main_Page

阅读全文

与pulseaudio录音源码相关的资料

热点内容
u盘备份linux 浏览:120
高压缩比活塞 浏览:92
压缩弹簧标准件 浏览:25
linux统计个数命令 浏览:292
cad转pdf居中 浏览:8
编译型语言处理过程 浏览:325
手机创文件夹复制到电脑 浏览:984
有什么直播APP可以看那种 浏览:41
程序员叫什么人 浏览:378
python画地图等高线 浏览:751
epic永劫无间是什么服务器 浏览:444
网游服务器下载地址 浏览:107
macphpfreetype安装 浏览:644
设计道pdf 浏览:615
单片机kill4软件下载收费吗 浏览:846
苹果手机怎么连接RMS服务器 浏览:603
cisco路由器基本配置命令 浏览:187
android状态栏颜色透明 浏览:117
db2编译工具 浏览:181
腾讯云服务器创建环境 浏览:567