Naudio WasapiLoopbackCapture分割通道录制

时间:2019-02-22 21:15:12

标签: c# split naudio channel wasapi

我正在尝试使用NAudio的<IfModule pagespeed_module> ModPagespeed on # using commands,filters etc </IfModule> # BEGIN WpFastestCache <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTPS} =on RewriteCond %{HTTP_HOST} ^tilsonpr.com # Start WPFC Exclude # End WPFC Exclude # Start_WPFC_Exclude_Admin_Cookie RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=admin|smg|team # End_WPFC_Exclude_Admin_Cookie RewriteCond %{HTTP_HOST} ^tilsonpr.com RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot) RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot) RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{REQUEST_URI} !(\/){2}$ RewriteCond %{REQUEST_URI} \/$ RewriteCond %{QUERY_STRING} !.+ RewriteCond %{HTTP:Cookie} !comment_author_ RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC] RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or] RewriteCond /home/tilsonpr/public_html/wp-content/cache/all/$1/index.html -f RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L] </IfModule> <FilesMatch "index\.(html|htm)$"> AddDefaultCharset UTF-8 <ifModule mod_headers.c> Header set Cache-Control "max-age=A10368000, public" Header set Pragma "no-cache" Header set Expires "Mon, 29 Oct 2024 20:30:00 GMT" Header set Last-Modified "Thu, 23 February 2019 2:00:00 GMT" </ifModule> </FilesMatch> # END WpFastestCache # BEGIN GzipWpFastestCache <IfModule mod_deflate.c> <IfModule mod_setenvif.c> <IfModule mod_headers.c> SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding </IfModule> </IfModule> AddType x-font/woff .woff AddType x-font/ttf .ttf AddType image/png .png AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/png AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf </IfModule> # END GzipWpFastestCache # BEGIN LBCWpFastestCache <FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$"> <IfModule mod_expires.c> AddType application/font-woff2 .woff2 AddType image/png .png ExpiresActive On ExpiresDefault A10368000 ExpiresByType video/webm A10368000 ExpiresByType video/ogg A10368000 ExpiresByType video/mp4 A10368000 ExpiresByType image/webp A10368000 ExpiresByType image/gif A10368000 ExpiresByType image/png A10368000 ExpiresByType image/jpg A10368000 ExpiresByType image/jpeg A10368000 ExpiresByType image/ico A10368000 ExpiresByType image/svg+xml A10368000 ExpiresByType text/css A10368000 ExpiresByType text/javascript A10368000 ExpiresByType application/javascript A10368000 ExpiresByType application/x-javascript A10368000 ExpiresByType application/font-woff2 A10368000 </IfModule> <IfModule mod_headers.c> Header set Expires "max-age=A10368000, public" Header set Connection keep-alive </IfModule> </FilesMatch> # END LBCWpFastestCache # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress 到我的输出中记录32位立体声48000hz到2个单独的通道文件。所以我想使用类似WasapiLoopbackCapturechannel1.wav

的东西

我从link开始尝试过的事情

channel2.wav

我也已经尝试将 public List<RecordingResult> SplitStereoRecordingByTalkUnit() { wasapiIn = new WasapiLoopbackCapture(); wasapiIn.DataAvailable += wi_DataAvailable _writers = new WaveFileWriter[wasapiIn.WaveFormat.Channels]; for (int n = 0; n < _writers.Length; n++) { var format = new WaveFormat(wasapiIn.WaveFormat.SampleRate, wasapiIn.WaveFormat.BitsPerSample, 1); _writers[n] = new WaveFileWriter(String.Format("channel{0}.wav", n + 1), format); } wasapiIn.StartRecording(); return output; } void wi_DataAvailable(object sender, WaveInEventArgs e) { if (e.BytesRecorded != 0) { int offset = 0; while (offset < e.BytesRecorded) { for (int n = 0; n < wasapiIn.WaveFormat.Channels; n++) { _writers[n].Write(e.Buffer, offset, 4); _writers[n].Flush(); offset += 4; } } } } 与使用MultiplexingWaveProvider函数的BufferedWaveProvider结合使用。

所有这些都会导致不良的嘈杂录音。

我该怎么办?

更新:此代码在16位上有效,仅将偏移增量更改为2,将缓冲区读取更改为2

0 个答案:

没有答案