Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convolution2: kernel size is truncated to fftsize #737

Closed
joslloand opened this issue Feb 26, 2013 · 4 comments
Closed

Convolution2: kernel size is truncated to fftsize #737

joslloand opened this issue Feb 26, 2013 · 4 comments

Comments

@joslloand
Copy link
Contributor

Input kernel size is truncated to fftsize.

There should probably be a warning in the documentation that this is the case.

// -----------------------------------------------
// Test: Convolution2, kernel size is truncated to fftsize
//
// OS: OSX 10.8
// SC: 3.6.2
// SR: 96000
Server.default = s = Server.local.boot;

// number of frames for buffer (kernel)
~numFrames = 2**10; // 1024

// frames size of FFT
~frameSize = 29; // 512 - bad!
// ~frameSize = 2
10; // 1024 - good!

// set up buffer (kernel)
~buffer = Buffer.alloc(s, ~numFrames);
~buffer.zero;

// add an impulse @ gain
~gain = 0.dbamp;
~sampleIndex = ~numFrames - 1;

// create impulse at sampleIndex
~buffer.set(~sampleIndex, ~gain);

(
// inspect
"\nnumFrames = ".post; ~buffer.numFrames.postln;
"frameSize = ".post; ~frameSize.postln;

// test!
~synth = {
Convolution2.ar(
Saw.ar(110.0, -18.dbamp),
// PinkNoise.ar(-6.dbamp),
~buffer,
framesize: ~frameSize
)
}.play;
)
~synth.free;
~buffer.free;
s.quit;

@danstowell
Copy link
Member

This OK? (patch attached)

2013/2/26 Joseph Anderson [email protected]

Input kernel size is truncated to fftsize.

There should probably be a warning in the documentation that this is the
case.

// -----------------------------------------------
// Test: Convolution2, kernel size is truncated to fftsize
//
// OS: OSX 10.8
// SC: 3.6.2
// SR: 96000
Server.default = s = Server.local.boot;

// number of frames for buffer (kernel)
~numFrames = 2**10; // 1024

// frames size of FFT
~frameSize = 29; // 512 - bad!
// ~frameSize = 2
10; // 1024 - good!

// set up buffer (kernel)
~buffer = Buffer.alloc(s, ~numFrames);
~buffer.zero;

// add an impulse @ gain
~gain = 0.dbamp;
~sampleIndex = ~numFrames - 1;

// create impulse at sampleIndex
~buffer.set(~sampleIndex, ~gain);

(
// inspect
"\nnumFrames = ".post; ~buffer.numFrames.postln;
"frameSize = ".post; ~frameSize.postln;

// test!
~synth = {
Convolution2.ar(
Saw.ar(110.0, -18.dbamp),
// PinkNoise.ar(-6.dbamp),
~buffer,
framesize: ~frameSize
)
}.play;
)
~synth.free;
~buffer.free;
s.quit;


Reply to this email directly or view it on GitHub.

http://www.mcld.co.uk

@joslloand
Copy link
Contributor Author

Hello Dan,

Thanks for this! Sounds very plausible, thanks for such a quick solution. I've just spoken Josh, who has said he'll make a compile this evening and forward to me for a look.

I'll let you know when all is confirmed.

My best,
Jo

Joseph Anderson

http://joseph-anderson.org

On 26 Feb 2013, at 1:25 pm, danstowell [email protected] wrote:

This OK? (patch attached)

2013/2/26 Joseph Anderson [email protected]

Input kernel size is truncated to fftsize.

There should probably be a warning in the documentation that this is the
case.

// -----------------------------------------------
// Test: Convolution2, kernel size is truncated to fftsize
//
// OS: OSX 10.8
// SC: 3.6.2
// SR: 96000
Server.default = s = Server.local.boot;

// number of frames for buffer (kernel)
~numFrames = 2**10; // 1024

// frames size of FFT
~frameSize = 29; // 512 - bad!
// ~frameSize = 2
10; // 1024 - good!

// set up buffer (kernel)
~buffer = Buffer.alloc(s, ~numFrames);
~buffer.zero;

// add an impulse @ gain
~gain = 0.dbamp;
~sampleIndex = ~numFrames - 1;

// create impulse at sampleIndex
~buffer.set(~sampleIndex, ~gain);

(
// inspect
"\nnumFrames = ".post; ~buffer.numFrames.postln;
"frameSize = ".post; ~frameSize.postln;

// test!
~synth = {
Convolution2.ar(
Saw.ar(110.0, -18.dbamp),
// PinkNoise.ar(-6.dbamp),
~buffer,
framesize: ~frameSize
)
}.play;
)
~synth.free;
~buffer.free;
s.quit;


Reply to this email directly or view it on GitHub.

http://www.mcld.co.uk

Reply to this email directly or view it on GitHub.

@danstowell
Copy link
Member

Fixed in commit e978406

@joslloand
Copy link
Contributor Author

Thanks Dan! Updating the help clarifies this!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants