0
votes

I R, thanks to the library sound, we are able to create a sine wave:

s1 <- Sine(650, 1, 44100, 16, 2)

Plotting the waveform we obtain an image like this:

plot(s1[1:100])

waveform

The waveform moves in the interval [-1, +1]. If I play it, to what deciBel does it correspond?

How to generate a wave sound (with the same parameters), with a specified deciBel level (i.e. a wave sound, frequency 650Hz, duration 1 sec, sampling rate 44100, 16 bits, 2 channels, 55dB)?

Thanks in advance!

1
Doesn't this depend upon the player? I'm not an audio expert but if the volume control in Media Player (or whatever) or your PC is changed, so will the decibels.Richie Cotton

1 Answers

0
votes

So I guess you want to change the amplitude right? There is no straightforward way to change amplitude in sound the way you want, because it's very basic package. Try tuneR or seewave packages for much more advanced options and control (for example afilter in seewave could be a good solution, but unfortunately I couldn't run it in R 2.14 - not compatible).

What you could do in a simple way is to use normalize to change the volume, but it doesn't work for the 'default' amplitude in sound package. For example, if you produce this sine wave

 s1 <- .6*Sine(650, 1, 44100, 16, 2)  

you can normalize it by

 s2 <- normalize(s1) 

And you can hear (and see on the plot) that the s2 is louder.