Sound on PandaBoard
Chris Johnson (125) 825 posts |
Curiouser … I have now found that after the sound cuts out, I can get it going again, from exactly where DigitalCD stopped playing, by resetting the sample rate to 96k and then back to 88.2k (using the SharedSound_SampleRate SWI). The trouble is it stops again after a few minutes and I have to repeat the process. The question is – is something resetting the sample rate or is sharedsound getting in a knot? What I have found is that it is not sufficient to simply issue the SWI for 88.2. It is necessary to set to 96k, when the sound comes back, and it can then be reset to 88.2k. |
Willi Theiss (541) 17 posts |
Try the command sequence *Audio Off and *Audio On for reviving the sound system. |
Chris Johnson (125) 825 posts |
I am not really any further forward. I have completely reinstalled all the audio related apps/modules, but that hasn’t eliminated the problem. I said it was random in occurrence, but I have noticed that sometimes the audio stops when there is other disc activity (I don’t mean a pause due to the buffer not being filled for a while due to cpu load but a complete cessation of the sound system). My main storage is a 120 GB SSD connected via an externally powered usb hub. The correlation is far greater than that which gets particle physicists very excited, but small compared with a five nines correlation coefficient. I do seem to be getting longer periods of uninterrupted sound at times, up to an hour, but may then get several occurrences over a period of 5 minutes. At the moment I am using DigitalCD playing mp3s for the tests. It’s just gone! I was doing nothing on the PandaRO, just allowing it to play a few tracks – this is being typed on the Iyo. The sequence audio off + audio on does indeed kick the sound back into life. It is as if DigitalCD is waiting for its buffer to be filled but nothing comes. What I will do is do a clean boot and run only the audio, and see if it still happens. Puzzled of Edinburgh afterthought: there does seem to be crackles sometimes from the sound, but only when something is playing. |
jim lesurf (2082) 1438 posts |
That does sound (sorry for the pun!) like a buffer / timing problem. Do you get the same problem playing lpcm wave files? I’ve not encountered the problem. However I don’t use DCD much at present as I now use the USB Audio. And almost never play mp3. IIRC DCD lets you change the buffer size, etc. Have you experimented with that? Jim |
Raik (463) 2061 posts |
I have try any things yesterday. Play mp3 with DigitalCD and wrote any things in Techwriter, mailing with MPro7, surfing with Netsurf. No problems around 3h here. |
Chris Johnson (125) 825 posts |
I had the external amp on for about three hours without playing anything. Not a single click that I noticed.
Only have one wav file on the PandaRO at the moment. It is about 7:20 in duration. I started it playing. Immediately there were random clicks occurring. At about 3:40 it halted. I restarted it using audio off/on and it ran for about another minute before halting again. Restarted again and it continued to about 6:20, before halting. Another restart and it continued to the end. Have now started some mp3s playing, and it played two ok (about 7 min), but has now halted again a short way into the third. One thing I noticed while the wav file was playing. The clicks (of varying intensity) seemed to always coincide with a blink of the SSD activity lamp, but not every access caused a click. I currently have all the buffer adjustments in DigitalCD set to high values. I’ll try again with them set much lower. I also may copy a few files on to the SD card and see if the same problem occurs. I guess I can also try streaming over ShareFS from either the Iyonix or the Bubba NAS. Third thing I can do is to set up DigitalCD on the BeagleBoard and see how that behaves – it was fine several months ago but I haven’t used any sound on that since. I am using recent OS versions – the PandaRO is currently at the 26 Mar 2014 version. |
jim lesurf (2082) 1438 posts |
What about playing files from ramdisc? When I was testing replay and recording over USB I found that ramdisc was the fastest. Closest to that was the main ‘Hard disc’ SD card (Sandisc 64GB card), and SD cards via USB (SCSI) were slower. However I was testing with up to 192k/32bit, so rather higher data rates than an mp3. For 44.1k/16 stereo lpcm transfers were much easier than for the higher rates. For 44.1k/16 I could use 0.1 sec buffers OK, but for the 192k/32 I needed 1 sec buffers. But this is all for playing via USB Audio so isn’t exactly the same as using DCD. Jim |
jim lesurf (2082) 1438 posts |
I’ve just done some quick checks and I seem to get the same behaviour. Clicks and a tendency for audio replay to ‘halt’. This using DCD to play lpcm wave files on my ARMiniX [R-Comp RO 5.21 (7-Mar-14)]. DCD using DiscSample to play wave lpcm. First I set the system rate to 96k and played a 96k/24 wave file. This was a deliberate test using a relatively high data rate. This played OK. I then realised I should be surprised as it was a 24bit file which I’d not bothered trying in the past with DCD! :-) I then set the system rate to 88.2k and tried some 44.1k/16 wave files. These were also OK, but fairly short files of a few mins each. All the above test files on the main SD card hard disc. I then tried some 44.1k/16 files from a Fat32 external SD card in a reader. These gave clicks, and shortly after starting one file ‘halted’. I can’t recall encountering these problems in the past. For the last month or two I’ve been focussed on USB and ignoring the main sound system. I upgraded to the new OS version just about a week ago. So I suspect that upgrade may have caused the change in behaviour, but don’t know. I’ll do some more tests when I get a chance. In parricular I’ll load the modules that support USB audio transfers and see if that makes any difference. Not clear if this is a buffer problem or something to do with the USB handling, or what. I’ll also check changes in buffer size and if using PlayIt rather than DiskSample helps. FWIW At present my copy of DCD is setting the DiskSample buffer sizes to 512 / 4096 k. One detail that may be diagnosic is that I’m using the ‘PPM’ level indicators and these also freeze when playing halts. If DCD were still playing but getting zero input they’d glide down in level. So it looks like DCD replay is freezing. But I can quit DCD and use the desktop. Jim |
jim lesurf (2082) 1438 posts |
Now had a chance to do afew more tests. I treied loading the relevant USB modules and then played some wave files via USB. This worked fine with no problems. Used it to listen to some Vaughan Williams while I made a cup of coffee and did a few other things. :-) I then tried using !PlaySound, which uses PlayIt. So means a different driver as well as a different application. As with DCD this seemed fine for wave files on my main HD. But gave clicks and eventually a ‘halt’ when I played a file from an external Fat format SD card in a reader. So now the same (14 min long) file works fine with DCD+DiskSample and PlaySound+PlayIt provided it is on my main HD. But if it is on a Fat format external SD card they both give clicks and ‘halt’. However the same file on the same SD card is fine if I pay it with the USB Audio method. So I conclude that there is something unsatisfactory about the external SD card and SharedSound combination. I didn’t get this problem in the past, but I’ve not been using such a combination for a couple of months or more. So I can’t tell when this may have changed precisely. As with DCD, when PlaySound ‘halts’ I can still use the desktop. But need an audio off/audio on cycle to regain sound play. FWIW When R-Comp issued the OS upgrade they did bullet-point improvements in sound. But although I’ve asked, I don’t know what these may be or what has changed. (I’ve also wanted to know what the VFP changes are, but again not yet had any explanation.) I’ll raise this behaviour on the email list for Pandaland… Jim |
jim lesurf (2082) 1438 posts |
IIUC Chris correctly it occurs to me that the main common factor here may be having the file to be played being read via USB. Is that so? What I’m wondering is if there is a clash for the optimum/chosen buffer sizes between data reading from the device and data writing into the sound system. I’ve not really experimented with buffer sizes in DCD or PlaySound as my main interest personally is USB Audio as it bypasses other problems anyway. Jim |
Chris Johnson (125) 825 posts |
Thanks Jim for making those tests. It looks as if it is not just my setup. I had been wondering if it was a generic usb problem, or a problem with my usb hardware. I said earlier in this topic I would try playing from other media, and try some tests on the BB based ARMini as well. I know that was fine some months back, but haven’t used sound on that for a while. May get some time later today. |
jim lesurf (2082) 1438 posts |
FWIW When recording from a USB audio device onto a USB connected SD card or stick I find I have to have a very big buffer to avoid timing problems. (Shows as missing bursts of samples in the recorded result.) If I record to the internal SD card (main hard disc) I can use a smaller buffer. However this only really shows up when recording high rates – e.g. 96k/32. But it indicates that the USB system seems a bit ‘slow’. So it may be better to play or record to the main SD card used as the ‘hard disc’ on the Panda board as that isn’t USB. Indeed, if only playing small mp3 files you may find the safest method is to copy each one to ramdisc before playing it! The alternative is to load an entire file into memory before playing. Alas, I often work with files with sizes of the order of a GB which makes that a bit impractical for me. Wish we now had 4G ram available and could use it! 8-] Have to leave it to someone else to examine and sort out why USB seems oddly slow. Not an area I understand. Jim |
Chris Johnson (125) 825 posts |
Have now tested it playing from 120 MB RAM disc. As long as the machine is otherwise idling, then playing is faultless with no clicks or halts. However, once you start using the machine for other things involving access to the usb SSD, clicks occasionally are heard during access, and I managed to provoke two halts while copying large files. When the audio is halted, the DCD front end is still active – the control panel display is still cycling through the info it displays – artist, title, sample rate etc, and CPUClock and TaskUsage show that DCD is doing something every few seconds – looking for the audio data which isn’t appearing? I have been on the Iyo for the last 25 mins while the PandaRO has been playing from RAM disc – no clicks, no halts. Next to check is the SD card as source, and then ShareFS. |
André Timmermans (100) 655 posts |
It sounds to me like the system stops generating Sound Buffer filling interrupts. You should try using the TimVis full-screen visualization plug-in with DigitalCD. While playing MP3s it will provides some info on DiskSample like the status of input/output buffers (see the first image below the text at http://www.riscos-digitalcd.net/digitalcd/plugins/timvis.htm). If the waveform displayed freezes and the output buffers remain filled, then this means that DiskSample is not asked anymore to fill sound buffers. If the buffers continue to be emptied and and filled, then the problem is with what the system does with the buffers. |
Chris Johnson (125) 825 posts |
@André
I downloaded this and gave it a try. However, it fails to run, giving an ‘unknown variable’ error. The error line (4560) is simply Var_Info% = Var_InfoMax% Searching the !RunImage file, there is no other mention of Var_InfoMax%. Have tried a number of variations on SSD, powered hub, other filing systems etc but still get the halt at irregular intervals. |
Stephen Unwin (1516) 154 posts |
I’ve just had a quick look at the program, being nosey! |
Chris Johnson (125) 825 posts |
I noticed from the CVS recent changes that for Apr 22nd there is an entry ‘Improvements to audio FIFOing’ by Willi Theiss. I thought I would give DigitalCD another try. Updated to the 23rd April ROM, and have been playing audio intermittently all afternoon, and haven’t yet had a audio freeze. Maybe I am tempting fate, but it looks as if Willi might have cracked it. |
jim lesurf (2082) 1438 posts |
IIUC R-Comp are also in the process of releasing an upgrade based on this. Probably will become recommended for ARMiniX users after the show. Since I’m mainly using USB for audio at present I’m leaving testing to others. 8-] Jim |
Chris Johnson (125) 825 posts |
Just to add that I have been giving DigitalCD a bit of a thrash this evening (playing mp3s) and there have been no freezes of the audio. There are still occasional clicks on the audio, but I will try a different SSD/powered hub combination and see if that makes any difference. Thanks Willi for the changes. |