为了检测语音,我正在使用这个 sox 命令:
rec voice.wav silence 1 5 30% 1 0:00:02 30%
Run Code Online (Sandbox Code Playgroud)
只要输入音量提高到阈值的 30% 左右,它就应该开始录制,并在音频低于相同阈值 2 秒后停止。
有用。但如果能“重新触发”就更好了。我的意思是:当音频低于阈值并且音频再次上升后,应该继续注册(即用户仍在说话)。
仅当检测到静音持续 2 秒时才会停止。或者您推荐任何其他“VOX”工具吗?
我有一些麻烦以html格式居中项目.一个非常简单的例子:
https://jsfiddle.net/a9cnuypz/
#rectLogin {
margin: auto;
width: 60%;
border-style: solid;
border-width: 1px;
}
#formLogin {
margin: auto;
width: 60%;
display: inline-block;
}
#btn {
margin: auto;
display: inline-block;
width: 200px;
}Run Code Online (Sandbox Code Playgroud)
<div id="rectLogin">
<form id="formLogin">
<div>
<label>Username</label>
<fieldset>
<input type="text" name="username" required>
</fieldset>
<label>Password</label>
<fieldset>
<input type="password" name="password" required>
</fieldset>
<input id="btn" type="submit" value="Login">
</div>
</form>
</div>Run Code Online (Sandbox Code Playgroud)
这是现在出现的方式:
在这里我想要的:
我不明白我的错误.我为相关项目(表单和按钮)设置了宽度和边距=自动.
我正在尝试向捕获源过滤器添加音频功能,以便制作带有音频的虚拟摄像头。从TMH和rdp的代码开始,我用另一个引脚对其进行了扩展,称为“音频”:
CUnknown * WINAPI CVCam::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr)
{
ASSERT(phr);
CUnknown *punk = new CVCam(lpunk, phr);
return punk;
}
CVCam::CVCam(LPUNKNOWN lpunk, HRESULT *phr) : CSource(LPCSTR(FILTER_NAME), lpunk, CLSID_VirtualCam)
{
ASSERT(phr);
CAutoLock cAutoLock(&m_cStateLock);
m_paStreams = (CSourceStream **) new CVCamStream*[2];
m_paStreams[0] = new CVCamStream(phr, this, L"Video");
m_paStreams[1] = new CVAudioStream(phr, this, L"Audio");
}
HRESULT CVCam::QueryInterface(REFIID riid, void **ppv)
{
if (riid == _uuidof(IAMStreamConfig) || riid == _uuidof(IKsPropertySet))
{
HRESULT hr;
hr = m_paStreams[0]->QueryInterface(riid, ppv);
if (hr != S_OK) return …Run Code Online (Sandbox Code Playgroud) 从此处捕获源过滤器的绝佳示例开始,我编写了自己的输入捕获设备,该设备在 Graph Studio Next 中运行良好,但在 Skype 或类似应用程序中并未显示为捕获设备(即网络摄像头)。
因为我想了解发生了什么,所以我请您帮助我找出那些应用程序需要什么来显示这样的设备。
一些相关代码:
DLL文件
DEFINE_GUID(CLSID_VirtualCam, 0x8e14549a, 0xdb61, 0x4309, 0xaf, 0xa1, 0x35, 0x78, 0xe9, 0x27, 0xe9, 0x33);
const AMOVIESETUP_MEDIATYPE AMSMediaTypesVideo =
{
&MEDIATYPE_Video,
&MEDIASUBTYPE_NULL
};
const AMOVIESETUP_PIN AMSPinVCam[] =
{
{
L"Output", // Pin string name
FALSE, // Is it rendered
TRUE, // Is it an output
FALSE, // Can we have none
FALSE, // Can we have many
&CLSID_NULL, // Connects to filter
NULL, // Connects to pin
1, // Number of types …Run Code Online (Sandbox Code Playgroud) 我使用 aQTableView来显示只读数据。该模型基于QList包含另一个QList. 像这样的东西:
typedef struct
{
int range;
QString description;
} Field;
typedef struct
{
QString name;
QList<Field> fields;
} Item;
QList<Item> items;
Run Code Online (Sandbox Code Playgroud)
在我的QAbstractTableModel实现中,我有一个选择当前的插槽item:
void setCurrentItem(int idx)
{
// checks for errors (omissis)
currentItemIdx = idx;
// ask to redraw the table
emit dataChanged(this->index(0, 0), this->index(rowCount(), columnCount()));
}
Run Code Online (Sandbox Code Playgroud)
模型的所有逻辑都依赖于该项目,例如:
int MyModel::rowCount(const QModelIndex&) const {
return items.at(m_currentItemIdx).fields.count();
}
QVariant MyModel::data(const QModelIndex &index, int role) const {
if (!index.isValid()) return QVariant();
if …Run Code Online (Sandbox Code Playgroud) 在ASP.NET Core 2应用程序中,我设置了一些服务:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<MyContext>(options => options.UseSqlServer(Configuration.GetConnectionString("MyContext")));
services.AddHangfire(options => options.UseSqlServerStorage(Configuration.GetConnectionString("MyContext")));
services.AddOptions();
services.Configure<MySettings>(options => Configuration.GetSection("MySettings").Bind(options));
services.AddMvc().AddDataAnnotationsLocalization();
services.AddScoped<IMyContext, MyContext>();
services.AddTransient<IFileSystem, FileWrapper>();
services.AddTransient<Importer, Importer>();
}
Run Code Online (Sandbox Code Playgroud)
在program.cs我可以检索自己的服务中:
var host = BuildWebHost(args);
using (var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
var ip = services.GetRequiredService<Importer>();
Task task = ip.ImportListAsync();
}
Run Code Online (Sandbox Code Playgroud)
现在,我试图了解在没有宿主变量的情况下(例如在其他C#类中,甚至在cshtml页面中)如何执行相同操作:
public async Task<IActionResult> OnPostRefresh()
{
if (!ModelState.IsValid)
{
return Page();
}
// host is not defined: how to retrieve it?
using (var scope = host.Services.CreateScope())
{
var …Run Code Online (Sandbox Code Playgroud) 在 C# WindowForms 应用程序中,我启动了一个 OWIN WebApp,它创建了我的另一个类 Erp 的单例实例:
public partial class Engine : Form
{
const string url = "http://*:8080"; //49396
private IDisposable webApp;
public Engine()
{
InitializeComponent();
StartServer();
}
private void StartServer()
{
webApp = WebApp.Start<Startup>(url);
Debug.WriteLine("Server started at " + url);
}
private void btnDoSomething(object sender, System.EventArgs e)
{
// needs to call a method in erp
}
}
class Startup
{
public void Configuration(IAppBuilder app)
{
Trace.Listeners.Remove("HostingTraceListener");
app.UseCors(CorsOptions.AllowAll);
var builder = new ContainerBuilder();
var config = new …Run Code Online (Sandbox Code Playgroud) 如果我在 Ubuntu 16.04 下使用Sublime打开我的 Yocto 项目文件夹并尝试构建:
bitbake <image>
Run Code Online (Sandbox Code Playgroud)
我收到这些错误:
ERROR: Unable to start bitbake server (None)
ERROR: Server log for this session (/local/STM32MP15-Ecosystem-v1.1.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-10-09/build-openstlinuxeglfs-stm32mp1-sw25v00/bitbake-cookerdaemon.log):
--- Starting bitbake server pid 4602 at 2020-02-01 02:59:00.519051 ---
Traceback (most recent call last):
File "/local/STM32MP15-Ecosystem-v1.1.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-10-09/layers/openembedded-core/bitbake/lib/bb/daemonize.py", line 83, in createDaemon
function()
File "/local/STM32MP15-Ecosystem-v1.1.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-10-09/layers/openembedded-core/bitbake/lib/bb/server/process.py", line 469, in _startServer
self.cooker = bb.cooker.BBCooker(self.configuration, self.featureset)
File "/local/STM32MP15-Ecosystem-v1.1.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-10-09/layers/openembedded-core/bitbake/lib/bb/cooker.py", line 210, in __init__
self.initConfigurationData()
File "/local/STM32MP15-Ecosystem-v1.1.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-10-09/layers/openembedded-core/bitbake/lib/bb/cooker.py", line 396, in initConfigurationData
self.add_filewatch(mc.getVar("__base_depends", False), self.configwatcher)
File "/local/STM32MP15-Ecosystem-v1.1.0/Distribution-Package/openstlinux-4.19-thud-mp1-19-10-09/layers/openembedded-core/bitbake/lib/bb/cooker.py", line 306, in add_filewatch
watcher.add_watch(f, …Run Code Online (Sandbox Code Playgroud) 我使用在线安装程序安装了 Qt 6.2.0,并选择了大部分模块进行桌面开发。我收到这个奇怪的消息:
/home/user/Qt/Examples/Qt-6.2.0/multimedia/video/mediaplayer/CMakeLists.txt:28: error: Found package configuration file: /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT FOUND. Reason given by package: Failed to find Qt component "Quick". Expected Config file at "/home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake" exists
Run Code Online (Sandbox Code Playgroud)
英语不是我的主要语言,我不确定最后一句话的真正含义:
"Expected Config file at <path> exists"
Run Code Online (Sandbox Code Playgroud)
实际上该文件存在:
$ ls /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake
/home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake
Run Code Online (Sandbox Code Playgroud)
我不明白为什么它找不到 QtQuick,然后我不知道如何修复它......
我不能用一个非常简单的例子来开始使用Qt多线程.我阅读了很多帖子和教程,但它仍然不起作用.
让后台工作者独立于GUI.哦,哇...
一个简单的例子:
Engine类QMainWindowQTimer打印一个数字但如果您左键单击GUI的标题栏,按住鼠标按钮(即最小化按钮),计数器将停止!即使它是在非GUI环境中创建的,它也被移动到另一个线程中!
main.cpp中
#include "engine.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Engine e;
return a.exec();
}
Run Code Online (Sandbox Code Playgroud)
engine.h
#ifndef ENGINE_H
#define ENGINE_H
#include <QObject>
#include <QThread>
#include <QTimer>
#include "mainwindow.h"
class Engine : public QObject
{
Q_OBJECT
public:
explicit Engine(QObject *parent = 0);
private:
MainWindow mainWindow;
QThread *thread;
QTimer *timer;
private slots:
void foo();
};
#endif // ENGINE_H …Run Code Online (Sandbox Code Playgroud) 在buildroot环境中,我将一个用户添加到组轮.现在我可以使用sudo以root权限执行命令.
它似乎有效,但当我尝试在我的RPi上导出一个引脚时,我总是得到Permission denied:
rpi:~$ sudo echo 4 > /sys/class/gpio/export
sh: can't create /sys/class/gpio/export: Permission denied
Run Code Online (Sandbox Code Playgroud)
这里是该目录的内容:
rpi:~$ ls -l /sys/class/gpio/
total 0
--w------- 1 root root 4096 Jan 1 00:00 export
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
--w------- 1 root root 4096 Jan 1 00:00 unexport
Run Code Online (Sandbox Code Playgroud)
使用sudo获取root权限是否足以在导出文件中写入?我害怕所有者和团体.事实上,如果我输入:
rpi:~$ sudo chmod a+w /sys/class/gpio/*
Run Code Online (Sandbox Code Playgroud)
然后我可以成功导出引脚.但我不知道这是否是最好的方法.
c++ ×4
qt ×3
audio ×2
c# ×2
directshow ×2
alignment ×1
autofac ×1
buildroot ×1
center ×1
cmake ×1
css ×1
forms ×1
html ×1
input-filter ×1
owin ×1
qtableview ×1
qtquick2 ×1
razor-pages ×1
root ×1
sox ×1
sublimetext3 ×1
sudo ×1
threshold ×1
visual-c++ ×1
windows ×1
yocto ×1