I implemented another spectrogram algorithm: constant Q

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

I implemented another spectrogram algorithm: constant Q

Paul Licameli
I put a branch in my fork called constant-q.

The "constant Q transform" makes the horizontal bands of the spectrogram have equal height on the logarithmic scale, rather than on the linear.  Thus each band could correspond to a semitone of the chromatic scale, that is, whole numbered MIDI tones.

You can turn this on in Spectrogram Settings or Preferences by choosing "Tones" for the algorithm.

There is a hard coded numer in SpectrogramSettings::GetConstantQSettings that controls the width of the bands.  You can change it and recompile.  I didn't yet do the work to put that choice in the user interface.

So you can choose a fine quarter-tone resolution, or semitone resolution, or a resolution corresponding to the 31 equalization sliders (exactly 10 per decade, or very close to 3 per octave).

I also haven't yet done the work to tune the bands precisely, so that, say, 440 Hz is exactly at the (geometric) mean frequency of a band.

Another feature of this algorithm, which you can observe if you make a click as with click track, is that the time resolution is finer at higher frequencies, as the frequency resolution becomes coarser.

Now I am not yet convinced that this looks interesting and compelling enough to put into 2.1.4, but I was very interested to learn how to implement the mathematical method described here... 


... which is something I may also want to redo in Nyquist Lisp to improve my DeClicker plug-in so it might work much faster.

PRL


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|

Re: I implemented another spectrogram algorithm: constant Q

James Crook
Lovely.  I've just tried this branch out.  I've long wanted us to have constant Q.

And but, I would have expected a dramatic and compelling change in appearance.  I'd expect to see detailed structure better where it is most needed (without futile computation being done - because it's all being calculated for the 'appropriate' bands/times).  Are the settings you compiled with simply too coarse??  Or is the idea of constant Q not as compelling as it sounds? 

--James





On 2/15/2017 5:28 PM, Paul Licameli wrote:
I put a branch in my fork called constant-q.

The "constant Q transform" makes the horizontal bands of the spectrogram
have equal height on the logarithmic scale, rather than on the linear.
Thus each band could correspond to a semitone of the chromatic scale, that
is, whole numbered MIDI tones.

You can turn this on in Spectrogram Settings or Preferences by choosing
"Tones" for the algorithm.

There is a hard coded numer in SpectrogramSettings::GetConstantQSettings
that controls the width of the bands.  You can change it and recompile.  I
didn't yet do the work to put that choice in the user interface.

So you can choose a fine quarter-tone resolution, or semitone resolution,
or a resolution corresponding to the 31 equalization sliders (exactly 10
per decade, or very close to 3 per octave).

I also haven't yet done the work to tune the bands precisely, so that, say,
440 Hz is exactly at the (geometric) mean frequency of a band.

Another feature of this algorithm, which you can observe if you make a
click as with click track, is that the time resolution is finer at higher
frequencies, as the frequency resolution becomes coarser.

Now I am not yet convinced that this looks interesting and compelling
enough to put into 2.1.4, but I was very interested to learn how to
implement the mathematical method described here...

http://academics.wellesley.edu/Physics/brown/pubs/effalgV92P2698-P2701.pdf

... which is something I may also want to redo in Nyquist Lisp to improve
my DeClicker plug-in so it might work much faster.

PRL



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot


_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|

Re: I implemented another spectrogram algorithm: constant Q

Pokechu22-2
This is pretty neat.  However, it's currently breaking when the window
size is set at or below 32:

> Debug Assertion Failed!
> Program: C:\WINDOWS\SYSTEM32\MSVCP120D.dll
> File: c:\program files (x86)\microsoft visual studio 12.0\vc\include\vector
> Line: 1201
> Expression: vector subscript out of range

The topmost item of the stacktrace is:

> Audacity.exe!SpecCache::Populate(const SpectrogramSettings & settings, WaveTrackCache & waveTrackCache, int copyBegin, int copyEnd, unsigned int numPixels, sampleCount numSamples, double offset, double rate, double pixelsPerSecond) Line 1107

--Poke

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|

Re: I implemented another spectrogram algorithm: constant Q

MartynShaw
In reply to this post by Paul Licameli
Hi Paul

This sounds interesting and I would like to try it out and see the
results.  Unfortunately I have not got into Git and don't know how to
get your current version to try it out.  I think I did it once many
months ago but have not done it since.

I have found much less time for Audacity since I gave up working.

Good luck!  And thanks for the link to an interesting paper.

TTFN
Martyn

On 15/02/2017 17:28, Paul Licameli wrote:

> I put a branch in my fork called constant-q.
>
> The "constant Q transform" makes the horizontal bands of the
> spectrogram have equal height on the logarithmic scale, rather than on
> the linear.  Thus each band could correspond to a semitone of the
> chromatic scale, that is, whole numbered MIDI tones.
>
> You can turn this on in Spectrogram Settings or Preferences by
> choosing "Tones" for the algorithm.
>
> There is a hard coded numer in
> SpectrogramSettings::GetConstantQSettings that controls the width of
> the bands.  You can change it and recompile.  I didn't yet do the work
> to put that choice in the user interface.
>
> So you can choose a fine quarter-tone resolution, or semitone
> resolution, or a resolution corresponding to the 31 equalization
> sliders (exactly 10 per decade, or very close to 3 per octave).
>
> I also haven't yet done the work to tune the bands precisely, so that,
> say, 440 Hz is exactly at the (geometric) mean frequency of a band.
>
> Another feature of this algorithm, which you can observe if you make a
> click as with click track, is that the time resolution is finer at
> higher frequencies, as the frequency resolution becomes coarser.
>
> Now I am not yet convinced that this looks interesting and compelling
> enough to put into 2.1.4, but I was very interested to learn how to
> implement the mathematical method described here...
>
> http://academics.wellesley.edu/Physics/brown/pubs/effalgV92P2698-P2701.pdf
>
> ... which is something I may also want to redo in Nyquist Lisp to
> improve my DeClicker plug-in so it might work much faster.
>
> PRL
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|

Re: I implemented another spectrogram algorithm: constant Q

Pokechu22-2
Martyn:
It's not too hard to find get his version once you know his repo, but
if you don't know where that is (which requires a bit of understanding
of GitHub), then it can be difficult.  You can find it by going to the
"contributors" tab on audacity/audacity, then selecting his name, and
then selecting his fork of audacity.  This brings you to
"https://github.com/Paul-Licameli/audacity".
>From there, you can either get the code from the git command line, or
by downloading a zip directly.  If you want to directly download the
zip, first change the branch to "constant-q" and then select "clone or
download".  If you want to do it from git, though, instead perform
these commands within your copy of the audacity repo:

git remote add PRL https://github.com/Paul-Licameli/audacity.git
git fetch PRL
git checkout constant-q

Hopefully this helps.

--Poke

On Thu, Feb 16, 2017 at 5:02 PM, Martyn Shaw <[hidden email]> wrote:

> Hi Paul
>
> This sounds interesting and I would like to try it out and see the
> results.  Unfortunately I have not got into Git and don't know how to
> get your current version to try it out.  I think I did it once many
> months ago but have not done it since.
>
> I have found much less time for Audacity since I gave up working.
>
> Good luck!  And thanks for the link to an interesting paper.
>
> TTFN
> Martyn
>
> On 15/02/2017 17:28, Paul Licameli wrote:
>> I put a branch in my fork called constant-q.
>>
>> The "constant Q transform" makes the horizontal bands of the
>> spectrogram have equal height on the logarithmic scale, rather than on
>> the linear.  Thus each band could correspond to a semitone of the
>> chromatic scale, that is, whole numbered MIDI tones.
>>
>> You can turn this on in Spectrogram Settings or Preferences by
>> choosing "Tones" for the algorithm.
>>
>> There is a hard coded numer in
>> SpectrogramSettings::GetConstantQSettings that controls the width of
>> the bands.  You can change it and recompile.  I didn't yet do the work
>> to put that choice in the user interface.
>>
>> So you can choose a fine quarter-tone resolution, or semitone
>> resolution, or a resolution corresponding to the 31 equalization
>> sliders (exactly 10 per decade, or very close to 3 per octave).
>>
>> I also haven't yet done the work to tune the bands precisely, so that,
>> say, 440 Hz is exactly at the (geometric) mean frequency of a band.
>>
>> Another feature of this algorithm, which you can observe if you make a
>> click as with click track, is that the time resolution is finer at
>> higher frequencies, as the frequency resolution becomes coarser.
>>
>> Now I am not yet convinced that this looks interesting and compelling
>> enough to put into 2.1.4, but I was very interested to learn how to
>> implement the mathematical method described here...
>>
>> http://academics.wellesley.edu/Physics/brown/pubs/effalgV92P2698-P2701.pdf
>>
>> ... which is something I may also want to redo in Nyquist Lisp to
>> improve my DeClicker plug-in so it might work much faster.
>>
>> PRL
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> audacity-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|

Re: I implemented another spectrogram algorithm: constant Q

MartynShaw
Thanks Poke, this is helpful.  I knew this stuff once I'm sure!

TTFN
Martyn

On 17/02/2017 03:53, Pokechu22 wrote:

> Martyn:
> It's not too hard to find get his version once you know his repo, but
> if you don't know where that is (which requires a bit of understanding
> of GitHub), then it can be difficult.  You can find it by going to the
> "contributors" tab on audacity/audacity, then selecting his name, and
> then selecting his fork of audacity.  This brings you to
> "https://github.com/Paul-Licameli/audacity".
>>From there, you can either get the code from the git command line, or
> by downloading a zip directly.  If you want to directly download the
> zip, first change the branch to "constant-q" and then select "clone or
> download".  If you want to do it from git, though, instead perform
> these commands within your copy of the audacity repo:
>
> git remote add PRL https://github.com/Paul-Licameli/audacity.git
> git fetch PRL
> git checkout constant-q
>
> Hopefully this helps.
>
> --Poke
>
> On Thu, Feb 16, 2017 at 5:02 PM, Martyn Shaw <[hidden email]> wrote:
>> Hi Paul
>>
>> This sounds interesting and I would like to try it out and see the
>> results.  Unfortunately I have not got into Git and don't know how to
>> get your current version to try it out.  I think I did it once many
>> months ago but have not done it since.
>>
>> I have found much less time for Audacity since I gave up working.
>>
>> Good luck!  And thanks for the link to an interesting paper.
>>
>> TTFN
>> Martyn
>>
>> On 15/02/2017 17:28, Paul Licameli wrote:
>>> I put a branch in my fork called constant-q.
>>>
>>> The "constant Q transform" makes the horizontal bands of the
>>> spectrogram have equal height on the logarithmic scale, rather than on
>>> the linear.  Thus each band could correspond to a semitone of the
>>> chromatic scale, that is, whole numbered MIDI tones.
>>>
>>> You can turn this on in Spectrogram Settings or Preferences by
>>> choosing "Tones" for the algorithm.
>>>
>>> There is a hard coded numer in
>>> SpectrogramSettings::GetConstantQSettings that controls the width of
>>> the bands.  You can change it and recompile.  I didn't yet do the work
>>> to put that choice in the user interface.
>>>
>>> So you can choose a fine quarter-tone resolution, or semitone
>>> resolution, or a resolution corresponding to the 31 equalization
>>> sliders (exactly 10 per decade, or very close to 3 per octave).
>>>
>>> I also haven't yet done the work to tune the bands precisely, so that,
>>> say, 440 Hz is exactly at the (geometric) mean frequency of a band.
>>>
>>> Another feature of this algorithm, which you can observe if you make a
>>> click as with click track, is that the time resolution is finer at
>>> higher frequencies, as the frequency resolution becomes coarser.
>>>
>>> Now I am not yet convinced that this looks interesting and compelling
>>> enough to put into 2.1.4, but I was very interested to learn how to
>>> implement the mathematical method described here...
>>>
>>> http://academics.wellesley.edu/Physics/brown/pubs/effalgV92P2698-P2701.pdf
>>>
>>> ... which is something I may also want to redo in Nyquist Lisp to
>>> improve my DeClicker plug-in so it might work much faster.
>>>
>>> PRL
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>>>
>>>
>>>
>>> _______________________________________________
>>> audacity-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> _______________________________________________
>> audacity-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel