Author Topic: (Version 1.7.4) Spectrogram Panel Plugin  (Read 14431 times)

zkhcohen

  • Sr. Member
  • ****
  • Posts: 307
Spectrogram-Display


---     ---     ---     ---     ---     ---     ---     ---




NOTE: I supplied the 64 bit version of FFMPEG in the Dependencies folder. This will not work on some Operating Systems. Download a 32-bit build here: https://ffmpeg.zeranoe.com/builds/





(UPDATED) Latest Release (Requires MusicBee 3.3.7001 or NEWER): Click Here.

For users on MusicBee version 3.3.6996 or OLDER: Click Here.


Changelog:

Update 1: Fixed scaling issues.
Update 2: Added height-resizing.
Update 3: Added support for mobile installations / updated installation instructions.
Update 3.1: New instructions / troubleshooting tool to fix spectrogram when it fails to appear (incorrect ffmpeg.exe path).
Update 4: Fixed percent and quotation symbols causing incorrect filenames. Added support for songs with identical filenames.
Update 5: Added a configuration panel which allows you to take advantage of all the ffmpeg 'showspectrumpic' switches. Added the ability to clear files on each restart of the add-in. Updated installation instructions due to (new) built-in debugging.
Update 5.1: Updated names of programs, structure of files, fixed support for mobile installations, debugging message, Readme and other back-end improvements.
Update 5.2: Added ability to set your own path to Ffmpeg. Removed unnecessary files. Many back-end improvements.
Update 5.3: Additional improvements including debugging and previously-set Ffmpeg path populating Config. Panel automatically.
Update 5.4: Streams no longer cause Ffmpeg to hang. Ability to prevent the header (title bar) from being shown by manually creating a text file called "noheader.txt" in the Dependencies folder (USE AT YOUR OWN RISK).
Update 5.5: Configuration panel now integrated with MusicBee. Debug logging to "MBSpectrogramLog.txt" in Dependencies folder (cleared on restart). Other general improvements.
Update 5.6: Attempt to fix stream image generation. Code optimizations.
Update 5.7: Fixed stream image generated bug. Fixed track seeking when frequency legend is enabled.
Update 5.8: Debugging Mode made optional. Fixed MusicBee error log spam. Code optimizations. Updated README.
Update 5.9: Fixed identical tracks with different file-types preventing unique image from being generated. Added ability to set Placeholder image for streams (place "placeholder.png" in the Dependencies folder). Switched to Zerandoe FFMPEG build so that the Magma color scheme works.
Update 6: Spectrogram now always shows the full frequency spectrum of the track, regardless of the size of the panel. This works by finding the closest resolution (multiple of 2) and then stretching the image to fit the panel. This also means that substantially fewer images will be generated, and accidental/minor resizes won't trigger new image generation (it will use the best-fit).
Update 6.1: You can now access the Spectrogram Configuration Panel by right-clicking the panel. Bug fixes. More efficient image generation / resolution matching.
Update 6.2: Fixed prompt. Changed defaults to the popular configuration. Removed right-click configuration menu -> moved to the header drop-down menu.
Update 7: Added two experimental features to the Configuration Panel - Enable Seekbar and Disable Header.  Added ability to pause/play by right-clicking the Spectrogram.
Update 7.1: Added dynamic indicator (tooltip) of time in song. Fixed version.
Update 7.2: Attempt at fixing multi-threading crash and tooltip issues. Changed cursor.
Update 7.3: Fixed an issue which caused a System.OverflowException when listening to radio streams for extended periods with the seekbar enabled.
(BETA) Update 7.4: Re-fixed the issue using a Bind.


Planned Updates and Fixes (in no particular order):

None, currently.



Description:

This plugin displays the spectrogram for the currently playing song. It also works as a seekbar,
allowing you to select the location in the track by clicking on it.

The program works by sending a command to ffmpeg (a free-ware program located in the
Tooltips folder) which generates a spectrogram. Afterwards, the .png image
it generated is displayed by the plugin.

After the image has been generated once, it will be used for any future plays, meaning
that it will load almost instantly, with no CPU usage.

The Plugin:




Installation Instructions:

1. With MusicBee off, extract the file located in the "Plugins" folder to your MusicBee Plugins directory.
2. Start MusicBee.
3. A message will appear telling you where to place the plugin's "Dependencies" folder;  extract the whole folder there now.
4. In MusicBee navigate to Edit > Edit Preferences > Plugins. Ensure that "spectrogram-display" appears. Enable it, and hit Save.
5. Navigate to View > Arrange Panels...
6. Drag the "spectrogram-display" element from the "available elements" window to the "main panel" section to your desired position, for instance above the "now playing bar" element. Note: This is not the required location of the plugin, but it is HIGHLY RECOMMENDED that you position it here.  Hit Save.
7. Drag the top of the Spectrogram window where you have placed it to the desired height.
8. Try playing a song. After a second or two of processing, the spectrogram should appear.  You can seek through the song if desired within the spectrogram window.
9. See the first post of the plugin's thread on the MusicBee forum for instructions on using the plugin's built-in Configuration Panel and other important information.



Using the Configuration Panel:

1. To open the configuration panel, go to Edit > Edit Preferences > Plugins, then locate "Spectrogram-Display" and click "Configure" or click on the header drop-down:



2. The settings are rather intuitive, but for further information on what they do, please go to the following link:

 https://ffmpeg.org/ffmpeg-filters.html#showspectrumpic


NOTE: Adding a .png file called "placeholder.png" in the Dependencies folder will allow the plugin to display an image of your choice while streams are being played.


The Configuration Panel:




Example Configuration:
Last Edit: March 20, 2020, 07:26:39 PM by zkhcohen

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 31552
MusicBee 3.2 is prone to crashes when enabling new plugins. Expect for it to crash up to 3 times before it becomes permanently stable.
Can you expand on that and provide me with more info? I am not aware of a general issue with plugins crashing. It might be better to reply on the developers section

boroda

  • Hero Member
  • *****
  • Posts: 3520
Quote
. Extract the files located in the "Plugins" folder to your MusicBee Plugins directory:

 C:\Users\YOUR_USERNAME\AppData\Roaming\MusicBee\Plugins

 Note: If you aren't using this directory, you'll have to change the "folderPath"
 variable in the source files to the appropriate destination, and then rebuild it.
so your plugin wont work with portable mb at all? you could store any settings under path returned by MB_GetPersistentStoragePath() API function.

zkhcohen

  • Sr. Member
  • ****
  • Posts: 307
Quote
. Extract the files located in the "Plugins" folder to your MusicBee Plugins directory:

 C:\Users\YOUR_USERNAME\AppData\Roaming\MusicBee\Plugins

 Note: If you aren't using this directory, you'll have to change the "folderPath"
 variable in the source files to the appropriate destination, and then rebuild it.
so your plugin wont work with portable mb at all? you could store any settings under path returned by MB_GetPersistentStoragePath() API function.

Interesting - I didn't realize that was an issue. If I have some free time this afternoon, I'll push out an update following your advice.

Thanks!

zkhcohen

  • Sr. Member
  • ****
  • Posts: 307
Latest update is live. Let me know if you have any issues.

boroda

  • Hero Member
  • *****
  • Posts: 3520
hmm... not sure whats the matter, but spectrogram panel displays nothing for me (portable mb if its important). i suspect that you use predefined path for Tooltips folder (i.e. C:\Program Files (x86)\MusicBee\).
Last Edit: August 17, 2018, 11:01:21 AM by boroda74

zkhcohen

  • Sr. Member
  • ****
  • Posts: 307
hmm... not sure whats the matter, but spectrogram panel displays nothing for me (portable mb if its important). i suspect that you use predefined path for Tooltips folder (i.e. C:\Program Files (x86)\MusicBee\).

Hm... I'll look into this. I decided to use GetCurrentDirectory for the ffmpeg path, which appears as Tooltips for me. I'm not sure if this is standard for all MusicBee instances.

Frankly, I have no idea why Tooltips would be the working directory for plugins as standard.
Last Edit: August 17, 2018, 03:11:05 PM by zkhcohen

zkhcohen

  • Sr. Member
  • ****
  • Posts: 307
Updated.
Last Edit: August 19, 2018, 07:51:43 AM by zkhcohen

rudolph

  • Jr. Member
  • **
  • Posts: 37
Useful, but it will still not replace spek that I'm using to check if song is fake mp3 or anything like that because it doesn't show numbers on any of the sides of the spectrum, so i can't guess where it goes above 16 kHz and 20khz.


zkhcohen

  • Sr. Member
  • ****
  • Posts: 307
Ah yeah, I disabled that. You can have the ffmpeg output contain the numbers as an overlay on the image.

I'm planning on updating this soon, anyway, so I'll give it a shot.
Last Edit: October 26, 2018, 11:25:39 PM by zkhcohen

mrbenn

  • Jr. Member
  • **
  • Posts: 55
Hi.

I think I found a bug - if a track has the same Artist and Title, the plugin shows the same output for both files.

My test was "Chic - Good Times", (which is a common dupe in my library as I have a *lot* of disco.)

Over several different versions, lengths and bitrates, the files tagged "Chic - Good Times" all gave an identical image (which I think is the one from the first track with those tags that is played), but the one marked "Chic - Good Times (Original 12" Mix)" had a unique image.

My guess is that these two tags are used to tag the image in the cache for the next time its played?


zkhcohen

  • Sr. Member
  • ****
  • Posts: 307
Hi.

I think I found a bug - if a track has the same Artist and Title, the plugin shows the same output for both files.

My test was "Chic - Good Times", (which is a common dupe in my library as I have a *lot* of disco.)

Over several different versions, lengths and bitrates, the files tagged "Chic - Good Times" all gave an identical image (which I think is the one from the first track with those tags that is played), but the one marked "Chic - Good Times (Original 12" Mix)" had a unique image.

My guess is that these two tags are used to tag the image in the cache for the next time its played?



Oh, yeah. I should probably fix that.

I'll work on it asap.

I also created a version with the frequencies shown, but it's really only practical if you put it on another tab of its own.

I'll release both.

zkhcohen

  • Sr. Member
  • ****
  • Posts: 307
Hi.

I think I found a bug - if a track has the same Artist and Title, the plugin shows the same output for both files.

My test was "Chic - Good Times", (which is a common dupe in my library as I have a *lot* of disco.)

Over several different versions, lengths and bitrates, the files tagged "Chic - Good Times" all gave an identical image (which I think is the one from the first track with those tags that is played), but the one marked "Chic - Good Times (Original 12" Mix)" had a unique image.

My guess is that these two tags are used to tag the image in the cache for the next time its played?





Here's a fixed version:

http://www.mediafire.com/file/eamoioe1483muj0/MusicBee_Spectrogram_Plugin.zip/file


Let me know if you have any issues.

zkhcohen

  • Sr. Member
  • ****
  • Posts: 307
Useful, but it will still not replace spek that I'm using to check if song is fake mp3 or anything like that because it doesn't show numbers on any of the sides of the spectrum, so i can't guess where it goes above 16 kHz and 20khz.



Here's a version with the legend enabled. Personally I don't like the look of it. I'm hoping I can modify the source files of ffmpeg to use a much smaller legend:


http://www.mediafire.com/file/cm4ie9b7s5jj7mv/mb_Spectrogram-Display.dll/file

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6053
IMPORTANT NOTE: MusicBee 3.2 is prone to crashes when enabling new plugins. Expect for it
 to crash up to 3 times before it becomes permanently stable. If you continue
 to have issues, try reinstalling the plugin, or reconfiguring the panels.
I suggest that you change this text since MB is -not- prone to crashes. It may be the -plugin- that causes MB to crash. Especially since you told Steven (in the developers sub-forum) that the issue was fixed.
Download the latest MusicBee v3.3 patch from here.
Download the latest MusicBee v3.4 beta patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here