abs_4to16pads_bin_conv_sv: convert 4 (midi) pads from a binary value to a decimal (for rerouting)
Background:
Last week I made the (what I now know as "life-altering") commitment to buy (and did) my first usb+midi keyboard controller, a Samson Graphite M25. I have since set up my shop (since given my tools+configuration I could not use the Graphite Preset Editor and because everything works better if you get pd involved :---)) to run the kb into pd then into amsynth via jack, using pd as the midi interface: kb>pd>amsynth>out.
In the process, one thing I did was upgrade the 32 "pre", preset button knobs, to 120, using the ideas included in this abstraction: convert the 4 pads and their binary-ness into decimals, so I can then tell pd to make the knobs, 8x15, instead of 8x4 (the default PRE pad count), see below for clarification...
Requirement(s): Linux and shell external (though I am pretty sure a version using the "until" object is do-able, I did not find one and know the shell waaayyy better than until or even metro.
Synopsis: by pushing on various combinations of pads (could actually be any set of cc(?)'s) the resulting binary number is turned into a decimal which can then be used to re-route or set a different control, ex. PROG.
(from the _help file comments):
Purpose: convert binary values to decimals in order to simplify and expand the rerouting from one control to another, ex. from POLTYTOUCH to PROG.
The left inlet takes a routing/control value,;
ex. note/polytouch control, etc.;
the middle inlet takes the value from that control;
and the right inlet takes a bang to trigger/get/output;
the decimal equivalent.
4pad/trigger to 16 pad/trigger binary-to-decimal converter;
the patch converts the pressing of multiple pads;
to a binary number then to a decimal so that;
for ex. a 4 pad control can send signals from 1-15.
the "shell" external is required;
and the shell script, named:bin2dec_pd, is;
also required. It includes only a single line, echo "$((2#$1))".
FYI: in the polytouch instance, the control is looking for;
127 as a trigger value, so the pads must be pushed Completely down.
I DO believe a metro or until version;
of this is also possible but the shell was more expedient.;
-svanya
'Swallow' keyboard key press
Thanks David, I agree that midi keyboards and controllers are cheap and convenient. I also have touchOSC.
My quest with the qwerty keyboard is more for the sake of geekness than practicability.
With glovepie my script would use scroll lock as a toggle: when off it's a typing computer keyboard and when on events are swallowed and turned into midi messages. I then use the mouse to control what happens on the screen.
One of my uses is that I have a second qwerty keyboard connected to the PC that is lying on the floor (the computer doesn't make the difference between 2 keyboards). With just one scroll lock press then each third of the keyboard surface is mapped to one midi note: that's how I have a puzzling looking wireless effect footswitch!
I also had a mouse footswitch in the same fashion, it's great fun to kick those interfaces. And they come for free as you can still make use of them when people discard them because some keys are defective..
I'm discovering Auto Hot Key now and it seems it may be the answer to my needs.
'Swallow' keyboard key press
Thank you for the answer! I 've been looking for so long for a way to use the qwerty keyboard as a midi instrument and controller without having to focus on the program windows and only glovepie could do that but it's dead now.
Auto Hot Key should be able to swallow input but I haven't tried the midi side yet.
For people curious about this, here's what I found until now that can be useful:
http://www.bome.com/products/mousekeyboard is very nice with keyboard, mouse and joystick midi control. You can also trigger chords. But the window needs to be on top to receive the keys..
http://freepiano.tiwb.com/en/ Open source and allows to self record midi. Still needs window focus.
http://www.nosuch.com/keykit/ is quite fun for the geeks. Maybe a bit similar to puredata. Needs window focus.
http://midi-control-center.software.informer.com/ Very old but a lot of midi messages and notes customization with joystick, keyboard and mouse. Need window focus.
http://www.vanilin.org/v7/7.html How frustrating! This one finally is able to swallow keys even when not in focus and you can customize the keys a bit but no midi control and no use of special keys.
New to PD, need help with notes failing to turn off.
I've been working on my first major patch for the past few months. It's a synthesizer based heavily on the tutorial on flossmanuals.net. After finally creating all of the features I wanted I started to modify the patch to make the synthesizer polyphonic. The catch is that I want to control the patch using the Mad Catz Mustang midi guitar controller. This controller works perfectly fine with the polyphonic synth in the PD help browser as well as with other polyphonic synth patches I've found online, so I do not think the controller has any problem interacting with the [poly] object.. The problem is that when I use it with my patch, some notes fail to turn off. It seems to happen most often when I quickly slur from one note to another. I did not have this issue when using the monophonic version of my patch. The amplifier subpatch is definitely receiving noteoff messages, but for some reason, they do not cause the envelope to close.
I think part of the problem has to do with the way the controller sends messages. I use the controller in 'tap mode,' meaning a noteon is sent whenever a fret button is pressed and noteoffs are sent when fret buttons are released. However noteoffs are also sent whenever any fret button is pressed in order to turn off the "open string" (A note can be played without pressing a fret button by striking the string sensors, and the only way to turn it off is by playing a fretted note). This occurs whether or not the open string is playing and I think this may be messing with [poly]'s voice allocation. I'm tempted to just say that the controller can't be worked around, but since I know it works for other patches I'm going crazy trying to fix my patch.
I understand it would be hard to duplicate this behavior without having the controller, but as I said before it works like a dream with other patches. I have tried to imitate the polyphony of these patches as best as I can. I've tried disconnecting and reconnecting objects in every order imaginable and I've tried delaying on and off messages in case they were somehow arriving to the amplifier envelope out of order.
Attached is a simplified version of my polyph[full poly help.pd] onic patch. I'd really appreciate it if anyone could give it a quick look over just in case there's anything really obvious that I'm just missing.
Thanks so much and have a great day.
EDIT: Please ignore the errors about missing {receive~}s or {catch~}es. The {send~}s and {throw~}s are for some of the features that I removed from this version of the patch for simplicity's sake but I did not remove the {send~}s and {throw~}s.
Pack - cold inlets and lists
I had a similar problem packing ctlin outlets for further routing.
The control value bangs after the control number. The control number is used to route the control value to its place, so whoever got the control value, it was always one bang delayed. This was specially irritating because my controls would never go to zero (I made a simple drawbar organ).
I worked around this problem by inserting an extra value to the left of the pack, thus creating a dummy hot inlet. I fed the dummy hot inlet with the last banging signal (the control value), and then removed it with an unpack. Then I packed it again, this time with no dummy value.
Multiple mice and keyboards as \[hid\] not for X input
@atarikai said:
I know I can target individual mice and keyboards with [hid] but is there a way to keep the linux Xserver from using them as input?
Old thread, I know, but for anyone else who stumbles upon it...
I think what you want is the `xinput` command. First, find out what devices you have:
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Trackball id=8 [slave pointer (2)]
⎜ ↳ Wacom Intuos3 6x8 eraser id=9 [slave pointer (2)]
⎜ ↳ Wacom Intuos3 6x8 cursor id=10 [slave pointer (2)]
⎜ ↳ Wacom Intuos3 6x8 id=11 [slave pointer (2)]
⎜ ↳ Logitech USB-PS/2 Optical Mouse id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Power Button id=7 [slave keyboard (3)]
↳ Unicomp Endura Keyboard id=13 [slave keyboard (3)]
You can detach the device, preventing it from controlling the X pointer/keyboard, by using `xinput float`, e.g.
$ xinput float "Logitech USB Trackball"
(or use its numeric ID.) The control stream will still come through via HID. In fact, you can use `xinput` to access the control stream as formatted text as well:
$ xinput test "Logitech USB Trackball"
motion a[0]=1176 a[1]=607
motion a[0]=1177 a[1]=608
motion a[0]=1177 a[1]=609
motion a[0]=1177 a[1]=610
button press 1
button release 1
The `xidump` command from the Linux Wacom Project can be used in a similar way.
To reattach the floated device and regain control of the X pointer:
$ xinput reattach "Logitech USB Trackball" "Virtual core pointer"
You can detach keyboard devices as well, but watch for the Enter key getting (virtually) stuck!
LP blending into a BP blending into a HP + filter graph
Hmmmm...I built one like this once...I think.
I don't recall exactly what I did but I think this would work (better):
First things first, decide what controls it. If it's MIDI you're looking at 0-127 control values, better off with Audio control. You can make a 128 point table that uses the curve you like, then read it from [tabread4~] with a MIDI CC or a [line~] for (much) higher resolution.
Anyhoo, it sounds like you'll want to take advantage of [moses] to separate the the control values into different ranges. Here's a thought:
0-24: controls LPF
24-48: controls LPF & BPF & and a crossfade curve between them
48-72: controls BPF
72-96: controls BPF & HPF and a crossfade curve between them
96-127: controls HPF
And now someone will say "but the phase distortion..." Yeah, I'm not phased.
When we say morphing there are much more complex ways of accomplishing this effect than crossfading - but crossfading is simple.
For visualizing it - well, you know what it does so it's an unnecessary burden on your CPU, but if you don't care about latency you can explore data structures - it'd be difficult to construct. Other alternatives are silly, like using noise and an FFT plot - but you'd be able to do that by hacking apart the resynthesis sample I think, again only if you are using it for production.
Please share, I could use a well thought out filter of this type - it's common in the old Traktor, right?
-J.P.
Workshop: Xth Sense - Biophysical generation and control of music
April 6, 7, 8 2011
11:00-19:00
Xth Sense – biophysical generation and control of music
@NK
Elsenstr. 52/
2.Hinterhaus Etage 2
12059 Berlin Neukölln
FULL PROGRAM: http://www.nkprojekt.de/xth-sense-%E2%80%93-biophysical-generation-and-control-of-music/
~ What
The workshop offers an hands-on experience and both theoretical and practical training in gestural control of music and bodily musical performance, deploying the brand-new biosensing technology Xth Sense.
Developed by the workshop teacher Marco Donnarumma within a research project at The University of Edinburgh, Xth Sense is a framework for the application of muscle sounds to the biophysical generation and control of music. It consists of a low cost, DIY biosensing wearable device and an Open Source based software for capture, analysis and audio processing of biological sounds of the body (Pure Data-based).
Muscle sounds are captured in real time and used both as sonic source material and control values for sound effects, enabling the performer to control music simply with his body and kinetic energy. Forget your mice, MIDI controllers, you will not even need to look at your laptop anymore.
The Xth Sense biosensor was designed to be easily implemented by anyone, no previous experience in
electronics is required.
The applications of the Xth Sense technology are manifold: from complex gestural control of samples and audio synthesis, through biophysical generation of music and sounds, to kinetic control of real time digital processing of traditional musical instruments, and more.
~ How
Firstly, participants will be introduced to the Xth Sense Technology by its author and led through the assembling of their own biosensing wearable hardware using the materials provided.
Next, they will become proficient with the Xth Sense software framework: all the features of the framework will be unleashed through practical exercises.
Theoretical background on the state of art of gestural control of music and new musical instruments will be developed by means of an audiovisual review and participatory critical analysis of relevant projects selected by the instructor.
Eventually, participants will combine hardware and software to implement a solo or group performance to be presented during the closing event. At the end of the workshop, participants will be free to keep the Xth Sense biosensors they built and the related software for their own use.
~ Perspective participants
The workshop is open to anyone passionate about sound and music. Musical background and education does not matter as long as you are ready to challenge your usual perspective on musical performance. Composers, producers, sound designers, musicians, field recordists are all welcome to join our team for an innovative and highly creative experience. No previous experience in electronics or programming is required, however participants should be familiar with digital music creation.
Participation is limited to 10 candidates.
Preregistration is required and can be done by sending an email to info@nkprojekt.de
Requirements and further info
Participants need to provide their own headphones, soundcards and laptops with Pd-extended already installed.
Musicians interested in augmenting their favourite musical instrument by means of body gestures are encouraged to bring their instrument along. More information about the Xth Sense and a video of a live performance can be viewed on-line at
http://res.marcodonnarumma.com/projects/xth-sense/
http://marcodonnarumma.com/works/music-for-flesh-ii/
http://marcodonnarumma.com/teaching/
Dates
6-7-8 April, 11.00-19.00 daily (6 hours sessions + 1 hour break)
Fee
EUR 90 including materials (EUR 15).
Contact
Marco Donnarumma
m[at]marcodonnarumma.com
http://marcodonnarumma.com
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)
PD cuts off other sound on the computer
I did.
For command jackd I get this terminal output:
matjaz@matjaz-NV59C:~$ jackd
jackdmp 1.9.6
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2010 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
Cannot create thread 1 Operation not permitted
Cannot create thread 1 Operation not permitted
usage: jackdmp [ --no-realtime OR -r ]
[ --realtime OR -R [ --realtime-priority OR -P priority ] ]
(the two previous arguments are mutually exclusive. The default is --realtime)
[ --name OR -n server-name ]
[ --timeout OR -t client-timeout-in-msecs ]
[ --loopback OR -L loopback-port-number ]
[ --port-max OR -p maximum-number-of-ports]
[ --midi OR -X midi-driver ]
[ --verbose OR -v ]
[ --clocksource OR -c [ c(ycle) | h(pet) | s(ystem) ]
[ --replace-registry ]
[ --silent OR -s ]
[ --sync OR -S ]
[ --temporary OR -T ]
[ --version OR -V ]
-d backend [ ... backend args ... ]
Available backends may include: alsa, dummy, freebob, firewire or net
jackdmp -d backend --help
to display options for each backend
and for qjackctl:
The same control GUI opened where I clicked start.
15:38:11.262 Patchbay deactivated.
15:38:11.263 Statistics reset.
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
15:38:11.286 ALSA connection graph change.
15:38:11.482 ALSA connection change.
15:38:19.241 Startup script...
15:38:19.242 artsshell -q terminate
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
sh: artsshell: not found
15:38:19.646 Startup script terminated with exit status=32512.
15:38:19.646 JACK is starting...
15:38:19.646 /usr/bin/jackd -dalsa -d/dev/dsp -r44100 -p256 -n2 -Xseq
15:38:19.649 JACK was started with PID=2544.
Cannot create thread 1 Operation not permitted
Cannot create thread 1 Operation not permitted
jackdmp 1.9.6
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2010 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
Cannot lock down memory area (Cannot allocate memory)
ALSA lib control.c:882:(snd_ctl_open_noupdate) Invalid CTL /dev/dsp
control open "/dev/dsp" (No such file or directory)
ALSA lib control.c:882:(snd_ctl_open_noupdate) Invalid CTL /dev/dsp
control open "/dev/dsp" (No such file or directory)
audio_reservation_init
Acquire audio card Audio-1
creating alsa driver ... /dev/dsp|/dev/dsp|256|2|44100|0|0|nomon|swmeter|-|32bit
ALSA lib control.c:882:(snd_ctl_open_noupdate) Invalid CTL /dev/dsp
control open "/dev/dsp" (No such file or directory)
Cannot initialize driver
JackServer::Open() failed with -1
Failed to start server
15:38:19.743 JACK was stopped with exit status=255.
15:38:19.745 Post-shutdown script...
15:38:19.746 killall jackd
jackd: no process found
15:38:20.153 Post-shutdown script terminated with exit status=256.
15:38:21.703 Could not connect to JACK server as client. - Overall operation failed. - Unable to connect to server. Please check the messages window for more info.
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
15:38:31.152 Could not connect to JACK server as client. - Overall operation failed. - Unable to connect to server. Please check the messages window for more info.
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
15:38:42.143 Could not connect to JACK server as client. - Overall operation failed. - Unable to connect to server. Please check the messages window for more info.
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
15:39:02.300 Could not connect to JACK server as client. - Overall operation failed. - Unable to connect to server. Please check the messages window for more info.
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
I'm lost.