導航:首頁 > 源碼編譯 > 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錄音源碼相關的資料

熱點內容
androidapp調用另一個app 瀏覽:621
數控銑床法蘭克子程序編程 瀏覽:173
linux打包命令targz 瀏覽:996
抖音app是哪個 瀏覽:407
蘋果app怎麼上架 瀏覽:255
NA伺服器地址 瀏覽:427
我的世界如何初始化伺服器 瀏覽:97
哪個手機app天氣預報最准 瀏覽:752
怎樣把視頻壓縮至25m 瀏覽:570
vivox27文件夾怎麼改變 瀏覽:727
新手玩狼人殺用什麼app 瀏覽:615
pdf在線查看 瀏覽:954
安卓tv90如何關閉後台 瀏覽:683
php讀取word亂碼 瀏覽:755
minicom源碼 瀏覽:1001
海爾冷櫃壓縮機 瀏覽:416
聯通伺服器如何調試信號 瀏覽:136
stata新命令 瀏覽:941
單調棧演算法python 瀏覽:606
微信解壓游戲怎麼下載 瀏覽:962