Hi! -- Newbie here with very basic Newbie technical questions

Protomixer

New member
Hi! -- I have been listening to lots of MP3 mixes (genre: Trance) and would like to make my own mixes starting from the MP3 mixes -- just for my own use.

I will not be using any packaged software, but being a coder, would like to write my own little software. I am sure my questions below have been covered many times over in this forum. But not knowing the keywords, it will be very hard for me to find them.

1- Is it possible to simply arithmentically add two MP3 streams of the same bit rate (e.g. 320 kbs) and get a mix, or must it first be converted? What does it sound like when MP3s are simply added?

2- If it has to be converted, would that be Wave 44.1 kHz, or is there a higher-quality method to convert for the purpose of mixing and converting back to MP3? Am I correct to assume that two Wave 44.1 kHz can be arithmetically added, and volume controlled by multiplication with a constant?

3- Where can I find source code (in C) of codecs for this purpose that are basic, small and raw, and don't come with frills and bloats? That take one stream and produce another stream.

Thank you so much in advance for each and all replies.

Protomixer
 
Last edited:
Hi Protomixer and welcome. I cannot help you with anything to do with "coding" but I can give you my opinion about working with MP3s. Don't, if you can avoid it. AFAIK the compression* system is a 'one off, one time' event and any further manipulation with MP3 tend to lead to sonic degradation. For example, MP3 is intended for reproduction at modest 'domestic' sound levels. Boost it up to stage PA SPLs and 'cracks' begin to show. There is also the problem that the bit rate will be different for different sources. Music done at 320k is really very good but stuff smashed down to 92k or less get very 'blugh'

If MP3 is all you got, convert it to 44.1kHz 16 bits .wav (or 48kHz if more convenient). You won't make it any better but at least subsequent mixing and manipulation will not make it any worse. You CAN then convert back to MP3 but why bother? The reason for the system has really gone away. Storage is cheap as chips and even the meanest internet connection more than fast enough.

I suspect LINUX is the very chap for you and there is a guy over at soundonsound.com forum who does music on that platform.

We can talk hardware later?

*Strictly NOT a compression system. More a "throw this bit of *** away, the punter will never notice".

Dave.
 
but why bother? The reason for the system has really gone away. Storage is cheap as chips and even the meanest internet connection more than fast enough.
I don't think the reason for MP3s has gone away. There are still tons of people with mobile devices.
 
I've just been given the audio for a show tomorrow - all mp3, and 320K really is perfectly usable.

When I was teaching in college, we teamed up for a VERY short time with the engineering department because one of their Higher students wanted to do something very similar to your question. I'm certainly no expert, but the basic answers are that yes, you can add the data together, and the sampling rate is irrelevant as the stream is the same format, the read out frequency being the critical thing. Memory (and it's about 15 years ago) says that the mathematics part was fairly simple for people who code, but the real issue was synchronisation sample rate accuracy is vital, and he struggled getting the two streams to lock above about 3KHz sampling rate. He failed at 33, 44.1 and 48 to get the streams to align so he could process them. He also struggled with the reading into and out of the buffers, so his coding was presumably taking longer than the readout time. In the end it fell apart. Us audio people couldn't help with the coding, and the engineering lot who uderstood that couldn't understand the audio side - so while interesting, it failed as a project. He wasted 6 months. Again - I think the other thing that got him was the adjustment of balance between the two streams. 73% of one and 27% of the other and then changing it was a real tough thing. I don't know why, it's beyond me but what should be simple clearly wasn't. He also tried backwards engineering some open source software - Audacity - but he was on his own. None of the staff had any experince about audio coding at all - so it was over our heads. The theory of adding digital waveforms we all got, but the practice was horific.
 
Proto, Likewise I can't give any advice on the coding/decoding or combining of MP3 streams. You might, however, look at the LAME project. It's an open source encoder, and the source code is freely available at Lame Project.
 
I don't think the reason for MP3s has gone away. There are still tons of people with mobile devices.
Yes indeed and good luck to 'em Grimm! I just mean for one's OWN musical enjoyment, storage and transit systems are now SO huge/cheap/fast we can stick with .wavs.

Dave.
 
Yes indeed and good luck to 'em Grimm! I just mean for one's OWN musical enjoyment, storage and transit systems are now SO huge/cheap/fast we can stick with .wavs.

Dave.
I was talking about one's own musical enjoyment. For example, when I go swimming, I swim with one of those MP3 players that you can swim underwater with. With an 8 gig player, I can fit more than 1737 songs {of various lengths, anything from 3 minutes to 23 minutes long} on. I encode my swimming stuff at 128kbps and it sounds perfectly excellent as I trawl through the waters of the world. My ipod stuff goes on as 320kbps or the apple encoding {I'm not sure what it is but it's their equivalent to .wavs} and my own music for testing on an ipod goes on as .wavs ~ none of it sounds deficient but the point I was making was this; what made the whole MP3 route so attractive was that, if one was so minded, one could fit one's entire music collection in an A4 envelope and put it in a draw, as opposed to many boxes of LPs and singles. Doing everything as .wavs kind of defeats the object, in my mind.
 
I was talking about one's own musical enjoyment. For example, when I go swimming, I swim with one of those MP3 players that you can swim underwater with. With an 8 gig player, I can fit more than 1737 songs {of various lengths, anything from 3 minutes to 23 minutes long} on. I encode my swimming stuff at 128kbps and it sounds perfectly excellent as I trawl through the waters of the world. My ipod stuff goes on as 320kbps or the apple encoding {I'm not sure what it is but it's their equivalent to .wavs} and my own music for testing on an ipod goes on as .wavs ~ none of it sounds deficient but the point I was making was this; what made the whole MP3 route so attractive was that, if one was so minded, one could fit one's entire music collection in an A4 envelope and put it in a draw, as opposed to many boxes of LPs and singles. Doing everything as .wavs kind of defeats the object, in my mind.
Yes, all fine mate but those are 'one off' processes whereas the OP is, I understand, talking about processing various MP3 content? Turned into .wav one can eff about with impunity.

Dave.
 
I agree. I was totally off-topic, just responding to your point which I thought was an interesting one, though I disagree in part.
 
Hi Protomixer and welcome. I cannot help you with anything to do with "coding" but I can give you my opinion about working with MP3s. Don't, if you can avoid it. AFAIK the compression* system is a 'one off, one time' event and any further manipulation with MP3 tend to lead to sonic degradation. For example, MP3 is intended for reproduction at modest 'domestic' sound levels. Boost it up to stage PA SPLs and 'cracks' begin to show. There is also the problem that the bit rate will be different for different sources. Music done at 320k is really very good but stuff smashed down to 92k or less get very 'blugh'

If MP3 is all you got, convert it to 44.1kHz 16 bits .wav (or 48kHz if more convenient). You won't make it any better but at least subsequent mixing and manipulation will not make it any worse. You CAN then convert back to MP3 but why bother?
Isnt this where dithering can help? When there are random synchronization errors (in m/s) between the fresh tracks from the floating point recording process. You dither the render. This fills in and evens the timing of said tracks. Fixing inherent latency issues and such. You dont need to dither twice. Once does the trick.
 
MP3 has nothing to do with dithering. Dithering is randomizing the least significant bit of an audio sample. It doesn't affect timing or latency in any way. MP3 encoding uses psychoacoustic modeling to analyze a signal and decide that it can throw out certain parts of the sound because it is masked by other parts. That's why it's called "lossy". Once you throw the information away it can never be retrieved. Part of what using lower bit rates do is to toss out higher frequencies. Look at 128K MP3 response and you'll find it's roughly equal to an FM modulated signal with a cutoff of 15kHz. 64Kbps tops out at around 11kHz.

It's like the difference between a JPG file and a bitmap file. If you repeatedly save a bitmap file, it will still be the same. If you re-encode a JPG, each generation will lose more detail. The same thing will happen if you decode and encode an MP3 sound file repeatedly.
 
Quantization error is where you have to decide between 2 numbers which are not exactly the true analog value. The way to make this less apparent is to randomize the lowest digit so that you don't get consistent errors which would creats a specific type of harmonic distortion. Essentially you are adding noise to the signal, although if you are working with a 16 bit system, the noise is at -96dB. With 24bit, it's at -144dB below the max level. That has the effect of lowering the overall distortion.

It still has little if anything to do with MP3 encoding, latency, syncronization or timing. MP3 encoding might use dither to try to lower the distortion, but it's still throwing away lots of data.
 
The real snag with this sort of experimentation is the test gear you need to see meaningful results. We're just taking a sample and giving it a value. We do enough samples to reconsitute the original waveform. I'd suggest that it is not as simple to just add the two. The troubles with digital systems as people above have been saying will be unsolved in a home built system. How will you know about your quantisation errors, jitter and other potential artefacts without some high ticket test gear.
 
Thank you for all the replies and information. Will reply individually soon. Yes, I am talking codec level programming. I suppose I can convert from MP3 to Wave, add the samples, and convert back to MP3. I just wonder if there is a faster way of doing this? My player is an Arduino MCU and does not have much memory or processing speed. I don't believe it is capable of conversion/deconversion in real time. And I don't want to pre-mix the tracks. I want to mix on the fly while streaming. Many thanks.
 
Interesting sort of hobby project - way, way above my capabilities. Two compressed and data reduced sources, blend them, then recompress? Sounds like an option not likely to actually be very pleasant to listen to? But I suppose if you are skilled in these things, it's perhaps simpler than it appears. Good luck.
 
Thank you for all the replies and information. Will reply individually soon. Yes, I am talking codec level programming. I suppose I can convert from MP3 to Wave, add the samples, and convert back to MP3. I just wonder if there is a faster way of doing this? My player is an Arduino MCU and does not have much memory or processing speed. I don't believe it is capable of conversion/deconversion in real time. And I don't want to pre-mix the tracks. I want to mix on the fly while streaming. Many thanks.
If this is beyond Rob A it is a million light years from my understanding! There are DAWs that can do 'batch conversion'. I dare say Reaper can.
As Rob says, trying to combine 'alien' streams is likely to result in garbage. Low bit rate MP3 is not good, mess it about and it just gets worse. Wavs however are non-destructive "linear PCM" and can be manipulated with impunity.

You could do an in depth search for "mixing MP3 streams" and if nothing pops up I would guess it can't be done...OR! Nobody has bothered to try because it is simpler to just go with .wav!

Dave.
 
Hi Protomixer and welcome. I cannot help you with anything to do with "coding" but I can give you my opinion about working with MP3s. Don't, if you can avoid it. AFAIK the compression* system is a 'one off, one time' event and any further manipulation with MP3 tend to lead to sonic degradation. For example, MP3 is intended for reproduction at modest 'domestic' sound levels. Boost it up to stage PA SPLs and 'cracks' begin to show. There is also the problem that the bit rate will be different for different sources. Music done at 320k is really very good but stuff smashed down to 92k or less get very 'blugh'

If MP3 is all you got, convert it to 44.1kHz 16 bits .wav (or 48kHz if more convenient). You won't make it any better but at least subsequent mixing and manipulation will not make it any worse. You CAN then convert back to MP3 but why bother? The reason for the system has really gone away. Storage is cheap as chips and even the meanest internet connection more than fast enough.

I suspect LINUX is the very chap for you and there is a guy over at soundonsound.com forum who does music on that platform.

We can talk hardware later?

*Strictly NOT a compression system. More a "throw this bit of *** away, the punter will never notice".

Dave.
Thank ECC83 - that link is very helpful.

PM
 
Yes indeed and good luck to 'em Grimm! I just mean for one's OWN musical enjoyment, storage and transit systems are now SO huge/cheap/fast we can stick with .wavs.

Dave
I have a problem with wave in that my portable player is a microcontroller running the VS1053 sound chip. It only accepts micro SD cards of 32 GB or less. I can't even fit my MP3 library on 32 GB, much less wave files.
 
Back
Top