You are not logged in.

#1 2012-07-02 20:28:22

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,598
Website

Audio CD iso from wav files on the shell

I googled around for this but haven't found a solution.  I want to take a directory of wav files and write them to an iso file that can be burned off to a CD (a functional audio CD) at a later time.  Closest I found is using /usr/bin/genisoimage but it doesn't make an audio CD image, rather, just a data iso.

genisoimage -o test.iso ./music/*.wav

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2012-07-02 22:31:51

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Audio CD iso from wav files on the shell

I haven't tried it:
http://linuxdevcenter.com/pub/a/linux/2 … tml?page=2

cdrecord -v speed=2 dev=0,0 -audio /home/dlphilp/soundfiles/cd-audio/my_songs/*.wav

Edit: Argh, you wanted to burn it later. Sorry, back to the drawing board.



Edit 2: Have you tried the cue + bin pair instead of an iso?

Last edited by karol (2012-07-02 22:53:29)

Offline

#3 2012-07-03 00:22:44

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,598
Website

Re: Audio CD iso from wav files on the shell

Love to, but it has to be from the shell... any ideas there?

EDIT: Getting closer I think.  Using sox to convert flac files to .cdda files and then make a toc file:

find . -type f -name *.flac | parallel sox {} {.}.cdda
for file in *.cdda; do echo "TRACK AUDIO" >> toc; echo "FILE \"$file\" 2" >> toc; done

Now cdrdao can be used to write out to a CDR drive... now to figure out how to redirect to an iso file???

Source: http://duganchen.ca/burning-gapless-audio-cds-in-linux/

Last edited by graysky (2012-07-03 00:50:45)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2012-07-03 00:51:37

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Audio CD iso from wav files on the shell

Install shntool and cdrdao.

$ shntool cue *.wav > foo.cue
$ shntool join *.wav
$ cdrdao write --device /dev/sr0 foo.cue

Test it

$ mplayer cdda://
<blah blah blah>
Playing cdda://.
Found audio CD with 2 tracks.

Track 1
Detected file format: rawaudio
<forwarded a bit>
A: 347.8 (05:47.7) of 642.2 (10:42.1)  1.7% 

Track 2
A: 350.0 (05:50.0) of 642.2 (10:42.1)  1.8% 

Offline

#5 2012-07-03 00:55:13

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,598
Website

Re: Audio CD iso from wav files on the shell

@karol - right but I don't want to actually write the it out to physical media; I want to keep it as an iso file so I can mount it via:

$ sudo mount -o loop /path/to/foo.iso /mnt/fake_cd

It's like I need cdrdao to support a null device or image writing mode which I can't find documented hmm

Last edited by graysky (2012-07-03 00:56:04)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2012-07-03 01:12:41

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Audio CD iso from wav files on the shell

I'm confused. You can't mount an AudioCD, not sure if it's possible with an "AudioCD image".

What exactly are you trying to do?

Offline

#7 2012-07-03 01:15:46

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,598
Website

Re: Audio CD iso from wav files on the shell

I want to mount the image as a virtual CD for the wife to get the files into iTunes for her damn iPod.  There is software for windows that allows mounting in this fashion.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#8 2012-07-03 01:52:25

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,598
Website

Re: Audio CD iso from wav files on the shell

OK... your suggestion worked.  Now how can I automate this on a per-directory basis?  In other words, starting in /path/to/music go into each directory and execute each of the following commands.

bincue() {
  shntool cue *.flac > foo.cue
  shntool join *.flac
  }

I was thinking something like the following but it doesn't work:

$ find /path/to/music -type d | parallel cd {} && bincue

EDIT: Seems like daemontools can mount a wav/cue as a drive such that itunes can then access it to encode.  A pure Linux solution would be preferred, but opensource aac encoders are inferior to the codec itunes uses per my reading.

Last edited by graysky (2012-11-06 21:04:25)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#9 2012-07-03 20:51:48

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Audio CD iso from wav files on the shell

graysky,

to my limited knowledge ISO files are not capable of dealing with multiple audio tracks inside the image. Bin / cue is the way to go here.

If you know a bit python you might want to check out the two script I posted a few days ago.

Simply check out:
https://bbs.archlinux.org/viewtopic.php?id=56646&p=74
My posting is #1939

On script generates M3U files based on recursive MP3 search inside each subdirectory while the other shows parallel MP3 encoding in multiple ffmpeg processes. I guess you could easily modify my recurseM3U script to do your per-directory stuff.

While I know that it is cool to do stuff with one or two simple bash commands inside one line, it is often more effective to use a few more lines Python or Perl.

Just my two cents,
D$

P.S.: Let me know if I can help...

Last edited by Darksoul71 (2012-07-05 12:17:02)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#10 2012-07-03 20:57:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Audio CD iso from wav files on the shell

Darksoul71 wrote:

It's #1839: https://bbs.archlinux.org/viewtopic.php … 9#p1123189
The link to a specific post is "hidden" under time/date of the post - move your mouse over it to get the url to copy, bookmark etc.

Offline

#11 2012-07-03 21:01:57

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Audio CD iso from wav files on the shell

Ah ! Thanks, you never stop to learn things smile
I have no clue why I mentioned the wrong number though....
Thanks karol...

Last edited by Darksoul71 (2012-07-05 12:22:25)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#12 2012-07-05 14:30:16

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Audio CD iso from wav files on the shell

graysky,

this is how a simplified single process script could look like:

#!/usr/bin/python
import os

# Grab all subdirectories within the current directory 
search_sub ="find ./* -type d"

dirlist = []

for subdir in os.popen (search_sub):
  dirlist.append(os.getcwd() + subdir[1:-1] + '/')

for cur_dir in dirlist:
  os.chdir (cur_dir)
  os.popen ("shntool cue *.flac > foo.cue")
  os.popen ("shntool join *.flac")

You might want to give it a shot at a trial copy of your audio directories.

Edit:

A quick prototype for multiple encoding processes:

#!/usr/bin/python
import os
import multiprocessing

def bincue ():
  while not q.empty():
    cur_dir = q.get()
    os.chdir (cur_dir)
    os.popen ("shntool cue *.flac > foo.cue")
    os.popen ("shntool join *.flac")
 
# Init Queue for found sudirectories
q = multiprocessing.Queue()

# Grab all subdirectories within the current directory 
search_sub ="find ./* -type d"

for subdir in os.popen (search_sub):
  q.put (os.getcwd() + subdir[1:-1] + '/')

cores=multiprocessing.cpu_count()

for i in range (cores):
  process = multiprocessing.Process(target=bincue, args=())
  process.start()

Last edited by Darksoul71 (2012-07-05 14:47:54)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#13 2012-07-06 01:32:59

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,598
Website

Re: Audio CD iso from wav files on the shell

Thanks for the offer, ds.  Makes me wanna learn python.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#14 2012-07-06 04:50:41

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Audio CD iso from wav files on the shell

You are welcome ! Python is really easy to learn. A bit of OOP knowledge will not hurt though.
Just drop me a PM if I can help. I tested the script so far to tell that it changes into the found sub-directory.
I did not test the part with the shmtool though.


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

Board footer

Powered by FluxBB