Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

waveforms arent as smooth as they should be

So I've been trying to create a little clone of SoundClouds 'peaks' waveform. I have noticed that their waveforms are a lot more streamlined compared to my sudden shifts in 'loudness'. The dynamic range between peaks never seems to be too steep, and they always represent the perceived loudness of each part of the track pretty well.


Here's an example:

example

Notice how all the 'drops' are fairly distinguishable to the 'breakdowns' in their waveform, but mine is all over the place (apart from the last drop and breakdown, which are kind of similar). There are some minor similarities, but the 'jaggedness' is still very prominent even in those areas.

I'm using wav2json as a peaks converter (which is run through the command line and programmed in C++). This is is an example of how I use it:

/*
*    --channels: mids and min
*    --db-min (minimum level in dB to capture): -35dB
*    --db-max (pretty self explanatory): 6dB
*    -d: use logarithmic instead of linear scale
*    -s (number of peaks to generate): 1800
*    -o (output file): outputfile.json
*    -p (precision of floats): 0
*    -n: no header 
*/
exec("wav2json inputfile.wav -s 1800 --channels mid min -d --db-min -35 --db-max 6 -p 0 -o outputfile.json -n");

$fp     = fopen($tmpOutput, "r");
$json   = fread($fp, filesize($tmpOutput));
// get mids and min from the generated peaks file
$mid    = json_decode($json, true)["mid"];
$min    = json_decode($json, true)["min"];
fclose($fp);
unlink($tmpOutput);

/* 
*  from here I just combine each mid and min value together and divide by two
*
*  then I normalise all the peaks (instead of each value being between -0.293 to 
*  1.766(just as an example), it is between 0 and 100)
*/

What I'm trying to figure out - and have been trying to for the last few months - is how to get each peak more streamlined and to have the dynamic range of each one look how it actually sounds.


What I have tried:

  • ffmpeg eqing
  • actually eqing the highs and lows in a daw and then comparing waveforms
  • using various parameters for wav2json (db min and max, linear etc.)
  • using various compressors and multiband compressors on the track

All help is appreciated,
Cheers.

like image 875
GROVER. Avatar asked Mar 04 '19 16:03

GROVER.


1 Answers

Just guessing here, but the dB scale is already logarithmic compared to the actual level so adding the -d parameter might just be what makes yours worse.

You might also try with just mids or just min, not both! There's a possibility max is the right thing?

Another thing is the amount of samples you take, I'm sure they don't have 1800 on that graph, you could try counting them and making the same amount.

You are also "clipping" your output to a max db of 35, try not clipping it in the positive direction and maybe increasing the clipping in the negative direction.

Also you can "smooth" the curves by making an average of the previous, current and next value.

Try combining the above, don't forget to let us know if something works for you.

like image 184
xception Avatar answered Nov 15 '22 03:11

xception