Author |
Message |
hanez
Joined: Feb 07, 2007 Posts: 10 Location: Austria
|
Posted: Mon Oct 22, 2007 6:15 am Post subject:
file IO with OSC Subject description: a small utility program that allows file input/output from within chuck using OSC |
 |
|
hello,
recently i was doing some "chuck research" using the new UAna's. the goal was to develop an audio-to-midi translator to trigger my synths with the microphone (my voice). Just for the chucking fun of it. I used the spectral flux for note-on detection, but at the beginning i had no idea how the spectral flux of may voice looked like, i.e. when i bellow a bass line into the mic. So i was confronted with the problem to get the spectral flux data out of chuck to analyse it with a different program (i use matlab for this). as far as i know there is still no file input/output functionality in chuck.
That's why i coded (in C++, using MS Visual Studio 2005, release build) a small utility that can receive data from chuck and save it into a ASCII textfile and it also can load such a file and send it to chuck using the OSC protocol. So with it you can analyse (plot, make calculations with it, show it your girlfriend) data generated by chuck, you can make a preset management for your chuckmachines and you can feed them with external data.
I thought, i will share this here, because maybe some other chuckchuckers also needs this functionality. So here it is. WinXP only, sorry.
Download it, read the readme, test it with the two examples "testInput.ck", "testOutput.ck". You have to adapt these two files, read the comments.
I also included the source code for those who want to improve it. To do so you also need the oscpack library, described in the readme.
(I don't know if there are additional microsoft-specific dll's (msvcrt.dll?) or other files necessary to run the .exe. If so they should be available on the net).
Of course, if this chucky software chucks down your computer into chuckhell - i take no chucking responsibility.
chucks,
hanez
Description: |
|
 Download (listen) |
Filename: |
oscFileIO.zip |
Filesize: |
22.56 KB |
Downloaded: |
330 Time(s) |
|
|
Back to top
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Mon Oct 22, 2007 9:45 pm Post subject:
|
 |
|
Oh.. wow! thanks for this valuable contribution, i hope this can grow into a very useful tool for various applications someday! |
|
Back to top
|
|
 |
chuckles
Joined: Apr 02, 2007 Posts: 72 Location: San Diego, California
|
Posted: Wed Oct 24, 2007 12:12 pm Post subject:
|
 |
|
I haven't tried it yet (my main music machine is still running Windows 2000, believe it or not) but I just wanted to come in and really encourage this kind of work.
I have ideas for chuck that need the orchestra/score separation a la Csound (and other MusicN languages) where I can create a single orchestra and feed it all kinds of different data files (perhaps even MIDI, eventually) to create different pieces with given sound generation algorithms. So this is exciting to me even if I have to plug in some other libraries/dlls. |
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Wed Oct 24, 2007 7:13 pm Post subject:
|
 |
|
I would use your contribution to send out the text that generates POV-Ray animations if it ran on a Mac. Maybe the ChucK developers can plug your code into ChucK to add the functionality. Anyway it is nice to see the contributions and collaborations that are happening here. |
|
Back to top
|
|
 |
hanez
Joined: Feb 07, 2007 Posts: 10 Location: Austria
|
Posted: Thu Oct 25, 2007 12:06 am Post subject:
|
 |
|
chuckles wrote: | I haven't tried it yet (my main music machine is still running Windows 2000, believe it or not) but I just wanted to come in and really encourage this kind of work.
|
hi,
i tested it also on an win2000 machine, and it worked.
greetz
hanez |
|
Back to top
|
|
 |
eduard
Joined: Nov 04, 2007 Posts: 2 Location: Barcelona
|
Posted: Mon Nov 05, 2007 1:12 am Post subject:
makefile for oscTofile Subject description: makefile for oscTofile |
 |
|
Here's a makefile for compiling fileToOsc on unixes like OS.
You should create a directory called src where you should put the oscToFile* files and another for oscpack.
However when run on OS X I get the following error ( i think there should be easier test examples so the problem is easier to track):
In one terminal I run: oscToFile 9000 while in another terminal I run chuck testInput.ck testOutput.ck.
The output in terminal 1 is:
listening for input on port 9000...
press ctrl-c to end
/oscFromFile
fileName: sinusParam.dat
formatString: sf
hostToSend: localhost
portToSend: 1092550656
bufsize: 262144
terminate called after throwing an instance of 'std::runtime_error'
what(): unable to connect udp socket
Abort trap
The output in the terminal 2:
[chuck](VM): removing shred: 3 (spork~exp)...
values: 0.000000 0.000000
Here's the makefile:
PROGRAM = osc2File
CXX = g++
ENDIANESS=OSC_HOST_BIG_ENDIAN
CXX_FLAGS = -g -Wall -D$(ENDIANESS)
OSC_DIR=./oscpack
INCLUDE= -I$(OSC_DIR)
SRC_DIR = src
SRC_FILES= $(SRC_DIR)/oscToFile.cpp $(OSC_DIR)/osc/OscTypes.cpp\
$(OSC_DIR)/osc/OscReceivedElements.cpp $(OSC_DIR)/osc/OscPrintReceivedElements.cpp\
$(OSC_DIR)/osc/OscOutboundPacketStream.cpp $(OSC_DIR)/ip/posix/NetworkingUtils.cpp\
$(OSC_DIR)/ip/posix/UdpSocket.cpp $(OSC_DIR)/ip/IpEndpointName.cpp
OBJS = $(SRC_FILES:.cpp=.o)
all: $(PROGRAM) $(OBJS)
$(PROGRAM): $(OBJS)
$(CXX) $(CXX_FLAGS) $(INCLUDE) -o $(PROGRAM) $(SRC_DIR)/oscToFileMain.cpp $(OBJS)
.cpp.o:
$(CXX) -c $(CXX_FLAGS) $(INCLUDE) -o "$@" "$<"
clean:
-rm $(OBJS)
distclean: clean
-rm $(PROGRAM) |
|
Back to top
|
|
 |
eduard
Joined: Nov 04, 2007 Posts: 2 Location: Barcelona
|
|
Back to top
|
|
 |
|