sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
From: Mikko Olkkonen <molkko@gmail.com>
To: sox-users@lists.sourceforge.net
Subject: Re: remove known sample from audio
Date: Thu, 27 Sep 2018 09:24:59 +0300	[thread overview]
Message-ID: <CANWtmUDNCpMPVERgqtr30jZSpbFhRHCozABc597_y_49ip4CFw@mail.gmail.com> (raw)
In-Reply-To: <20180926181651.GA77937@www.stare.cz>


[-- Attachment #1.1: Type: text/plain, Size: 5561 bytes --]

Jan Stary <hans@stare.cz> wrote:
>343 * 0.0115 = 3.9445, so was the drums about 4 meters from the bass mic?
Basically yes. Delays after the mics can be assumed negligible and/or
equal. I can do the spill removal by trying out various values and picking
up with the one with maximal correlation. Or maybe I implement some script
that does that fiddling, lets see. Anyway, my idea when posting this issue
was that maybe there is some clever way to use sox where I could avoid that
manual operation (or scripting) required to find delay and vol that deliver
the maximum correlation. I believe that at least audio watermarking folks
must have streamlined this procedure so that they can detect their
watermarks even if their audio has been (slightly) tweaked. It beats me
that the wikipedia spill article did not discuss this postprocessing
approach. It was all about studio setup that minimizes the problem _during_
the recording.
Mikk00


On Wed, Sep 26, 2018 at 9:17 PM Jan Stary <hans@stare.cz> wrote:

> On Sep 26 16:49:31, molkko@gmail.com wrote:
> > I have two mics
> > https://www.piksu.com/eps/tmp/mic1.wav
> > https://www.piksu.com/eps/tmp/mic2.wav
> > and audible spill in both.
>
> Yeah, the bass is not very precise and a bit behind the tempo.
>
> > I want to remove the spill from both.
>
> That's something different from what you described in
> the original mail, but I understand your problem now.
>
> > I am able to remove the spill in this
> > specific case (with outstanding results)
> > for example for mic1.wav with commands
> > sox mic2.wav mic2id.wav pad 0.0115 0 vol -0.13
> > sox -m -v 1 mic1.wav -v 1 mic2id.wav mic1clean.wav stat
> > i.e. by inverting the other mic and mixing that _at suitable_ point in
> time
> > and suitable power to the signal to be cleaned.
>
> Indeed, it is very good. (The -v 1 are imho not necessary.)
>
> > The problem is that finding those values ("point in time" 0.0115
> > and power/"volume" -0.13) is cumbersome. Basically, I am after a command
> > to find one given signal embedded in another given signal.
>
> That is very expensive, computation-wise. To find the offset,
> I would compute the correlation of the mic1.wav and mic2.wav signals
> for every suspected delay (say, for 0 to 0.1, with a step of 0.01)
> and take the one where the correlation is maximal.
>
> Then "remove" the properly-delayed mic1id.wav from mic2.wav as above,
> again with various levels of vol, and pick the one for which the
> resulting "clean" signal has the maximal correlation with
> the original mic2.wav.
>
> This problem must be as old as DSP.
> http://www.dspguide.com/
>
>
>         Jan
>
>
> >
> > On Tue, Sep 25, 2018 at 11:10 PM Jan Stary <hans@stare.cz> wrote:
> >
> > > On Sep 25 12:26:36, molkko@gmail.com wrote:
> > > > What is the best way to subtract a known sample from given audio i.e.
> > > > extract/reconstruct the original.wav from final.wav when final.wav
> has
> > > been
> > > > created with commands:
> > > >
> > > > sox knownsample.wav knownsample_delay_gain.wav pad <X> 0 vol <Y>
> > > > sox -m original.wav knownsample_delay_gain.wav final.wav
> > >
> > > First of all, by "sample", you mean "signal",
> > > not some one sample value, right?
> > >
> > > > original.wav is not anymore available. knownsample.wav and final.wav
> are
> > > > available.
> > >
> > > Do you also have knownsample_delay_gain.wav ?
> > >
> > > > pad delay and the vol parameter are known _roughly_ (X =~10ms,
> > > > Y=~0.1)
> > >
> > > So you want to reconstruct original.wav from the mix
> > > AND one of the originals - that's quite different than reconstructing
> > > from just the mix.wav (which I doubt would be possible).
> > >
> > > > PS1, I can reconstruct the original with the process below but this
> > > method
> > > > is very cumbersome:
> > > > repeat {
> > > > come up with some guessed X and Y
> > > > sox knownsample.wav knownsample_delay_gain.wav pad <X> 0 vol -<Y> //
> is
> > > > also inverted
> > > > sox -m -v 1 original.wav -v 1 knownsample_delay_gain.wav final.wav
> stat
> > > > } until RMS amplitude reported by stat has reached local minimum
> > >
> > > You said you no longer have original.wav, but you are using it here.
> > > So what's there to reconstruct?
> > >
> > > > PS2, The original problem is a two musical instruments recorded
> > > > simultaneously in the same space. They have their own mics but the
> other
> > > > instrument is audible in each recording. I want to remove the "wrong
> > > > instrument" from each recording and have clean audio for both
> > > instruments.
> > >
> > > https://en.wikipedia.org/wiki/Spill_(audio)
> > > This should be your starting paragraph, not PS2.
> > >
> > > So show us the files: the mix (final.wav) and
> > > the non-delayed bleeding instrument (knownsample.wav).
> > > Also, name them more plainly (guitar, trumpet, mix - or whatever).
> > >
> > > It will be much easier to help you then.
> > >
> > >
> > >         Jan
> > >
> > >
> > >
> > > _______________________________________________
> > > Sox-users mailing list
> > > Sox-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/sox-users
> > >
> >
> >
> > --
> > Terveisin, Mikko
> > +358-40 506 6146
>
>
> > _______________________________________________
> > Sox-users mailing list
> > Sox-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/sox-users
>
>
>
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

[-- Attachment #1.2: Type: text/html, Size: 7989 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

  parent reply	other threads:[~2018-09-27  6:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25  9:26 remove known sample from audio Mikko Olkkonen
2018-09-25 19:42 ` Jan Stary
2018-09-26 13:49   ` Mikko Olkkonen
2018-09-26 18:16     ` Jan Stary
2018-09-26 18:35       ` Jan Stary
2018-09-27  6:24       ` Mikko Olkkonen [this message]
2018-09-27  9:48         ` Jan Stary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-users

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANWtmUDNCpMPVERgqtr30jZSpbFhRHCozABc597_y_49ip4CFw@mail.gmail.com \
    --to=sox-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).