C# dili ve .NET Framework kullanarak bir ses görselleştirme sistemi oluşturmak istiyorum. Bu, Winamp uygulamasında olduğu gibi olabilir. Belki de ücretsiz kütüphane veya nasıl yapılacağını anlatan ilginç makaleler var mı? Örnek: alt text http://img44.imageshack.us/img44/9982/examplel.pngC# ses görselleştirme
cevap
Sen OpenVP Screenshots bkz bu bağlantıları
(C# ile yazılmış müzik görselleştirme, gelişmekte için ücretsiz ve açık kaynak platformudur) deneyebilirsiniz.Play and Visualize WAV Files using Managed Direct Sound
Bye
.WASAPI API'sı kullanılarak bilgisayarda çalınan herhangi bir sesin FFT'sini hesaplayan bir komut dosyası. ayrı bir iş parçacığı üzerinde değiştirilir beri ilk kilitlemek önerilir farklı bir komut barData alınırken Sonra
using CSCore;
using CSCore.SoundIn;
using CSCore.Codecs.WAV;
using WinformsVisualization.Visualization;
using CSCore.DSP;
using CSCore.Streams;
using System;
public class SoundCapture
{
public int numBars = 30;
public int minFreq = 5;
public int maxFreq = 4500;
public int barSpacing = 0;
public bool logScale = true;
public bool isAverage = false;
public float highScaleAverage = 2.0f;
public float highScaleNotAverage = 3.0f;
LineSpectrum lineSpectrum;
WasapiCapture capture;
WaveWriter writer;
FftSize fftSize;
float[] fftBuffer;
SingleBlockNotificationStream notificationSource;
BasicSpectrumProvider spectrumProvider;
IWaveSource finalSource;
public SoundCapture()
{
// This uses the wasapi api to get any sound data played by the computer
capture = new WasapiLoopbackCapture();
capture.Initialize();
// Get our capture as a source
IWaveSource source = new SoundInSource(capture);
// From https://github.com/filoe/cscore/blob/master/Samples/WinformsVisualization/Form1.cs
// This is the typical size, you can change this for higher detail as needed
fftSize = FftSize.Fft4096;
// Actual fft data
fftBuffer = new float[(int)fftSize];
// These are the actual classes that give you spectrum data
// The specific vars of lineSpectrum here aren't that important because they can be changed by the user
spectrumProvider = new BasicSpectrumProvider(capture.WaveFormat.Channels,
capture.WaveFormat.SampleRate, fftSize);
lineSpectrum = new LineSpectrum(fftSize)
{
SpectrumProvider = spectrumProvider,
UseAverage = true,
BarCount = numBars,
BarSpacing = 2,
IsXLogScale = false,
ScalingStrategy = ScalingStrategy.Linear
};
// Tells us when data is available to send to our spectrum
var notificationSource = new SingleBlockNotificationStream(source.ToSampleSource());
notificationSource.SingleBlockRead += NotificationSource_SingleBlockRead;
// We use this to request data so it actualy flows through (figuring this out took forever...)
finalSource = notificationSource.ToWaveSource();
capture.DataAvailable += Capture_DataAvailable;
capture.Start();
}
private void Capture_DataAvailable(object sender, DataAvailableEventArgs e)
{
finalSource.Read(e.Data, e.Offset, e.ByteCount);
}
private void NotificationSource_SingleBlockRead(object sender, SingleBlockReadEventArgs e)
{
spectrumProvider.Add(e.Left, e.Right);
}
~SoundCapture()
{
capture.Stop();
capture.Dispose();
}
public float[] barData = new float[20];
public float[] GetFFtData()
{
lock (barData)
{
lineSpectrum.BarCount = numBars;
if (numBars != barData.Length)
{
barData = new float[numBars];
}
}
if (spectrumProvider.IsNewDataAvailable)
{
lineSpectrum.MinimumFrequency = minFreq;
lineSpectrum.MaximumFrequency = maxFreq;
lineSpectrum.IsXLogScale = logScale;
lineSpectrum.BarSpacing = barSpacing;
lineSpectrum.SpectrumProvider.GetFftData(fftBuffer, this);
return lineSpectrum.GetSpectrumPoints(100.0f, fftBuffer);
}
else
{
return null;
}
}
public void ComputeData()
{
float[] resData = GetFFtData();
int numBars = barData.Length;
if (resData == null)
{
return;
}
lock (barData)
{
for (int i = 0; i < numBars && i < resData.Length; i++)
{
// Make the data between 0.0 and 1.0
barData[i] = resData[i]/100.0f;
}
for (int i = 0; i < numBars && i < resData.Length; i++)
{
if (lineSpectrum.UseAverage)
{
// Scale the data because for some reason bass is always loud and treble is soft
barData[i] = barData[i] + highScaleAverage * (float)Math.Sqrt(i/(numBars + 0.0f)) * barData[i];
}
else
{
barData[i] = barData[i] + highScaleNotAverage * (float)Math.Sqrt(i/(numBars + 0.0f)) * barData[i];
}
}
}
}
}
: Bu CSCore ve WinformsVisualization örneğini kullanır.
Github Repo'da görünmediği için nereden aldığımdan emin değilim , ama işte burada. Sadece bu dosyaya yapıştırın ve kodum çalışmalıdır.
public float[] GetSpectrumPoints(float height, float[] fftBuffer)
{
SpectrumPointData[] dats = CalculateSpectrumPoints(height, fftBuffer);
float[] res = new float[dats.Length];
for (int i = 0; i < dats.Length; i++)
{
res[i] = (float)dats[i].Value;
}
return res;
}
Örnek kodunuzu kullanmayı denedim, ancak ['GetSpectrumPoints()' artık bir işlev gibi görünmüyor] (https://github.com/filoe/cscore/blob/29410b12ae35321c4556b072c0711a8f289c0544/Samples/ WinformsVisualization/Visualization/LineSpectrum.cs # L10) ve git deposunun geçmişini denetleme, onu da göstermiyor. Cevabınızı açıklığa kavuşturmak/güncellemek ister misiniz? (* Windows üzerinde ses yakalama/işlemeyi LED ışıkları çalıştıran çapraz platformlu bir konsol uygulaması ile entegre etmeye çalışıyorum; 0.0 - 1.0 bar frekans veri değerlerinin tümü ihtiyaç duyuyor *) – Shane
@Shane Üzgünüz! Bu kodu ekledim, umarım yardımcı olur – Phylliida
- 1. C# yöntemi mantığını görselleştirme
- 2. C# Sınıf/Nesne görselleştirme yazılımı
- 3. C++ 'da 3 Boyutlu Görselleştirme Gerçek Zamanlı
- 4. Açık Kaynak C++ Veri Görselleştirme Kütüphanesi
- 5. Ses Algılama C#
- 6. XSD Görselleştirme?
- 7. Graphx Görselleştirme
- 8. c ses dosyasını çalma programı
- 9. Algoritma görselleştirme nasıl yapılır?
- 10. Veri görselleştirme kütüphanesi
- 11. görselleştirme yosys çıktı kullanıyorum
- 12. Dinamik görselleştirme bokeh
- 13. Kibana görselleştirme - Nagios
- 14. Python modülünün yapısını görselleştirme
- 15. Google Görselleştirme ColumnChart
- 16. Grafik Boyama Görselleştirme
- 17. Grafik görselleştirme aracı
- 18. JavaScript Ses Spektrum Analiz Cihazı
- 19. Gecikme olmadan ses efekti çalma Objective-C
- 20. omurga görünümü + google görselleştirme api
- 21. Resimlere Google görselleştirme grafiği ekleme
- 22. Networkx Programatik Ağ Grafik Görselleştirme
- 23. Haskell Veri Modeli Görselleştirme Kaynaktan
- 24. node.js ile D3.js görselleştirme
- 25. Açık kaynaklı akış görselleştirme aracı
- 26. python 3B görselleştirme ve grafikler
- 27. Bir ses dosyasındaki ses ısırması örneklerini bulma
- 28. iOS'ta arka plan ses akışını engelleme
- 29. Jave EE uygulaması Google Görselleştirme API'sini tanımıyor
- 30. Google görselleştirme çizgi grafiğinde değişen eksen tutarsız
Başlamak için iyi olacağını düşünüyorum, teşekkürler. –