©2003 Kåre Sjölander and Jonas Beskow
Introduction Download Documentation Links Forum
WaveSurfer user forum

FAQ  FAQ
Search  Search
Memberlist  Memberlist
Register  Register
Profile  Profile
Login  Login

Making timeaxis start from other time than 0.0 (Python)

 
Post new topic   Reply to topic    www.speech.kth.se/wavesurfer Forum Index -> WaveSurfer
View previous topic :: View next topic  
Author Message
mickel



Joined: 17 Dec 2002
Posts: 28
Location: Espoo, Finland

PostPosted: Tue Nov 11, 2003 12:28 pm    Post subject: Making timeaxis start from other time than 0.0 (Python) Reply with quote

Hi!

Is is possible to increment the start time of the timeaxis, i.e. to give it a start time it should use instead of 0.0?

The reason I am asking is that I am reading a snippet from the middle of a tkSnack.Sound object and visualize that with Wsurf. The timeaxis always starts from 0.0, but I would like to show the actual starting point in relation to the tkSnack.Sound object instead. E.g., if I start reading from second 2.0 in my tkSnack.Sound object, I would like the Timeaxis in the Wsurf widget to start from 2.0 as well.

Is this possible? If so, can you give me an example in Python?

Thanks. Again. icon_smile.gif

/Mickel
Back to top
View users profile Send private message Visit posters website
kare



Joined: 16 Aug 2002
Posts: 371
Location: KTH, Centre for Speech Technology

PostPosted: Mon Nov 17, 2003 4:34 pm    Post subject: Reply with quote

In the latest release timeaxis has a new option -starttime that is used to specify an offset used fort the time axis.

wsapp3.tcl could be modified like this

$widget timeaxis::addTimeAxis $pane -starttime 2.0

to get the desired effect.

How to achieve this from Python is another matter, I'll try to have a look at that at some point.

Kåre
Back to top
View users profile Send private message Visit posters website
mickel



Joined: 17 Dec 2002
Posts: 28
Location: Espoo, Finland

PostPosted: Wed Nov 19, 2003 11:29 am    Post subject: Reply with quote

Great Kåre! I'll post a snippet of Python code when I get this done from Python.

Cheers,

/Mickel
Back to top
View users profile Send private message Visit posters website
mickel



Joined: 17 Dec 2002
Posts: 28
Location: Espoo, Finland

PostPosted: Thu Nov 20, 2003 1:32 pm    Post subject: Reply with quote

I still cannot get the hang of it. I downloaded the source code for Wavesurfer 1.5.7 and copied the Wsurf1.5 directory to a place where Tcl can find it. When I try creating a timeaxis I can configure the font and color to use but not the starttime (it still starts from 0.0).

Here is my sample code (Python):

Code:
import Tkinter
import tkSnack

## Initialization
root = Tkinter.Tk()
root.tk.eval('package require -exact wsurf 1.5')
tkSnack.initializeSnack(root)

## Creating a tkSnack.Sound object
sound = tkSnack.Sound(load="../signal/mickelpuhuu1.wav")

## Creating a simple Wsurf widget and packing it
wsurf = Tkinter.Widget(root, "wsurf")
wsurf.pack()

## Adding the tkSnack.Sound object as sound source
wsurf.configure(sound=sound)

## Adding a pane to hold the time axis
wsurf.tk.call(wsurf._w, "addPane", "-height", 20)

## Getting the panes
panes = wsurf.tk.splitlist(wsurf.tk.call(wsurf._w, '_getPanes'))

## Creating a time axis on the last (only) pane
wsurf.tk.call(wsurf._w, "timeaxis::addTimeAxis",
              str(panes[-1]),
              "-color", "blue",          ## This works
              "-font", "Helvetica 10",   ## This works
              "-starttime", 2.0)         ## This does not work

root.mainloop()


Any ideas?
Back to top
View users profile Send private message Visit posters website
mickel



Joined: 17 Dec 2002
Posts: 28
Location: Espoo, Finland

PostPosted: Thu Nov 20, 2003 2:03 pm    Post subject: Reply with quote

Disregard of the previous posting!!

My program accidentally used Wsurf 1.5.5 and not Wsurf 1.5.7. icon_redface.gif

Setting starttime works fine now.
Back to top
View users profile Send private message Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    www.speech.kth.se/wavesurfer Forum Index -> WaveSurfer All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.1 © 2001, 2002 phpBB Group