Comments (1)
Hi DeltaImpact, It's hard to assemble the high-level sequence of what is going on by looking at the code alone. I hope this brief summary helps clarify the topic and answer your question! I don't have the variable names memorized, but I think the terms I use will be general enough you may be able to figure them out if you understand these concepts. Note that I am referencing the microphone spectrograph source code for this example
- a list of PCM audio values is added to
List<short> unanalyzed_values
every time a new audio buffer is completed- when
waveIn.StartRecording()
is called, the sound recorder starts filling-up the audio buffer - every time the buffer is full,
Audio_buffer_captured()
gets run (which adds the latest buffer tounanalyzed_values
) - if a high frame-rate of updates is required, it's important to get a high rate of completed buffers per second (since the data is only updated when a buffer completes). That's why the
waveIn.BufferMilliseconds = 1000 / buffer_update_hz
line is important.
- when
timer1
periodically looks at the analyzes PCM data and analyzes it when it's long enough- analysis always slightly lags behind recording, usually by 1-2 buffer lengths
- if analysis falls behind (CPU load issues), excessively old analyzed data is deleted to lighten the load. However, this should only occur in near-error-like conditions, and is a fail-safe to prevent slowness or crashing.
- analysis analyzes the last "chunk" of audio, which could be the buffer size itself or some other size. The chunk is probably the FFT size.
- There is a 1:2 relationship between the input PCM data length and the output FFT data in my code. This is because I collapse the real and imaginary data into a single FFT array. A 1000 point PCM array analyzed in this way will produce a FFT with 500 points.
- FFT analysis benefits from "windowing" the sample so its edges approach zero. Check out this page on windowing, but note that you can do a pretty good job just by applying a triangle-shape window to the data prior to the FFT.
- when analysis completes, the analyzed data is deleted from the list of unrealized values
- often spectrographs benefit from having overlapping "chunks" of sequential analysis, therefore it may be desired to delete less data than you actually analyzed, thus forcing partial re-analysis of overlapping data. This produces "smoother" output spectrographs.
I hope these notes help! Let me know if you have additional questions.
Best,
Scott
from csharp-data-visualization.
Related Issues (20)
- PCM audio input clips HOT 1
- Values go out of graph area HOT 1
- Linux support? HOT 1
- How to, Detect sound Frequancy sample ( 10KHZ ) HOT 3
- What to use for Graphs visualization? HOT 1
- WPF: What is the best way to achieve continuous rendering? HOT 1
- drawtext-rectangle missing words HOT 2
- ImageSharp's relationship with the .NET Foundation
- add information about LightningChart
- add information about GrapeCity ComponentOne
- The Type or namespace "RectangleF' could not be found (are you missing a using directive or assembly reference) HOT 1
- FFt audiomonitor output hangs after a few minutes, or skips HOT 5
- SkiaSharp SVG export page
- Problem with conversion to Int16 HOT 3
- website contains dev pages that should be deleted
- PCM audio input clips HOT 8
- Does this work with ASIO? HOT 1
- An unhandled exception of type 'System.NullReferenceException' occurred HOT 2
- How can I 2d-FFT fo Image using this NAudio.FFT? HOT 1
- provide compiled binaries for every project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csharp-data-visualization.