Hi Peder, thank you for your reply.
On Sun, May 22, 2011 at 02:26:19PM +0200, Peder Hedlund wrote:
Quoting Thor Andreassen <ta(a)toggle.be>be>:
I've failed to turn up any evidence that it is
possible, if it is, could
someone please point me to a plugin that does this?
Steve Harris has a "Decimator" in his swh-plugins that reduces sample
rate : "Decimates (reduces the effective sample rate), and reduces the
bit depth of the input signal". There's also a "Smooth Decimator"
Right, I have shifted through the decimator source, and other excellent
plugins by Steve, however, I had not seen any way to reduce the emitted
signal size.
I had a second look now and it still doesn't seem to be possible, please
correct me if I am wrong. The following are the steps I took. I only
list the decimator_1202 tests, the smooth_decimate_1414 tests gave the
same results.
Create a one second 100Hz file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ sox -r 44100 -n -b 16 out.wav synth 1 sine 100 trim 0 1
$ soxi out.wav
Input File : 'out.wav'
Channels : 1
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:01.00 = 44100 samples = 75 CDDA sectors
File Size : 88.2k
Bit Rate : 706k
Sample Encoding: 16-bit Signed Integer PCM
Plugin takes two parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ analyseplugin decimator_1202
Plugin Name: "Decimator"
Plugin Label: "decimator"
Plugin Unique ID: 1202
Maker: "Steve Harris <steve(a)plugin.org.uk>"
Copyright: "GPL"
Must Run Real-Time: No
Has activate() Function: No
Has deactivate() Function: No
Has run_adding() Function: Yes
Environment: Normal
Ports: "Bit depth" input, control, 1 to 24, default 24
"Sample rate (Hz)" input, control, 0.001*srate to 1*srate, default 1*srate
"Input" input, audio, -1 to 1
"Output" output, audio, -1 to 1
Apply decimator plugin with sox as host
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ sox -V out.wav out2.wav ladspa decimator_1202 16 1000
sox: SoX v14.3.2
sox INFO formats: detected file format type `wav'
Input File : 'out.wav'
Channels : 1
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:01.00 = 44100 samples = 75 CDDA sectors
File Size : 88.2k
Bit Rate : 706k
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
Output File : 'out2.wav'
Channels : 1
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:01.00 = 44100 samples = 75 CDDA sectors
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
Comment : 'Processed by SoX'
sox INFO sox: effects chain: input 44100Hz 1 channels
sox INFO sox: effects chain: ladspa 44100Hz 1 channels
sox INFO sox: effects chain: dither 44100Hz 1 channels
sox INFO sox: effects chain: output 44100Hz 1 channels
Using appplyplugin(1) gives the same results. AFAICT the decimator
plugin sets stretches of samples to the same, so a later resampling
would have the desired effect.
On Sun, May 22, 2011 at 02:26:19PM +0200, Peder Hedlund wrote:
As for increasing sample rate Ardour (at least)
automagically
upsamples imported sounds to match the sample rate of the project.
Alternatively you could use sndfile-resample or sox to do that.
Sorry, I should have been more verbose in my request. It is not
resampling per se that I am after, I want to be able to write a plugin
that can emit a reduced signal after analysis. One application I'm
aiming for is to create compressed views of long signals.
The reason for using LADSPA is the ease of implementation. If it is not
possible with LADSPA plugins, I plan on writing a sox effect instead,
unless someone has other good ideas for accomplishing this, of course in
a CLI friendly way?
[...]
--
best regards
Thor Andreassen