rbn
Posts: 136
Joined: Tue Dec 27, 2011 8:32 pm
Location: Near Peterborough
Contact: Website

Re: RPi and real-time, low-latency audio

Sat Sep 21, 2013 7:20 pm

OK. I've ordered a hub with a hefty psu

Hub sorted it. Works now thanks

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Tue Oct 15, 2013 5:49 am

Hey AutoStatic / All,

I'm back to tweaking my Pi:)

Could anyone tell me whether zram
http://en.wikipedia.org/wiki/ZRam
is ok to add - i.e. not mess with the audio?

Regards,

Julian

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Wed Oct 16, 2013 6:08 pm

Hi JulianBrooks,

I'm disabling swap altogether so I'm not sure if using zram would make a difference. It won't affect audio so it's worth a try I guess.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Thu Oct 24, 2013 5:57 am

Hmm interesting...

Presume you're disabling swap so it doesn't mess with the audio.

If I wanted to do that how can I be sure swap is off?

This is on raspbian btw.

Cheers,

Julian

Vanfanel
Posts: 433
Joined: Sat Aug 18, 2012 5:58 pm

Re: RPi and real-time, low-latency audio

Thu Oct 24, 2013 2:58 pm

@JulianBrooks: just run the "free" command, and you should see there's no swap space at all:

Code: Select all

[email protected] ~/src/SDL12-kms-dispmanx $ free
total       used       free     shared    buffers     cached
Mem:        188840      92668      96172          0      16720      44216
-/+ buffers/cache:      31732     157108
Swap:            0          0          0

User avatar
arrowmax08
Posts: 5
Joined: Wed Apr 09, 2014 6:40 pm

Re: RPi and real-time, low-latency audio

Wed Apr 09, 2014 6:46 pm

I used your video and all the steps you placed in the description.
The usb audio is working when i test with aplay.
In the video you are talking about an UDEV rule, what is this?
Because the midi drumkit isnt working yet
Kan je me helpen? :]

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Thu Apr 10, 2014 6:40 pm

Hi arrowmax08,

udev is more or less a Linux "plug-and-play" daemon, it takes care of loading the right drivers when a device is connected. It's possible to do other neat things with udev, like running a script when a MIDI or audio interface is being connected. In your case you don't need it, your issue is that you're probably using the wrong name for your audio interface. In my example scripts I've used the name of one of my USB interfaces (UA25, an Edirol UA-25) and you have to replace that name with the name of your own interface. Could you post the output of cat /proc/asound/cards with your USB audio interface attached?
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

User avatar
arrowmax08
Posts: 5
Joined: Wed Apr 09, 2014 6:40 pm

Re: RPi and real-time, low-latency audio

Tue Apr 15, 2014 8:53 am

This is what i get:
0 [Device ]: USB-Audio - USB PnP Sound Device
C-Media Electronics Inc. USB PnP Sound Device at usb-bcm2708_usb-1.3.1, full sp

The line is empty after "Device"?!

Is this the udev rule and how do you implement this?
https://raw.github.com/AutoStatic/scripts/rpi/drumpad

Top dat je me helpt maat, leuk project!

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Tue Apr 15, 2014 11:59 am

That's the script to get the necessary software running in order to use the RPi as a drum module. So in your case the script should work sound wise because your USB audio interface has the same ALSA name ('Device'). The corresponding udev rule to start the drumpad script when I connect my drumpad can be found here: https://raw.githubusercontent.com/AutoS ... mpad.rules
What kind of drumpad are you using? Could you post the output of aconnect -io with the drumpad connected?
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

User avatar
arrowmax08
Posts: 5
Joined: Wed Apr 09, 2014 6:40 pm

Re: RPi and real-time, low-latency audio

Tue Apr 15, 2014 12:39 pm

Thanks for your quick reply :]
The 2 lines are now in etc/udev/rules.d/10-drumpad.rules!
But i dont know where and how to place the drumpad script?
I configured in drumkv1, 6 wav sounds wich are located in /home/pi/samples...

I have exactly the same hardware as you, with aconnect -io i get:
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5267
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: RPi and real-time, low-latency audio

Tue Apr 15, 2014 2:05 pm

vmsda wrote:If I do everything the wiki suggests as far as usb audio is concerned, do I stand a chance of playing my 192khz/24bit downloads, or is this type of throughput just too much for the Pi?
I believe I2S cards like HifiBerry can support this sort of data rate (as can HDMI).

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Tue Apr 15, 2014 7:36 pm

arrowmax08 wrote:Thanks for your quick reply :]
The 2 lines are now in etc/udev/rules.d/10-drumpad.rules!
Could you post the output of lsusb to make sure the vendor and product ID's match?
arrowmax08 wrote:But i dont know where and how to place the drumpad script?
You can place it wherever you like, I prefer putting user scripts in ~/bin, this is also the directory the udev rules point to.
arrowmax08 wrote:I have exactly the same hardware as you, with aconnect -io i get:
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
Hmmm, I don't see any MIDI drum pad device. So the output of lsusb would be really helpful here :)
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

User avatar
arrowmax08
Posts: 5
Joined: Wed Apr 09, 2014 6:40 pm

Re: RPi and real-time, low-latency audio

Wed Apr 16, 2014 1:41 pm

This is what i get with lsusb:
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 005: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller
Bus 001 Device 007: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher

The drumpad is connectyd to a powered usb hub

I made the drumpad file using sudo su, cd bin, sudo nano drumpad... (here your drumpad script code)
Is this the right way to do it? :D

User avatar
Siwan
Posts: 26
Joined: Wed Apr 16, 2014 7:28 pm
Location: Netherlands

Re: RPi and real-time, low-latency audio

Wed Apr 16, 2014 7:52 pm

Can you perhaps help me out autostatic?

I also want to use the raspberry pi as a drum machine and i'm having a few problems.
I've installed everything in the video description: jack jalv drumkv1 and aj-snapshot and added your audio software repository.
I've also added your udev rule and created a bin directory in my home/pi with the drumpad script in it.

This udev rule gets initialised when you plug in the usb drumpad right?
When I plug the drumpad into my usb hub the flash light on my 3d soundcard does not flicker like it did in your video.

Also, can you put your drumkv1.conf file here?
I don't know how to modify it correctly..

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Wed Apr 16, 2014 8:31 pm

arrowmax08 wrote:Bus 001 Device 007: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher
Unfortunately this is the non-USB MIDI version of the foldable drumpad, I know because I have both versions: http://lists.linuxaudio.org/pipermail/l ... 91142.html
So in the context of Linux low-latency audio it's useless :( You need a foldable drumpad that explicitly states that it does MIDI.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

User avatar
Siwan
Posts: 26
Joined: Wed Apr 16, 2014 7:28 pm
Location: Netherlands

Re: RPi and real-time, low-latency audio

Thu Apr 17, 2014 9:23 am

AutoStatic wrote:
arrowmax08 wrote:Bus 001 Device 007: ID 1941:8021 Dream Link WH1080 Weather Station / USB Missile Launcher
Unfortunately this is the non-USB MIDI version of the foldable drumpad, I know because I have both versions: http://lists.linuxaudio.org/pipermail/l ... 91142.html
So in the context of Linux low-latency audio it's useless :( You need a foldable drumpad that explicitly states that it does MIDI.
http://www.dx.com/p/portable-roll-up-us ... 0-Vxvl_uSo
http://www.dx.com/p/portable-roll-up-us ... 0-VB_l_uSo

If that is so, which of these links is the right one, the 26$ one or the 23$ one.
im asking this because I've got the non-USB midi version too...

PS: if you know another site where I could buy a usb midi drum kit with faster delivery, could you give me the link then?
I'm kind of in a hurry haha ..

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Thu Apr 17, 2014 8:36 pm

RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

User avatar
arrowmax08
Posts: 5
Joined: Wed Apr 09, 2014 6:40 pm

Re: RPi and real-time, low-latency audio

Mon Apr 21, 2014 8:48 am

Jeremy,
How does your drumkv1.conf looks like?
I linked my map with samples in this config file...
But how can i link 1 sound to 1 drumpad??

User avatar
Siwan
Posts: 26
Joined: Wed Apr 16, 2014 7:28 pm
Location: Netherlands

Re: RPi and real-time, low-latency audio

Thu Apr 24, 2014 11:22 pm

arrowmax08 wrote:Jeremy,
How does your drumkv1.conf looks like?
I linked my map with samples in this config file...
But how can i link 1 sound to 1 drumpad??
Ye i really want to know this too

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Fri Apr 25, 2014 3:12 pm

I'll post it if I find time!
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

User avatar
Siwan
Posts: 26
Joined: Wed Apr 16, 2014 7:28 pm
Location: Netherlands

Re: RPi and real-time, low-latency audio

Sun Apr 27, 2014 6:18 pm

AutoStatic wrote:I'll post it if I find time!

thank you! hopefully this week, because i'll be expecting my drumpad to be delivered this week

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Mon Apr 28, 2014 7:38 pm

https://github.com/AutoStatic/configs/t ... pi/drumkv1

If you have jalv installed from my repository you can create presets yourself:
  • ssh -X into your RPi
  • Run jalv.gtk http://drumkv1.sourceforge.net/lv2
  • Create your presets (warning: this process can be slow and tedious on the RPi)
  • Save your preset with either File - Save or Presets - Save Preset, first option creates a jalv state directory, second one an LV2 preset which should be more portable
Alternatively you could try doing this on a Linux desktop and transfer all the files to your RPi.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

walla
Posts: 5
Joined: Wed May 14, 2014 11:05 am

Re: RPi and real-time, low-latency audio

Wed May 14, 2014 11:32 am

Hello everybody,

I am trying to get JACK running on my Raspberry. My ultimate goal is to have a Python script that simultaneously plays and records at least one channel of audio for a couple of seconds. But at the moment I can't get JACK / ALSA to run stable. I did download the JACK version from the AutoStatic repository and followed the advise on the linuxaudio wiki (except I did not force USB1 mode as afterwards JACK / ALSA failed to start (ALSA: cannot configure playback channel), and I did not disable the network adapter since I need it to execute commands by SSH). I am using a digidesign MBox 2 Mini.
I get JACK started with the following command: jackd -r -p16 -t2000 -dalsa -dhw:1 -p2048 -n4 -r48000 -s & - but eventually, apparently ALSA gets some error and outputs: ALSA: poll time out, polled for 64063084 usecs (the number varies). I started JACK also with the -R option, and it did seem to fail after a shorter time - but I am not really sure about that. I tried both Jack2 and Jack1, and both fail. As I am not firm with Linux, I don't really know how to approach the failure. Maybe someone can provide a tip on what I should do?

Thank you very much!

Cheers,
Walle

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Wed May 14, 2014 6:44 pm

Hello Walle,

From the website of the author of the Digidesign Mbox 2 kernel module:
Any config issues with JACK, make sure you are using the ALSA backend and 2 ins and 2 outs, >256 buffer size and 3 periods
So maybe JACK works better like this:

Code: Select all

jackd -P89 -p16 -t2000 -dalsa -dhw:1 -p256 -n3 -i2 -o2 -s &
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

walla
Posts: 5
Joined: Wed May 14, 2014 11:05 am

Re: RPi and real-time, low-latency audio

Wed May 14, 2014 8:08 pm

Hey AutoStatic,
thanks for the quick reply! When I start jackd the way you proposed, it quits right away, with the following output:

Code: Select all

loading driver ..
creating alsa driver ... hw:1|hw:1|256|3|48000|2|2|nomon|swmeter|soft-mode|32bit
control device hw:1
configuring for 48000Hz, period = 256 frames (5.3 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 24bit big-endian
ALSA: use 3 periods for capture
ALSA: final selected sample format for playback: 24bit big-endian
ALSA: use 3 periods for playback
cannot use real-time scheduling (FIFO at priority 99) [for thread -1246063504, from thread -1246063504] (1: Operation not permitted)
I remember now having read that 3 periods are recommended, but I never got jack working at all with 3. (Also changing the period size to 2048 did not help.)
Funny enough, magically it seems to work now with the start command that I posted earlier - to that degree that it doesn't quit with that poll time out message. It used to do that within 5 minutes, and I had it running now several times for at least 30 minutes without crash. Other than that, the audio I managed to produce with Python and py-jack is completely distorted. So it is running without errors, but not working. I can't even produce a clean sine wave (copying a demo script from py-jack). It sounds completely distorted. As did audio that I recorded with py-jack. I saved it as a wav, you can download it here: http://ul.to/2e161t64. Except from being distorted, the pitch of my voice seems too high. There were no sync issues reported during the recording. Do you have any idea what I am missing?
Thank you very much!

EDIT:
Ok, forget about jack running stable. Apparently it just decided to not quit for a couple of hours, but it just stopped with the same error message again.

Cheers,
Walle

Return to “Graphics, sound and multimedia”