Closed wiiNinja closed 2 years ago
Hi @wiiNinja,
I think the best way to implement this would be to write your own image generator (copy/pasting the existing one, making a few tactical edits). After creating a SpectrogramGenerator
and loading it with data, instead of calling its GetBitmap()
method you would instead call GetFFTs()
and pass that result into your own method almost identical to the one below, but which creates a rotated image.
That should be enough to get you started! I'll try to implement this today and if it's as easy as I think it is I'll name it something like GetBitmapVertical
and publish an updated package. I'll follow-up here to report what I find either way.
I added a rotate
argument to Spectrogram.GetBitmap()
in #48 and will release Spectrogram 1.6 in a few minutes
I hacked-in a checkbox to the demo app to show how it works, and you can see the spectrogram operates as expected but there is not support to draw a horizontal frequency scale. I hope you still find this useful!
https://user-images.githubusercontent.com/4165489/178158073-337056a7-b4cd-42f4-9631-c9011879789e.mp4
SpectrogramGenerator sg = new(44100, 4096, 500, maxFreq: 3000);
sg.Add(audio);
System.Drawing.Bitmap bmp1 = sg.GetBitmap(rotate: false);
bmp1.Save("test-image-original.png");
System.Drawing.Bitmap bmp2 = sg.GetBitmap(rotate: true);
bmp2.Save("test-image-rotated.png");
original | rotated |
---|---|
doh! I just realized it's upside-down 🤦
Fixed original | rotated |
---|---|
:) I do appreciate it very much. Definitely helps. Edit: Snapshot of things working. The "Morse Keyer V4.3" in the screenshot is an external app that triggers the audio. Thanks again.
I'm writing an app that has a visual audio waterfall component. This component is almost exactly what I need, except that the display flows from right to left instead of top to bottom. I found that before I draw the image, I can rotate it 270 degrees to achieve this effect, but it's not as clean as if the component itself can be configured to do so from the start. So this is a request for that feature. If you don't have time to do it, can you suggest a way to do this using your component? Thanks for giving a really nice and useful component.