Previous topicNext topic

Frequency cuts to waveforms

Suggestions for new features for Magic.
Post Reply
Colin Gale
Posts: 1
Joined: Thu Dec 15, 2016 8:29 pm

Frequency cuts to waveforms

Post 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?
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Frequency cuts to waveforms

Post 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
Sadler
Posts: 1139
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: Frequency cuts to waveforms

Post 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 10580 times
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Frequency cuts to waveforms

Post 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.
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Frequency cuts to waveforms

Post 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.
artnik
Posts: 268
Joined: Tue Jan 05, 2016 5:33 pm

Re: Frequency cuts to waveforms

Post 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.
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Frequency cuts to waveforms

Post 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.
artnik
Posts: 268
Joined: Tue Jan 05, 2016 5:33 pm

Re: Frequency cuts to waveforms

Post 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!
Sadler
Posts: 1139
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: Frequency cuts to waveforms

Post 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?
artnik
Posts: 268
Joined: Tue Jan 05, 2016 5:33 pm

Re: Frequency cuts to waveforms

Post 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!
tongleiter
Posts: 7
Joined: Sat Dec 17, 2016 11:04 am

Re: Frequency cuts to waveforms

Post 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?
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Frequency cuts to waveforms

Post 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.
tongleiter
Posts: 7
Joined: Sat Dec 17, 2016 11:04 am

Re: Frequency cuts to waveforms

Post 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
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Frequency cuts to waveforms

Post 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
Post Reply