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 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
poster
 Forum index » DIY Hardware and Software » ChucK programming language
Trouble Writing to File.
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [9 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
sir honey



Joined: Aug 04, 2006
Posts: 36
Location: NY

PostPosted: Mon Feb 19, 2007 9:08 am    Post subject:  Trouble Writing to File.
Subject description: my audio files won't open after recording to disk
Reply with quote  Mark this post and the followings unread

Hi All,

I'm trying to grab samples from my dac while other chuck programs are running. I run this program:

Code:


// Jack's record module.


dac => WvOut wave => blackhole;

"/chuck/jackchuck/chucksamples/testing.wav" => wave.wavFilename;

2 => int seconds; //number of seconds to sample (increment to increase file size).

0 => int control;

while ( control < seconds )
{
   1::second => now;
   control++;
}



and actually write a file in the desired location. Everything appears fine until I try to open the file and play it back, and then Quicktime tells me that there is an error opening the file. Same goes for iTunes, LogicPro etc. So what's up with the file? none of the other formats seem to work either (aif, raw etc.)

I can't get the enclosed example rec.ck to do any differently (although my version is so similar, this isn't surprising).

Any help on this? I'm really bummed, 'cause this was the single most exciting this about chucK for me! realtime sampling and manipulation! Help.

Thanks for putting up with my posts,

jack
Back to top
View user's profile Send private message
ge



Joined: Aug 13, 2006
Posts: 108
Location: Palo Alto, CA

PostPosted: Mon Feb 19, 2007 9:38 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hi!

Hmm, interesting. I can't seem to duplicate the bug - I am able to play the file. Are you on OS X? Checking the code, the file seems to be written correctly. What is the file size for your corrupted file?

We'll do what we can to get to the bottom of this!
Back to top
View user's profile Send private message Visit poster's website
sir honey



Joined: Aug 04, 2006
Posts: 36
Location: NY

PostPosted: Tue Feb 20, 2007 7:48 am    Post subject: Reply with quote  Mark this post and the followings unread

the file size is 172k. seems right, no?

I'm in OSX 10.3.9 on an old 800mhz G4 powerbook.

I really wish this would work...

thanks for your help, Ge

(I'm a big fan of what you do).

jack
Back to top
View user's profile Send private message
ge



Joined: Aug 13, 2006
Posts: 108
Location: Palo Alto, CA

PostPosted: Wed Feb 21, 2007 10:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

sir honey wrote:
the file size is 172k. seems right, no?

That seems promising...

Are you using the command line chuck or the miniAudicle? for the miniAudicle, some files won't get closed properly until you quit the miniAudicle.

Also, here is a modified standalone test, try running this by itself, separately in both command line chuck and then miniAudicle (check preferences to see where the file is put):

Code:
// patch
SinOsc s => dac => WvOut wave => blackhole;
440 => s.freq;
.25 => s.gain;

"foo.wav" => wave.wavFilename;

// number of seconds to sample (increment to increase file size).
2 => int seconds;
0 => int control;

// go
while( control < seconds )
{
   1::second => now;
   control++;
}


Using this, you should be able to generate a 2 second file of sine.

Quote:
thanks for your help, Ge

No need to thank. Happy to try!!

Thank you for reporting this!
Back to top
View user's profile Send private message Visit poster's website
sir honey



Joined: Aug 04, 2006
Posts: 36
Location: NY

PostPosted: Thu Feb 22, 2007 7:32 am    Post subject: Reply with quote  Mark this post and the followings unread

hey ge,

I'm running command line chuck only, havent even tried using the audicle or mini.

Nope, Same result with your code!

Quicktime, Realplayer, iTunes, Logic Pro... nobody wants to open these files originated in chuck. Has anybody else had this sort of problem before?

I'm about to get a new intel mac, but I'd like not to have to wait until then to use chuck in this fashion. Probably you would agree, too.

Talk to you soon!

jack
Back to top
View user's profile Send private message
spencer



Joined: Aug 16, 2006
Posts: 53
Location: northern california

PostPosted: Thu Feb 22, 2007 1:17 pm    Post subject: Reply with quote  Mark this post and the followings unread

jack,
I was able to reproduce this problem by running 'chuck --loop yourtestfile.ck'. chuck won't automatically close WvOut's until it exits, because without garbage collection its not great at knowing when you are actually done recording to it. you might want to try closing the file manually (and stop recording) with a line like this:
Code:
w.closeFile( "" );
after the end of your loop. The string argument there doesn't have any significance but for some reason its required.

spencer
Back to top
View user's profile Send private message
sir honey



Joined: Aug 04, 2006
Posts: 36
Location: NY

PostPosted: Thu Feb 22, 2007 3:42 pm    Post subject: Reply with quote  Mark this post and the followings unread

thanks spencer.

I did try:

Code:


wave.closeFile;



at the end of my record program, and that didn't work.

but I hadn't tried appending the ("path/filename.blah") part.

I'll try it soon, and report back.

thanks again.
jack
Back to top
View user's profile Send private message
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Thu Feb 22, 2007 4:44 pm    Post subject: Reply with quote  Mark this post and the followings unread

sometimes i got this problem also..
and most of the time i changed the format (wav) to AIFF instead..
and it worked -_-"
so it's still quite strange to me. -_-' .. Shocked
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
sir honey



Joined: Aug 04, 2006
Posts: 36
Location: NY

PostPosted: Thu Feb 22, 2007 5:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

thanks guys,

problem solved. I'm happily chucking and recording my live sessions right now!

jack
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [9 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