Hi! There is so much documentation online, but i still cant seem to figure this out:
I have a sharp gp2d120 sensor hooked up to my arduino. The arduino has firmata 2.0 installed so that it can communicate to PD (using pduino). I am getting a steady stream of voltage data from the sensor (as you can see from the the 4th analog pin in the screenshot). I'm trying to figure out how i can turn this data into something i can work with. Or maybe i need to learn how to work with it. Ultimately i want to control the frequency of a sound file based on the voltage output of the sensor (which is relative to the proximity of an object to the sensor).
So how can i convert this analog data into something i can work with (some data type that i can [delay] and that i can output to [dac~]? Do i need to use [mtof] to convert it to frequency? Do i need to turn it into a MIDI device somehow? [ctlin]? [tabread4]? These are just some objects that have come up after i searched for solutions, but i don't know how to execute it all.
side note: is it possible to set the sample rate of arduino in PD? the sensor works best with 10ms intervals between each sample.
I installed pd-extended on Ubuntu 8.04, following the instructions here: http://en.flossmanuals.net/PureData/InstallingUbuntu ... but what they suggest doesn't work:
Since "feisty" is a pretty old release, the archive is no longer available... so you gotta use the "old-releases" i think:
I hope this helps somehow. pd-extended has all the good stuff installed, unlike pd-vanilla.
damn godinpants, that was exactly what i needed!! damn i'm excited now, its starting to work out! i also divided the soundfiler info by 100 and multiplied it to the signal before the [pack 0 100]. that made sure it worked for the full sound file instead of just 0-44100.
i have two sensors. one sensor is the scratcher: the soundfile is played fast/slow depending on how fast i move an object closer to the sensor. I dont know if that makes sense. is it possible to have the other sensor slow down the speed of the playback??
for instance, i have a 10 second file. i made the vertical slider range from 20-100 because that's the range the signal is clearest. if i move my hand slowly closer to the sensor, the 10 second sound file plays forward. i want the other sensor to "zoom" into the vertical slider and make, for instance, the 20-30 range the range that the 1st-scratcher-sensor is working with. if my left hand is using the 2nd "zoom" sensor, and my right hand is using the 1st "scratcher" sensor, my left hand will pinpoint a section of the sound file that i want my right hand, the scratcher, to play back and forth.
Whats the best way to do that? (sorry for the long detailed messages, i just try to make sure you guys understand my situation)
radiostarkiller, thank you so much for your suggestions! The floss manual was very helpful with the basics. Pduino was actually running fine and compute audio was activated, i just forgot to have it running when i took the screen shot The audio examples folder was very helpful. I found some awesome examples. I ended up using the scratch machine in B07.sampler.pd .... so now i can control the playback of the audio file based on how far my hand is away from the IR sensor. I attached a screenshot. Awesome!!
godinpants, thanks for your very useful advice. Knowing that [soundfiler] outputs the file length is very helpful. Why is it always 44104 when i open any sound file? Is it the sample rate or the file length? When i try to add a longer sound file, the [soundfiler] outputs the same information, and the playback is shortened. Is the length of the sound file cached somewhere or does the [tabread4~] or [soundfiler] object automatically factor that in? I opened a 30sec sound file but i only saw a very small sample of it in the table.
If you look at the screenshot, you can see that vertical slider. I'm using that to clip the data into the range from 1-100. Is it possible to do that using objects? I want to smooth out the incoming sensor data so it wont be jumping up and down; that wont make my scratching machine work very effectively. How do i use a float or [line] to smooth in my patch? I found that i can make a metronome bang every 50 ms to broaden the incoming data and that might do the same thing, but i don't know how to implement (assuming using float?)
Thanks for the help!
Ahhh, i found the object i was looking for. I needed to convert numbers to audio signal using [sig~]. So i connected [sig~] to [phasor~] to [hip~] and finally to [dac~]. This outputs a sawtooth wave. I was able to place a [cos~] in there somewhere and output a smoother sound. I was stocked when i actually heard the pitch change while moving my hand away from the sensor.
Now I have two working IR sensors. I want the output of one to change the pitch of the sound file and the other to change the speed. I looked at many looper patches, and tried to implement the patches into my patch, but it didn't output sound for some reason. Check out the attachment. Is this the right way to play a local sound file using [soundfiler]? Do you have to load the frequency from a sound file into a graph in order for it to loop? Am I missing something?
Also, is there documentation out there that goes over the basic flow of data from numbers to sound, explaining what range of numbers creates what frequency, etc? It's hard to find simple documentation for beginners. Patches are very helpful because i play around with the different objects and messages, but i would like to understand whats going on in the background.