I am a beginner of Praat and I need to apply the Remove noise... filter on a file using the Praat script.

My Code:

filePath$ = dirPath$+"/"+fileName$+".wav";
sound = Read from file... 'filePath$'

selectObject: sound

noise_reduction_method = Spectral subtraction
smoothing      = 40

filtered = Remove noise: 0.0, 0.0, 0.025, 80, 1000, smoothing, noise_reduction_method
selectObject: filtered


Unknown symbol << ' Script line 16 not performed of completed << noise_reduction_method$ = 'Spectral subtraction'

I tried a lot to find out the correct way of giving the last argument of this filter but couldn't succeed. Someone please guide me in this regard.

1 Answer 1


The last argument to that command is a string, so the variable where you store it must be a string variable. This should work:

method$ = "Spectral subtraction"
smoothing = 40
filtered = Remove noise: 0.0, 0.0, 0.025, 80, 1000, smoothing, method$

Bonus: What does the error mean?

The code you posted does not raise the error you reported (so I guess that comes from a previous version of your script).

If you run the code as it is, it will die saying that the Spectral subtraction command does not exist. The upper-case S tells the interpreter that what follows is a command name, which in Praat can have spaces and any other number of odd characters (as in Remove noise...). If it were a lower-case s the interpreter would expect a variable name, and also die.

The error you got (about the unknown symbol) is raised if you surround Spectral subtraction in single quotes ('), which tell the interpreter to interpolate the value of a variable. In this case, the "unknown symbol" is the Spectral subtraction variable, which will remain unknown (= you won't be able to define it) because it is illegal (it starts with an upper-case character and has a space in it).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.