Page 1 of 1

Frequency cuts to waveforms

Posted: Thu Dec 15, 2016 8:47 pm
by Colin Gale
Hey Magic Users,
I Really like what has been done in Magic 2.0, But one feature that i feel is sorely missed in this release is the option to do basic EQ cuts from the audio window.

This would be a fantastic addition from my standpoint, however I may just be missing out on an already existing feature.
Is it possible to make waveforms respond to certain frequency ranges? if so how is this achieved?

Re: Frequency cuts to waveforms

Posted: Fri Dec 16, 2016 1:25 am
by Terry Payman
Colin Gale wrote:...Is it possible to make waveforms respond to certain frequency ranges? ...
Not in Magic - but it would be really cool if one could (I may have already requested this - I certainly intended to). You must filter the audio outside Magic before feeding it the Waveform module. For real-time use I have a graphic EQ on the mic input to my sound card (although a parametric EQ would probably be better). If I'm working with audio files I pre-filter in Audacity if I only have a mix rather than separate stems.

It would be very cool to be able to filter within Magic - perhaps use the same filtering as is available for the "Freq. Range" audio feature, also to have some tuning on the timebase so one could arrange for a stationary waveform for any desired frequency.

Perhaps of interest: I've been experimenting with an XY oscilloscope shader, a slight variant on https://www.shadertoy.com/view/4tdXzX. Because it's fed with audio in the form of an image texture, a blur module in that feed has the effect of an audio low-pass filter. The beauty of the plotting technique is that a waveform is plotted against a time-shifted version of itself, giving a pattern that is static if the harmonic content of the wave is static. This video contrasts that with Magic's native waveform display modes, which have an inherent timebase ("Overwrite" is checked for the upper waveforms, unchecked for the lower).

I've certainly put in a feature request for XY display viewtopic.php?f=4&t=919

Re: Frequency cuts to waveforms

Posted: Fri Dec 16, 2016 11:34 am
by Sadler
In this graph I select frequencies from the input audio using a polygon - you have to pass this on the a GL or ISF visualiser though. You can do other things to the input audio too - like brightness and contrast.
Frequency select.png
Frequency select.png (30.92 KiB) Viewed 10774 times

Re: Frequency cuts to waveforms

Posted: Fri Dec 16, 2016 11:51 am
by Terry Payman
Sadler wrote:In this graph I select frequencies from the input audio using a polygon...
That's a neat way of selecting a frequency range from a spectrum input, but without an inverse transform I struggle to see how it can produce a frequency-filtered waveform, although I can see it would broadly modulate the amplitude.

Must do some experiments when time permits, as clearly it's a useful modulation technique regardless of the actual waveform - thanks for sharing.

Re: Frequency cuts to waveforms

Posted: Fri Dec 16, 2016 4:35 pm
by Magic
one feature that i feel is sorely missed in this release is the option to do basic EQ cuts from the audio window.
I agree :). It would be a very useful feature, and it's something I'm planning to do.
Because it's fed with audio in the form of an image texture, a blur module in that feed has the effect of an audio low-pass filter
In the meantime, this is a good solution. Generally when people want to filter a waveform, they want to do a low-pass filter because low frequencies produce more interesting visual patterns than high frequencies. So if you use audio data in the form of an image texture (using the AudioToImage module), and you feed this image into a shader (similar to the one Terry posted), you can blur the image beforehand to get the low-pass effect.

Re: Frequency cuts to waveforms

Posted: Fri Dec 16, 2016 6:50 pm
by artnik
I think the suggestion of adding a complementary inverse "AudioImage to Waveform" function to Magic would be fantastic from a new user experience perspective. I've used the method he describes, with that exact same shader, but it was non-obvious as a beginning user. I did look for an opposite to "Audio to Image" before stumbling on the method later on.

Re: Frequency cuts to waveforms

Posted: Sat Dec 17, 2016 5:08 pm
by Magic
That would actually be a fairly simple shader for you to write :), because it's almost identical to this one: https://www.shadertoy.com/view/Xds3Rr. It draws the waveform based on the second row of input image data (which happens to be how Shadertoy provides the sound waves), but you could change it to an arbitrary row (or column, or whatever). Then all you have to do is hook up an input module in Magic -- Image, VideoFile, etc.

Re: Frequency cuts to waveforms

Posted: Sat Dec 17, 2016 8:22 pm
by artnik
Here's a converted version of that shader, with a couple of toggles for drawing each element.

https://www.interactiveshaderformat.com/sketches/1590

For input use the AudioToImage module with both boxes checked.

Cheers!

Re: Frequency cuts to waveforms

Posted: Sat Dec 17, 2016 11:39 pm
by Sadler
Hey Nik - perhaps in your port you could parameterise the second value in the smoothstep with a range of 0.002 to 0.2?

Re: Frequency cuts to waveforms

Posted: Sun Dec 18, 2016 5:01 am
by artnik
Hey Sadler,

Done. It's been added.

Lately I've been trying to keep true to a 0-1 range, so it runs from that, with an offset of .001 to ensure the line doesn't disappear. You can always use modifiers to limit the range to what you want.

It also struck me it would be handy to add controls to define which rows the Frequency and Waveform data are being sampled from.

Cheers!

Re: Frequency cuts to waveforms

Posted: Thu Dec 29, 2016 8:05 am
by tongleiter

Perhaps of interest: I've been experimenting with an XY oscilloscope shader...
@Terry Payman: Did you manage to create an oscilloscope fully in Magic? If yes, how do you do it?

Re: Frequency cuts to waveforms

Posted: Mon Jan 02, 2017 12:34 pm
by Terry Payman
@tongleiter:
Sorry for my delay in responding.

No, I haven't been able to create a full oscilloscope. Following your question I did try to add a timebase to my XY display (with a brightness ramp on the X-axis) but the overall system ran far too slowly to be of any use.

Re: Frequency cuts to waveforms

Posted: Tue Jan 03, 2017 9:11 am
by tongleiter
Thank you very much Terry - no worries.

How did you manage to create the centered-animation (in red) from the video you have posted on vimeo - it looks much like an oscilloscope to me.. (in the external application "Shadertoy" I guess)?

I'll create a new topic to reach out to the whider community - mabey someone else has managed to create a full oscilloscope.

Best,
Silvan

Re: Frequency cuts to waveforms

Posted: Thu Jan 05, 2017 9:14 am
by Terry Payman
tongleiter wrote:How did you manage to create the centered-animation (in red) from the video you have posted on vimeo...?
I'll respond in your handy new topic viewtopic.php?f=2&t=1126