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
GUI seed for ChucK
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [1 Post]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
fretless



Joined: Nov 29, 2009
Posts: 19
Location: Boston

PostPosted: Thu Jan 16, 2014 6:02 pm    Post subject: GUI seed for ChucK Reply with quote  Mark this post and the followings unread

This shows a very minimal knob with a readout controlling the MIDI note number.

Run the ChucK in miniAudicle ...
[code]
SinOsc s => dac;.5 => s.gain;
OscRecv recv;
6449 => recv.port;
recv.listen();
recv.event( "/foo/notes, i" ) @=> OscEvent @ oe;
while( true ){
oe => now;
while( oe.nextMsg() ){
oe.getInt() => Std.mtof => s.freq;
}
}
[/code]

... and this is FXRuby
[code]
require 'fox16'
require 'osc'
include Fox
include OSC

class HelloWindow < FXMainWindow
def initialize(app)
sc = SimpleClient.new('localhost', 6449)
super(app, "Hello, World!" , :x => 200, :y => 200, :width => 200, :height => 100)
line_frame = FXLabel.new(self, "Line Frame", :opts => FRAME_LINE)

control_knob01 = FXKnob.new(self,:opts => KNOB_NORMAL|LAYOUT_CENTER_X)
control_knob01.setRange (38..58)
control_knob01.connect(SEL_CHANGED) do |sender, sel, data|
line_frame.text = "Number #{data}"
sc.send(Message.new('/foo/notes', nil, data))
end

end

def create
super
show()
end
end

if __FILE__ == $0
FXApp.new do |app|
HelloWindow.new(app)
app.create
app.run
end
end
[/code]



On my system I am using Ruby 1.9.3 and I used 'gem' (Ruby package manager) to install FXRuby and Osc. I think it's possible to get a long way onto a GUI with just a few lines of FXRuby.
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 [1 Post]
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