Skip to contentSkip to conversation

making wav sample of a big mp3

DISCUSSION Michael Stutz 3 participants 7 messages Sep 17, 1998 – Sep 19, 1998 Sound

lore
Share & tools
lore
#0 lore raw

I need to make a 15-second WAV sample from a 3-minute mp3 file that I have. Does anyone know an easy way to do this?

(I thought the simplest way to do this would be to play the mp3 in one xterm and use brec in another, but this doesn't work -- it would if I'd install paudio, the package that adds a /proc/audio device. It's a sweet idea -- could this become a standard part of the kernel package?)

#1 lore raw
Quoted 2 lines · Michael Stutz

I need to make a 15-second WAV sample from a 3-minute mp3 file that I have. Does anyone know an easy way to do this?

This is how I do it (improvements welcome!):

dd if=<input.mp3> of=tmp.mp3 count=X [where X = 14.2 * number-of-seconds-desired]

mpg123 -s tmp.mp3 > tmp.raw

sox -r44100 -s -w -c2 tmp.raw sample.wav

#2 lore raw
In reply to Michael Stutz

Out of curiosity, I tried this, and just got noise with "play sample.wav"

Quoted 8 lines

This is how I do it (improvements welcome!):

dd if=<input.mp3> of=tmp.mp3 count=X [where X = 14.2 * number-of-seconds-des ired]

mpg123 -s tmp.mp3 > tmp.raw

sox -r44100 -s -w -c2 tmp.raw sample.wav

#3 lore raw
In reply to Michael Stutz
Quoted 1 line · Thomas C Sobczynski

Out of curiosity, I tried this, and just got noise with "play sample.wav"

Was is a mono mp3? If so, use "-c1" instead of "-c2" on the last line..

Quoted 10 lines
Quoted 9 lines

This is how I do it (improvements welcome!):

dd if=<input.mp3> of=tmp.mp3 count=X [where X = 14.2 * number-of-seconds-des ired]

mpg123 -s tmp.mp3 > tmp.raw

sox -r44100 -s -w -c2 tmp.raw sample.wav

#5 lore raw
In reply to Michael Stutz
Quoted 3 lines · Michael Stutz

I need to make a 15-second WAV sample from a 3-minute mp3 file that I have. Does anyone know an easy way to do this?

[this does not belong in linux-sound...]

mpg123 --help shows:
...
-k n skip first n frames [0] -n n decode only n frames [all]

Use these options with -s to grab the output; the no. of frames /s will depend on the mp3, but a bit of trial and error should work OK.

-- Christopher Reed, Selwyn College, Cambridge --
E-Mail: [email protected] WWW: http://dura.sel.cam.ac.uk/ [~cr212/] r2 T1 cSEL dCS hEn/Chi A4 S+ C*$+++L/UdP W+++ y# a VTsj (Cantab) 1.0
"Offer me solutions, offer me alternatives and I decline"

#6 lore raw
In reply to Michael Stutz
Quoted 6 lines · Chris Reed
Quoted 2 lines · Michael Stutz

I need to make a 15-second WAV sample from a 3-minute mp3 file that I have. Does anyone know an easy way to do this?

[this does not belong in linux-sound...]

Why?