I am new to Pd, so figive me if this is very simple...
Is there a way to implement a "switch" that will allow a signal to pass, or block it based on an input bang? Like, one bang enables the signal to pass, the following bang blocks it.
Thanks!
Controlling signal flow
I am new to Pd, so figive me if this is very simple...
Is there a way to implement a "switch" that will allow a signal to pass, or block it based on an input bang? Like, one bang enables the signal to pass, the following bang blocks it.
Thanks!
spigot switch or gate does that
I see in the help for spigot that there is a way to do this for audio, which is what i was looking fr.
Thanks!
Try to avoid [spigot~] since it's not available in all platform releases. But it's behaviour can be easily duplicated with some simple [*~] objects. Something like this:
[adc~]
|
| [X] <-- toggle which outputs 0 or 1
| |
[*~]
|
[dac~]
You could connect the bang to the toggle because that will switch it from 0 to 1 and back the next time.
|] [] |.| ][|-| -- http://soundcloud.com/domxh
That makes sense - thanks for the help.
Hi all of you!
We're totally new to the forum, and haven't ever worked with PD, but have to since we gotta do a little audio-thing with it for a subject at the University of Applied Sciences.
We thought about analysing the PC_microfone-input for some seconds, and then opening and playing a file which says something like "Whooooaaaa, you're way too loud!" etc etc...
Now, so far, so good. We got a problem with the spigot, which should block the incoming values, so that the answer to the input, better said the file, can be played in one row without interuption, which would take place, without spigot. But now, undependingly of sending an 1 or 0, it doesn't get any floats or values, and so no output takes place. What is wrong here??
Thanks for your answers beforehand!
PS: of course the audio files aren't included, so they won't work, but I guess one can control it with the number field or you make some audio files on your own. Most of you are specialists here so I keep my fingers crossed, I guess it won't be a problem for you.
There are two problems here. The first is that you have this:
[float]
|
[bng]
|
[spigot]
|
[float]
The [bng] converting all of your numbers into bangs (which is a unique data type in Pd), so the only thing the [spigot] is passing through are bangs. When the [float] at the bottom receives a bang, it outputs its stored value, which is zero by default. So it looks like it's doing nothing because its sending zero over and over. So get rid of the [bng]. Same thing with the one after [1(.
Second--and this is more subtle--when you fan out connects from a single outlet, you can't be certain just by looking at it what order the connections execute. You can force the order using [trigger], also known as [t ]. The arguments of [t ] determine the number of outlets and what data type to convert to (if needed). When it receives a value, it outputs them from right-to-left order from its outlets, so you can be certain what gets executed first. I mention this because you probably want to make sure the [spigot] gets opened before you send the value, like this:
[float]
|
[t f b] <-- send a bang out the right outlet, then pass the float to the left outlet
| \
| [1(
| \
[spigot]
It's a good idea to get in the happen of using [t ] to improve the readability of your patches and to prevent hard to find bugs.
But how do I stop the flow of the spigot? How do I have to use the delay, so that once 10 seconds past, the spigot blocks the passage. If i connect the 0 to the 1 or put another bang after the trigger, the 1 gets banged as well. and putting the delay 1000 and the 0 after the 1, the one doesn't even get to the spigot.
After taking a closer look at your patch, I'm not sure why you would even want that. I would think you'd want the [spigot] to close when it receives a new value and reopen after the soundfile is finished playing. If you leave the [spigot] open, it will just keep retriggering the soundfiles. [readsf~] sends a bang out its right outlet when it is finished playing, which you can use to to reopen the [spigot]. If you mean you want it to wait ten seconds after the soundfile is done, just stick a [delay 10000] between that and the [1(. See the attached (I also cleaned up you patch a bit).
Ok, thanks, it takes form now We did some small changes and now we've got exactly what we wanted thanks a lot for all your help!
Hi, I'm working on a setup which uses a loadbang to enable ;pd dsp $1. So far, so good. However, I have it like this:
[loadbang]
|
and
[r bang]
|
[toggle]
|
[;pd dsp $1]
however, I also have an [init] button going to elsewhere in the script, and am wondering, what should I do so that the toggle is switched to un-toggled after the first loadbang is sent? Because now that I do an [init], it switches the [;pd dsp $1] off. Should I use a spigot, but how should I plug it so that it's done once, and then set to off, without sending to the [;pd dsp $1] messagebox?
[loadbang]
|
|0(
|
and
[r bang]
|
[toggle]
|
[;pd dsp $1]
@Gromit said:
[loadbang]
|
|0(
|and
[r bang]
|
[toggle]
|
[;pd dsp $1]
can this be altered to[r bang]
|
|0(
|
[;pd dsp$1] ?
Yes
Oops! Looks like something went wrong!