< Back to IRCAM Forum

Sonogram and Frequency Range

Hello everyone,

Is it possible to export Sonograms as uncompressed, high-resolution bitmaps, e.g. png files, restricted to a chosen frequency range, resolution and size?
As a corollary, is it possible to export Partial Analyses in the same way, as uncompressed, high-resolution bitmaps?
I am using AudioSculpt 3.4.6 and the Pm2 and SuperVP libraries for OpenMusic.

Any input on these issues, would be greatly appreciated.

All the best,
António

hello,

no AS does only support exporting the complete sonogram. You might do what you want by means of
converting the sound to lower sample rate and then export the resulting sonogram.

AS does not support exporting images with partial analysis.

Best
Axel

Thanks, Axel, for the quick reply. Lowering the SR won’t exactly do as I’m thinking of restricting the Frequency Range to specific notes as min and max. What about the Scales option in “Export Image” menu, can’t it be tweaked (perhaps through the command-line) to be exported as a more precise grid? It would be then possible to crop the resulting bitmap to a good enough approximation of the desired Frequency Range.

In any case, would you have any suggestions of techniques and/or software tools that I could use to achieve what I proposed in my first post?

Best,
António

Hello, António,

I very often had the same need, that is, to export parts of sonograms (both in frequency and time domain). The only way I found, was to adapt the display to the region I wanted to see, then take a screen shot of the picture. With a large, retina screen, the quality of the image is still acceptable. Not ideal, though.

Marco

I just remembered another option for spectrogram display

librosa supports all sort of scales and limits, see examples here

https://librosa.github.io/librosa/generated/librosa.display.specshow.html

Best
Axel

I just remembered another option for spectrogram display

librosa supports all sort of scales and limits, see examples here

https://librosa.github.io/librosa/generated/librosa.display.specshow.html

Note that once you have a figure in matplotlib, you can save it as PDF, PNG and basically whatever you like.

See here:

https://matplotlib.org/api/_as_gen/matplotlib.pyplot.savefig.html

Best
Axel

Great. Thank you both for this.

Hi Antonio,

I tried now for about 10 times to reply to your post EASDIF and Python, the Forum simply accepts my answers but does not display them.
So I try here…

As I mentioned already in my first reply you find some useful tools precompiled for Anaconda python here,

https://anaconda.org/roebel

All these are python3, and I don’t see why this should not work for Mojave.

Most interestingly for you may be the EASDIF package ready to be installed into Anaconda for Linux and MacOS. There is also
quite good support for reading more or less all uncompressed sound files into python with the pysndfile package build around the libsndfile library.

In case you are not using Anaconda (or you use windows) you could compile from sources

For easdif you have the sources here

https://sourceforge.net/p/sdif/code/HEAD/tree/

The description for compiling is here, (this includes windows instructions that worked at some point in time)

https://sourceforge.net/p/sdif/code/HEAD/tree/trunk/Easdif/README

and for compiling python interfaces ere

https://sourceforge.net/p/sdif/code/HEAD/tree/trunk/Easdif/swig/README

svn checkout svn://svn.code.sf.net/p/sdif/code/trunk/Easdif EASDIF_SDIF

There are special targets for creating and installing the python modules, it comes down to this sequence of commands:

svn checkout svn://svn.code.sf.net/p/sdif/code/trunk/Easdif EASDIF_SDIF
mkdir -p build_easdif
cd build_easdif
cmake …/EASDIF_SDIF -DPYTHON:PATH=python3 -DEASDIF_DO_PYTHON:bool=on
make pythonswig
make install_python_easdif_module_globally

alternatively in case you are not allowed to install globally you can use the target that installs for the current user

make install_python_easdif_module_locally

Concerning pysndfile you can also find it on pypi

this will work again only on macos and linux, and in case you would like to compile for windows you can look into the sources here

https://forge-2.ircam.fr/roebel/pysndfile

or here

https://github.com/roebel/pysndfile

Best,
Axel