I'm trying to get pitch from a piano with fiddle to control a synth (kind of).
First try/test is the attached file. Problem is it only works for high keys. I think this is due to lower amplitude in lower keys. Input comes from a cheap casio keyboard via a cheap microphone and is not very strong. What is the best way to amplify this signal within PD?
-
Fiddle~ and piano
-
Instead of a mic and the keyboard, seeing as its cheap and old, perhaps a hack is in order?
Connect the speaker connection straight to a jack.puredata punx http://www.cyberpunki.biz
-
Thanks for advice, hardoff and jon2211. The lop and hip amplification seams to do the trick, and larger buffer propably helped as well. Getting decent results now.
Plan is to use a toy piano when I'm finished so hacking the keyboard wouldn't realy help (it's got both headphones and midi out, any way). Otherwise it would have been smart though.
More questions propably to come since this is my first real project. -
Can this patch be modified as follows? i'm looking to have a microphone input that not only recognizes pitch but that can also distinguish amplitude. Here's the tricky part: i'd like to be able to assign keyboard/text outputs depending on the output. For instance, if a piano plays a 440A, i'd like the patch to recognize that and then output the letter "A"; if the sound hits a certain dB range, i'd like to assign another key stroke (say "F") that could be outputted to another program like PowerPoint to trigger visual cues.
I've read on the PDList that some folks suggest using fiddle~ and moses~ - being a total PD newbie, i'm hoping some kind soul will write up a working patch that i can learn from and possibly modify. Thanks!
-
In your last post, you said the toy piano has MIDI out. Instead of using the audio signal, why not use the MIDI note and Velocity to control the text output and powerpoint control.
-
Well, i'd like to experiment with live audio options - i'm a collaborative pianist and want to see what kind of effects we can control with various acoustic instrument and vocal ensembles
-
one way
sound (sound source, [adc~] or [osc~] etc)
|
|
fiddle~ (get pitch, see fiddle example for more detail)
|
|
split 430 450 (if pitch is between 430 and 450)
|
[A( (send message with A)see attached
-
This looks terrific! Can't wait to try it out - can you make another example using volume as a variable instead of pitch? Thank you soooo much!!
-
for volume try using env~ in a separate chain from the source. you might have to scale it to work right (output is 0-100) but should work the charm. up the patch when you're done so we can play with it
sound
|
|
env~
|
|
split 90 100 <--i tend to use moses instead of split but they work similarly
| |
| |
[loud{ [not as loud{ -
Ok, i can see how substituting the osc~ with adc~ can get PD to recognize A440 when i play it on my piano. Here are a few more questions:
1. How can i get PD to actually print (send the typed characters) to an external application, like Powerpoint?
2. The patch seems to continually send the text string. Is there a way to limit the keystroke repetitions? Perhaps some sort of timing variable requiring a certain amount of time to elapse before "re-firing" the text string?Thanks so much for your help! This is exciting! PD is so cool!
-
Just to clarify - i'm hoping i can have PD emulate a keyboard with the text outputs. Does that make sense? Is that even possible?
-
GEM can display text I believe. text2d or something like that, look in pd reference
I don't think you emulate a keyboard could directly in PD. I would think PD->external hardware->back to computer e.g. PD sends signal to microprocessor(basic stamp, arduino) to throw switch on typing keyboard (or emulation device).
On windows you could use VBScript to look at a text file and output the contents as keystrokes. PD could write the textfile. However, this would probably be somewhat clunky.
Also, if you just want to display the text, you could send it to flash using [flashserver]. For that matter any program that can read in OSC, TCP, or UDP messages and can display graphics might work.
Anywho, that's the brain dump for now
-
argh! so close, and yet so far! i'm using a presentation program called Liquid Media that has the visual programming simplicity of Powerpoint. i was hoping to be able to use PD to trigger assignable keystrokes to activate visual events within Liquid Media...can anyone come up with a simple way to have PD emulate a keyboard? Even if it means rigging up a second computer to "talk" to the other via an ethernet cable? I guess i'm showing my reluctance to dive into GEM, given how complex it looks...
-
so liquid media seems to be windows only. so see attached.
i wrote an object called [openfile] that is windows only. has worked for me so far but use at you own risk.
the file launches a vbscript in the background that sends keystrokes to a window of your desire.
open the included text file (not minimize but open(can be in the background)
open pd and turn on the metro by hitting the toggle box. the textfile will pop to the front and starting printing "Test"
The script works by calling the window by name in title bar, then sending keystrokesin case no one wants to open the script:
'''''''''''''''''''''''''''''''''SendKeyToApp.vbs
'May 8, 2008
'JonGrant
'Send text string to desired open window
''''''''''''''''''''''''''''''''Option Explicit
'On Error Resume Next
Dim objWshShell
Set objWshShell = CreateObject("WScript.Shell")
objWshShell.AppActivate "Test"
objWshShell.SendKeys "Test"'figure a way to do command line and the command is
'sendkeystoapp.vbs windowTitle string
'e.g. sendkeystoapp.vbs Test.txt Test
'This will send Test to a textfile call Test
'Just replace above with these
'Option Explicit
'On Error Resume Next
'Dim strAppWindowTitle
'Dim strSendString
'Dim objWshShell
'Set objWshShell = CreateObject("WScript.Shell")
'strAppWindowTitle = WScript.Arguments.Item(0)
'strSendString = WScript.Arguments.Item(1)
'WshShell.AppActivate appWindowTitle
'WshShell.SendKeys strSendString -
This new vbs app is very, very cool - thanks so much, jon2211! Is there any way to modify this so that the script can accept variable text/strings printed from within PD, instead of a defined text within the vbs script? i'd like to be able to create multiple parameters within PD sending different text strings for different conditions - perhaps sending "A" for a 440 pitch through fiddle~ and then a "C" keystroke if the pitch changes to 523.25 (C above middle A). Sorry for all the hand-holding, this Newbie REALLY appreciates all the help he's getting
-
Ok - here's what i've been able to come up with so far, thanks to everyone's help! I used bonk~ and moses to help distinguish loud and soft audio inputs, and then sent the resulting signals to two variations of the sendkeytoapp.vbs scripts. Overall it works well, but i'm noticing a significant delay from PD to the external app.
I'm still trying to get my head around using sendOSC and somehow calling the python version of SendKey directly from within PD - i have the sendOSC apparently successfully opening a socket, but i don't know how to follow through and send keypress text to another application. Any additional help to explore this option would be greatly appreciated! I'm learning so much from everyone here - thanks a million!!
-
you mentioned python in your last post,
I just remembered thisnever used it but it looks like a way to use python scripts in PD
-
Hello there,
I'm trying to get the signal from a piezzo mic stuck to a cello to send a midi note to an instrument. So, needless to say I've learnt quite a lot from this thread. Thanks for that!
Now, I'm having some trouble : fiddle seems to send a bang, and therefore a new noteout, every time it's trying to pick up a frequency. I don't know if I'm being clear, but the problem is that when I play a note on the cello, the patch sends A LOT of noteout, making something like a "swarm" of notes that becomes really chaotic in no time.
I tried to bypass this problem by sending a bang (and therefore a note) regularly, but that's obviously not a good way to do it.
What I would need is a patch that would detect the beginning of a note played by the cello, send the "noteout", wait for the beginning of another note to send the corresponding "noteout", and so on.
Any idea on getting this happening?
Here's the code, it's obviously very similar to what has been shown here
Cheers.
Rodolphe
-
rodolpheg: if you round off the midi note values you could probably use [change], i'm not on my pd computer but there's definitely a vanilla pd object that takes a numerical inlet and drops the decimal, then [change] will take that value and not output again until it gets a different integer (read: different semitone), hence working around all the bangs from fiddle~
also about 4 months late to the party but if it doesn't help you it'll help someone -
rudolpheg: too elaborate on slvchn's method, something like this:
[fiddle~]
|
|<----------only taking the pitch info.
|
[+ .499]
|
[int]
|
[change]the [int] truncates the midi float to an integer, and the +.499 is there so it rounds to the nearest note, rather than simply truncating the decimal off.
alternatel, you could use the attack bang inlet on [fiddle~] (the 3rd or 4th outlet?) to send a stored [float]. check the helps for [fiddle~] and [int]. and for your low cello notes, you want a bigger fft hanning window. try [fiddle~ 1024] perhaps.
any technology distinguishable from magic
is insufficiently advanced.