conditionally mixing signals
I have a very simple mixer in my app that mixes two signals at a time and takes the sum and mixes with another signal and then once again for a fourth signal.
This approach worked well before for just two signals but now with four signals to combine it seems like there are some audio quality issues when some of the voices are nil.
I'm no pd expert and I'm stumped on how to do this better.
should I toss this approach or is there a way to preserve audio fidelity when either or both of Voice 2 and Voice 3 have no signal.
It looks like I need a moses~ to conditionally bypass a mixing stage but I have no idea how to pull this off. If anyone can point me to an example that would be awesome.
I can only use vanilla objects.
Looking for PD guru...private proj
Cool...excellent in fact. Will start with 1 issue and go 1 at a time...
Main behaviour is a single click/double click/long hold. ie For midi sustain, a quick single click enables a filter which allows only note on values to play midi notes (for sustained atmoshpheres played from a midi guitar). Anything longer than a quick click is a standard momentary sustain pedal. A double click resets the pedal action and sends an 'all notes off' to clear everything.
I was planning to use this in a browser so I used an active X timer so it would be async to the rest of the script. Hope I have added enough comments to explain;
Insert Code Here Case 64 'Case CC 64 = sustain message from floorboard 'Dat1 = Midi message type+channel 'Dat2 = message value 'default action is send cc64 to instrument out ie Dat2 = 127 and begin sustain regardless of note off filter/sustain action If Dat2>0 Then mox.OutputMidiMsg InstOut, &hB0, 64, 127 'SC is prefix: SingleClick 'Check if its the first trigger in timer sequence and timer has been fired If SCTiming = 1 then 'Test how many pedal downs have occured during timer period If Dat1 = SCOldDat1 THEN SCClkCnt = SCClkCnt+1 End If Else 'Waiting for Single Click Pedal Up If WaitForSCPU=1 Then If (SCOldDat1=Dat1 AND Dat2=0) Then 'Long Hold Action - cc64 sustain off mox.OutputMidiMsg InstOut, &hB0, 64, 0 'Clear wait flag WaitForSCPU = 0 End If Else 'fresh trigger 'sc and dc are single/double click actions that are executed as strings according to timer sc="FilterMGNoteOff = FilterMGNoteOff XOR True : mox.OutputMidiMsg InstOut, &hB0, 64, 0" ' PUREDATA NOTE: couldnt see any XOR functions? dc="mox.OutputMidiMsg InstOut, &hB0, &h7B, &h7F : FilterMGNoteOff = False : mox.OutputMidiMsg InstOut, &hB0, 64, 0" 'SCTiming is a flag to indicate timer has fired SCTiming = 1 SCTimer.enabled = true SCTimer.Duration = 400 'set the click count to 1 (ie pedal down of 127 has ocurred) SCClkCnt = 1 End If End If 'Single Click previous value used for comparison/click count SCOldDat1 = Dat1
Insert Code Here
And here is the timer sink/sub; Insert Code Here Sub SC_Timer SCTiming=0 'Do Timer results here If (SCClkCnt=3 OR SCClkCnt=4) Then 'DC Behaviour Execute(dc) Else If SCClkCnt=2 Then 'msgbox "sc" 'SC Behaviour Execute(sc) Else If SCClkCnt=1 Then 'Wait for pedal up 'msgbox "pedal up" WaitForSCPU=1 End If End If End If 'Reset ClkCnt SCClkCnt=0 SCTimer.enabled = false End Sub
Hope that helps explain
The above example is a bit parametric in that it feeds strings to the sub. This type of module is used throughout the script so Im totally open to simplifying it/modding to make it better in PD...which, from what I have seen, looks like it should be able to do.
If I can get all the previous code to translate, would like to add a control panel showing the fcb with the the current status/values of footswitches on screen, or even just just plug a tablet on the front of the controller for the future.
Low audio latency in windows 7
Hi all, I'm struggling a bit on audio latency in pd (windows), so I wanted to have a clearer picture.
Apparently other applications seems to perform quite well (Reaktor), but in pd I'm experiencing serious problems.
I did a simple test, the result is here:
This is the test setup:
- pd .042.5 extended
- pd patch: 7.stuff/tools/latency.pd, measurement quite precise (Miller says ~1.5 ms)
- audio board: Cakewalk Sonar VS-100 (roland), USB 2.
- ASIO4ALL driver (portaudio)
- line out (1) cable jack connected to line in 1 (mic)
- windows 7 (64 bits)
Pretty instructive, at least for myself. I put a Scope~ object to visually see the output pulse fed back into input of the audio board:
the "sharp" pulse is the one generated by the patch, the "blurred" one that follows is the one fed back into the audio board.
The distance between the two is the "latency" of the system.
In summary, these are the major results I found:
- lowest true (measured) usable latency ~ 30 ms, corresponding to "delay (msec)" set to ~ 8 ms
- lowest true (unusable) latency ~ 20 ms, audio "destructed" "delay (msec)" set to ~ 3 ms
- Original HW driver is totally unuseful, only ASIO4ALL seems working ok (why? anyone has an idea?)
- I probably used very bad cables (see the bad pulse shape following the one created by the latency patch)
- changing the ASIO4ALL buffer size didn't change anything in terms of latency (why?)
Note: the only way I was able to lower down the "delay (msec)" values to few msec was using ASIO4ALL driver.
I'd like to hear your experience (I read about Domien playing "delayed") and if anyone was able to succeed to lower
the latency in win to unnoticeable values (~10 ms or even less).
PD from Max, missing Umenu
Little things like scope~ needing to be written [Scope~] was a bit confusing, but PD works great.
Since [Scope~] is an external, it may have been to avoid a nameclash with another [scope~] external. Just speculating, though.
I've looked into wrap~, and though it might be easier if it could accept wrapping arguments like max's pong~, I can surely force it into those ranges otherwise.
There is a [pong~] clone in Pd-extended.
I've also realized there aren't any dsp conditionals, like >=~.
Well, they actually do exist, but there were issues with them loading properly in Pd-extended. You can use [expr~ $v1>=$v2] as an alternative. [expr~] is one of those objects not included in Max that you may find yourself using all the time (unless you were using the external).
Also wondering about matrix~, is the table method the only way?
I don't know of a [matrix~] equivalent in Pd, but you definitely have all the objects you need to build it. I think you actually mean [matrixctl], though? Most people just line up a bunch of [tgl]s to make that kind of interface.
That's one of the things you'll likely find when moving from Max to Pd. Pd-vanilla doesn't have as many high-level objects as Max/MSP, but most of them have counterparts in Pd-extended or can be built with what Pd offers.
Are there externals I will need that aren't included in the recent PDextended release?
That depends on what your needs are.
Also wondering if anyone here is familiar with jMax, and if so if it would have the objects I'm looking for in an open source format.
I've never used jMax, but I do know that it was just recently brought back from the dead after a few years of no development and, so, needs to rebuild its community. I would say "not likely."
Will I need to tackle OSC to get these functionalities outside of Max?
That also depends on what your needs are.
PD from Max, missing Umenu
Lurked for a while, first post now.
I've been using Max/MSP pretty heavily since last December, and I've fallen in love with the visual coding paradigm. For a variety of reasons PD appeals to me more than Max (though I did get used to the bells and whistles). I've replaced all my hardware effects (loopers, stompboxes, synths, sequencers) with max patches, and I'd be comfortable enough making the same over again in PD, but I'm having trouble translating a few objects that I relied on heavily in Max.
Umenu is a big one, the ability to receive numbers and output corresponding text comes in handy with scripting lots of objects, and routing sends and receives. It's ease of populating, rewriting, and deleting of entries makes many complex tasks easily manageable. It also functions as a great label when I hid things away. I suspect there's an equivalent method, but nothing leaps out. Should I be looking at some sort of coll type object? Struct?
In the DSP realm, I'm a little worried not to see Rate~ or some analog of it. I use phasor~ to control my loops, and Rate~ works magic on polymetric sequences. I could probably rig up a similar system scaling and wrapping a signal, but straight up Rate would be best.
In order to be able to slot effects in and out of different parts of the signal chain, I've been using combinations of bpatchers and polys, with scripting to switch between different stompbox abstractions. I found the graph on parent option, but it doesn't seem (at least not obviously) that I can use scripting on it to call up different subpatches. Please correct me if I'm wrong.
I think those three might just cover it (at least for the time being). I've found the externals pulled from the max library to be an amazing resource, and between overlapping objects, manuals, and the answers on this forum most of what I need to know is readily available. If those objects lack analogs in PD I may just bite the bullet and get into java/c/python...at the moment I have no experience with text based programming, but I'm just looking for an excuse, really.
I'll be hitting the manuals cover to cover as best I can in the morning, but I'd be glad to have my patches running sooner all the same.
All help is much appreciated.
ok hello to evrybody, i'm new in puredata, i try to give coordonates to my cursor.
so i use this patch http://codelab.fr/attachment.php?item=682.
i can transmit to my mouse the position in x and y. with
mouse_pos linked to input_event. ok it's great
but i want to give x values and y values to the mouse_pos.
you know for example a audio input, i use the velocity of the audio to make the mouse moving.
so the more my number box is, the more my mouse will move in x or in y..
so i don't know if somebody had already done something similar, any help will be appreciate.
thanks a lot
DJ/VJ scratching system
First my story: (you can skip down to END OF STORY if you want)
Ever since I saw Mike Relm go to town with a DVDJ, I've wanted a system where I could scratch and cue video. However, I haven't wanted to spend the $2500 for a DVDJ. As I was researching, I found a number of different systems. I am not a DJ by trade, so to get a system like Traktor or Serrato with their video modules plus turntables plus hardware plus a DJ mixer, soon everything gets really expensive. But in looking around, I found the Ms.Pinky system and after a little bit, I found a USB turntable on Woot for $60. So I bought it. It was marketed as a DJ turntable, but I knew that it wasn't really serious since it had a belt drive, but it came with a slip-pad and the USB connection meant that I wouldn't need a preamp. And so I spend the $100 on the Ms.Pinky vinyl plus software license (now only $80). This worked decently, but I had a lot of trouble really getting it totally on point. The relative mode worked well, but sometimes would skip if I scratched too vigorously. The absolute mode I couldn't get to work at all. After reading a little more, I came to the conclusion that my signal from vinyl to computer just wasn't strong enough, so I would need maybe a new needle or maybe a different turntable and I didn't really want to spend the money experimenting. I think that the Ms. Pinky system is probably a very good system with the right equipment, but I don't do this professionally, so I don't want to spend the loot on a system.
Earlier, before I bought Ms.Pinky (about two years ago), I had also looked around for a cheap MIDI USB DJ controller and not found one. Well, about a month ago, I saw the ION Discover DJ controller was on sale at Bed, Bath & Beyond for $50. They sold out before I could get one, but Vann's was selling it for $70, so I decided that that was good enough and bought one. I had planned to try to use it with Ms. Pinky since you can hook up MIDI controllers to it. But it turns out that you can hook up MIDI controllers to every control except the turntable, so that was a no go. If I had Max/MSP/Jitter, I could have changed that, but that's also way expensive. So, how should I scratch? My controller came with DJ'ing software and there's also some freeware, like Mixxx, but none of this has video support. So I look around and find Pure Data and GEM.
And I see lots of questions about scratching, how to do it. And there are even some tutorials and small patches out there, but as I look at them, none of them are quite what I'm looking for. The YouTube tutorial is really problematic because it's no good at all for scratching a song. It can create a scratching sound for a small sample, but it's taking the turntable's speed and using that as the position in the sample. If you did that with a longer song, it wouldn't even sound like a scratch. And then there are some which do work right, but none of them keep track of where you are in the playback. So, whenever you start scratching, you're starting from the beginning of the song or the middle.
So, I looked at all this and I said, "Hey, I can do this. I've got my spring break coming up. Looking at how easy PD looks and how much other good (if imperfect) work other people have done, I bet that I could build a good system for audio and video scratching within a week." And, I have.
END OF STORY
So that's what I'm presenting to you, my free audio and video scratching system in Pure Data (Pd-extended, really). I use the name DJ Lease Def, so it's the Lease Def DJ system. It's not quite perfect because it loads its samples into tables using soundfiler which means that it has a huge delay when you load a new file during which the whole thing goes silent. I am unhappy about this, but unsure how to fix it. Otherwise, it's pretty nifty. Anyway, rather than be one big patch, it relies on a system of patches which work with each other. Each of the different parts will come in several versions and you can choose which one you want to use and load up the different parts and they should work together correctly. Right now, for most of the parts there's only one version, but I'll be adding others later.
There's a more detailed instruction manual in the .zip file, but the summary is that you load:
the engine (only one version right now): loads the files, does the actual signal processing and playback
one control patch (three versions to choose from currently, two GUI versions and a MIDI version specific to the Ion Discover DJ): is used to do most of the controlling of the engine other than loading files such as scratching, fading, adjusting volume, etc.
zero or one cueing patch (one version, optional): manages the controls for jumping around to different points in songs
zero or one net patch (one version: video playback): does some sort of add-on. Will probably most commonly be used for video. The net patches have to run in a separate instance of Pd-extended and they listen for signals from the engine via local UDP packets. This is set-up this way because when the audio and video tried to run in the same instance, I would get periodic little pops, clicks, and other unsmoothnesses. The audio part renders 1000 times per second for maximum fidelity, but the video part only renders like 30 or 60 times per second. Pure Data is not quite smooth enough to handle this in a clever real-time multithreading manner to ensure that they both always get their time slices. But you put them in separate processes, it all works fine.
So, anyway, it's real scratching beginning exactly where you were in playing the song and when you stop scratching it picks up just where you left off, you can set and jump to cue points, and it does video which will follow right along with both the scratching and cuing. So I'm pretty proud of it. The downsides are that you have to separate the audio and video files, that the audio has to be uncompressed aiff or wav (and that loading a new file pauses everything for like 10 seconds), that for really smooth video when you're scratching or playing backwards you have to encode it with a codec with no inter-frame encoding such as MJPEG, which results in bigger video files (but the playback scratches perfectly as a result).
So anyway, check it out, let me know what you think. If you have any questions or feedback please share. If anyone wants to build control patches for other MIDI hardware, please do and share them with me. I'd be glad to include them in the download. The different patches communicate using send and receive with a standard set of symbols. I've included documentation about what the expected symbols and values are. Also, if anyone wants me to write patches for some piece of hardware that you have, if you can give me one, I'll be glad to do it.
Keith Irwin (DJ Lease Def)
A collection of GLSL effects?
i get these errors...it doesnt want to link
error: [glsl_fragment]: shader not loaded
linking: link 9.80909e-45 7.00649e-45
linking: link 9.80909e-45 1.12104e-44
[glsl_program]: linking with uncompiled shader
[glsl_program]: Link failed!
[glsl_vertex]: Vertex_shader Hardware Info
[glsl_vertex]: MAX_VERTEX_ATTRIBS: 16
[glsl_vertex]: MAX_VERTEX_UNIFORM_COMPONENTS_ARB: 4096
[glsl_vertex]: MAX_VARYING_FLOATS: 64
[glsl_vertex]: MAX_COMBINED_TEXTURE_IMAGE_UNITS: 32
[glsl_vertex]: MAX_VERTEX_TEXTURE_IMAGE_UNITS: 16
[glsl_vertex]: MAX_TEXTURE_IMAGE_UNITS: 16
[glsl_vertex]: MAX_TEXTURE_COORDS: 8
Artists using Pure Data
Here is my experience...
im learning pd before i buy max/msp , since pd is a lot like max but free and there is a whole lot more documentation on PD than max, and the people who developed PD are the same people developing MAX (from what ive read) i figured id learn PD before buying MAX.
This has a lot to do with me buying Reaktor 5 before i learned programming and hated myself for years for that and ended up using the library and almost never opened reaktor after that.
After about 3 or 4 months of annoying reading on PD im on my way to building my first FM synthesis drum machine so yay! i dont feel so stupid now and studying on PD is making me understand Reaktor 5 so im guessing itll help me with max/msp as well.
so take it from someone who made an idiotic choice on purchasing software about 2 years ago based on who is using it, being a fan of richard devine and datachi and electroacoustic music.
Software wont make you sound great only studying hard will.
PD is a great place to start and im guessing itll be a great place to stay...
hope this helps.
Controlling old plotter with PD \[comport\]
I recently did the same thing in Max, I don't know exactly how pd deals with special characters, but here are some pointers.
To read in the plotfile, I used Max's filein, which gives you ascii directly. I believe mrpeach/binfile does the same for pd?
"," ";" etc are problematic in Max, and probably in pd too. to output "PA 120,200;" I used atoi ("asci to int in" max) only for the numbers, and inserted the , ; etc via an append / prepend chain with the corresponding ascii values, i.e. [append 59 13] to put ";" + CR at the end etc.
occasionally one might need to use backslash as an escape char in Max, don't know about pd
depending on the plotter, you might need to tell it to go into xon/xoff mode, this is some escape sequence, I "manually" translated to ascii and used it as a list in Max.
if its a hp plotter, most docs are available at hpmuseum.net (go for programming manuals), for other brands I hope it came with a printed one ...