michaelallen
Posts: 7
Joined: Sat Oct 05, 2013 9:59 pm

Sound issues with Pure Data / Jack

Mon Oct 28, 2013 5:54 am

After a couple weeks of tinkering with Raspbian and an MAudio MobilePre usb, I am having some issues with choppy sound coming from Pure Data.

The sound card is working fine if I play a WAV via aplay.

If I load a simple adc~ > dac~ patch in pure data (command line, not using X) and play a guitar through it, the sound is choppy and isn't the right frequency. There is distortion and glitching and the frequency of the notes played back is not the same frequency as what I am playing on the guitar.

Running Jack2 (from the autostatic respository) makes a different choppy sound, slightly less chopped but still distorted and wrong frequency.

I've tried starting Pure Data with 44100 and 48000 sampling and it subtly changes the chopping, and changes the out of tune-ness of the wrong frequencies, but it's still terrible.

I got the sound card running by installing the madfuload package. Just upgraded the Pure Data to 0.45-3 with no improvement. Have slowed the USB to 1.1 by editing /boot/cmdline.txt.

I am starting Pure Data like so:

Code: Select all

pd -nogui patch.pd &
with either -jack or -alsa, and have tried inserting both 44100 and 48000

Code: Select all

pd -nogui -r 48000 patch.pd &
When running jack, i start it with

Code: Select all

jackd -P70 -p16 -t2000 -dalsa -p128 -r44100 -n3 -s -S &
Using either 44100 or 48000. I included the -S to force 16bit. Doesn't seem to make a difference.

Any ideas how to look for what might be causing the choppy audio? Playing music through aplay sounds fine so i think this is a Pure Data issue?

User avatar
duberry
Posts: 379
Joined: Mon Jan 28, 2013 10:44 pm
Location: standing on a planet that's evolving. And revolving at nine hundred miles an hour

Re: Sound issues with Pure Data / Jack

Mon Oct 28, 2013 8:38 am

hi
if its any help i happen to have an old maudio usbpre
if find the time might be able try and replicate

if i understand corectly your setup .
- (latest?) raspbian
- modifyed /boot/cmdline.txt to set usb to 1.1
- with added packages jack and pd

it could be usefull? to know what firmware you curently have (exprenced problems with)
before surgesting
upgrading the firmware tbh the only thing i can think of atm
other than starting with fresh image

-------

Code: Select all

/opt/vc/bin/vcgencmd version
from
http:// elinux.org/R-Pi_Troubleshooting#Check_your_firmware_version
&
How can I find out what firmware I'm running?
lend me your arms, fast as thunderbolts, for a pillow on my journey.
If the environment was a bank, would it be too big to fail
so long; and thanks for all the pi

michaelallen
Posts: 7
Joined: Sat Oct 05, 2013 9:59 pm

Re: Sound issues with Pure Data / Jack

Tue Oct 29, 2013 12:04 am

Thanks for your help. That would be awesome if you had time to try and replicate my issue.

Here is the firmware

Code: Select all

pi@raspberrypi ~ $ /opt/vc/bin/vcgencmd version
Sep  1 2013 23:31:02 
Copyright (c) 2012 Broadcom
version 4f9d19896166f46a3255801bc1834561bf092732 (clean) (release)
Purchased this RPi three weeks ago, and haven't updated firmware. Installed Raspbian three weeks ago and have done apt-get update and apt-get upgrade a few times. Most recently yesterday.

I installed puredata package and had the choppy audio issues, then updated to the 0.45-3 version manually. Same issues.

Installed the jack2 package from the auto.static repository: http://wiki.linuxaudio.org/wiki/raspberrypi

I will try to update firmware and see if it helps. Thanks!

Edit: Updated the firmware, and it still doesn't work. If anything, audio sounds more ring mod!

User avatar
duberry
Posts: 379
Joined: Mon Jan 28, 2013 10:44 pm
Location: standing on a planet that's evolving. And revolving at nine hundred miles an hour

Re: Sound issues with Pure Data / Jack

Tue Oct 29, 2013 10:28 am

did you see this
http://puredata.info/docs/raspberry-pi
Available Distros

Pd-extended included in a rapsberry image from Satellite CCRMA

Pd-extended 0.43.4 in apt.puredata.info or via direct download

Vanilla Pd included in the modified Raspian image downloadable from the Pd-LA Website or this sdsc.edu location
#i'v not tested but i asume most/all/more things http://wiki.linuxaudio.org/wiki/raspberrypi eg audio related ajustments ect would be applie in d image's .. that might just be wishful thinking
lend me your arms, fast as thunderbolts, for a pillow on my journey.
If the environment was a bank, would it be too big to fail
so long; and thanks for all the pi

michaelallen
Posts: 7
Joined: Sat Oct 05, 2013 9:59 pm

Re: Sound issues with Pure Data / Jack

Tue Oct 29, 2013 3:09 pm

I did try and get the Satellite CCRMA os running last night, and now have some more jack and pure data issues to sort out. Not getting any sound at this point. Once I get sound, we'll see what quality it is.

Edit: Okay played around a bit and I am getting sound with aplay. Simply playing into arecord and recording some guitar like this:

Code: Select all

ccrma@satellite ~ $ arecord -f dat wav.wav
Recording WAVE 'wav.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Playing that file sounds terrible! This is not a jack or pure data issue, it's not sound playback issue, it is sound capture issue.

If you could try and get your Mobilepre installed and just see what happens when you capture something with arecord, it would be a great help. Then we can see if this is a driver issue or if something is unique to me.

Thanks!

LittleJoe
Posts: 15
Joined: Sat Apr 13, 2013 10:30 am

Re: Sound issues with Pure Data / Jack

Thu Oct 31, 2013 12:35 pm

Went thru something similar... Can you post your .pdsettings file? What sound device do you use?

Cases in which I noticed problems before, include: a too slow SD card, having set the no. of input channels to 2 i.s.o. 1 when using a UCG102 (this really messed up the sound), keeping the USB speed at 2.0 (though this really depends on what sound card you use), and having the audio api in .pdsettings set to 1 (ALSA) i.s.o. 5 (jack) or the other way around.

You might want to try using the GUI version of pd until you've got the settings for your device worked out. If nothing helps, changing the USB speed or no. of input channels might work.

J__
Posts: 7
Joined: Thu Apr 10, 2014 2:03 pm

Re: Sound issues with Pure Data / Jack

Tue Apr 15, 2014 11:19 am

Hello,

Did you manage to get audio working correctly with puredata?
I'm having the same sort of problems.

having updated, upgraded
- puredata test patch (osc~ 400 into dac~, delayed loadbang to start dsp) working fine with internal audio card
- Usb audio card - logitech Usb To 3.5 (verified for rPi & puredata) - working fine using alsa player

- puredata test patch with usb soundcard -> constant distorted sound

I tried a lot of things, usb audio speed to 1, rate 44100, 48000, buffer size etc, but I can't get any audio card (i tried with a creative soundblaster play too).
None of these options solved my problem.
Any advice about how you got it working?

thanks,
J.

michaelallen
Posts: 7
Joined: Sat Oct 05, 2013 9:59 pm

Re: Sound issues with Pure Data / Jack

Sat Apr 26, 2014 11:48 pm

I did get audio working correctly. RIght now I can use either my MobilePre or a cheap USB sound card from ebay. C-Media or something.

Basically it is all the usual things you have to do, like set USB speed to 1.1 and setting default audio to USB. That stuff is all well documented.

For me I am running headless from command line via ethernet. I start Jack set to either 44100 or 48000 (can do both) and then set buffer to 512 or more. 512 gives acceptable latency for playing guitar in realtime. 256 is best but gives a lot more glitches. I have to set input and output to 2 each in order for jack to run. This is done with -i 2 -o 2. For example my whole line looks like:

jackd -P70 -p16 -t2000 -d alsa -dhw:0 -p 512 -n 3 -r 44100 -s -i2 -o2 &

Then i start PD with

pd-extended -nogui -jack -open patch

I get some clicks every minute maybe. It's annoying and I can't figure it out, so it probably won't ever make it to a live setup. Otherwise my PD patch runs rev4 with a freeze switch, a spectral delay, my own delay with tap tempo, and a swell delay I made or a looper. Looper clicking still needs some work. I can run the delay, spec delay, and reverb without overwhelming the CPU. The reverb is rev4 since other patches used too much CPU. Freeverb, rev1 etc.

The pots and footswitches are running to a Teensy arduino.

J__
Posts: 7
Joined: Thu Apr 10, 2014 2:03 pm

Re: Sound issues with Pure Data / Jack

Mon Apr 28, 2014 11:24 am

I got audio output working correctly with satellite CCRMA, running in ssh too.
I use a logitech usb to jack audio card, and a creative soundblaster play.
running the usual command as you said, setting usb audio to default and usb speed to 1.
pd -nogui -inchannels 0 -r 44100 /home/ccrma/doc/sine.pd

-> good qualtity

but I need to use a sound input, so I only try to activate it when starting pd
pd -nogui -inchannels 2 -r 44100 /home/ccrma/doc/sine.pd

->the sound gets really glitchy...

Do you think I should run jack as you mentioned above?
typing your line all I get is

(...)
configuring for 44100Hz, period = 512 frames (11.6 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: cannot set channel count to 2 for capture
ALSA: cannot configure capture channel
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server

Return to “Graphics, sound and multimedia”