Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Searching for a plugin to cut/divide audio files (Read 7540 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Searching for a plugin to cut/divide audio files

Hello,

I'm searching for a foobar plugin that allows to cut/divide audio files (MP3) (for example, I would use it to divide the last track of an album that contains a bonus, and delete the silence).
I use Audacity to do that stuff, but for such a basic operation it would be easier to do it with foobar (and not to have to open an external program...)

I don't know if such a plugin exists?...

Thanks,

Searching for a plugin to cut/divide audio files

Reply #1
No, such a component doesn't exist as far as i know. Nevertheless, i wouldn't cut my mp3 files with audacity as it transcodes the file so that you will have a lost of quality. What you can do is to use mp3DirectCut. With foo_run you can call the tool from foobar2000: just rightclick a file and go to the entry in "Run Services", wich you have defined in preferences.

Searching for a plugin to cut/divide audio files

Reply #2
I second the recommendation for mp3DirectCut, especially for the kind of splitting you want to do (extracting two silence-separated songs from one file into their own files). It's got a nice visual interface and will cut at frame boundaries, which is good enough for your needs. If the bit reservoir gives you problems, you can use mp3packer to expand the mp3 to 320 kbps with minimal bit reservoir usage (-b 320 -r in.mp3 temp.mp3), make your edits in mp3DirectCut, then use mp3packer again to repack (-s -t -z temp.mp3 out.mp3).

FWIW, if you're using a player that supports LAME gapless tags (encoder delay & padding in the VBR info header frame), then you can do more precise, sample-level editing with the command-line java tool pcutmp3 (Google it). It's the only one we've found that does what it's supposed to. There's no GUI for it though, so figuring out what parameters to pass might be challenging, if you don't know where exactly the cuts are needed. It's more geared toward splitting based on info in a cue sheet.

Searching for a plugin to cut/divide audio files

Reply #3
Thanks for your responses,
Yes, Audacity re-encode the audio track. But isn't it possible to keep the original signal with Audacity after having cut it? (an option, may be??)

mp3DirectCut will cut at frame boundaries, which is good enough for your needs. If the bit reservoir gives you problems, you can use mp3packer to expand the mp3 to 320 kbps with minimal bit reservoir usage (-b 320 -r in.mp3 temp.mp3), make your edits in mp3DirectCut, then use mp3packer again to repack (-s -t -z temp.mp3 out.mp3).
I don't know what is the bit reservoir : could yout explain a little bit more to me, please?
- If mp3DirectCut cut at frame boundaries, isn't it a quality guarantee?...
- How could I know if the bit reservoir gives me problems? By listening to the audio result? Or with mp3DirectCut software?

Quote
if you're using a player that supports LAME gapless tags (encoder delay & padding in the VBR info header frame)
? I use Foobar2000 1.1.1...

Quote
then you can do more precise, sample-level editing with the command-line java tool pcutmp3 : It's the only one we've found that does what it's supposed to.
So mp3DirectCut doesn't do what it's supposed to?

Searching for a plugin to cut/divide audio files

Reply #4
I really wish people would stop recommending mp3DirectCut. Use pcutmp3 if quality matters to you at all. mp3DirectCut is shit. The only good thing about it is the GUI.


Searching for a plugin to cut/divide audio files

Reply #6
Data loss. pcutmp3 is lossless.

Searching for a plugin to cut/divide audio files

Reply #7
In the rare cases i used mp3directcut i can't say that the result didn't satisfy me. I would appreciate if you could explain with more details what you mean with data loss and what else is an argument not to use it. So i can start thinking about keep or stop using it.

Searching for a plugin to cut/divide audio files

Reply #8
pcutmp3 preserves gapless information. Do some reading here, this question has been answered many times.


Searching for a plugin to cut/divide audio files

Reply #10
And excepting pcutmp3, there is no other software that can cut audio losslessly (and with a GUI)?

Searching for a plugin to cut/divide audio files

Reply #11
Bit reservoir - An mp3 consists of frames, each frame having some header info/metadata and then the main audio data. If the audio data for a particular frame doesn't occupy the entire frame, then the extra room can be used for the beginning of the next frame's audio data. The audio data for a given frame, therefore, is often found spread across 2 frames. Basically the discrepancy in the sync between the frame headers and the main data begin is the 'bit reservoir usage'. So you can see the frame boundary is a bad place to cut. However as I said, the risk is minimized if you use mp3packer first.

Also, each frame's audio data depends partially on audio data from adjacent frames (sometimes more), for psychoacoustics and for accurate sample reconstruction. So when you use mp3DirectCut to cut on frame boundaries, the first frame after a cut might be useless because of the bit reservoir, and even if not, you're making the samples near every cut inaccurate and/or unusable.

Whether this makes an audible difference is impossible to predict, but in my experience, it's fine for situations where the cut is happening next to silence, which is the situation you're asking about. Why not just try it and listen to the results?

The other program mentioned is better because I believe it outputs frames adjacent to the cut and then sets the gapless data in the VBR info header frame in order to tell the player to only play the audio portion you wanted. The player will still decode and use the extra frames so that you get the complete & accurate samples you asked for. But like I said, to use it, you need player support, and you have to figure out where to make the cut, which isn't going to be simple for the kind of files you're dealing with.

Searching for a plugin to cut/divide audio files

Reply #12
pcutmp3 preserves gapless information.

mp3DirectCut preserves the gapless info, too, just a little too well, not changing delay & padding values and not including frames adjacent to the cuts. However in his situation it doesn't matter, does it? He's asking about the last track on the CD, which has two songs separated by silence... he just wants the 2 songs to be in 2 files, if I understand correctly. The first song will have accurate encoder delay and bad padding, but if he makes the song end 1 or 2 frames into the silent portion, then it shouldn't matter. The second song will have incorrect delay, but all he has to do is make his cut 1 or 2 frames early so there's some silence at the start.

original mp3: |------song1------|-----silence-----|-----song2-----|
new mp3 1: |-----song1-----|-| (that's 1 or 2 frames from the silence at the end)
new mp3 2: |-|-----song2-----| (that's 1 or 2 frames from the silence at the beginning)

If it's not the last track, or if he wants to preserve the silence as a 3rd mp3 with perfect precision, then yeah, it's not going to work. But mp3DirectCut should be fine for what he wants to do.

Searching for a plugin to cut/divide audio files

Reply #13
Ok, thank you very much mjb2006 for those informations. I better understand the problem.
I used to cut an MP3 file just at the beginning of a track, to avoid a silence, but now, knowing that MP3 problem, I won't do that anymore : the sound attack can be lost!...

Quote
The first song will have accurate encoder delay and bad padding, but if he makes the song end 1 or 2 frames into the silent portion, then it shouldn't matter. The second song will have incorrect delay, but all he has to do is make his cut 1 or 2 frames early so there's some silence at the start.
How long is a frame, in seconds?
I've read that it depends on the bitrate : The frame size is from 104 (+1 padding) byte (32 kBit/s) to 1253 (+1 padding) byte (320 kBit/s) (at 44.1 kHz sampling rate)
It makes 105/32k to 1255/320k, so around 3 or 4 ms : is it correct?

- - -
Secondly, sometimes I cut big MP3 files into separate files (live music for example).
And because an MP3 file can hardly be cut, I'm wondering about the opportunity of encoding the MP3 file into a lossless format (like APE or FLAC), and then cut the lossless file :
1. First I'm asking about the size of the lossless file. Is the resulting lossless filesize always much bigger than the original MP3? Isn't it possible to have a lossless filesize approximatively about the same than the MP3 filesize??? (cause the informations included are the same, no?)
2. And what about this idea? Cutting a lossless file doesn't include gap problems, isn't it? But may be other problems would appear?

Searching for a plugin to cut/divide audio files

Reply #14
How long is a frame, in seconds?
I've read that it depends on the bitrate : The frame size is from 104 (+1 padding) byte (32 kBit/s) to 1253 (+1 padding) byte (320 kBit/s) (at 44.1 kHz sampling rate)
It makes 105/32k to 1255/320k, so around 3 or 4 ms : is it correct?

1 frame = 1152 samples. 1152/44100 = 26.1 ms. And, 150 bytes/32 kbits = 150*8 bit/32000 bit = 37.5 ms 


And because an MP3 file can hardly be cut

pcutmp3 works well.

1. First I'm asking about the size of the lossless file. Is the resulting lossless filesize always much bigger than the original MP3? Isn't it possible to have a lossless filesize approximatively about the same than the MP3 filesize??? (cause the informations included are the same, no?)

You can use LossyFLAC. Typical bitrate is 450-500 kbps or even less.

Searching for a plugin to cut/divide audio files

Reply #15
Quote
1 frame = 1152 samples. 1152/44100 = 26.1 ms. And, 150 bytes/32 kbits = 150*8 bit/32000 bit = 37.5 ms
Is 1152 samples/second a constant? So at 48kHz, 1 frame=1152/48000= 24ms?

Quote
pcutmp3 works well.
It's not handy at all to cut an audio file : I won't do it in a command line...

Quote
1. First I'm asking about the size of the lossless file. Is the resulting lossless filesize always much bigger than the original MP3? Isn't it possible to have a lossless filesize approximatively about the same than the MP3 filesize??? (cause the informations included are the same, no?)

You can use LossyFLAC. Typical bitrate is 450-500 kbps or even less.
If the original MP3 is 192kbps, why the LossyFLAC won't be 192kbps?

Searching for a plugin to cut/divide audio files

Reply #16
If the original MP3 is 192kbps, why the LossyFLAC won't be 192kbps?

Not possible. Yes, WAV file decoded from MP3 contains redundant info, but there is no way to remove it and obtain 192 kbps file.

Searching for a plugin to cut/divide audio files

Reply #17
Somebody needs to make a GUI for pcutmp3, because using the command line switches are a pain in the ass to use. I never know if I'm correctly specifying the range for a particular file. (Of course, the only times I've ever needed to split a MP3 is to cut a two hour segment out of a 3-4 hour recording from a 128kbps CBR stream that doesn't broadcast track titles.)

Searching for a plugin to cut/divide audio files

Reply #18
If the original MP3 is 192kbps, why the LossyFLAC won't be 192kbps?

To achieve this the LossyFLAC encoder would have to do the following: From the decoded(!) sound stream (PCM wav) determine that it is a decoded MP3 signal AND which one it was, which is almost impossible!

Situation: Some signal is encoded with lame to a 192 kbit/s MP3 file, information is lost. After decoding this MP3 file, the result is not the original file and there is no known (not years of CPU time consuming) way to get back the MP3 file from this. One can try to re-encode that stream as MP3 but the artifacts that have been introduced will probably even take up more space to reproduce.

Searching for a plugin to cut/divide audio files

Reply #19
Quote
WAV file decoded from MP3 contains redundant info, but there is no way to remove it and obtain 192 kbps file.
Where could I find some information about the way an MP3 file is decoded to a WAV file? Or could someone explain it to me?
What is the redundant info? The headers of the MP3 frames? All the MP3 frames are entirely included in the WAV file, with all the frames headers??

If the original MP3 is 192kbps, why the LossyFLAC won't be 192kbps?

To achieve this the LossyFLAC encoder would have to do the following: From the decoded(!) sound stream (PCM wav) determine that it is a decoded MP3 signal AND which one it was, which is almost impossible!

Situation: Some signal is encoded with lame to a 192 kbit/s MP3 file, information is lost. After decoding this MP3 file, the result is not the original file and there is no known (not years of CPU time consuming) way to get back the MP3 file from this. One can try to re-encode that stream as MP3 but the artifacts that have been introduced will probably even take up more space to reproduce.
So there is no lossless format that could give - after transcoding - approximatively the same bitrate as the original MP3 file?

Searching for a plugin to cut/divide audio files

Reply #20
By WAV I meant LPCM encoded data: http://en.wikipedia.org/wiki/LPCM

MP3 -> WAV -> FLAC is almost the same as JPG -> BMP -> PNG.

 

Searching for a plugin to cut/divide audio files

Reply #21
So there is no lossless format that could give - after transcoding - approximatively the same bitrate as the original MP3 file?

Oh, there are such lossy formats, for example LossyWAV. It is designed in such a way that for example after throwing it into the FLAC encoder you'll even get a smaller bitrate. Presumably the LossyWAV files are much larger than MP3 files... LossyFLAC seems to generate such an intermediate lossy wave, too.