Emitters and Midi playing
-
@unknownuser said:
Anyway, 1st question: I need a code to set times (frames) at which an object emits. I plan on having a lot of times set. Would it be possible to put it in the scripted field? Or is that for something else? P.S. I only want it to emit once.
You have to use time rather than frames or it will not work right. I learned that from the drums example. The code to set an emitter to fire at a certian time is in both the piano and drum example.
@unknownuser said:
2nd question: Is there a way to delay when an emitter emits? (Possibly incorporated into the previous question)
You dont delay the emitter. You adjust the music score to handle the delay.
@unknownuser said:
3rd question: Is there a way to find out exactly how many frames an object takes to go from point A to point B?
I do it by firing the emitter at frame 0 and seeing how long it takes to actually produce a sound.
@unknownuser said:
I'm apparently no good with codes. The smartest thing I can probably do is variables.
Your best bet would be to wait until I finish my examples. They you should be able to do almost any music machine with very little coding.
-
Okay, cool.
But like I said, I have little knowledge on coding. I'm guessing that the drumScore is the emitter times. But the rest is gibberish. Could you possibly explain the process? (I have SP 3.2 (SU8) and SP 3.1 (SU7)) Other than that, I'll wait for you to get farther on your work and see what you accomplish. -
@naththagr8 said:
Okay, cool.
But like I said, I have little knowledge on coding. I'm guessing that the drumScore is the emitter times. But the rest is gibberish. Could you possibly explain the process? (I have SP 3.2 (SU8) and SP 3.1 (SU7)) Other than that, I'll wait for you to get farther on your work and see what you accomplish.The piano example is more like the right way to do it. As I said I was still figuring things out when I did the drums.
@@drumScore={"10:46"=>[[0, "NoteOn", 76], [10, "NoteOn", 0],
This is a converted midi file. It is stored in a hash table. The "10:46" means channel 10 (always drums in midi) note 46. After that is an array of events. At frame 0 turn note (10:46) "on" with a velocity of 76. At frame 10 "on" with velocity 0. In midi "on" with velocity 0 actually means Note Off. and so on...In the piano example its called midiEvents and the "NoteOn" has been changed to 1.0 for on and 0.0 for off.
@midiEvents={"1:69"=>[[3660, 1.0, 86], [3779, 0.0, 0],
-
Sorry if this bugs you, but the other things I don't understand as well. You explained the midiEvent well enough, but I believe that in order to fully understand it, most of the other codes would be needed to be explained. But I don't think I would want you to explain (and have myself try to figure out) the rest of it in about 30 paragraphs. Maybe there's another way? Was there a way to set the firing times for the emitter in SP 3.0 or maybe 3.1? I might understand that more easily.
My scenario: A drum set with other objects in them that play a sound when touched (onTouch). Balls emit, aimed at the drums, and bounce off the drums and end their 'lifetime.' I just need to know an easy way to set the times for the balls to fire. I have the sounds for the drums already. Thanks for doing this . -
It sounds like you are trying to recreate the drums example. Why dont you just modify the one I did. I dont mind.
The names of each of the drums is something like:
"midi:38"
That means when a ball touches me play note 38 (which is one of the drums)If you copy a drum and a emitter (the cone) and change the name of the drum to "midi:45" that pair will now play note 45.
You can change the aiming and strength of the emitter and you can change the graphics to whatever you want. You should be able to do a set of say, chimes without changing much.
Then just modify the drumScore to be whatever you want. The only other way to time this would be with a HUGE if then statment
-
I don't know why I didn't think of that earlier. I never noticed that they're named in order to play their sounds. What 'tells' the cone to emit? I know the drumScore has all of the info, but how does a specific cone receive it's part? Also, what's the point of telling the emitter to stop for the drums? ...[0, "NoteOn", 76], [10, "NoteOn", 0]... Also also, are all the midi files in SP 3.2? (strings, keyboards, guitars, etc.)
-
@unknownuser said:
I don't know why I didn't think of that earlier. I never noticed that they're named in order to play their sounds. What 'tells' the cone to emit?
There is code inside the cone and that checks every tick to see if it is time to fire based on the drumScore. Something like if drumScore[frame] is "on" then fire.
@unknownuser said:
I know the drumScore has all of the info, but how does a specific cone receive it's part?
Emitters know what note they play and the delay it takes the ball to arrive at the drum after firing. They know this by firing a ball at frame 0 and then measuring the time and the note played when it first strikes a drum.
@unknownuser said:
Also, what's the point of telling the emitter to stop for the drums? ...[0, "NoteOn", 76], [10, "NoteOn", 0]...
No point, they are not used. But the midi score I converted had them.
@unknownuser said:
Also also, are all the midi files in SP 3.2? (strings, keyboards, guitars, etc.)
Those are midi "instruments" and yes all midi instruments will work. There is a script command that will set the instrument on a given channel. Up to 16 different instruments can be playing at any one time.
-
I tried copying both an emitter and a drum. However, it only fired the very first one at frame 0. And so did everything else. (I should mention that I wanted to use my drum set that I have to do this model. But if that won't work, then I'll have to use yours.)
I then tried putting my model into yours, changed a drum (mine) to midi:38, moved an emitter (the one for the same drum on yours), and turned everything off except for mine, and it still only emitted the one time. Is this from the emitter trying to find the delay (What's the purpose for the emitter knowing the delay?)? Could you give me some other reasons for this? Plus, could you give me some tips for working on my model? Would I be able to use my sounds for my drum set?
How do you get another midi instrument to play? (Such as a vibraphone)
Questions, questions. I really appreciate it.
-
Sounds similar to my experience but I don't think I'm trying as hard as Nathan...just hanging back to see what all of these creative minds do with this when Chris gets enough time free from his "day job" and family to post the update. This is just the piece I need before proposing STAM as in Science Technology Arts and Music....the math and science are implied. Keep creating!
-
@naththagr8 said:
I tried copying both an emitter and a drum. However, it only fired the very first one at frame 0. And so did everything else. (I should mention that I wanted to use my drum set that I have to do this model. But if that won't work, then I'll have to use yours.)
Hmm, I tried it and it didnt work. Not sure why and I am afraid I dont have time to figure it out right now. Once I get back to doing SP stuff I will make a much nicer demo with all the stuff I learned making this and the piano example.
@unknownuser said:
Is this from the emitter trying to find the delay (What's the purpose for the emitter knowing the delay?)?Could you give me some other reasons for this?
Go back and read some of the other posts in this thread. Now that you know a bit about the model it might make more sense.
@unknownuser said:
Plus, could you give me some tips for working on my model? Would I be able to use my sounds for my drum set? How do you get another midi instrument to play? (Such as a vibraphone) Questions, questions. I really appreciate it.
As I said earlier the drums were the first model I did and its not done "right". The piano is a much better example.
-
Maybe 6 months later we can work this out....
So I recently started to work on this again. I got my model to play midi sounds with your drum example codes (I like the drum example even though you say the piano one is better). I need a way to tell the emitters when to fire, and currently the way you have it in your models seems too time consuming (unless you didn't type it out one by one).
And by not using your way ("10:46"=>[[...)), how can you change instruments?
Does the new version of SP help with this?I'm sure you'll have more time now.
Advertisement