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
Hid refresh rate
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [14 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Frostburn



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

PostPosted: Mon Jan 14, 2008 10:38 am    Post subject: Hid refresh rate
Subject description: what does it depend on?
Reply with quote  Mark this post and the followings unread

I read about the Theremin and I just had to make a digital FM theremin using two mice.
It seems that the smalles duration between two hid messages is 1024::samp on my machine. Is there any way to make it even more rapid? What decides the refresh rate? ChucK, Linux's kernel, USB or the hid-device in question?

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


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

PostPosted: Mon Jan 14, 2008 12:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

so, that's 44 or 48 messages per second? that does sound a bit slow to me I don't think you can change this from within ChucK code but it also seems odd that it's linked to the sample rate at such a remarkbable number. I'd ask Spencer as he did the HID implementation.

You could find his private adress easily as he also maintains the Mini but as this is likely of interest to more people you might want to try the users list.

You could of course also dig in the source if you feel adventerous...

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frostburn



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

PostPosted: Mon Jan 14, 2008 1:59 pm    Post subject: Reply with quote  Mark this post and the followings unread

*Bangs head*
The answer was almost too obvious.
I'm running JACK for easier connection between ChucK and other programs and it has a setting called Frames/Period that was set to 1024. Very strangely changing this to 16 brings the smallest achievable duration between hid events to 16::samp. Smile
Running on my chuck.alsa build without JACK the update duration was 512::samp.
ChucK with --silent did what I believe to be 1::samp. Smile

So the hid refresh rate depends on the system that ticks ChucK.

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


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

PostPosted: Mon Jan 14, 2008 7:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

Right! And Jack was likely asuming a system that used block-processing and trying to sync all blocks? (ChucK doesn't use block-processing, this is very cool for many things and also somewhat expensive).

Good to know!

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frostburn



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

PostPosted: Tue Jan 15, 2008 2:36 am    Post subject: Reply with quote  Mark this post and the followings unread

Hmm... When I'm not running jack the refesh rate depends on the --bufsize that I set for chuck.alsa . I wonder if it would be possible not to constrain it at all... let hid run freely. Maybe I'll need to ask Spencer about this.
_________________
To boldly go where no man has bothered to go before.
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


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

PostPosted: Tue Jan 15, 2008 7:40 am    Post subject: Reply with quote  Mark this post and the followings unread

Yeah, that makes sense, I suppose.

Are you running a realtime kernel? If not installing one will likely bring down the lowest bufsize you can use. Installing one isn't hard anymore, at least not on Debian and it's children (like the popular Ubuntu). I had one on 7.10 after a few seconds download and a reboot. It's worth your efford if you didn't yet.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frostburn



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

PostPosted: Tue Jan 15, 2008 10:56 am    Post subject: Reply with quote  Mark this post and the followings unread

[quote="Kassen"]Are you running a realtime kernel? If not installing one will likely bring down the lowest bufsize you can use. Installing one isn't hard anymore, at least not on Debian and it's children (like the popular Ubuntu). I had one on 7.10 after a few seconds download and a reboot. It's worth your efford if you didn't yet.[quote]

I installed a realtime kernel and realtime-lms but I still couldn't get jack to run with the realtime option... Maybe I'm doing something wrong here.

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


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

PostPosted: Tue Jan 15, 2008 11:13 am    Post subject: Reply with quote  Mark this post and the followings unread

I'm not sure what Jack's realtime option does, might be just what you need, but I was able to get my ALSA buffersize on ChucK way down using one.

I'm going to bring this topic to the atention of my friend Nescivi who's a bit of a expert on HID usage for sound on Linux.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nescivi



Joined: Mar 23, 2005
Posts: 94
Location: Montreal

PostPosted: Tue Jan 15, 2008 12:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well, HID rate is as fast as the USB transport goes, and then what the software does with it. So it should not by definition depend on the buffer size of the audio interface. I am unfamiliar with how HID is implemented in Chuck, but I strongly suspect the problem lies there. I suspect that underneath it only checks the HID values once each buffer frame, instead of updating it whenever there is a new value.
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: Tue Jan 15, 2008 12:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks Marije!

Frost, I'd say it's time to send a friendly mail to Spencer with all the info you have now.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Inventor
Stream Operator


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

PostPosted: Wed Jan 16, 2008 11:46 pm    Post subject: Reply with quote  Mark this post and the followings unread

Frostburn makes a Theremin with ChucK...

The force is strong with this one!

Kas, have you spoken to Yoda about his training?
Back to top
View user's profile Send private message Send e-mail
Kassen
Janitor
Janitor


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

PostPosted: Thu Jan 17, 2008 3:15 am    Post subject: Reply with quote  Mark this post and the followings unread

Last time I spoke with Yoda he was claiming to meditate but there was a huge pile of bottles in the corner so I thought it best not to disturb him, I think Frostburn has been consulting Finnish Moutain trolls instead!

Wink

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frostburn



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

PostPosted: Sat Jan 19, 2008 3:03 am    Post subject: Reply with quote  Mark this post and the followings unread

I mailed with Spencer and I quote, (hopefully he wont mind):
Spencer Salazar wrote:

I believe that the audio buffer size determines ChucK's overall
refresh rate--all Ugen calculation and user ChucK code execution
occurs on audio buffer boundaries. I think the advantage to this is
that it helps avoid audible dropouts in the signal to the DAC.

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


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

PostPosted: Sun Jan 20, 2008 12:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

Frostburn wrote:
I mailed with Spencer and I quote, (hopefully he wont mind):
Spencer Salazar wrote:

I believe that the audio buffer size determines ChucK's overall
refresh rate--all Ugen calculation and user ChucK code execution
occurs on audio buffer boundaries. I think the advantage to this is
that it helps avoid audible dropouts in the signal to the DAC.


Ow. That kinda makes sense but it does make small buffers quite important.

_________________
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 [14 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