# Mit "minim" in Processing interne Musik analysieren

**URL:** https://discourse.processing.org/t/mit-minim-in-processing-interne-musik-analysieren/20458
**Category:** Processing for Pi
**Created:** [May 4, 2020, 8:15am UTC](https://discourse.processing.org/t/mit-minim-in-processing-interne-musik-analysieren/20458 "2020-05-04T08:15:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Harti](https://avatars.discourse-cdn.com/v4/letter/h/eb8c5e/32.png) [@Harti](https://discourse.processing.org/u/Harti)
#### Post date: [May 4, 2020, 8:15am UTC](https://discourse.processing.org/t/mit-minim-in-processing-interne-musik-analysieren/20458/1 "2020-05-04T08:15:39Z")

</div>

Hallo Forum

Ich bin neu mit Linus/Raspian unterwegs.  
Nun scheitere ich nach einem relativ erfolgreichen Weg an der (ALSA)-Audiokonfiguration.

Mein Ziel:

1. Über mein Smartphone den Raspi asuwählen für die Musikwiedergabe.
2. Die Musik über ein DAC von Hifi-Berry ausgeben.
3. Mit Processing die Musik der internen “Soundkarte” abgreifen mit der Bibliothek “minim”.
4. Die Signale mit FFT analysieren.
5. Befehle an LEDs schicken über den fadecandy-Server.

Auf meinem Win10-PC funktioniert alles.  
Auf meinem Raspi (4) scheitert der 3. Schritt.  
Um auf dem Win10-PC die Musik abgreifen zu können (nicht vom Mikro sondern von der digitalen Audio-Ausgabe) installierte ich ein virtuelles Audiokabel.

Frage:  
Wie verschalte ich die digitale Soundkarte  
`snd_rpi_hifiberry_dac`  
mit meiner Verabreitung in Processing:  
`in = minim.getLineIn(Minim.MONO);`

Vorgängig habe ich diese Fehlermeldung gehabt:

```auto
==== JavaSound Minim Error ====
==== Unable to return a TargetDataLine: unsupported format - PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian
=== Minim Error ===
=== Minim.getLineIn: attempt failed, could not secure an AudioInput.
NullPointerException

```

Wenn ich dann  
`sudo modprobe snd-aloop`  
ausführe, ist diese Meldung weg. Aber ich habe kein “Volume” auf dieser neu erstellten Soundkarte.  
Habe dann verschiedene Befehle mit  
`amixer`  
und  
`aplay`  
etc ausgeführt, aber weiss ehrlich gesagt nicht was ich tue…

Habe auch mal  
`nano .asoundrc`  
angepasst, um irgendwie ein output auf den Input zu kriegen:

```auto
pcm.!default {
        type asym
        playback.pcm {
                type plug
                slave.pcm "output"
        }
        capture.pcm {
                type plug
                slave.pcm "input"
        }
}

pcm.output {
        type hw
        card 0
}

pcm.input {
        type hw
        card 0
}

pcm.output {
    type plug
    slave {
        pcm "hw:0,0"
    }
}

pcm.input {
    type plug
    slave {
        pcm "hw:0,0"
    }
}

ctl.!default {
        type hw
        card 0

}

```

Diese Config wird mir je nach Gestaltung von plugs etc. vom System geändert. Und ab und an kann danach kein Audioausgang mehr beim Lautsprechersymbol mehr gewählt werden.

Die Parameter von minim.in habe ich durchprobiert mit 44100Hz, 48000Hz, 512Puffer, 256Puffer, 1048Puffer, STEREO, MONO…

Hat irgend jemand eine zusätzliche Idee?  
Ich beschreibe auch gerne noch mehr Details wenn erwünscht…

Gruss  
Christian

---

<div class="post-metadata">

### Author: ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)
#### Post date: [May 4, 2020, 10:28am UTC](https://discourse.processing.org/t/mit-minim-in-processing-interne-musik-analysieren/20458/2 "2020-05-04T10:28:40Z")

</div>

Dieses Forum ist leider auf Englisch. Auch wenn manche hier Deutsch sprechen, würde ich dir empfehlen das ganze zu übersetzen, damit alle dir helfen können.

---

<div class="post-metadata">

### Author: ![Harti](https://avatars.discourse-cdn.com/v4/letter/h/eb8c5e/32.png) [@Harti](https://discourse.processing.org/u/Harti)
#### Post date: [May 5, 2020, 6:37am UTC](https://discourse.processing.org/t/mit-minim-in-processing-interne-musik-analysieren/20458/3 "2020-05-05T06:37:49Z")

</div>

english version (sorry for my bad english):

Hello forum

I am new to Linux / Raspian.  
Now I am failing the (ALSA) audio configuration after a relatively successful path.

My goal:

1. Use my smartphone to select the Raspi for music playback.
2. Output the music through a Hifi-Berry DAC.
3. Use Processing to loop the music of the internal “sound card” into the “minim” library.
4. Analyze the signals with FFT.
5. Send commands to LEDs via the fadecandy server.

Everything works on my Win10 PC.  
The third step fails on my Raspi (4).  
In order to be able to tap the music on the Win10 PC (not from the micro but from the digital audio output) I installed a virtual audio cable.

Question:  
How do I interconnect the digital sound card on raspi  
`snd_rpi_hifiberry_dac`  
with my code in processing:  
`in = minim.getLineIn (Minim.MONO);`

Previously I had this error message:

```auto
==== JavaSound Minim Error ====
==== Unable to return a TargetDataLine: unsupported format - PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes / frame, little-endian
=== Minim Error ===
=== Minim.getLineIn: attempt failed, could not secure an AudioInput.
NullPointerException

```

If I execute  
`sudo modprobe snd-aloop`  
this message is gone. But I don’t have a “volume” on this newly created sound card.  
Then I executed different commands like  
`amixer`  
and  
`aplay`  
etc, but frankly I do not know what I’m doing …

I also adjusted  
`nano .asoundrc`  
to somehow get an output on the input:

```auto
pcm.! default {
        type asym
        playback.pcm {
                type plug
                slave.pcm "output"
        }
        capture.pcm {
                type plug
                slave.pcm "input"
        }
}
pcm.output {
        type hw
        card 0
}
pcm.input {
        type hw
        card 0
}
pcm.output {
    type plug
    slave {
        pcm "hw: 0.0"
    }
}
pcm.input {
    type plug
    slave {
        pcm "hw: 0.0"
    }
}
ctl.! default {
        type hw
        card 0
}

```

This config is automatically changed by the system depending on the design of plugs etc. And from time to time you can no longer select an audio output for the loudspeaker symbol.

I tried various minim.in parameters with `44100Hz`, `48000Hz`, `512Buffer`, `256Buffer`, `1048Buffer`, `STEREO`, `MONO`…

Does anyone have an additional idea?  
I also like to describe more details if desired …

Greeting  
Christian
