audio waveform to Integer sequence

I need to create an Integer Sequence from an Audio file. I was checking the waveform libraries as that draw a linear graph. But I am searching for the key information, What is the source of the integer that is used to draw the graph ? is it amplitude ? frequency ? or something else ? There are libraries available but I need to know what unit of information I need to extract to have a data t

音频波形转换为整数序列

我需要从音频文件创建一个整数序列。 我正在检查波形库,并绘制线性图。 但是我正在寻找关键信息,用于绘制图形的整数的来源是什么? 它是幅度吗? 频率 ? 或者是其他东西 ? 有可用的库,但我需要知道我需要提取哪些信息单元以获取可供图形使用的数据。 然而,绘制图表并不是我的目标。 我只想要那个原始整数数组。 当然,这是获得波形波形图所需的幅度,也是PCM数据存储在wav文件中的方式(例如,直接位于文件头后

Why Ideal band pass filter not working as expected?

Here is latest version that produce effect close to the desired void DeleteFrequencies(short *audioDataBuffer, const int bufferSize, int lowestFrequency, int highestFrequency, int sampleRate ) { int frequencyInHzPerSample = sampleRate / bufferSize; /* __________________________ /* ___________ __________________________ filter kernel */ int

为什么理想带通滤波器不能按预期工作?

这是最近的版本,产生的效果接近所需的 void DeleteFrequencies(short *audioDataBuffer, const int bufferSize, int lowestFrequency, int highestFrequency, int sampleRate ) { int frequencyInHzPerSample = sampleRate / bufferSize; /* __________________________ /* ___________ __________________________ filter kernel */ int nOfPointsInFilterKernel =

Outputting audio (Windows Audio API)

Alright, so I have a small program in which user can control the output frequency of the audio signal and play songs (in theory :) ). I generate the sine wave myself in code by figuring out how many points it will take for a single period of that waveform given it's sampled at 44100Hz. Like this: for (int k = 0; k < points_sine_wave; k++) { // Generate sine wave

输出音频(Windows Audio API)

好的,所以我有一个小程序,用户可以在其中控制音频信号的输出频率并播放歌曲(理论上:))。 我自己在代码中生成正弦波,通过计算它在44100Hz采样时的单个周期中需要多少个点。 喜欢这个: for (int k = 0; k < points_sine_wave; k++) { // Generate sine wave sineWave[k] = pow(2.0,10) * (sin(2*3.14159*f*td*k + old_angle) + 1); } td是delta t(常数),f是频率,k

Continuous waveform audio synthesizer

I'm starting to write a soft synthesizer with a peculiar characteristic: The oscillators will have a "continuous waveform" knob that will allow users to select sine, square and saw tooth waves in a continuous fashion. That is, if the knob is all the way to the left, the output will be a sine wave, if it's in the middle it will be a saw tooth wave, if it's all the way to the

连续波形音频合成器

我开始写一个具有独特特性的软合成器:振荡器将有一个“连续波形”旋钮,可以让用户连续选择正弦波,方波和锯齿波。 也就是说,如果旋钮一直到左边,则输出将是正弦波,如果它在中间则是锯齿波,如果一直到右边,它将是方波然后中间位置将输出经典波的“内插”版本的波。 - 波形的旋钮位置和类型可以改变,但需要连续改变波形的方式 - 我想到了几种实现振荡器的方法: 提出一个函数,该函数获取旋钮位置并计算实际信号(幅度

How can I perform a realtime FFT on SDL2 audio stream data

I am trying to create a music visualiser in C++ using SDL2 and FFTW3. My aim is to load a .wav audio file and then simultaneously play the audio and perform a realtime Fast Fourier Transform using an SDL2 Callback function. I want to get the frequency spectrum data so that I can implement the graphical visualiser at a later date. I followed an SDL YouTube guide on loading the .wav and playing

如何对SDL2音频流数据执行实时FFT?

我正在尝试使用SDL2和FFTW3在C ++中创建音乐可视化工具。 我的目标是加载.wav音频文件,然后同时播放音频并使用SDL2回叫功能执行实时快速傅立叶变换。 我想获取频谱数据,以便日后可以实现图形可视化。 我按照SDL YouTube指南加载.wav并使用回调函数播放音频,但我不明白如何对此数据执行FFT。 我遵循另一个使用FFTW和SDL的C指南来产生类似的效果,但我仍然不确定如何实际执行它。 Uint8* sampData; SDL_AudioSpec wavSpec;

XAudio2 delay with small buffer size

I'm writing a video player. For audio part i'm using XAudio2. For this i have separate thread that is waiting for BufferEnd event and after this fills buffer with new data and call SubmitSourceBuffer. The problem is that XAudio2(driver or sound card) has huge delays before playing next buffer if buffer size is small (1024 bytes). I made measurements and XAudio takes up to two times lo

XAudio2延迟小缓冲区大小

我在写一个视频播放器。 对于音频部分我使用XAudio2。 为此,我有单独的线程正在等待BufferEnd事件,并在此之后用新数据填充缓冲区并调用SubmitSourceBuffer。 问题是如果缓冲区大小很小(1024字节),则在播放下一个缓冲区之前,XAudio2(驱动程序或声卡)会有大量延迟。 我做了测量,XAudio需要长达两倍的时间才能播放这样的大块。 (1024字节大小的48khz原始2声道pcm应该在接近5ms播放,但在我的电脑上播放时间可达10ms

Can I pause the callback from within itself?

I am using SDL audio to play sounds. SDL_LockAudio tells this : Do not call this from the callback function or you will cause deadlock. But, SDL_PauseAudio doesn't say that, instead it tells : This function pauses and unpauses the audio callback processing My mixer callback looks like this : void AudioPlaybackCallback( void *, core::bty::UInt8 *stream, int len ) { // numbe

我可以暂停回调吗?

我正在使用SDL音频播放声音。 SDL_LockAudio讲述了这一点: 不要从回调函数调用此函数,否则会导致死锁。 但是,SDL_PauseAudio并没有这么说,而是告诉: 此功能暂停并取消暂停音频回拨处理 我的混音器回调看起来像这样: void AudioPlaybackCallback( void *, core::bty::UInt8 *stream, int len ) { // number of bytes left to play in the current sample const int thisSampleLeft = currentSam

overload with typedef gives an error

Consider the following types: #include <iostream> typedef unsigned long long usize_t; typedef unsigned __int16 uword_t; typedef uword_t clockval_t; // time without seconds in format HHMM std::string toString(clockval_t nClock) { return std::to_string((usize_t)nClock/100) + ":" + std::to_string((usize_t)nClock % 100); } std::string toString(uword_t nVa

用typedef重载会导致错误

考虑以下几种类型: #include <iostream> typedef unsigned long long usize_t; typedef unsigned __int16 uword_t; typedef uword_t clockval_t; // time without seconds in format HHMM std::string toString(clockval_t nClock) { return std::to_string((usize_t)nClock/100) + ":" + std::to_string((usize_t)nClock % 100); } std::string toString(uword_t nValue) {

What are consequences of not calling libusb

I am writing a userspace program which interacts with the USB video playback controller. I am programming in C++ and the program is intended to run on Linux. While studying the libusb manual I came across the void libusb_exit ( struct libusb_context * ctx ) function. The description says: Deinitialize libusb. Should be called after closing all open devices and before your application term

什么是不调用libusb的后果

我正在编写一个与USB视频播放控制器交互的用户空间程序。 我使用C ++进行编程,并且该程序旨在在Linux上运行。 在研究libusb手册时,我遇到了void libusb_exit ( struct libusb_context * ctx )函数。 说明书说: 取消初始化libusb。 应在关闭所有打开的设备之后并在应用程序终止之前调用。 手册没有解释为什么它需要。 我对终止一个已经初始化并使用libusb而不调用libusb_exit()的程序的后果感到好奇。 如果由于某

Skybox using OpenGL ES 2.0, Android NDK

This is how I setup the things. Loading .tga files is fine, I have used that loading for 2D texture mapping, which works fine. glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glActiveTexture(GL_TEXTURE0); glGenTextures(1, &engine-> GLData.gTextureId); checkGlError("glGenTextures gTextureId"); glEnable(GL_TEXTURE_CUBE_MAP); glBindTexture(GL_TEXTURE_CUBE_MA

Skybox使用OpenGL ES 2.0,Android NDK

这是我设置的东西。 加载.tga文件很好,我已经使用2D加载纹理映射,这很好。 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glActiveTexture(GL_TEXTURE0); glGenTextures(1, &engine-> GLData.gTextureId); checkGlError("glGenTextures gTextureId"); glEnable(GL_TEXTURE_CUBE_MAP); glBindTexture(GL_TEXTURE_CUBE_MAP, engine-> GLData.gTextureId); checkGlError("gl