LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-12-2009, 03:52 PM   #1
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,276

Rep: Reputation: 229Reputation: 229Reputation: 229
A bug in bchunk 1.2.0


I found a bug in bchunk 1.2.0. After converting a large WAV file into a few separate WAV tracks using CUE file (example command: bchunk -w file.wav file.cue track) the first WAV track starts with a loud snap. I inspected such a file and I discovered that bchunk adds at the beginning his RIFF header but it leaves an original RIFF header untouched. In result first WAV track starts with a double RIFF header and it causes during a playback mentioned above noise. It's possible to remove or overwrite that additional header using binary editor (example command: vim -b track01.wav) but it isn't comfortable.

So bchunk should pass over the first 44 bytes of the original WAV file. I improved bchunk for my own purposes. I'm not a programer and I was unable to skip the beginning of just the first WAV track. After my modifications bchunk skips the first 44 bytes of each track and adds 44 bytes at the end of each track:

Code:
475c475
<                       track->start = track->startsect * SECTLEN;
---
>                       track->start = track->startsect * SECTLEN + 44;
In result data in WAV files is shifted by 44 bytes and CDR files are shorter by 44 bytes. I'm not sure if the resulting WAV and CDR tracks are appropriate from the technical point of view.

I reported that bug to the author of bchunk -- Heikki Hannikainen -- but it seems he doesn't maintain bchunk since 2004 so I'm dubious about his interest in resolving that problem.

I found one more bug in bchunk. The length of the last track doesn't match the length of the header -- cdrdao reports an error and corrects it:

Code:
WARNING: 07.wav: file length does not match length from WAVE header - using actual length.
Maybe someone here will be interested in improving bchunk a little.

Homepage: http://he.fi/bchunk/.
 
Old 11-13-2009, 07:40 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,846

Rep: Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007
I recommend using shntool instead. It's a more powerful solution for extracting and converting tracks from bin/cue files.

There's a nice blog entry about how to use it here:
http://aidanjm.wordpress.com/2007/02...v-by-cue-file/

Check out the comments too for additional suggestions.
 
Old 11-13-2009, 05:08 PM   #3
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware, Mint
Posts: 1,276

Original Poster
Rep: Reputation: 229Reputation: 229Reputation: 229
Thank you, David the H.!

I tested shntool and it’s much more reliable and universal than bchunk.

To prepare the CUE sheet and the joined WAV file is enough to run the commands:

Code:
shntool cue *.wav > joined.cue
shntool join *.wav
To split joined WAV file is enough to run the command:

Code:
shntool split -f joined.cue joined.wav
If the CUE sheet contains information about the track titles better results gives the command:

Code:
shntool split -f joined.cue joined.wav -t "%n %t"
Unfortunately shntool doesn’t allow to store the information about track titles in the CUE sheet. I wrote dirty but working script which prepares the appropriate CUE sheet:

wavejoin:
Code:
#!/bin/sh

shntool cue *.wav > joined.cue

length="`wc -l joined.cue | cut -d ' ' -f 1`"

album="`echo \`pwd\` | perl -pe 's#.*/##;s#.*? - ##'`"
performer="`echo \`pwd\` | sed 's#.*/##;s# - .*##'`"

cuesheet="$performer - $album.cue"
> $cuesheet

echo "PERFORMER \"$performer\"" >> $cuesheet
echo "TITLE \"$album\"" >> $cuesheet
echo "FILE \"$performer - $album.wav\"" WAVE >> $cuesheet

length=`expr $length - 1`

for file in *wav
do
    tail -n $length joined.cue | head -n 1 - >> $cuesheet
    number="`tail -n 1 \"$cuesheet\" | cut -d ' ' -f 4`"
    echo "    TITLE \"`ls $number*.wav | perl -pe 's/[0-9]+ (.*).wav/$1/'`\"" >> $cuesheet
    length=`expr $length - 1`
    tail -n $length joined.cue | head -n 1 - >> $cuesheet
    length=`expr $length - 1`
done

shntool join *.wav
mv joined.wav "$performer - $album.wav"

rm joined.cue
It works when the directory containing WAV files has the name such as “Performer name - Album title” and when WAV tracks have the names such as “NN Track title.wav” where NN is the number from 01 to 99.
 
Old 11-15-2009, 04:01 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,846

Rep: Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007Reputation: 2007
Good to hear it's working for you.

Personally though, I can't stand bin/cue files. Not only are they a hassle to work with, they are almost completely unnecessary in today's computing world. I particularly hate them (along with .zip, .rar and other archiving methods) when used in bittorrent and other file-sharing systems, because there's no way to download individual files or preview them before you finish the download.

I can't tell you how many times I've had to wait days for a download to complete, only to discover that the archive doesn't contain what I want.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[BUG] Current pkgtools installpkg bug jazzor Slackware 7 04-16-2009 06:30 AM
a question on bchunk shva Linux - Software 1 03-04-2009 10:54 PM
LXer: 2008 CES: Bug Labs Introduces BUG, BUGbase. So Cool! LXer Syndicated Linux News 0 01-09-2008 02:21 AM
2038 bug-Is Debian Bug-Proof? deepclutch Debian 1 08-02-2007 11:59 AM
installing bchunk to read .dat cdr jcabral3 General 0 06-26-2003 04:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration