Processing for Pi can't hear through USB headset, Minim library

edited September 2016 in Raspberry PI

Hello Forum,

I am having trouble getting sound to play through my usb headset using Processing for Raspberry Pi. I wrote a very simple piece of code. When I plug in headphones to the 3.5mm jack, I hear the sound. When I plug in my usb headset, I hear nothing. I have switched the default sound to my logitech usb headset in the menu--> audio device settings. I hear sound from the web, so I know the headset is working. But alas, Processing seems unable to find it.

Thank you for your ideas! Here's my code:

import ddf.minim.*;
import java.io.*;
Minim minim;
AudioPlayer player;

void setup()
{
  size(100, 100);
  minim = new Minim(this);
  player = minim.loadFile("operator.mp3");
  player.play();
}

void draw()
{
  background(0);
  stroke(255);
  player.play();
}
Tagged:

Answers

  • Does it work with the Pi's on-board audio? Perhaps you could file a bug report over at https://github.com/ddf/Minim/issues? If there's anything that I can help with related to ARM or the Pi, feel free to bring me in to the conversation w/ @gohai!

  • Did any of you figure out this issue? I am having the same thing... @gohai

  • @Andreas_Ref I think it'd be best if you or @LizzyB bring this up with the developer(s) of Minim - not sure what's going on, but please let us know when you find a solution.

  • I am having the same issue here. It is also a problem with bluetooth audio.

    I can hear via aplay /usr/share/sounds/alsa/Front_Center.wav -D sysdefault:CARD=1

    and via the web ... but nothing through the minim sketches.

    If anybody has better luck ? thanks !

  • Answer ✓

    I had the same problem, which I managed to solve on Raspberry Pi 1 B, Raspbian Stretch.

    Prevent the onboard audio's module from loading:

    sudo nano /etc/modprobe.d/raspi-blacklist.conf

    add this line: blacklist snd_bcm2835

    Then: sudo nano /boot/config.txt

    comment the following lines if they exist:

    # Enable audio (loads snd_bcm2835)

    #dtparam=audio=on

    #audio_pwm_mode=2

    Run: aplay -l to see under which numbers the system recognizes your usb card

    And then:

    sudo nano /usr/share/alsa/alsa.conf to modify alsa's config file according to the output of aplay -l.

    For example, my USB card is recognized as card 1, device 0, so I edited the following lines:

    defaults.ctl.card 1

    defaults.pcm.card 1

    defaults.pcm.device 0

Sign In or Register to comment.