electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
SndBuf in RAM?
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
moonyphon



Joined: Jul 24, 2015
Posts: 2
Location: Germany

PostPosted: Fri Jul 24, 2015 12:56 pm    Post subject:  SndBuf in RAM?
Subject description: audio samples in memory or streamed from disk?
Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 22291
Location: The Netherlands, Enschede
Audio files: 212
G2 patch files: 319

PostPosted: Fri Jul 24, 2015 1:09 pm    Post subject: Reply with quote  Mark this post and the followings unread

welcome 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
Back to top
View user's profile Send private message Visit poster's website
moonyphon



Joined: Jul 24, 2015
Posts: 2
Location: Germany

PostPosted: Fri Jul 24, 2015 1:23 pm    Post subject: Reply with quote  Mark this post and the followings unread

thanks @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
View user's profile Send private message
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 1913
Location: Berks County, PA
Audio files: 78

PostPosted: Mon Aug 03, 2015 5:50 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 1913
Location: Berks County, PA
Audio files: 78

PostPosted: Mon Aug 03, 2015 5:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use