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
granular synthesis methods for ChucK
Post new topic   Reply to topic Moderators: Kassen
Page 2 of 4 [83 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: Previous 1, 2, 3, 4 Next
Author Message
Kassen
Janitor
Janitor


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

PostPosted: Fri May 18, 2007 5:35 am    Post subject: Reply with quote  Mark this post and the followings unread

Yeah, and by understanding it better it will help improve your music too!
_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Junk Rhythm



Joined: Jan 07, 2008
Posts: 81
Location: San Francisco, CA

PostPosted: Thu Mar 06, 2008 12:02 am    Post subject: Reply with quote  Mark this post and the followings unread

I know this is an old thread but here is a bit more to add to the topic. The following link goes to some granular ChucK code being interfaced by a monome.

http://post.monome.org/comments.php?DiscussionID=1011&page=1#Item_26

Might be of use for some down the road.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Kassen
Janitor
Janitor


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

PostPosted: Thu Mar 06, 2008 5:17 am    Post subject: Reply with quote  Mark this post and the followings unread

No problem. I'd rather use old topics then re-do discussions all the time.

Looks&sounds cool! Did you consider using LiSa (see /examples/special/)? that would get you a lot more grains at less eford.

_________________
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: Thu Mar 06, 2008 6:53 am    Post subject: Reply with quote  Mark this post and the followings unread

Wow, I watched the video. You know, I have a matrix like that Monome in my Boolean sequencing program. I guess computer interfaces sometimes end up using a matrix of some sort. Thanks for the show!
Back to top
View user's profile Send private message Send e-mail
Junk Rhythm



Joined: Jan 07, 2008
Posts: 81
Location: San Francisco, CA

PostPosted: Thu Mar 06, 2008 12:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

Actually, I didn't write the code in that link. I posted it here for others to look into for ideas.

It was because of that code that I finally dug into ChucK and tried to understand how things work. While digging around I came across this thread and also then discovered LiSa. I spent most of last evening messing around with LiSa which was a lot of fun so I will eventually implement something to that uses LiSa and the monome. I will definitely be back with some questions. Very Happy
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Kassen
Janitor
Janitor


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

PostPosted: Thu Mar 06, 2008 3:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

Lovely, that's the best way to learn. Questions are welcome
_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nununo



Joined: Mar 24, 2008
Posts: 4
Location: Portugal

PostPosted: Mon Mar 24, 2008 9:39 am    Post subject: Granular synth with LiSa and existing WAV Reply with quote  Mark this post and the followings unread

Hi,

From what I understand LiSa is targeted at dealing with live recording. I want to do granular synthesis on an existing WAV. Can LiSa still be used? I don't seem to understand how.

Thanks,
Nuno
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: Mon Mar 24, 2008 9:59 am    Post subject: Reply with quote  Mark this post and the followings unread

SndBuff is a module that plays wav files. I haven't worked with SndBuff yet, but it seems to have position and rate controls. Here is the link to the SndBuff documentation:

http://chuck.cs.princeton.edu/doc/program/ugen_full.html#sndbuf

I suppose you could read a wav file in with SndBuff or the other way to read wav files which is WvIn, and route it to LiSa. Here is the link to the WvIn documentation:

http://chuck.cs.princeton.edu/doc/program/ugen_full.html#WvIn
Back to top
View user's profile Send private message Send e-mail
nununo



Joined: Mar 24, 2008
Posts: 4
Location: Portugal

PostPosted: Mon Mar 24, 2008 10:24 am    Post subject: How to route from SndBuff to LiSa? Reply with quote  Mark this post and the followings unread

Hi,

Can you please help me understand what do you mean by "route to LiSa"? Are you talking about copying the samples one by one from SndBuff to LiSa's internal buffer? Or are there ways to move the whole thing?

I'm sorry if this is a stupid question... but ChucK is totally new to me....

Thanks!
Nuno
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: Mon Mar 24, 2008 10:30 am    Post subject: Reply with quote  Mark this post and the followings unread

There are no stupid questions, only stupid people! Just kidding, of course. By "route to LiSa", I mean you could ChucK them together like this:

SndBuff sndbuff => LiSa lisa => dac;

Then when you read a wav file by using SndBuff method calls, you can simultaneously make LiSa method calls to record the wav file. After that you can play around with the sound that's buffered in LiSa.
Back to top
View user's profile Send private message Send e-mail
nununo



Joined: Mar 24, 2008
Posts: 4
Location: Portugal

PostPosted: Mon Mar 24, 2008 10:37 am    Post subject: Ah! Reply with quote  Mark this post and the followings unread

I get it now. I'll give it a try. Looks like fun.

Although this seems to have the nuisance of, before being able to start playing with granular synthesis, having to sit through the whole WAV once while it is being ChucKed from SndBuff to LiSa, right?

In my case the source wave file is quite quite long: maybe over 10 minutes Sad
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: Mon Mar 24, 2008 10:45 am    Post subject: Reply with quote  Mark this post and the followings unread

An easier way to read in the wav file would be to use WvIn, which has a simple interface. You could use the rate features of all three modules to read the wav file in faster, though that would decrease sound quality I suppose. Also, instead of reading into LiSa, you could use the playback features of SndBuff which include position, rate, and looping. That way you wouldn't have to wait for it to play the file as it reads it in to ChucK.
Back to top
View user's profile Send private message Send e-mail
nununo



Joined: Mar 24, 2008
Posts: 4
Location: Portugal

PostPosted: Mon Mar 24, 2008 10:58 am    Post subject: Like this? Reply with quote  Mark this post and the followings unread

You mean something link this, right?

http://cm-wiki.stanford.edu/wiki/MultiGrain_Granular_Synthesis_in_Chuck

Ok, I think I will use this example as a start and tweak it into what I need.

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



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

PostPosted: Mon Mar 24, 2008 11:04 am    Post subject: Reply with quote  Mark this post and the followings unread

I've got an idea i'd like to try soon,
but if you guys want to try first, it'd be great.

I see that there can be some easy way to do granular synthesis with a simple SndBuf, an array of delays and envelopes.

If we connect one SndBuf to all the envelopes and the envelopes connect to the delays,
we surely can perform quite a lot of granular things.
although we don't have all the freedom in playing the sample,
but we can place many grains around quite easily.

I'll work with this idea if i have time.
It sounds quite simple in my head now, and I think we can apply this idea into many technics.
I hope we'll be testing it soon.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Inventor
Stream Operator


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

PostPosted: Mon Mar 24, 2008 11:12 am    Post subject: Reply with quote  Mark this post and the followings unread

What is the idea with grains anyway? Is it just playing back little snippets of sound from different parts of a wav file, all simultaneously? What little I've heard of grains, it just sounds like noise to me. What am I missing?
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: Mon Mar 24, 2008 1:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

Inventor wrote:
What is the idea with grains anyway? Is it just playing back little snippets of sound from different parts of a wav file, all simultaneously? What little I've heard of grains, it just sounds like noise to me. What am I missing?


Ouch! that's a really big question. You are right; it's just playing back snippets of sound from a buffer but then again, additive synthesis is just sines mixed together and subtractive synthesis it just filtering some signal...

The trick is in using it well, Granular synthesis opens up a road to the creation of textures and timbres (or indeed rhythms) in a way that's very pleasant and intuitive to work with for certain sounds (but then again so do the others).On a functional level it's especially good for pitch-shifting and time-stretching, it's also great for making things sound like a moving "swarm" and quite a few other things. It's used a lot on drum beats... this can be good or it can be a case of a random number generator taking the seat of the composer, depending on how it's done.

As far as I know there is a single book on this topic that's very good; "Microsound" by Curtis Roads. If you are serious about the subject that would be my recommended source.

If you just want to play around (which could be better then reading a book!) then I recommend downloading some free plugins to try, then build your own in ChucK and using formulas for the parameters instead of randomness. I personally feel the amount of randomness in most implementations is obfuscating the usefulness of grains

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



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

PostPosted: Mon Mar 24, 2008 1:51 pm    Post subject: Reply with quote  Mark this post and the followings unread

Grains can be created from other kinds of sources other than playing directly from a crude sound sample,
One poppular way is to synthesize each grain. (not playing from a sampled sound)

For example, if the wave form in the grain is created from sine wave oscillator,
and the SinOsc's frequency increases continuously when the grain is played,
pass it through some kind of envelope to shape the grain's amplitude into a small piece of sound (maybe with fade-in and fade-out) ...

you'll get a small sinewave chirp by producing that kind of grains.
and multiple grains like that are lots of chirps surely.

It's a lot of fun creating synthesized grains because we can imagine up very different kinds of soundscape.

but it's not that better than making grains from sampled sound,
it's just another way to make use of granular synthesis technic ^_^
- - -

I've got a new idea!
I'm gonna make a class called "Sound Canvas" oh no! that sounds like Roland -_-"
Okay.. I'll think up a nice name hmmm....
DigitalTape! ..

okay, here's the idea:
this tape is a float array.
it's gonna hold the waveform, but functions can do many things to each part of the tape:
read (play sound), write/add, erase.

I still decide not to apply writing rate to the tape, coz I need much more time to study how to do effective interpolation.
(but i'll come up with some new ideas for that)

but with this, we'll have .. a canvas for painting sounds.
and so we can put some grain sounds to be played ahead in the future.
I guess this idea would become handy in this granular synthesis situation.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Frostburn



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

PostPosted: Mon Mar 24, 2008 2:59 pm    Post subject: Reply with quote  Mark this post and the followings unread

A nice idea kijjaz!
If you need any help with the math I can assist. I'd go by cubic interpolation with this one because sinc is more suited for steadily playing sounds.

_________________
To boldly go where no man has bothered to go before.
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: Mon Mar 24, 2008 4:34 pm    Post subject: Reply with quote  Mark this post and the followings unread

With your DigitalTape, you could set up rules for the grains. For example, as a grain plays the sound, it "eats" it, reducing the amplitude of that section of the tape. When a grain gets hungry it randomly jumps to another section of the tape to eat and play some more. Then you can have sun and rain which slowly grow the tape's amplitude. If a grain meets another grain, some interaction occurs such as they have lunch and eat the tape down to zero in that spot. If the grains run out of food for too long, they go dormant until more food arrives. Just a thought, thinking krazy like kijjaz!
Back to top
View user's profile Send private message Send e-mail
kijjaz



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

PostPosted: Mon Mar 24, 2008 9:42 pm    Post subject: Reply with quote  Mark this post and the followings unread

Inventor: That'd be a fun effect to do! hahah.

Frostburn: I have this idea for doing the interpolation:
The "read head" and "write head" can shrink and expand in size, according to the read/write speed hahhahah

oh i have to go. i'll be back to continue on this soon.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Inventor
Stream Operator


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

PostPosted: Tue Mar 25, 2008 3:15 am    Post subject: Reply with quote  Mark this post and the followings unread

How about this? We take a sentence, such as "Port MAUI now please.", and chop it into individual word segments, or segments approximately the duration of one word. We then play back these grains in a clouded storm that begins with many disorganized voices of it and then over time they go into place gradually and form a repetition of the sentence.

So at first you hear a bunch of noise and then gradually over time the words form and finally the sentence. Might be a nice effect, in fact we could do it both forward and reverse, starting with a sentence and then breaking it into grains and then forming the sentence again.

Frostburn, what math would you use for that one?
Back to top
View user's profile Send private message Send e-mail
Frostburn



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

PostPosted: Tue Mar 25, 2008 9:18 am    Post subject: Reply with quote  Mark this post and the followings unread

Inventor wrote:
We then play back these grains in a clouded storm that begins with many disorganized voices of it and then over time they go into place gradually and form a repetition of the sentence.


Hmm... It is easier to go from a few words to a storm. Maybe your idea could be accomplished by rendering it to a float array in reverse and just playing it back once it's done.

I'll make interpolating float array writers and readers and give it a try.

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



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

PostPosted: Tue Mar 25, 2008 12:03 pm    Post subject: Reply with quote  Mark this post and the followings unread

Frostburn: Let's jam in this part.

I was wanting to make a tool that can read and write with varying speed also.
I once thought of a real tape:

if we speed up the tape, the energy transfered from the write head to the tape will be less per magnetic area.. but bigger in area
so i was thinking about resizing write area according to the speed.

then I think about writing as adding a signal x a distribution histogram to the cells of the float array..

aahhhhhhh I can't explain that well enough in English hahah...
ok..

-_-"

that eliminates the need to write more than once a samp..
but i then just had a new idea a few moments ago...
- - -

I think the above may not be that good for sound quality of the tape result after being written.. (but that still depends on the algorithm and how we calculate / choose the distribution type to "spray" value to the tape)

so I think about moving the tape head but not every samp=>now;
instead I think of samp/speed => now;

so now a good interpolation is gonna be essential.
also the interpolation algorithm would effect aliasing.
- - -

hmmm.. i can't explain well -_-
but i guess you've got some idea, and actually you must know how to do it efficiently. I'll see what I can do for now heheh.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Frostburn



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

PostPosted: Tue Mar 25, 2008 1:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

I was just thinking about classes that make writing to and reading from float arrays easier when dealing with varying rates/speeds.

Attached is the code and a sound file it produced when I loaded a sample of yours truly saying "Please implement garbage collection."


digitaltape.ck
 Description:
DigitalTape beta (only does linear interpolation now)

Download
 Filename:  digitaltape.ck
 Filesize:  7.17 KB
 Downloaded:  218 Time(s)


garbage.mp3
 Description:
An output of the program

Download
 Filename:  garbage.mp3
 Filesize:  140.63 KB
 Downloaded:  515 Time(s)


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



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

PostPosted: Tue Mar 25, 2008 8:36 pm    Post subject: Reply with quote  Mark this post and the followings unread

Arrrrrggh.. totally cool. I'll come back to play with it soon! ..
Thanks. This is amazing.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 2 of 4 [83 Posts]
View unread posts
View new posts in the last week
Goto page: Previous 1, 2, 3, 4 Next
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