Author |
Message |
moonyphon
Joined: Jul 24, 2015 Posts: 2 Location: Germany
|
Posted: Fri Jul 24, 2015 12:56 pm Post subject:
SndBuf in RAM? Subject description: audio samples in memory or streamed from disk? |
 |
|
Hi,
I'm getting glitches and pops on a pretty slow machine (Raspberry Pi:
800MHz, 256MB) while playing samples using chuck, with realtime kernel.
My basis was this example
http://chuck.cs.princeton.edu/doc/examples/basic/sndbuf.ck
Is this actually loading a sample into the memory or is it played as a
stream from disk?
If it streams from disk, how could I improve the performance? I've already disabled all unneeded system services.
Best regards,
moony |
|
Back to top
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24422 Location: The Netherlands, Enschede
Audio files: 297
G2 patch files: 320
|
Posted: Fri Jul 24, 2015 1:09 pm Post subject:
|
 |
|
moony
Disk being an SD card I assume .. those come in various speeds .. so maybe just a faster card would help ... I've no idea if it streams from memory or from disk though. _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
moonyphon
Joined: Jul 24, 2015 Posts: 2 Location: Germany
|
Posted: Fri Jul 24, 2015 1:23 pm Post subject:
|
 |
|
@Blue Hell for the friendly welcome. Yes I'm new in the forum. btw.: I got into chuck while building a loop-player-pedal to provide sequences of background music for guitarists (myself) or other instrument players.
Here it is in action: http://tinypic.com/player.php?v=5z1bw5&s=8
I'm almost every time getting glitches or a weird speed up, when completely stopping a loop and starting a new one (not the case in the video).
Yes an SD card. It's fast enough, as long almost nothing else happens (ssh access i.e.), but maybe also a real-time-kernel problem.
The chuck examples are really great, but not well documented.. |
|
Back to top
|
|
 |
Acoustic Interloper

Joined: Jul 07, 2007 Posts: 2073 Location: Berks County, PA
Audio files: 89
|
Posted: Mon Aug 03, 2015 5:50 pm Post subject:
|
 |
|
I just started reading the ChucK book today, partly to get me through some plane rides tomorrow, partly because I am thinking of using it in a multimedia programming course next spring. I have been coding ChucK since 2006 or 2007, am not an expert, though, and am learning some things by reading.
There is almost a whole chapter on SndBuf. It's strictly memory based, not disk. They show how to load a sequence of files into one SndBuf, one at a time, and warn about pops etc. using that approach. They also show pre-loading a sequence of files into a sequence of SndBuf objects stored in an array, but warn that that approach may not work well in a small-memory-footprint device such as RaspberryPi. Any O.S. with demand paging will start paging to disk when you over-run physical memory, and even if it's solid state disk, there is overhead involved.
We also plan to use RaspberryPis in that course, so this will matter to me. It might work to have one ChucK shred play a relatively short file while another thread is prefetching the next one. Let's say a 2-length SndBuf array where one is being played by one shred while the other is being loaded by the other shred. I don't know whether that would help your problem, but it is a tradeoff between the 2 techniques shown in the book.
You can download all of the book's code from the above page without buying the book, which is cool, since code makes up much of the book. The SndBuf examples are Chapter 4.
Am looking at ChucK U for the first time, looks useful. Good luck. _________________ When the stream is deep
my wild little dog frolics,
when shallow, she drinks. |
|
Back to top
|
|
 |
Acoustic Interloper

Joined: Jul 07, 2007 Posts: 2073 Location: Berks County, PA
Audio files: 89
|
Posted: Mon Aug 03, 2015 5:56 pm Post subject:
|
 |
|
PS: If you are capturing the samples on the fly, make sure to check out the LiSa ugen. I am working on a data sonification technique that puts waveforms into a LiSa object and loops them, have used LiSa for other things in the past. It is also memory resident. _________________ When the stream is deep
my wild little dog frolics,
when shallow, she drinks. |
|
Back to top
|
|
 |
|