Using two identical USB soundcards in Pure Data on Raspberry PI (raspbian stretch lite)
I needed a cheap way to get audio in/out of PD on RPI so I bought a couple of these tiny white USB soundcards with line out and mic input (less than a dollar each) as I'd read here that they work with RPI.
http://raspberrypimaker.com/cheap-quality-audio-raspberry-pi/
They work ( RPI1, model B ), and the output is decent, but there's an annoying high-pitched hum originating from the mic input that is probably due to the proximity of the ADC to the DAC on the unit.
I though I'd solve it by using one card for the mic input and another for the output.
As far as I understand, this should be possible using the -audiodevout options in the pd command line (or the gui settings). Neither of these have worked for me. Specifically, pd outputs from the same card, even though I specify the correct device number in =audiodev or -audiodevout. Both cards work well when used alone.
I'm guessing the problem is that pd sees the two devices (or at least refers to them) as identical. This is the output from pd -nogui -alsa -listdev
audio output devices:
- bcm2835 ALSA (hardware)
- bcm2835 ALSA (plug-in)
- USB PnP Sound Device (hardware)
- USB PnP Sound Device (plug-in)
- USB PnP Sound Device (hardware)
- USB PnP Sound Device (plug-in)
So even though one card is here listed as device 3-4, and the other as 5-6, pd always plays audio from the same card when given any of the numbers in -audiodev. / -audiodevout.
I'm very inexperienced with linux in general, but it seems that since alsa does give these two devices a unique name/number, pd. should be able to distinguish between them. This is the output from alsa -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 7/7
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Device_1 [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
Any advice would be greatly appreciated!
[poly] object glissando
i tried using the CC messages but i keep getting the same result. The problem is that maybe poly is not the right object to use for what i need.
Basically i need monophonic midiout; the reason i am using poly as [poly 1 1] is that it triggers the note off whenever a second note is triggered. Although, doing so the midi out results as follows:
(when first note is triggered)
midi note: 44
velocity: 100
(when second note is triggered)
midi note: 44
velocity: 0
midinote 45
velocity: 100
So basically, in this way i will always end up having stepped notes without legato...
Is there any other method to make sure that a note off is triggered at the right time? I think that what i need at the output to eliminate the stepping between notes is something like this:
(when first note is triggered)
midi note: 44
velocity: 100
(when second note is triggered)
midi note: 45
velocity: 100
midinote 44
velocity: 0
ANN library - where to get?
@Hugo Legrand thanks a lot. i downloaded the file "ml-0.17.0-alpha-WIN32.zip" from this link: https://github.com/cmuartfab/ml-lib/releases somehow the windows build contains only 2 .pd objects (ml.svm-help and ml.zerox-help) but a lot of .dll´s. i added the library path to the search path and the name to start processes and pd prints can´t load library. the 2 objects are recognized but only half of the messages do work. so i am not sure if i do something wrong, or if the build does not work (for me). i tried it with the osx build, in comparison to windows build the library get loaded on startup but everything else seems the same.
this are the printed messages if i click every help-file message from ml.svm-help.pd:
ml.svm: Support Vector Machines based on the GRT library version 0.2.5 revision: 2-Jan-2017
error: ml.svm: messages with the selector 'bang' are not supported
error: ml.svm: function not implemented
error: ml.svm: messages with the selector 'bang' are not supported
error: ml.svm: messages with the selector 'normalise' are not supported
error: ml.svm: function not implemented
ml.svm: new input vector size, adjusting num_inputs to 4
error: ml.svm: class label must be a positive integer
error: ml.svm: messages with the selector 'predict' are not supported
error: ml.svm: messages with the selector 'estimates' are not supported
error: ml.svm: messages with the selector 'load' are not supported
error: ml.svm: messages with the selector 'save' are not supported
Ubuntu - Browsers and Puredata wont share audio output device. [SOLVED]
I found this solution and it worked
@sdaau_ml said:
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-listdev
again: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
pulse
!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 thepulse
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 inpd
is-audiooutdev
: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... oncepd
starts: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 adddmix
as a PD device and playing through it, doesn't work on my Ubuntu 14.04)
ArguScore
Here is an updated version
arguscore-update.zip
and a few Purr Data compatibility replacement objects: purr-data-compatible-replacements.zip
A creation argument only object driven system for instant music making;
Objects so far;
Required;
globaltimer - outputs a 10ms bang to drive all objects;
globalsync - resets all objects to zero or start;
audio~ - dac~ catcher~ for all throws~, output level, mute;
Sound Objects
By default sound objects start playing at the bpm of the first argument
basspump - args - bpm note distortion duration
wood - args - bpm note duration
tremsaw - args - bpm note vibrato distortion duration
tremsine - args - bpm note vibrato noise duration
noisy - args - bpm note vcfq duration
kauplus - args - bpm note string-resonation duration
Effect Objects
sqr - args - 16 required(0 or 1) bpm (starts playing by default)
overides sound objects autoplay
2 optional args for cursor offset and pitch if font different
has 16 outlets to send 0 or 1
echo-delay-bpm - args - bpm feedback(0 to 100) level(0 to 100)
echo-delay-ms - args - millisecs feedback(0 to 100) level(0 to 100)
pan-level - args - pan (-100 to 100) level (0 to 100)
autopan - args - width (0 to 100) frequency (* 0.01) level (0 to 100)
fade - args - millisecs to fade-in pecentage of level to drop to (0 to 100) millisecs to fade-out
filter - args - highpass (midi note to frequency) lowpass (midi note to frequency)
(0 to 135 equates to approx 8Hz to 19912Hz)
start-delay-secs - args - seconds (delays the autostart of the connected object)
start-delay-bpm - args - bpm (delays the autostart of the connected object)
stop-delay-secs - args - seconds (outputs a one at the end of the delay which can connect to a globalsync)
stop-delay-bpm - args - bpm (delays the autostart of the connected object)
isolator - sits between two sqr's and sends a signal to start/stop the receiving sqr
seqnotes - four pairs of note & velocity that receive sqr ones to fire a connected sound object
Notes
Can crash Pd when making lots of edits to arguments, particularly while playing, so save often
There is a [declare -path objects] hiding behind the audio~ object
Fixed missing note and velo message for tremsaw
Two more arguscore patches can be open at the same time providing only one patch contains the globaltimer and audio~ objects (see arguscore-2.pd and arguscore-2-b.pd)
new objects
kauplus, autopan, fade, filter, stop-delay-secs, stop-delay-bpm;
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 -listdev
again:
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 pulse
!
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
is -audiooutdev
:
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 pd
starts:
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)
Purr Data rc5
Purr Data release candidate 5!
- small fixes to OSX app bundle name and build instructions
- fixed OSX app bundle name
- fixed GUI errors with some GUI objects on GOP
- use cat icon for patches
- fixed a [grid] crasher with binding symbol leak
- fixed [grid] line drawing bug and GOP xlet display
- added dialog and scale handle for [grid]
- ported moonlib/knob
- get rid of some extraneous debugging messages
- allow to install Purr Data alongside Pd-l2ork
- Scope~ code cleanup
- fixes for arm build
- added some OSX app bundle dependencies for [fluid~] and others
- fix saving preferences under OSX
- added startup paths and libs to preferences dialog
- use "Purr Data" in OSX menu app
- help browser fixes
- fixed MIDI preference saving on OSX and Windows
- added a "Recent Files" menu to the "File" menu
- get consistent behavior for present working directory when opening/saving files
- fix Volume name for OSX dmg installer
- try to standardize a deterministic package name when compiling Purr Data
- add a Pd-l2ork-specific version number
- add command line open args to "Recent Files" list
- fixed crasher with ds "canvas" field
- allow saving the zoom level per canvas
please report lots of bugs to
https://git.purrdata.net/jwilkes/purr-data/issues
Binaries:
Purr Data rc4
Edit: Windows binary is now up
Purr Data release candidate 4!
- fixed race when opening pd file in OSX
- partial fix for midi prefs not getting saved under Windows
- fixed #194: saving a loaded abstraction gives errors
- fixed for #201: new subcanvas position isn't saved with patch
- sync the ALSA sequencer port state with the GUI
- reset ALSA MIDI device handles and event buffers when closing
- got rid of more debugging output
- go ahead and allow curly braces in Pd messages
- replace the Pd-extended output~ abstraction with Alexandre Porres' improved version
- report userful value for "dsp-status" method of [pdinfo] by ignorning suspend/resume
- fixed display of dollar signs in properties dialogs
- fixed loading of lyonpotpourri and disis libraries
please report lots of bugs to
https://git.purrdata.net/jwilkes/purr-data/issues
Binaries:
Purr Data rc3
Purr Data release candidate 3!
- fixed race with [dsp-state(--[pdinfo]
- fixed preference saving on Windows 10
- small fix to the prepend.pd abstraction for cyclone to take variable number
- fixed receive symbol in number box
- fixed help menu links
- fixed vu scale font size
- fixed [table] default array display
- improved canvas find
- fixed problem with resizing [cnv] label
- fixed scalar bbox calculation for [plot] et al
- fixed stray errors with ds fields
- fixed openpanel/savepanel GUI errors
please report lots of bugs to
https://git.purrdata.net/jwilkes/purr-data/issues
Binaries:
Purr Data rc2
Purr Data release candidate 2!
- add delread4~ alias for vd~
- load Gem dependencies properly under Windows
- add help menu item for list of internal classes
- various help patch cleanups and fixes
- change zoom/fit keyboard shortcuts so they work on all platforms
- localize the canvas right-click menu
- small fixes to prefs menu and edit menu
- fix bug with color updates for iemguis
- zoom correctly on OSX 10.8
please report lots of bugs to
https://git.purrdata.net/jwilkes/purr-data/issues
Binaries:
OSX 64-bit Caught in a Trap Edition (10.8)
[Edit: typo in the name of the Elvis tune]