hansehv / SamplerBox

Alternative/extended version of Joseph Ernest's samplerbox
44 stars 25 forks source link

No sound after some time #110

Open DiXcipuli opened 1 year ago

DiXcipuli commented 1 year ago

I have burnt the latest image. I tried with/without sound card, with/without HDMI, powered with battery or directly from the outlet, but I still have the same behavior, on both Raspberry 3B+ or 3A:

After some time, and while playing multiple notes, no sound is coming out. I checked what was printed out, running samplerbox, and killing beforehand: systemctl stop samplerbox.service.

Approximately 40 sec after not having sound, I get the error:

File "./modules/audio.py", line 45, in AudioCallback
if gv.playingsounds[i].playingstopmode()!=3:    # let the backtracks be
IndexError: list index out of range

I tried with two different midi keyboards (Arturia MK2 and Novation Launchpad X)

Thanks!

hansehv commented 1 year ago

Hi, The error message you report is a result of the max-polyphony protection failing. In other words: there are too much sounds playing, so this protection has to break in but runs in a timing/syncing error - so this is collateral damage (which is quite rare by the way). But if so much sounds are playing, they were sent to some sound device - but you hear nothing. So it is interesting to see what sound device is detected and selected. This is in the very first messages at start up. Samplerbox will log info about available audio devices, the actual opened device and whether the alsmixer can control the volume. And yes, the internal PI audio device has a known issue - it will come to live over a minute after startup. But since samplerbox is usually used in combination with extra DACs (hats, usb devices) I haven't put much effort into that yet. Hans

thegink commented 6 months ago

Hi Hans, I have the same issue - after playing lots of notes, the sound output stops, and then the same error appears. It's quite repeatable, and seems to happen most times we play the keyboard (kids playing, so probably not quite the usual use-case!). In my setup, I'm using the headphone output of a pi3b (maybe? I'm going from memory).

I've attached a log of the error below. In this case, I don't think it ever played a note - I was playing the keyboard while it loaded the samples, and it crashed immediately. The "Callback queing killed" message appeared each time I played a note for a while, then it stopped.

pi@samplerbox(ro):/home/samplerbox$ sudo systemctl stop samplerbox
pi@samplerbox(ro):/home/samplerbox$ samplerbox
==========================================
  https://github.com/hansehv/SamplerBox
>>>>  Distribution image  2022-02-06  <<<<
> Synced with GitHub status 2022-02-06   <
> = merge of branch: 'Python3 migration' <
no track of local changes, that's for you!
==========================================
IP's: ['10.0.0.5']
Wireless: xxxxxxxx, -57dBm: Very good
Available audio devices:
  0 bcm2835 Headphones: - (hw:0,0), ALSA (0 in, 8 out)
  1 sysdefault, ALSA (0 in, 128 out)
< 2 default, ALSA (0 in, 128 out)
  3 dmix, ALSA (0 in, 2 out)
Opened audio device #0 bcm2835 Headphones: - (hw:0,0)
  samplerate 44100Hz, blocksize=384, LFOcycle=1
  valid blocksizes: [32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384]
Opened Alsamixer: card (hw:0,x), control Headphone
USB device on /media/usb/ has no samplesets, using SD space on samples/
We have None, we want 0 GrandPiano
Starting httpd on port 80
Opened input "SERIALPORT"
Opened input "Midi Through:Midi Through Port-0 14:0" as SMFplayer
Callback queing killed
Callback queing killed
Callback queing killed
Callback queing killed
Callback queing killed
Callback queing killed
Callback queing killed
Callback queing killed
Callback queing killed
Callback queing killed
Callback queing killed
Loaded '0 GrandPiano', 59% free memory left
Callback queing killed
From cffi callback <function _StreamBase.__init__.<locals>.callback_ptr at 0x746ea300>:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/sounddevice.py", line 856, in callback_ptr
    return _wrap_callback(callback, data, frames, time, status)
  File "/usr/local/lib/python3.7/dist-packages/sounddevice.py", line 2678, in _wrap_callback
    callback(*args)
  File "./modules/audio.py", line 45, in AudioCallback
    if gv.playingsounds[i].playingstopmode()!=3:    # let the backtracks be
IndexError: list index out of range