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 
Live streaming at radio.electro-music.com

  host / artist show at your time
  EdisonRex Edison's Electronic Review
Please visit the chat
 Forum index » DIY Hardware and Software » ChucK programming language
New to Chuck: UAna Vocoder = everything vocoded
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
pespes



Joined: Apr 18, 2009
Posts: 1
Location: Brooklyn, NY

PostPosted: Sat Apr 18, 2009 6:06 pm    Post subject: New to Chuck: UAna Vocoder = everything vocoded Reply with quote  Mark this post and the followings unread

Hi ChucK'ers,

I found a great piece of code on someone's site that allows you to use an external wav file as a "template" to vocode mic input. It works perfectly, but any additional shreds that I add to the VM also get vocoded. I would like the vocoder to only modify the left adc input....

Anyhow, I don't fully understand what the vocoder shred is doing, and would love some from someone familiar with ChucK's UAna system.



======* See attached .ck file!, or read on. *======



Code:
// implementation of FFT vocoder: (code not fully understood - P)

SndBuf carrier => FFT fft_c => blackhole; // music signal
"samples/insect_wav/insect_8.wav" => carrier.read; // file,of course.
adc.left => PoleZero dcblock => FFT fft_m => blackhole; // voice signal
IFFT ifft => PoleZero dcblock2 => dac;
0.999 => dcblock.blockZero;
0.999 => dcblock2.blockZero;

// fft/ifft constants
2500 => int FFT_SIZE => fft_c.size => fft_m.size => ifft.size;
FFT_SIZE => int WIN_SIZE;
FFT_SIZE/8 => int HOP_SIZE;

Windowing.blackmanHarris( WIN_SIZE ) => fft_m.window => fft_c.window => ifft.window;

// spectrum array:
complex spectrum_c[WIN_SIZE/2];
complex spectrum_m[WIN_SIZE/2];

// temp variables:
polar temp_polar_m, temp_polar_c;

// compute srate
second / samp => float srate;

1 => carrier.loop;
//1 => modulator.loop;
while( true )
{
    // take ffts:
    fft_m.upchuck();
    fft_c.upchuck();
   
    fft_m.spectrum( spectrum_m );
    fft_c.spectrum( spectrum_c );
     
    // convert complex form to polar, assign magnitudes & back to complex:
    for( 0 => int i; i <spectrum_m> temp_polar_m;
        spectrum_c[i]$polar => temp_polar_c;
        temp_polar_m.mag => temp_polar_c.mag;
        // store values. Re-use carrier's spectrum:
        temp_polar_c$complex => spectrum_c[i];
    }
   
    ifft.transform( spectrum_c );
   
    HOP_SIZE::samp => now;
}



vocode_left.ck
 Description:

Download
 Filename:  vocode_left.ck
 Filesize:  1.39 KB
 Downloaded:  139 Time(s)

Back to top
View user's profile Send private message Visit poster's website
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