cecilia makes an error when opening WAV or AIFF file as soundfile input. "ERROR Audio file is not valid"

Bug #1067126 reported by sebastien
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cecilia (Ubuntu)
Fix Committed
Undecided
sebastien

Bug Description

Hy maintainer

Getting through the tutorial of the program (cecilia), I get an error when opening ANY soundfile, even and especially the AIFF and WAV files that should be supported as sound input files by cecilia.
what was expected ? the file to open, be displayed and be playabe in the general window of cecilia.
what happens instead? the Messagebox says: ERROR Audio file is not valid. and then no way to open any file.
see DETAILS section to reproduce the bug

versions:
package cecilia Version: 2.0.5-2.2ubuntu1
package csound : Version: 1:5.17.6~dfsg-1
$csound --version says :
Csound version 5.17 (double samples) May 30 2012
system Description: Ubuntu 12.04.1 LTS Release: 12.04

FIXING tips :
this migth be because of csound is in version 5...., as the cecilia doc says csound (>= 4.23) needed.
maybe csound version 5.17 has different ouptut messages tha csound 4.23
the error message comes from function : getSoundInfo in file : lib/files.tcl
it is the result of test on the variable returned by function : getSoundFileInfo in file lib/unix/helpers.tcl:
   proc getSoundFileInfo {path}
but this procedure depends on shell execution, that returns info on the file :
the code (CODEA)
    catch {exec $prefs(help:CSND) -U sndinfo $path} stuff
basically the comand line is like $csound -U sndinfo /usr/share/cecilia/files/examples/beat.aiff
which returns : ----------
PortAudio real-time audio module for Csound
0dBFS level = 32768.0
Csound version 5.17 (double samples) May 30 2012
libsndfile-1.0.25
util sndinfo:
/usr/share/cecilia/files/examples/beat.aiff:
 srate 44100, stereo, 16 bit AIFF, 2.841 seconds
 (125307 sample frames)
--------
with such a string registered in the variable $stuff in getSoundFileInfo, the test TESTA :
   if {[lsearch $stuff "AIFF"] == -1 && [lsearch $stuff "WAVE"] == -1 } { (...) return 0}
is true because $stuff even converted as a list contains elements like "AIFF,"BUT NOT "AIFF"
so :
*** solution might be to replace the CODEA code previously quoted with something like CODEB
set stuff [lrange [exec file $path] 1 end]
(taken from lib/select.tcl file " set typer [lrange [exec file $fileselect(dir)/$path] 1 end] ")
 that code only returns :
IFF data, AIFF audio
or
RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz

but doing this replacement, we might introduce bugs in the function getSoundFileInfo after the test TESTA ............
especially there :
   set type [lindex $stuff [expr [lsearch $stuff "soundfile,"] - 1]]
    if {$type == ""} {
        set type [lindex $stuff [expr [lsearch $stuff "soundfile"] - 1]]
    }
    set dur [lindex $stuff [expr [lsearch $stuff "seconds"] - 1]]
    set sr [string trim [lindex $stuff [expr [lsearch $stuff "srate"] + 1]] ", "]
    set tr [string trim [lindex $stuff [expr [lsearch $stuff ${sr},] + 1]] ", "]
    set siz [lindex $stuff [expr [lsearch $stuff ${tr},] + 1]]
    return "$dur $sr [string tolower $type] $tr $siz"
}

********
so a better solution would be to modify only lib/unix/helpers.tcl and :
a) to leave CODEA declaration intact
b) to introduce a new variable $stuff2
set stuff2 [lrange [exec file $path] 1 end]
c) to change the TESTA instruction for the following:
   if {[lsearch $stuff2 "AIFF"] == -1 && [lsearch $stuff2 "WAVE"] == -1 } { (...) }
d) to change the assignment of the variable $type as such :
   set type [lindex $stuff2 [expr [lsearch $stuff2 "audio"] - 1]]
   if {$type == ""} {
      set type [lindex $stuff2 [expr [lsearch $stuff2 "audio,"] - 1]]
    }
e) to leave the rest of the code intact
********

ouf,
we went through.
 I will try to fix the bug and submit a patch myself.
cheers.
Seb.

DETAILS :
reproduce the bug : follow tutorial
http://cecilia.sourceforge.net/man/tut1.html
(also included in the package : /usr/share/cecilia/files/doc/html/tut1.html )

section : Opening a module and choosing a sound.

choose a module with the New... cascade under the File menu. Choose the Transposer module in the Pitch class since it uses most of the features of CECILIA and is conceptually straightforward: it transposes a soundfile in pitch with a few bells and whistles thrown in.

Two things happen:

1- The Grapher window has opened up showing some colored lines (some of the lines are hidden under others), a couple of sliders at the bottom, some toggle buttons and some coloured buttons etc.

 2- The Main window has expanded showing a largish button, a couple of small icons and a small slider.

Bring up the Main window and click on the toLoad button. This brings up the fileselector.
When you choose a file, information about it is shown. If its a soundfile, even more information is shown. If its a sound file, you can play it by hitting the speaker icon and you can edit it with the scissors.
BUG : the SPEAKER icon never turns active, even when soundfile is selected.
then when a soundfile (AIFF or WAV) is selected,
press the OK button of the fileselector :
BUG : a message box showing "ERROR Audio file is not valid" appears.
then no sound file is ever opened.

criticity : this is serious bug because no input audio file can be played.

Related branches

sebastien (sebastien.)
Changed in cecilia (Ubuntu):
assignee: nobody → sebastien (sebastien.)
description: updated
sebastien (sebastien.)
description: updated
sebastien (sebastien.)
Changed in cecilia (Ubuntu):
status: New → Fix Committed
sebastien (sebastien.)
no longer affects: cecilia (Debian)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.