Previous topicNext topic

How to generate a shape per beat?

Questions, comments, feedback, etc.
Post Reply
mr-self-destruct
Posts: 9
Joined: Sat May 26, 2018 9:35 pm

How to generate a shape per beat?

Post by mr-self-destruct »

I created a shape that animates from left to right, passing through the screen.

I am trying to make it so that shape keeps being generated on beat. So far, all I was able to do is get the shape to reset every beat, but I don't want it to disappear halfway through and start at the beginning (see video link).

I used 2 input selectors to cause it to reset the animation. I was thinking just drawing the shape multiple times, and have 1 triggered at a time cycling through them, but I can't figure that out.

I am hoping there is a simple expression or ISF that might help, but I am completely ignorant on how to write one. I am including a link to my project, so you can see what I mean. I want sound to keep triggering the animation, but instead of resetting, I need a new shape to keep being generated when sound triggers it.

Note:
I also tried using a starfield an moving the Y-axis. This allowed multiple shapes to be triggered and is closer to what I need, but it doesn't generate objects on beat. Instead it generates a certain amount of objects per second. I don't want that, because this causes shapes where there are no beats.

plz help?

Link to project: https://drive.google.com/file/d/1iaPZTg ... sp=sharing
Link to example video: https://drive.google.com/open?id=1H48iQ ... dwMDz8_t-H

Thanks for any tips and helpful info!

-David
Sadler
Posts: 1139
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: How to generate a shape per beat?

Post by Sadler »

Here's how to use the input selector to cycle through a number of shapes along with the beat. Trigger counts up when its threshold (0.3) is exceeded and Wrap makes sure it doesn't count more than the number of shapes (5.0).
shape_switch.png
shape_switch.png (62.92 KiB) Viewed 5195 times
mr-self-destruct
Posts: 9
Joined: Sat May 26, 2018 9:35 pm

Re: How to generate a shape per beat?

Post by mr-self-destruct »

Sadler wrote:Here's how to use the input selector to cycle through a number of shapes along with the beat. Trigger counts up when its threshold (0.3) is exceeded and Wrap makes sure it doesn't count more than the number of shapes (5.0).
Thank you for that tip! That's kind of what I need. The only issue now is that it switches between shapes, so the previous one disappears. I can't figure out a way to make the first shape keep moving, and the second enter.

Instead of just triggering each scene/shape, the input actually changes from one to the other. I need a way to do exactly that, but draw all 5 inputs simultaneously. Perhaps I am using the wrong approach. If I can somehow generate 1 animated shape per beat, that would make my life much easier.
Sadler
Posts: 1139
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: How to generate a shape per beat?

Post by Sadler »

When a beat triggers a shape travelling across the screen, the shape will take some time to complete its journey. If a another beat occurs in the interim you want to send off another shape across the screen. Is that correct? If there are many beats in succession, you'd have to send many shapes travelling across the screen together. Unless you were targeting a specific piece of music you couldn't predict how many instances you'd need travelling across. Even if you only planned to have five shapes, there may be more instances of those shapes especially if the shapes travel slowly or the beats come quickly.

There's been talk of an improved particle system and also of a module that will build up its inputs on this forum which might help you do what you want. In the meantime, there is no mechanism to dynamically instance different images that persist over time.

Perhaps if you could explain more exactly what you're trying to achieve, someone on the forum might have further thoughts.
mr-self-destruct
Posts: 9
Joined: Sat May 26, 2018 9:35 pm

Re: How to generate a shape per beat?

Post by mr-self-destruct »

Thank you. Your responses have already helped plenty :)

I apologize for the vagueness. I am working on a 25-30 minute avant garde film, with around 5 separate scenes. If I can get this to work, then I can include this scene.

My whole idea gets pretty intricate, but let me give you the gist and maybe we can find a way.
Imagine driving in a car across a desert, looking out the passenger window. I will program a cactus or some desert plants, that I need to generate on beat, moving across. I have the specific song in mind and it is a low BPM, so I think up to 5 shapes can cycle through animation. If a 6th beat occurs before the 1st shape left the screen, I don't mind shape 1 resetting to inital position, as it will be far less noticable with all the other details I have in mind.

Does that make sense?

Thanks again for reading and for any suggestions! I'm super excited to dive into visuals with Magic, and I can't wait to show you guys the installations/scenes that I'm working on.
mr-self-destruct
Posts: 9
Joined: Sat May 26, 2018 9:35 pm

Re: How to generate a shape per beat?

Post by mr-self-destruct »

As for the idea, Imagine a super abstract/simple/crappy version of this video by The Chemical Brothers: https://www.youtube.com/watch?v=0S43IwBF0uM
Sadler
Posts: 1139
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: How to generate a shape per beat?

Post by Sadler »

Here's an export from some experimentation. The arrows are initiated on the left on each beat then travel across to the right allowing enough beats to make it across the screen. However, you'll notice that some arrows disappear before their final destination. This is because there are more events in the audio than the loop can handle and the motion is restarted.

Because each loop waits, there isn't necessarily an instantiation on each beat. This is alleviated somewhat by having (in this case) six loops with slightly differentiated params so they come out at different beats.

Another thing you'll notice is that oftentimes multiple shapes will be initiated together. I think this is fine in this context but for your cacti not so much. Since everything is automatic dependent on the audio it is impossible (in this case) to ensure that there's a shape on every beat and no more than one. For that you'd need some of the features I mentioned earlier.

You'll appreciate with me that this isn't very punchy i.e. there's no great sense of the arrows instancing on the beat. I think that is because they're not regular but more so because they are initiated off screen so you can't see the beat. Whatever one does, one always has the issue with a travelling thing: where should the beat occur?

mr-self-destruct
Posts: 9
Joined: Sat May 26, 2018 9:35 pm

Re: How to generate a shape per beat?

Post by mr-self-destruct »

This is great! Pretty much what I'm trying to do. I can see what you mean about the "issues" about the beat and multiple shapes/resets. I honestly think I could still make this work, since the cacti was more of an illustration, I plan on using several different shapes that will pass through, and I also use MIDI clock to control some of the beats instead of the volume/frequency, making them appear exactly when I want them to. I don't mind a shape resetting once in a while, since it doesn't need to be perfectly sequenced. As long as you can tell that beats are generating them.

I don't know how you made it so that the shapes could all be drawn in 1 scene, it seems like this is the last thing I am missing in order to run some tests :(

Once again, I totally appreciate your help and the video you made! sweet music as well!
Sadler
Posts: 1139
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: How to generate a shape per beat?

Post by Sadler »

This is the trick that does all the work:
vf.jpg
vf.jpg (17.57 KiB) Viewed 5147 times
Controlling the power parameter is ideal in this situation since a VideoFile module doesn't play while its power is off and if Scene Start is checked it will restart its clip when powered on. Turn off looping. Using Magic, I exported six travelling shapes to video. I loaded these six videos varying the speed, wrap and audio feature. Each time an audio event triggers, it immediately powers on the VideoFile module. As more triggers come in, the value counts up until the wrap sends it back to zero, turning the module off. It shouldn't turn on again until the next audio event. If the Wrap matches the speed of the shape and the number of triggers it should make it to the other side before being restarted.

As you say, a midi clock will be much more reliable and predictable and will also allow you to play with the offset, i.e. sending the clock ahead of the music to fire the shapes a little early.

To get all the videos to play on top of each other, just feed them all as inputs into one module - any module will do as long as it doesn't affect the input. The videos would need to have an alpha channel or keyed in some way to see all the layers overlapped. In the video above I used a luma key.
mr-self-destruct
Posts: 9
Joined: Sat May 26, 2018 9:35 pm

Re: How to generate a shape per beat?

Post by mr-self-destruct »

Thank you! I will give this a try and see if I can make it work! :)
Post Reply