| Title: | Remove Vocals from a Song |
|---|---|
| Description: | Attempts to remove vocals from a stereo '.wav' recording of a song. |
| Authors: | John R. Dixon [aut, cre] |
| Maintainer: | John R. Dixon <[email protected]> |
| License: | GPL-3 |
| Version: | 3.0 |
| Built: | 2026-06-01 11:05:58 UTC |
| Source: | https://github.com/cran/karaoke |
Attempt to remove vocals from a stereo '.wav' recording of a song.
John R. Dixon <[email protected]>
Maintainer: John R. Dixon <[email protected]>
Well known trick.
Attempt to remove vocals from a stereo '.wav' recording of a song.
karaoke(infile = NULL, outfile = NULL, sampf = NULL)karaoke(infile = NULL, outfile = NULL, sampf = NULL)
infile |
filename of a stereo '.wav' recording of a song |
outfile |
filename for the output '.wav' file |
sampf |
sometimes optional sampling frequency |
John R. Dixon <[email protected]>
Well known trick.
#We use some '.wav' samples included in the seewave package to construct an example. data(orni) data(peewit) data(tico) #Extend all the samples to be at least 20 seconds long. for(loop in 1:5) orni<-pastew(orni,orni,f=22050, output="Wave") for(loop in 1:5) peewit<-pastew(peewit,peewit,f=22050, output="Wave") for(loop in 1:5) tico<-pastew(tico,tico,f=22050, output="Wave") #Cut all samples down to exactly 20 seconds long. orni<-cutw(orni,f=22050,from=0,to=20, output="Wave") tico<-cutw(tico,f=22050,from=0,to=20, output="Wave") peewit<-cutw(peewit,f=22050,from=0,to=20, output="Wave") #Construct and write the example song to a '.wav' file. The tweeting bird, "tico", will be the #"vocalist", mixed to center. The "rhythm section" will be "orni" and "peewit", not mixed to #center. (Usually in stereo song recordings, the vocals are most mixed to center, allowing the #trick employed by the "karaoke" function to work.) left<-normalize(tico+orni) right<-normalize(tico+peewit) wobj<-stereo(left,right) slot(wobj,"pcm")<-FALSE writeWave(wobj, filename="song.wav") #Make the karaoke version: the vocal from "tico" is removed. karaoke(infile="song.wav", outfile="song4karaoke.wav") file.remove("song.wav") file.remove("song4karaoke.wav")#We use some '.wav' samples included in the seewave package to construct an example. data(orni) data(peewit) data(tico) #Extend all the samples to be at least 20 seconds long. for(loop in 1:5) orni<-pastew(orni,orni,f=22050, output="Wave") for(loop in 1:5) peewit<-pastew(peewit,peewit,f=22050, output="Wave") for(loop in 1:5) tico<-pastew(tico,tico,f=22050, output="Wave") #Cut all samples down to exactly 20 seconds long. orni<-cutw(orni,f=22050,from=0,to=20, output="Wave") tico<-cutw(tico,f=22050,from=0,to=20, output="Wave") peewit<-cutw(peewit,f=22050,from=0,to=20, output="Wave") #Construct and write the example song to a '.wav' file. The tweeting bird, "tico", will be the #"vocalist", mixed to center. The "rhythm section" will be "orni" and "peewit", not mixed to #center. (Usually in stereo song recordings, the vocals are most mixed to center, allowing the #trick employed by the "karaoke" function to work.) left<-normalize(tico+orni) right<-normalize(tico+peewit) wobj<-stereo(left,right) slot(wobj,"pcm")<-FALSE writeWave(wobj, filename="song.wav") #Make the karaoke version: the vocal from "tico" is removed. karaoke(infile="song.wav", outfile="song4karaoke.wav") file.remove("song.wav") file.remove("song4karaoke.wav")