Gamma DSP C++ library
-
- KVRian
- Topic Starter
- 1091 posts since 28 May, 2010 from Finland
Making a thread for discussing about this library.
http://mat.ucsb.edu/gamma/ (note: I'm not the creator).
http://mat.ucsb.edu/gamma/ (note: I'm not the creator).
-
- KVRian
- Topic Starter
- 1091 posts since 28 May, 2010 from Finland
---Problem---
Need a way to sort the the produced DFT frame (consisting of gam::Complex<float>) based on the FREQ-part in MAG_FREQ mode.
The doc speaks only about operator < having been defined for the gam::Complex<float>. Doing std::sort(frame.begin(), frame.end(), predicate()) with the predicate
Does not do anything.
Need a way to sort the the produced DFT frame (consisting of gam::Complex<float>) based on the FREQ-part in MAG_FREQ mode.
The doc speaks only about operator < having been defined for the gam::Complex<float>. Doing std::sort(frame.begin(), frame.end(), predicate()) with the predicate
Code: Select all
struct predicate
{
bool operator()(const gam::Complex<float> &left, const gam::Complex<float> &right) {
return left[1] < right[1];
}
}
Last edited by soundmodel on Tue Aug 11, 2015 10:09 am, edited 1 time in total.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
What do you mean by doesn't do anything? (if there is an issue, it has nothing to do with the library BTW.)
-
- KVRian
- Topic Starter
- 1091 posts since 28 May, 2010 from Finland
It does not change the relationships that I'm seeing by plotting the MAGs over FREQs, which I thought would fix by sorting. I haven't tested the sort code, but I guess it should work.
This however would mean that the boxy plot problem described here:
http://www.kvraudio.com/forum/viewtopic ... 3&t=444106
is caused by something else than the ordering of the FREQs.
This however would mean that the boxy plot problem described here:
http://www.kvraudio.com/forum/viewtopic ... 3&t=444106
is caused by something else than the ordering of the FREQs.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
You should first check if the data is sorted int he first place... Just make a dump with std::cout to see if the data is sorted or not.
-
- KVRian
- Topic Starter
- 1091 posts since 28 May, 2010 from Finland
How can I make a dump from a VST plug-in that's ran in a VST Host?Miles1981 wrote:You should first check if the data is sorted int he first place... Just make a dump with std::cout to see if the data is sorted or not.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Open a file and write to it (which is also one of the reasons I first develop my codes in standalone applications in Python...).
-
- KVRian
- Topic Starter
- 1091 posts since 28 May, 2010 from Finland
So I found out that the FREQs are ordered. So the boxy plot problem is not about the order.
Likely then about the rapidly changing frequencies between windows.
What I'm not sure about is why I'm seeing any freq value repeating four times in the output before changing to another freq. That is, every adjacent 4 bins have the same frequency value, except for the first and last bins. That's what the bins have, so it's Gamma's algorithm that does it that way.
The different frequencies seem to be spaced evenly apart as well. What's the algorithm actually doing? It reminds me of a graphical EQ style of "computation" (combining bins).
Maybe the boxy plot was actually caused by these repeating frequencies?
Likely then about the rapidly changing frequencies between windows.
What I'm not sure about is why I'm seeing any freq value repeating four times in the output before changing to another freq. That is, every adjacent 4 bins have the same frequency value, except for the first and last bins. That's what the bins have, so it's Gamma's algorithm that does it that way.
The different frequencies seem to be spaced evenly apart as well. What's the algorithm actually doing? It reminds me of a graphical EQ style of "computation" (combining bins).
Maybe the boxy plot was actually caused by these repeating frequencies?
-
- KVRian
- Topic Starter
- 1091 posts since 28 May, 2010 from Finland
I'm trying to see the MAGs the DFT produces in MAG_FREQ mode, but can't seem to be able to. I'm writing them to a file and I can see the FREQs, which are at the index [1] of the bins, but printing index [0] (the MAG of the bin) prints the null value of float for every index.
I can plot the MAGs correctly, but just can't print them (using the same exact values that are used for plotting as well).
I can plot the MAGs correctly, but just can't print them (using the same exact values that are used for plotting as well).
-
- KVRer
- 1 posts since 4 Mar, 2016
AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
MAG_FREQ mode computes frequency estimates based on per-bin phase differences between frames (see http://blogs.zynaptiq.com/bernsee/pitch ... ng-the-ft/ (http://blogs.zynaptiq.com/bernsee/pitch-shifting-using-the-ft/)). Thus, any repeating patterns of frequencies will be due to the STFT settings, like hop size and window type, and the arrangement of partials in the input signal.You may want to try only plotting at the peaks. Peaks can be found with gam::arr::maxima:
template <class Index, class T>
unsigned maxima(Index * dst, const T * src, unsigned len, unsigned str=1);
So to get the peaks, you would do something like:
unsigned peakIndices[N];
unsigned numPeaks = gam::arr::maxima(peakIndices, &stft.bin(0)[0], stft.numBins(), 2);
-
- KVRian
- Topic Starter
- 1091 posts since 28 May, 2010 from Finland
Anyone happen to use Gamma with Xcode?
I'm having a trouble of seemingly getting only 0s out of the STFT, regardless of what I input in it.
The same exact code works on Windows and Visual Studio, but not on Xcode.
I'm having a trouble of seemingly getting only 0s out of the STFT, regardless of what I input in it.
The same exact code works on Windows and Visual Studio, but not on Xcode.
-
- KVRian
- 1353 posts since 6 Jul, 2004
Yep! We use it as part of our plug-ins. Lance (ljputnam above) is the lead developer and was part of our graduate department.Fluky wrote:Anyone happen to use Gamma with Xcode?
I'm having a trouble of seemingly getting only 0s out of the STFT, regardless of what I input in it.
The same exact code works on Windows and Visual Studio, but not on Xcode.
We haven't had cross-platform issues with any of our FFT-based plug-ins. We're not on the latest commit at the moment though. Try using this commit on the devel branch, which is what we're using on our latest release:
https://github.com/LancePutnam/Gamma/co ... 8c833c0fe4
Michael, Developer at Unfiltered Audio:
http://www.unfilteredaudio.com
http://soundcloud.com/the-february-thaw
http://mhetrick.github.com
http://www.unfilteredaudio.com
http://soundcloud.com/the-february-thaw
http://mhetrick.github.com
- KVRAF
- 1611 posts since 17 Jul, 2001 from Milan, Italy
I am trying to use the library, but I can only get output sound form the Audio Interface using the "AudioIOData" as in the examples.
How am I supposed to simply get the samples and rout them to my application instead of the standard audio interface?
Is there any totorial about embadding gamma in another app?
How am I supposed to simply get the samples and rout them to my application instead of the standard audio interface?
Is there any totorial about embadding gamma in another app?
-
- KVRAF
- 2256 posts since 29 May, 2012
From http://w2.mat.ucsb.edu/gamma/dl/gammaTutorial.0.9.5.pdfHow am I supposed to simply get the samples and rout them to my application instead of the standard audio interface?
Is there any totorial about embadding gamma in another app?
Code: Select all
Gen g; // define a new generator
g.freq(100); // set its frequency parameter
g.phase(0.25); // set its phase parameter
float
v;
v = g(); // generate first sample
v = g(); // generate second sample
~stratum~
-
- KVRist
- 92 posts since 26 Sep, 2005 from France
"How can I make a dump from a VST plug-in that's ran in a VST Host?"
Use OutputDebugString and read the output with DebugView
Use OutputDebugString and read the output with DebugView