electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
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
Newbe Question on Wavefile Cleanup
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Mr Theremin



Joined: Mar 22, 2008
Posts: 22
Location: Ohio

PostPosted: Wed Mar 26, 2008 12:43 pm    Post subject: Newbe Question on Wavefile Cleanup
Subject description: Cleanup wave file buffer
Reply with quote  Mark this post and the followings unread

I’m trying to code up a sampler in chuck in WinXP. This project may be too challenging for a beginner but I want to discover ChucK’s qualities and problems quickly so I jumped in with both feet.

What I am trying to understand is how to clean up after SndBuf.

I have been watching the Task Manager and it seems that memory and CPU are never released. I have tried several different methods of starting and sporking. The wave files here are any large sample (so that you can see memory usage meter move). Every instance of this code will grab more memory and not release until the main task is killed. Does any one know why this would leak the memory?

Is there a simple way to unload the file "FileName.wav" =< buf.read; ?

Code:

// spork the test function, store the shred reference
spork ~ Play() @=> Shred @ s;

3::second => now;

// remove by id
Machine.remove( s.id() );

3::second => now;


// test function
fun void Play()
{
SndBuf buf1;
"Large.wav" => buf1.read;
buf1 => dac;

SndBuf buf2;
"Large.wav" => buf2.read;
buf2 => dac;

SndBuf buf3;
"Large.wav" => buf3.read;
buf3 => dac;

3::second => now;
}
[/code]
Back to top
View user's profile Send private message
Frostburn



Joined: Dec 12, 2007
Posts: 255
Location: Finland
Audio files: 9

PostPosted: Wed Mar 26, 2008 1:21 pm    Post subject: Reply with quote  Mark this post and the followings unread

Garbage collection is one of the lacking features in ChucK at the moment.
If memory taken it is usually not released.

I ran a quick test and it seems that you can manually release the memory SndBuf uses by loading up an empty sound file to it. (Hopefully it also work in Windows. Linux here.)

EDIT: Oh and welcome to the board!
Theremins rock.

_________________
To boldly go where no man has bothered to go before.
Back to top
View user's profile Send private message
Mr Theremin



Joined: Mar 22, 2008
Posts: 22
Location: Ohio

PostPosted: Wed Mar 26, 2008 1:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

Wow Frostburn, thanks for a speedy reply... with an experiment included no less. You guys rock. Your idea will make a fine workaround until something gets revised.

Now if I could only figure out how to display this cool avatar image I found of Léon Theremin playing his early instrument. I uploaded it to the profile page but I don’t see it on my message.
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Wed Mar 26, 2008 2:45 pm    Post subject: Reply with quote  Mark this post and the followings unread

Mr Theremin wrote:
I uploaded it to the profile page but I don’t see it on my message.


Maybe it's too large?

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Mr Theremin



Joined: Mar 22, 2008
Posts: 22
Location: Ohio

PostPosted: Wed Mar 26, 2008 3:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well, my image is only 6K. I'm testing one more time with a different image. If this doesn't work it must be me and I'll stop cluttering this wonderful forum with my void messages.
Back to top
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Wed Mar 26, 2008 3:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

Post with reckless abandon! You should see some of the thinking out loud nonsense I post sometimes, I bet folks get a good laugh from time to time.
_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Wed Mar 26, 2008 4:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

Mr Theremin wrote:
Well, my image is only 6K.


Ok, so it's probably smaller than 100x100 pixels as well ... weird ... I checked your profile, nothing indeed ... maybe try to upload the image here or PM it to me so I can try to get it into your profile.

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Mar 26, 2008 6:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

Inventor wrote:
Post with reckless abandon! You should see some of the thinking out loud nonsense I post sometimes, I bet folks get a good laugh from time to time.


Yeah, just start typing and see where you end up, that's the ChucKian way!

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [8 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


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