We've sent a verification link by email
Didn't receive the email? Check your Spam folder, it may have been caught by a filter. If you still don't see it, you can resend the verification email.
Started September 19th, 2006 · 49 replies · Latest reply by HardPCM 16 years, 7 months ago
wav2ctd [-- | //]<switch> src.ext dst.ext
--fftsize <n> FFT Size (must be power of 2)
--windowsize <n> Overlapp width (must be <= fftsize)
--hopsize <n> Overlapp jump width (must be <= windowsize)
--cosine Use the Cosine Window
--hann Use the Hann Window
--hamming Use the Hamming Window
--blackman Use the Blackman Window
--verbose Verbose to Console
The regular form:
WAV2CTD [--flagname, ...] input.ext output.ext
wav2ctd --fftsize 1024 example.wav example.dat
or
wav2ctd //fftsize 1024 example.wav example.dat
If you want 50% Overlapp:
wav2ctd --fftsize 1024 --windowsize 1024 --hopsize 512 example.wav example.dat
or
wav2ctd //fftsize 1024 //windowsize 1024 //hopsize 512 example.wav example.dat
If you want 50% Overlapp plus double the resolution
wav2ctd --fftsize 1024 --windowsize 512 --hopsize 256 example.wav example.dat
or
wav2ctd //fftsize 1024 //windowsize 512 //hopsize 256 example.wav example.dat
I know the syntax is ugly,
anyway I do actually an cpp translation
and I will solve that in the same time,
you must know that actually,
the colors will be not exactly get the same range that those Bram use
This is the meaning of these values:
"fftsize" is the number of bin values for the time to frequency transform
"windowsize" is the number of samples in the buffer per tranform
"hopsize" is the number of samples shifted/remplaced in the buffer per tranform
so fftsize must be an power of 2
and windowsize must be equal or below fftsize
and hopsize must be equal or below windowsize
Thank you very much, I was able to successfully get a .dat file out of a .wav file now.
HardPCM
the colors will be not exactly get the same range that those Bram use
I have discovered that, in my three tests with three separate audio files, my results have been very... well.. pink. ops:
http://poisonthemind.com/ct.wav.png
The command I used in this example was:
wav2ctd ct.wav ct.dat && wav2png --input ct.wav --colorfile ct.dat
The wav file was a remix of some Chrono Trigger tracks called "The Final Battle" from Overclocked Remix. You can freely download it here if you'd like to test it yourself with this file: http://www.ocremix.org/remix/OCR01525/
Do I need to do something extra with the dat file or the wav2png command? Or will my results always be pink?
At least I have some kind of color now. That is a step in the right direction.
Updated for now:
http://code.google.com/p/wav2ctd/source/browse/trunk/wav2ctd-1.0.6/src/main.cpp
If bram don"T change it"s internal scaling this will work
else make sure that around line 420 you have this:
if(values.size())
{
int type = 1; /* must be equal to 1 to be compatible with wav2ctd v1.0.6 */switch(type)
{
case 0:
{
for(unsigned long k=0;k<values.size();k++)
{
if(values[k] < 0.f)
values[k] = 0.f;float scaledValue = sqrtf(values[k]) / sqrtf(11025);
colors.push_back(float2color(scaledValue,image));
}
break;
}
case 1:
{
for(unsigned long k=0;k<values.size();k++)
{
if(values[k] < 0.f)
values[k] = 0.f;float scaledValue = logf(values[k]+1) / logf(512+1);
colors.push_back(float2color(scaledValue,image));
}
break;
}
case 2:
default:
{
float maxValue = values[0];
float minValue = values[0];for(unsigned long j=1;j<values.size();j++)
{
if(values[j] > maxValue)
maxValue = values[j];if(values[j] < minValue)
minValue = values[j];
}if(minValue != maxValue)
{
for(unsigned long k=0;k<values.size();k++)
{
colors.push_back(float2color((values[k] - minValue) / (maxValue - minValue),image));
}
}
else
{
for(unsigned long k=0;k<colors.size();k++)
{
colors.push_back(float2color(1.0,image));
}
}
break;
}
}
}
http://poisonthemind.com/ct2.png
That did the trick. No more pink.
Excellent work from you both, HardPCM and bram. I wouldn't even begin to know what a spectral centroid was without the work you guys have put forth. This is that power of open source that those analysts are always going on about.
Thanks Bittermang, have now got it fully working - great tutorial
I might note that for the command
g++ main.cpp -o wav2ctd -L/usr/lib -lsndfile -lfftw3 -lfftw3f
I got -lfftw3 not found, so just did it with (presuming I only need the floating point version)
g++ main.cpp -o wav2ctd -L/usr/lib -lsndfile -lfftw3f
and it all works fine
It retrospect if you compile it with float support, it may only give you the fftw3f library. I had recompiled the library a few separate times to get to that point, and so I have both.
I will amend my tutorial with your information.