History

use os.path in task.cut to derive default output filenames use os.path in task.cut to derive default output filenames

Paul Brossier committed 20 years ago

Commit cf349221 parent 16109b31 file · +6 −5Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/aubio/task/cut.py+6−5
@@ -6,9 +6,11 @@ class taskcut(task): · 5 unmodified lines
6 """ open the input file and initialize arguments 6 """ open the input file and initialize arguments
7 parameters should be set *before* calling this method.7 parameters should be set *before* calling this method.
8 """8 """
9 from os.path import basename,splitext
9 task.__init__(self,input,output=None,params=params)10 task.__init__(self,input,output=None,params=params)
10 self.newname = "%s%s%09.5f%s%s" % (self.input.split(".")[0].split("/")[-1],".",11 self.soundoutbase, self.soundoutext = splitext(basename(self.input))
11 self.frameread*self.params.step,".",self.input.split(".")[-1])12 self.newname = "%s%s%09.5f%s%s" % (self.soundoutbase,".",
13 self.frameread*self.params.step,".",self.soundoutext)
12 self.fileo = sndfile(self.newname,model=self.filei)14 self.fileo = sndfile(self.newname,model=self.filei)
13 self.myvec = fvec(self.params.hopsize,self.channels)15 self.myvec = fvec(self.params.hopsize,self.channels)
14 self.mycopy = fvec(self.params.hopsize,self.channels)16 self.mycopy = fvec(self.params.hopsize,self.channels)
@@ -31,9 +33,8 @@ class taskcut(task): · 16 unmodified lines
31 fromcross += 133 fromcross += 1
32 zerocross += 134 zerocross += 1
33 del self.fileo35 del self.fileo
34 self.fileo = sndfile("%s%s%09.5f%s%s" % 36 self.fileo = sndfile("%s%s%09.5f%s%s" % (self.soundoutbase,".",
35 (self.input.split(".")[0].split("/")[-1],".",37 self.frameread*self.params.step,".",self.soundoutext),model=self.filei)
36 self.frameread*self.params.step,".",self.input.split(".")[-1]),model=self.filei)
37 writesize = self.fileo.write(fromcross,self.mycopy)38 writesize = self.fileo.write(fromcross,self.mycopy)
38 else:39 else:
39 writesize = self.fileo.write(self.readsize,self.myvec)40 writesize = self.fileo.write(self.readsize,self.myvec)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t