udpsend and receive
@toddak to fix the missing dependancies run this in terminal.............
sudo apt-get update
(and then)
sudo apt-get upgrade -f
In fact you should do all of these from time to time....... (not the bits in brackets)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get upgrade -f (fix missing dependencies)
sudo rpi-update (firmware and kernel)
It is most likely that you need pulse audio for Pd to run....... I think that it is essential....
and maybe the dejavu fonts (uncertain)........ and so the command above should solve your problem and Pd should then run....
ALSO...... if it will still not run once the missing dependancies have been installed you should check that you are running an armhf system:...........
Run this command in terminal:
readelf -A /proc/self/exe | grep Tag_ABI_VFP_args
If the Tag_ABI_VFP_args tag is found, then you're running on an armhf system. If nothing is returned, then it's armel. To show you an example, here's what happens on a Raspberry Pi running the Raspbian distribution:
pi@raspberrypi:~$ readelf -A /proc/self/exe | grep Tag_ABI_VFP_args
Tag_ABI_VFP_args: VFP registers
This indicates an armhf distro, which in fact is what Raspbian is. On the original, soft-float Debian Wheezy distribution, here's what happens:
pi@raspberrypi:~$ readelf -A /proc/self/exe | grep Tag_ABI_VFP_args
Nothing returned indicates that the kernel is armel.
David.
Pure Data / Raspberry Pi / Realtime Audio / Permissions
THE GOAL:
I want my Raspberry Pi 2 to automatically start up the Jack server with realtime scheduling, and subsequently start Pure Data with realtime scheduling, load a patch &c. without any user intervention from a login shell.
As a performance artist working primarily with psychodrama (the technology is definitely NOT the important part here), fiddling around at a terminal right before or during a performance is kind of... psychically inconvenient. I need a box that I can plug in, give the audio output to the sound guy, and be ready to go.
PREREQUISITES:
I use Raspbian with a Linux kernel compiled with realtime goodness. I have hand-compiled Jack2 and Pure Data with realtime support in order to take advantage of this. Running a process with realtime priority requires the proper PAM directives set in /etc/security/limits.conf and related places, but that is beyond the scope of this little write-up.
Also somewhat relevant: I use a M-Audio MobilePre USB soundcard (sounds pretty awful by today's standards, but it's an extremely USEFUL box and sounds good enough for the work I do). For full-duplex sound, this requires the RasPi's USB to be set to single speed. In this configuration, I can get just under 2.9ms latency with good CPU overhead for Pure Data to run a few of my 64-voice wavetable and delay line granulators. Yeah!
THE PROBLEM:
Purely by happenstance, I had given the jackd command in my startup script the option “-s” which allows the server to ignore overruns and so on. So things seemed to be working as expected, but I noticed a lot more glitches than when I manually started up Jack and Pd from the terminal without the “-s” option. Upon removing it from my startup script, everything failed! WAH.
So I started piping STDERR and STDOUT to text files so I could read what either Jack or Pd were complaining about. As it turns out, Jack was unable to start with realtime priority due to a permissions problem. (I assume this is one of the things the “-s” options allows jackd to ignore, and thus start up with non-realtime priority. Problem is that Pure Data can’t connect to a non-realtime Jack server when its “-rt” option specified.)
Now, I had already been through the whole rigamarole of setting proper memory and priority limits for the “audio” group, to which the user “pi” belongs. So I thought, okay, I have to execute these commands as “pi”, and while simulating a login shell because the security limits in question are only set during login.
So I did this:
su -l pi -c "/usr/local/bin/jackd -R -dalsa -dhw:1,0 -p128 -n3 -r44100 -S >> /home/pi/jackd.log 2>&1 &"
This says “login as user ‘pi’ and then run the jackd command with these options, piping the outputs to this log file and run it in the background”. Well, I still got all the same errors about not being able to set realtime priority. WHYYYYYYYYY?
THE SOLUTION:
I hunted and hunted and hunted on a Very Popular Search Engine til I decided to try searching “security limits not loaded with su -l” and found this.
(Makes me think of that Talking Heads lyric, “Isn’t it weird / Looks too obscure to me”.)
So by uncommenting the line # session required pam_limits.so
in /etc/pam.d/su
everything started working as expected.
CONCLUSION:
I now know a LOT MORE about PAM and how important it is to keep in mind when and in what order scripts and other little subsystems are executed; but also that sometimes the problem is EXTREMELY OBSCURE and is to be found in some seemingly far-flung config file.
I hope this helps anybody out there working with Pure Data and the RasPi. The second generation board really packs quite a punch and can run several hundred audio grains (run by vline~ and enveloped by vline~ and cos~) simultaneously without a problem. And I'm pretty sure this is just using ONE of the 4 cores!
I'm by no means an expert Linux sysadmin, so if you have any other suggestions or corrections, please let me know! I wouldn't have been able to get this far without all the generous and helpful writeups everybody else has contributed, both within the RasPi and Pure Data communities. If you have any questions about anything I glossed over here, I'll do my best to answer them.
creating a live line
If you send a new message to the [line] or [line~] object while it is active, it will use its current position x as a starting point for a new line with the newly given time n. This means that the total elapsed time will be x + n. Now I'm trying to make a patch where the total elapsed is just n, the newly selected time value. This would be useful ie. for changing tempo live, rather than waiting until [line] has finished before starting a new cycle.
Here is a prototype that works by sending a new value of n - x to [line].
However, this only works for one iteration. If you select a second or third new time value, the total elapsed time will be off.
I'm afraid that this problem stretches my maths brain further than it will go. Can anyone work out how to get it to work for n iterations, so that if you drag the new time value, [line] will always update? Or has this been solved already in a different way?
Problem with [comport]
Hello
i have one problem and i don't know how to solve it without going back to windows 8.1
before i update my pc to windows 10 my puredata+arduino work, on arduino i use Serial.write(); to comunicate with puredata with [comport 9600] but now when i open puredata sketch i get this error:
comport number 9600 out of range (1-99)
[comport] opening serial port 9600 failed!
comport number 9600 out of range (1-99)
[comport] opening serial port 9600 failed!
and when i try to open port 3 (where i have arduino connected) i get this error:
Opening COM3
[comport] opened serial line device 3 (COM3)
[comport]: RXERRORS on serial line (997)
[comport]: RXERRORS on serial line (997)
[comport]: RXERRORS on serial line (997)
[comport]: RXERRORS on serial line (997)
[comport]: RXERRORS on serial line (997)
[comport]: RXERRORS on serial line (997)
[comport]: RXERRORS on serial line (997)
[comport]: RXERRORS on serial line (997)
[comport]: RXERRORS on serial line (997)
[comport]: RXERRORS on serial line (997)
and i can't receive the data from arduino.
I am using arduino 1.6.4 and puredata 0.43.4- extended
anyone can help me?
thanks in advance
\[line~\] and \[+~\]
What's happening here is that the main playback [line~] (the upper left one) is sending a straight-line ramp that, alone, would read from the array at normal speed. However, this ramp is being modulated by the other [line~], which is not a straight line. The [*~] object after it makes it an exponential curve. This is added to the main [line~] ramp as a continuous offset modulation. The sum of the two [line~] segments results in a line that starts of as a curve and settles into a straight-line. So this starts reading from [tabread4~] at a faster than normal rate and gradually slows down to a normal rate.
By the way, this section is meant for posting your own tutorials, not questions about other tutorials. Questions like these should go in the "Technical Issues" section.
Swept sine deconvolution
Here is my new formula / method for an exponential test chirp.
sin((((pi/2^p)*L)/ln(2^p)) * e^((n/N)*ln(2^p)))
condition: ((pi/2^p)*L/ln(2^p)) = M*2*pi
M = a positive integer
L = a decimal number (floating point number) expressing chirpsize in unity samples
N = ceil(L), that is L rounded up to an integer, the real arraysize
p = the integer number of octaves in the chirp (user argument)
With this method, you get a chirp with evenly-spaced octaves. The chirp starts in sine-phase and also ends in (approximate) sine-phase, thus minimizing the ripple height. It is even the case that each octave starts and ends in approximate sine-phase, whatever use that may have.
The crucial element in the method is the exponential curve at index 0 and N.
e^((0/N)*ln(2^p)) = e^0 = 1
e^((N/N)*ln(2^p)) = e^ln(2^p) = 2^p
Notice that ((pi/2^p)*L/ln(2^p)) is a constant. If this constant is an integer multiple of 2*pi, the exponential curve will start with 2*pi and end with an integer multiple of 2*pi, since 2^p is also an integer.
Using this method, the start frequency depends on the sampling rate and number of octaves. The start frequency is (sr/2)/2^p. For example: (44100/2)/(2^10) = 21.53 Hz. The stop frequency is always near Nyquist, with a small deviance resulting from the rounding of L to N. For large N, the deviance is negligible for all practical purposes.
If y[n] is the chirp, the inverse chirp is formulated:
y[N-n] * -ln(1/2^p) * (2^(p/N))^-n
This calculates an inverse chirp with average power equal to the forward chirp. That means, more than unity peak level in the high frequencies, and less than unity in the low frequencies.
The user supplies a maximum length argument in nr of samples, and the required number of octaves. From this, a new object [expochirp~] calculates the first ideal length L below the maximum length. It returns the integer chirp size N as a message (so you can resize arrays), and starts feeding chirp and inverse chirp to the signal outputs.
Chirp and inverse chirp can be stored in a 32 bit float stereo .wav file, but the risk is that someone will play the stereo file in a regular soundfile player, which for the inverse chirp could lead to severe clipping. The reason for normalising to amplitude instead of unity peak level is that no further information is now needed about the chirp for normalisation after deconvolution. That normalisation will be simply N/2, like it would be the case for a linear chirp. For safety, chirp&inverse could be stored as .txt files instead of .wav. I don't know yet what is wise.
Although my expochirp method so far guarantuees a straightforward chirp with minimized ripple, the ripple is still considerable, and at the low frequency side quite problematic in my view. Some speaker systems may already have their own resonance frequencies in the region of the start frequency. Therefore this is exactly the region where a flat chirp spectrum is most important, to not push eventual resonances to further height. I have experimented with correction filters on the IR, but it would be better to relieve the problem at it's origin again, the shape of the chirp itself. I am now trying to find a fade-in window for that purpose. Windowing means amplitude modulation, causing sum- and difference frequencies. A proper window may cancel ripples, but a bad window could easily amplify them, or not? For me this is a new research topic. Only when results are acceptable I will finish [expochirp~] and share it.
Katja
Gui freezes while using wiilib
Hi,
I'm struggling against a pd GUI freeze problem.
This happens in a patch using objects from 'wiilib'.
The patch acts correctly and then at a random moment the GUI drops and I cannot move sliders seeing them (they remain drawed at the very position they had when the GUI dropped), etc...
Here are the error messages I get in console :
(Pd-Extended 0.42.5 on an Ubuntu 10.4-based distro optimized for RT music (tangostudio))
nau@lapnau:~$ /usr/bin/pdextended &
[2] 2090
nau@lapnau:~$ tk scaling is 1.3359631821170281
SSE2 detected
<init> : Avifile RELEASE-0.7.48-100119-23:57-../src/configure
<init> : Available CPU flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf p
<init> : 1801.00 MHz Intel(R) Core(TM)2 Duo CPU T5670 @ 1.80GHz processor detected
invalid command name "..x11a6370.c"
invalid command name "..x11a6370.c"
invalid color name "#fcf13.8.x11a6370.c"
bad option "item11a6370.c": must be addtag, bbox, bind, canvasx, canvasy, cget, configure, coords, create, dchars, delete, dtag, find, focus, gettags, icursor, index, insert, itemcget, itemconfigure, lower, move, postscript, raise, scale, scan, select, type, xview, or yview
invalid command name ".x1.x11a6370.c"
invalid command name ".x1.x11a6370.c"
invalid command name ".x11.x11a6370.c"
invalid command name ".x11.x11a6370.c"
unknown option "-tex0000.88.x11a6370.c"
invalid command name ".x11.x11a6370.c"
invalid command name "..x11a6370.c"
invalid command name "..x1651aa0.c"
can't read "cursor_runmode_nothin": no such variable
invalid command name ".x11.x11a6370.c"
Maybe should I work on IRQ priorities, or is it a wiilib or a pd "bug" ...
... has someone some idea of what I can investigate ?
Thanx.
Nau
How to call individual lines form text file as lists ?
Hello,
Anybody can tell me how I could call up individual lines from a .txt file by line number for example or by the first number in this line?
text.txt file containing;
0 61 112 ;
192 61 0 ;
192 63 112 ;
384 63 0 ;
384 64 112 ;
576 64 0 ;
576 62 112 ;
768 62 0 ;
I would like to call up individual lines into a list. For example line 4 would give me the following list; 384 63 0. Or how could I call up the first line that starts with 576 or the second line that starts with 576 or the first line that is greather than 700?
Thanks,
'instance handles' for abstractions
hi all,
i was wondering if anyone has advice/comments/questions on the following.
i am working on a that patch is set up with my synthesis/sampling algorithms nested in subpatches. i control them using 'command lines'. for example, to play a sample named x-sample, at pitch y and amplitude z, (x, y, and z being numerical parameters), i send a message such as [ ; sampler play x y z (. in the sampling subpatch, a recieve named sampler 'routes' the message and sends the parameters to the playback algorithm.
because the nature of my project will involve looping sequences of these 'command lines' i am working on an abstraction that takes creation arguments and loops whatever parameter accordingly. for the looping abstractions, i would like to use a similar message oriented command line interface, but i would also like to be able to use more that one instance of the looping abstraction at a time to sequence and loop various parameters at different phases.
how can i avoid jumbling up my 'command lines'--the abstractions will receive the messages and not understand to which loop or sequence the message corresponds. is there a way to assign each instance of an abstraction a unique handle or signature and then filter messages accordingly?
any discussion on such issues would be appreciated. i am open to help/suggestions/comments/criticism. thanks!
--zacha-dee