ALSA output error (snd\_pcm\_open) Device or resource busy
Sorry to necro this thread, but I finally found out how to run PureData under Pulseaudio (which otherwise results with "ALSA output error (snd_pcm_open): Device or resource busy").
First of all, run:
pd -alsa -listdev
PD will start, and in the message window you'll see:
audio input devices: 1. HDA Intel PCH (hardware) 2. HDA Intel PCH (plug-in) audio output devices: 1. HDA Intel PCH (hardware) 2. HDA Intel PCH (plug-in) API number 1 no midi input devices found no midi output devices found
... or something similar.
Now, let's add the
pulse ALSA device, and run
pd -alsa -alsaadd pulse -listdev
The output is now:
audio input devices: 1. HDA Intel PCH (hardware) 2. HDA Intel PCH (plug-in) 3. pulse audio output devices: 1. HDA Intel PCH (hardware) 2. HDA Intel PCH (plug-in) 3. pulse API number 1 no midi input devices found no midi output devices found
Notice, how from the original two ALSA devices, now we got three - where the third one is
Now, the only thing we want to do, is that at startup (so, via the command line), we set
pd to run in ALSA mode, we add the
pulse ALSA device, and then we choose the third (3) device (which is to say,
pulse) as the audio output device - and the command line argument for that in
pd -alsa -alsaadd pulse -audiooutdev 3 ~/Desktop/mypatch.pd
Yup, now when you enable DSP, the patch
mypatch.pd should play through Pulseaudio, which means it will play (and mix) with other applications that may be playing sound at the time! You can confirm that the correct output device has been selected from the command line, if you open Media/Audio Settings... once
As the screenshot shows, now "Output device 1" is set to "pulse", which is what we needed.
Hope this helps someone!
EDIT: I had also done changes to
/etc/pulse/default.pa as per https://wiki.archlinux.org/index.php/PulseAudio#ALSA.2Fdmix_without_grabbing_hardware_device beforehand, not sure whether that makes a difference or not (in any case, trying to add
dmix as a PD device and playing through it, doesn't work on my Ubuntu 14.04)
pd 0.47.1 change audio settings will hang program both on Mac and Windows
@leowang Yes, you are correct, my mistake.
I am using windows7.
I was in a hurry and didn't explain well. Try opening Pd from the [fix.pd] patch (Pd not already running)..... and then open media-settings, save and close............. and then see if you can change to what you wish.
I have 64 samples set (Block size) which is called Buffer size (samples) in my Asio4All driver. I have never changed that setting for Pd, but I have had to change it in the driver for some soundcards.
I am (almost) certain that the driver receives a 64 sample block size quite happily, and then you can set the block size for the cpu / outboard dsp in the driver settings. The driver does the block size conversion, and if you set the size too low in the driver then it will stall, or cause dropouts.
I have 2ms (Delay) set in Pd, which is called Buffer Offset in Asio4All. More Buffer offset, hardware or software, can be added in the driver if necessary.
But finding the low latency setting is all trial and error.
I have found that setting the offset (Delay ms) in Pd too low will cause dropouts, and setting it too high can cause Pd to stop responding. I think maybe Pd hangs when you open the Audio-settings window......... before you change the Block size......... and so the fix might help?
pd 0.47.1 change audio settings will hang program both on Mac and Windows
@leowang Hello....... The audio settings should match the hardware of the computer. If you try to set the "wrong" settings it will hang Pd. but as every computer setup is different it is impossible to give advice. Beware.... Delay (ms) and Block Size are not called the same things always in asio and other drivers......
Also, setting too "tight"...... trying to set the latency too low will cause problems.
Here is a patch that will set the audio-settings back to a relaxed normal setup........ fix.pd ..... and then you can try again.
Open it and save the settings.......
It is useful if you get into a situation where Pd will not open properly either....... because of the audio settings...... or where in fact it has already hung as soon as you open the audio-settings....... which is why you cannot change them to the correct ones!
Audio settings window cannot be closed [Vanilla 0.47-1]
@Hasselbalch It is maybe not "factory settings" but it is settings that should work with any system.
I would think that something must be different from your previous settings, but maybe not.
Once Pd is "confused", because it's settings do not match the system, the problem stops you setting something better...... hence my fix. Maybe the audio settings window is then not reliable (not showing it's actual state)?
Very pleased that it helped!
sampling rate impacting sound
Not entirely sure about the math of the whole thing, but what I know is that when you use Jack as your audio server, you don't change your audio setting in Pd, but only in Jack.
Check this, start Jack (in the image you posted, the sampling rate is at 48KHz), then start Pd and open its audio settings. Most likely it will read a 44.1KHz sampling rate. Don't change that, open a new patch and put a [samplerate~] connected to a [print]. Bang it and see what it prints. It should print 48000 and NOT 44100. This is because Jack's sampling rate is at 48000 and that's the sampling rate Pd is using, even though its settings read 44100.
What happens, I guess, is that when you change Pd's audio settings you force a different sampling rate between the client (Pd) and the server (Jack), which causes this frequency difference, which probably occurs due to two different samplings of the same frequency.
The only thing you should probably set in Pd's audio settings (if I'm not mistaken), is the number of channels of your sound card.
Uninstall from Ubuntu 16.04
@EEight It doesn't work, because it says that "El paquete «puredata» no está instalado", that puredata is not installed... isn't it rare?
anibal@anibal-ubuntu:~$ sudo apt-get purge pd [sudo] password for anibal: Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho Nota, seleccionando «puredata-core» en lugar de «pd» Los paquetes indicados a continuación se instalaron de forma automática y ya no son necesarios. libgsl0ldbl ttf-dejavu-core Utilice «sudo apt autoremove» para eliminarlos. 0 actualizados, 0 nuevos se instalarán, 0 para eliminar y 2 no actualizados. anibal@anibal-ubuntu:~$ sudo apt-get purge puredata Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho El paquete «puredata» no está instalado, no se eliminará Los paquetes indicados a continuación se instalaron de forma automática y ya no son necesarios. libgsl0ldbl ttf-dejavu-core Utilice «sudo apt autoremove» para eliminarlos. 0 actualizados, 0 nuevos se instalarán, 0 para eliminar y 2 no actualizados. anibal@anibal-ubuntu:~$
Then I did:
anibal@anibal-ubuntu:~$ sudo apt-get purge puredata-core Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho Los paquetes indicados a continuación se instalaron de forma automática y ya no son necesarios. libgsl0ldbl ttf-dejavu-core Utilice «sudo apt autoremove» para eliminarlos. Los siguientes paquetes se ELIMINARÁN: puredata-core* 0 actualizados, 0 nuevos se instalarán, 1 para eliminar y 2 no actualizados. Se liberarán 2.680 kB después de esta operación. ¿Desea continuar? [S/n] s (Leyendo la base de datos ... 242946 ficheros o directorios instalados actualmente.) Desinstalando puredata-core (0.46.7-3) ... Purgando ficheros de configuración de puredata-core (0.46.7-3) ... Procesando disparadores para man-db (2.7.5-1) ... anibal@anibal-ubuntu:~$ pd anibal@anibal-ubuntu:~$
...and I launched pd fine... The puredata-core corresponded to an earlier installation. Thanks!
Wavetable Drum Machine - repost
I uploaded this Wavetable Drum Machine last year but it became a casualty of a server issue (I hope it didn't cause it, it is a bit heavy). Anyway it didn't work under windows so while I was updating old drum machines I sorted this one out.
Here's the instructions, which are also under the Balwyn button.
Wavetable Drum Machine
8 x bank of 64 amplitude sliders, each bank runs in sync driven by a clock. The clock has 16 start/end settings plus a repeat cycles setting, there is also a Vradio block to set the return position.
The mixer block has 8 x level & pan settings with stereo to the dac~
The wave selector is for loading the individual wav files to the relevant drum line. The *.wav files must be stored in the 'waves' folder within the program folder and selected from there.
Saving must be saved to the 'pattern' folder within the program folder. Save the file with one word and no extension, a file of that name will be created for the pattern settings. Another file with the same name will also be created with the extension '.kit', this stores the names of the wave files.
Loading must be from the 'pattern' folder within the program folder. All the clock, pattern and wave files will be updated. select only the file WITHOUT the .kit extension, otherwise nothing will load and soundfiler errors will appear in the Pd window.
The clear button will clear all the amplitude sliders, set all the clock settings to 1 except BPM which is set to 500.
The supplied samples were recorded via Audacity from Qsynth. Ditch them for your own
randmodule - random ramps made easy! (vanilla)
My first contribution to the Patch Repo (and greater Pure Data community at large)!
In my own performance patch, I found myself re-creating this concept over & over again with slightly different parameters, and eventually realized I should just make an abstraction to save myself a lot of time & energy in the future.
The basic idea is simple—essentially just feeding [random] into [line] so that values will float around within a defined range at unpredictable intervals (without discontinuities between the ramps). You can set a center value and deviation percentage, so that the ramps will stick close to a value within the overall range. For example: playing sound files with [phasor~] and [tabread4~], I often like to add a touch of warping to the speed, so with this module I can send the phasor speed to argumentname-randcenter, set a range of values around the center (with small deviation %), and let the warping begin without having to redo all of the math.
Also, the module's output is sent to both the outlet and also to a [send] which is set by the creation argument, thus you can use the receive name of an existing slider in your patch as a creation argument, set the min/max and other preferred parameters, and it's ready to go.
Finally, I added the low clip % control to prevent the "jumpiness" that results when very low values of [random] are fed into the right inlet of [metro] (which can sound like discontinuities in certain applications). So, for instance, if your maximum rate in milliseconds (set by rate_range) is 3000, and you set low clip to 10%, none of the ramps will be faster than 300 ms. And, setting low clip % to 100% will result in a regular metro pulse at the specified maximum rate.
Hope you find it useful! Feedback/improvements welcome of course. (and apologies for the messy patching with the min/max/center calculations, still learning how to keep simple math from looking incomprehensible with cables running all over the place…)
Usefull sends messages to pd
@heyok I have a similar question: for pd .46-7 on a raspberry pi, do you know how to open the OSS-MIDI, or MIDI settings window?
I'm having a similar issue that I've been dealing with in this thread:
the "; pd midi-properties" message opens up the ALSA-MIDI or ALSA MIDI settings window, I'm trying to open the OSS-MIDI or MIDI Settings window.
I tried "; pd midi-settings" message.
Let me know if you have any ideas.
how to get current block size?
@phil123456 Hello Phil......
In windows you can get the current block size through the audio dialog like this (bottom right of "set audio parameters") but it has to open the window so you would need to close it automatically afterwards..........
You can set the bock size for your overall patch more easily from the same "set audio parameters" patch that I uploaded.
If you want to set the block size for a window then you send a "set" message to [block~]....... see its "help" file.........