View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

how to remove a nasty tone in a recording

this is a quick try on this issue. so no guarantee, it is very basic.
//problem: some nasty sound. how to remove it?
play({ Pulse.ar(MouseX.kr(7000, 8000), 0.5, 0.01) });

//first test
play({ 
	var a;
	a = Pulse.ar(8000, 0.5, 0.03) + WhiteNoise.ar(0.01) ;
	BRF.ar(a, MouseX.kr(7800, 8100), 0.05)


});


//test: tune the filter
(
var sf, path;
var w, sv;
	w = GUIWindow.new("tune the filter", Rect.newBy(128, 64, 297, 104));
	sv = StringView.new( w, Rect.newBy(46, 32, 128, 20), "");


sf = SoundFile.new;
path = ":sounds:floating_1";
sf.readHeader(path);
play({
	var src, m;
	src = DiskIn.ar(sf);
	m = MouseX.kr(3000, 9000);
	thisSynth.repeat(0, 0.1, { sv.label = m.poll.asString });
	Pulse.ar(m, 0.5, 0.03) + src;


});
w.close;
)


//filter the sound, and find the best frequency
//within the range you found in the last patch
(
var sf, path;
var min, max;
var w, sv;
	w = GUIWindow.new("find the best frequency", Rect.newBy(128, 64, 297, 104));
	sv = StringView.new( w, Rect.newBy(46, 32, 128, 20), "");

min = 8000;
max = 9000;

sf = SoundFile.new;
path = ":sounds:floating_1";
sf.readHeader(path);
play({
	var src, m;
	src = DiskIn.ar(sf);
	m = MouseX.kr(min, max);
	thisSynth.repeat(0, 0.1, { sv.label = m.poll.asString });
	BRF.ar(src, m, 0.05);


});
w.close;
)



//process all
(
var sf, path, freq, newpath;
freq = 8000; //put your value here
sf = SoundFile.new;
path = ":sounds:floating_1"; //path of origin
newpath = "tttt.aiff";       //path of destination
sf.readHeader(path);
Synth.write({
	var src, m;
	src = DiskIn.ar(sf);
	BRF.ar(src, freq, 0.05);
}, sf.duration, newpath)
)

//an all in one application, not as precise
(
var sf, path, out, tune, filt;
var w, sv, tv;
	w = GUIWindow.new("tune then filter", Rect.newBy(128, 64, 297, 104));
	sv = StringView.new( w, Rect.newBy(46, 32, 70, 20), "");
	tv = CheckBoxView.new( w, Rect.newBy(150, 32, 128, 20), "filtering", 0, 0, 1, 0, 'linear').
		action_({ out.source = if(tv.value < 1, {  tune }, { filt })   });


sf = SoundFile.new;
path = ":sounds:floating_1";
sf.readHeader(path);
play({
	var src, m;
	src = DiskIn.ar(sf);
	m = MouseX.kr(3000, 9000);
	out = Plug.ar(0);
	thisSynth.repeat(0, 0.1, { sv.label = m.poll.asString });
	tune = Pulse.ar(m, 0.5, 0.01) + src;
	filt = BRF.ar(src, m, 0.05);
	out.source = tune;
	out


});
w.close;
)

****

/*
authors so far:
jrh
*/


Link to this Page