Csound Csound-dev Csound-tekno Search About

[Csnd] Simple Patch Consistently Crashing on Pi Zero

Date2018-11-13 23:16
FromEmmett Palaima
Subject[Csnd] Simple Patch Consistently Crashing on Pi Zero
Hi, I'm working on a project that includes some pretty basic audio interactivity. Simply a looping audio file which fades in based on a proximity sensor getting triggered. Also needs to be embedded and I figured using a Raspberry Pi Zero (audio via PHat DAC soundcard) with Csound would be a simple way to add audio. Proximity sensor is read by a Teensy 3.5 microcontroller, which sends on / off values as a USB Midi CC message. 

However, even this extremely basic patch consistently crashes on a Pi Zero. The patch is not doing anything strenuous and I can't really see anything I can improve, wanted to post on here to see if the community could recommend anything, or catch something I was doing wrong. Was hoping Csound would be a viable option since I'm fast with it and can work entirely via SSH since it's text based. 

Here is the csd, please let me know if you see anything I can improve, thanks!:

<CsoundSynthesizer>
<CsOptions>
-odac
-+rtmidi=alsa
-Ma

</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 512
nchnls = 2
0dbfs = 1

turnon 1

instr 1

k1 chanctrl 1, 14
k2 chanctrl 1, 15

k1  port k1, .5
k2  port k2, .5

a1, a2  diskin2 "Butterfly.wav", 1, 0, 1

outs a2 * k2 * .9, a1 * k1 * .9

endin

</CsInstruments>
<CsScore>

</CsScore>
</CsoundSynthesizer>
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2018-11-13 23:57
FromDave Seidel
SubjectRe: [Csnd] Simple Patch Consistently Crashing on Pi Zero
When you say it crashes, what do you mean exactly? What is the console output? Did you build Csound yourself?

I run Csound on a Raspberry Pi all the time these days, but it's a Pi 3, which of course has different capabilities compared to a Pi Zero.

On Tue, Nov 13, 2018 at 6:26 PM Emmett Palaima <epalaima@meowwolf.com> wrote:
Hi, I'm working on a project that includes some pretty basic audio interactivity. Simply a looping audio file which fades in based on a proximity sensor getting triggered. Also needs to be embedded and I figured using a Raspberry Pi Zero (audio via PHat DAC soundcard) with Csound would be a simple way to add audio. Proximity sensor is read by a Teensy 3.5 microcontroller, which sends on / off values as a USB Midi CC message. 

However, even this extremely basic patch consistently crashes on a Pi Zero. The patch is not doing anything strenuous and I can't really see anything I can improve, wanted to post on here to see if the community could recommend anything, or catch something I was doing wrong. Was hoping Csound would be a viable option since I'm fast with it and can work entirely via SSH since it's text based. 

Here is the csd, please let me know if you see anything I can improve, thanks!:

<CsoundSynthesizer>
<CsOptions>
-odac
-+rtmidi=alsa
-Ma

</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 512
nchnls = 2
0dbfs = 1

turnon 1

instr 1

k1 chanctrl 1, 14
k2 chanctrl 1, 15

k1  port k1, .5
k2  port k2, .5

a1, a2  diskin2 "Butterfly.wav", 1, 0, 1

outs a2 * k2 * .9, a1 * k1 * .9

endin

</CsInstruments>
<CsScore>

</CsScore>
</CsoundSynthesizer>
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2018-11-14 00:23
FromEmmett Palaima
SubjectRe: [Csnd] Simple Patch Consistently Crashing on Pi Zero
I get a lot of buffer underruns, after which the control signal stops functioning correctly. Generally what happens is that the patch starts stuttering, and then the sound output gets stuck on, even when the controller is sending an off message.

On Tue, Nov 13, 2018 at 4:57 PM Dave Seidel <dave.seidel@gmail.com> wrote:
When you say it crashes, what do you mean exactly? What is the console output? Did you build Csound yourself?

I run Csound on a Raspberry Pi all the time these days, but it's a Pi 3, which of course has different capabilities compared to a Pi Zero.

On Tue, Nov 13, 2018 at 6:26 PM Emmett Palaima <epalaima@meowwolf.com> wrote:
Hi, I'm working on a project that includes some pretty basic audio interactivity. Simply a looping audio file which fades in based on a proximity sensor getting triggered. Also needs to be embedded and I figured using a Raspberry Pi Zero (audio via PHat DAC soundcard) with Csound would be a simple way to add audio. Proximity sensor is read by a Teensy 3.5 microcontroller, which sends on / off values as a USB Midi CC message. 

However, even this extremely basic patch consistently crashes on a Pi Zero. The patch is not doing anything strenuous and I can't really see anything I can improve, wanted to post on here to see if the community could recommend anything, or catch something I was doing wrong. Was hoping Csound would be a viable option since I'm fast with it and can work entirely via SSH since it's text based. 

Here is the csd, please let me know if you see anything I can improve, thanks!:

<CsoundSynthesizer>
<CsOptions>
-odac
-+rtmidi=alsa
-Ma

</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 512
nchnls = 2
0dbfs = 1

turnon 1

instr 1

k1 chanctrl 1, 14
k2 chanctrl 1, 15

k1  port k1, .5
k2  port k2, .5

a1, a2  diskin2 "Butterfly.wav", 1, 0, 1

outs a2 * k2 * .9, a1 * k1 * .9

endin

</CsInstruments>
<CsScore>

</CsScore>
</CsoundSynthesizer>
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2018-11-14 00:28
FromEmmett Palaima
SubjectRe: [Csnd] Simple Patch Consistently Crashing on Pi Zero
Here is the output from running the patch. I get the buffer underrun message, and then audio output gets stuck on, regardless of midi input value. I've checked the midi input via amidi and it's returning the correct values:

pi@raspberrypi:~$ csound FaerieAutoBoot.csd

time resolution is 1000.000 ns

0dBFS level = 32768.0

--Csound version 6.12 beta (double samples) Jul 16 2018

[commit: 65c13417ec76d3d148017f22e0455e000cc26291]

libsndfile-1.0.27

UnifiedCSD:  FaerieAutoBoot.csd

STARTING FILE

Creating options

Creating orchestra

closing tag

Creating score

rtaudio: ALSA module enabled

rtmidi: ALSA Raw MIDI module enabled

Elapsed time at end of orchestra compile: real: 0.044s, CPU: 0.034s

sorting score ...

... done

Elapsed time at end of score sort: real: 0.048s, CPU: 0.035s

midi channel 1 using instr 1

midi channel 2 using instr 1

midi channel 3 using instr 1

midi channel 4 using instr 1

midi channel 5 using instr 1

midi channel 6 using instr 1

midi channel 7 using instr 1

midi channel 8 using instr 1

midi channel 9 using instr 1

midi channel 10 using instr 1

midi channel 11 using instr 1

midi channel 12 using instr 1

midi channel 13 using instr 1

midi channel 14 using instr 1

midi channel 15 using instr 1

midi channel 16 using instr 1

graphics suppressed, ascii substituted

0dBFS level = 1.0

ALSA midi: Using all devices.

ALSA: opened MIDI input device 'hw:1,0'

orch now loaded

audio buffered in 2048 sample-frame blocks

ALSA output: total buffer size: 4096, period size: 2048

writing 4096 sample blks of 64-bit floats to dac

SECTION 1:

new alloc for instr 1:

diskin2: opened 'Butterfly.wav':

         44100 Hz, 2 channel(s), 20153217 sample frames


WARNING: Buffer underrun in real-time audio output


On Tue, Nov 13, 2018 at 5:23 PM Emmett Palaima <epalaima@meowwolf.com> wrote:
I get a lot of buffer underruns, after which the control signal stops functioning correctly. Generally what happens is that the patch starts stuttering, and then the sound output gets stuck on, even when the controller is sending an off message.

On Tue, Nov 13, 2018 at 4:57 PM Dave Seidel <dave.seidel@gmail.com> wrote:
When you say it crashes, what do you mean exactly? What is the console output? Did you build Csound yourself?

I run Csound on a Raspberry Pi all the time these days, but it's a Pi 3, which of course has different capabilities compared to a Pi Zero.

On Tue, Nov 13, 2018 at 6:26 PM Emmett Palaima <epalaima@meowwolf.com> wrote:
Hi, I'm working on a project that includes some pretty basic audio interactivity. Simply a looping audio file which fades in based on a proximity sensor getting triggered. Also needs to be embedded and I figured using a Raspberry Pi Zero (audio via PHat DAC soundcard) with Csound would be a simple way to add audio. Proximity sensor is read by a Teensy 3.5 microcontroller, which sends on / off values as a USB Midi CC message. 

However, even this extremely basic patch consistently crashes on a Pi Zero. The patch is not doing anything strenuous and I can't really see anything I can improve, wanted to post on here to see if the community could recommend anything, or catch something I was doing wrong. Was hoping Csound would be a viable option since I'm fast with it and can work entirely via SSH since it's text based. 

Here is the csd, please let me know if you see anything I can improve, thanks!:

<CsoundSynthesizer>
<CsOptions>
-odac
-+rtmidi=alsa
-Ma

</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 512
nchnls = 2
0dbfs = 1

turnon 1

instr 1

k1 chanctrl 1, 14
k2 chanctrl 1, 15

k1  port k1, .5
k2  port k2, .5

a1, a2  diskin2 "Butterfly.wav", 1, 0, 1

outs a2 * k2 * .9, a1 * k1 * .9

endin

</CsInstruments>
<CsScore>

</CsScore>
</CsoundSynthesizer>
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2018-11-14 00:58
FromDave Seidel
SubjectRe: [Csnd] Simple Patch Consistently Crashing on Pi Zero
So Csound may be getting a bit overwhelmed and isn't running very well, but it isn't crashing. You will probably need to play with the buffer options (-b and -B). I'm not an expert there, but there are plenty of fols here who might offer some suggestions (Victor?). Your code looks reasonable to me, but I don't have experience in playing back samples.

I also like using Csound on the Pi because I can use SSH and run headless. But I am running a more powerful Pi. I did try a Pi 2 first, but found it a bit glitchy with my code -- the Pi 3 is working great (with a Pisound sound card). 

On Tue, Nov 13, 2018 at 7:28 PM Emmett Palaima <epalaima@meowwolf.com> wrote:
Here is the output from running the patch. I get the buffer underrun message, and then audio output gets stuck on, regardless of midi input value. I've checked the midi input via amidi and it's returning the correct values:

pi@raspberrypi:~$ csound FaerieAutoBoot.csd

time resolution is 1000.000 ns

0dBFS level = 32768.0

--Csound version 6.12 beta (double samples) Jul 16 2018

[commit: 65c13417ec76d3d148017f22e0455e000cc26291]

libsndfile-1.0.27

UnifiedCSD:  FaerieAutoBoot.csd

STARTING FILE

Creating options

Creating orchestra

closing tag

Creating score

rtaudio: ALSA module enabled

rtmidi: ALSA Raw MIDI module enabled

Elapsed time at end of orchestra compile: real: 0.044s, CPU: 0.034s

sorting score ...

... done

Elapsed time at end of score sort: real: 0.048s, CPU: 0.035s

midi channel 1 using instr 1

midi channel 2 using instr 1

midi channel 3 using instr 1

midi channel 4 using instr 1

midi channel 5 using instr 1

midi channel 6 using instr 1

midi channel 7 using instr 1

midi channel 8 using instr 1

midi channel 9 using instr 1

midi channel 10 using instr 1

midi channel 11 using instr 1

midi channel 12 using instr 1

midi channel 13 using instr 1

midi channel 14 using instr 1

midi channel 15 using instr 1

midi channel 16 using instr 1

graphics suppressed, ascii substituted

0dBFS level = 1.0

ALSA midi: Using all devices.

ALSA: opened MIDI input device 'hw:1,0'

orch now loaded

audio buffered in 2048 sample-frame blocks

ALSA output: total buffer size: 4096, period size: 2048

writing 4096 sample blks of 64-bit floats to dac

SECTION 1:

new alloc for instr 1:

diskin2: opened 'Butterfly.wav':

         44100 Hz, 2 channel(s), 20153217 sample frames


WARNING: Buffer underrun in real-time audio output


On Tue, Nov 13, 2018 at 5:23 PM Emmett Palaima <epalaima@meowwolf.com> wrote:
I get a lot of buffer underruns, after which the control signal stops functioning correctly. Generally what happens is that the patch starts stuttering, and then the sound output gets stuck on, even when the controller is sending an off message.

On Tue, Nov 13, 2018 at 4:57 PM Dave Seidel <dave.seidel@gmail.com> wrote:
When you say it crashes, what do you mean exactly? What is the console output? Did you build Csound yourself?

I run Csound on a Raspberry Pi all the time these days, but it's a Pi 3, which of course has different capabilities compared to a Pi Zero.

On Tue, Nov 13, 2018 at 6:26 PM Emmett Palaima <epalaima@meowwolf.com> wrote:
Hi, I'm working on a project that includes some pretty basic audio interactivity. Simply a looping audio file which fades in based on a proximity sensor getting triggered. Also needs to be embedded and I figured using a Raspberry Pi Zero (audio via PHat DAC soundcard) with Csound would be a simple way to add audio. Proximity sensor is read by a Teensy 3.5 microcontroller, which sends on / off values as a USB Midi CC message. 

However, even this extremely basic patch consistently crashes on a Pi Zero. The patch is not doing anything strenuous and I can't really see anything I can improve, wanted to post on here to see if the community could recommend anything, or catch something I was doing wrong. Was hoping Csound would be a viable option since I'm fast with it and can work entirely via SSH since it's text based. 

Here is the csd, please let me know if you see anything I can improve, thanks!:

<CsoundSynthesizer>
<CsOptions>
-odac
-+rtmidi=alsa
-Ma

</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 512
nchnls = 2
0dbfs = 1

turnon 1

instr 1

k1 chanctrl 1, 14
k2 chanctrl 1, 15

k1  port k1, .5
k2  port k2, .5

a1, a2  diskin2 "Butterfly.wav", 1, 0, 1

outs a2 * k2 * .9, a1 * k1 * .9

endin

</CsInstruments>
<CsScore>

</CsScore>
</CsoundSynthesizer>
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here